Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B-ASIC - Better ASIC Toolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computer Engineering
B-ASIC - Better ASIC Toolbox
Commits
a811046e
Commit
a811046e
authored
1 year ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Assign argument to resources
parent
6717f355
No related branches found
No related tags found
1 merge request
!386
Assign argument to resources
Pipeline
#97431
passed
1 year ago
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
b_asic/architecture.py
+14
-2
14 additions, 2 deletions
b_asic/architecture.py
examples/thirdorderblwdf.py
+17
-4
17 additions, 4 deletions
examples/thirdorderblwdf.py
with
31 additions
and
6 deletions
b_asic/architecture.py
+
14
−
2
View file @
a811046e
...
...
@@ -293,10 +293,15 @@ class ProcessingElement(Resource):
Process collection containing operations to map to processing element.
entity_name : str, optional
Name of processing element entity.
assign : bool, default True
Perform assignment when creating the ProcessingElement.
"""
def
__init__
(
self
,
process_collection
:
ProcessCollection
,
entity_name
:
Optional
[
str
]
=
None
self
,
process_collection
:
ProcessCollection
,
entity_name
:
Optional
[
str
]
=
None
,
assign
:
bool
=
True
,
):
super
().
__init__
(
process_collection
=
process_collection
,
entity_name
=
entity_name
)
if
not
all
(
...
...
@@ -318,7 +323,8 @@ class ProcessingElement(Resource):
self
.
_type_name
=
op_type
.
type_name
()
self
.
_input_count
=
ops
[
0
].
input_count
self
.
_output_count
=
ops
[
0
].
output_count
self
.
assign
()
if
assign
:
self
.
assign
()
@property
def
processes
(
self
)
->
List
[
OperatorProcess
]:
...
...
@@ -364,6 +370,9 @@ class Memory(Resource):
Number of read ports for memory.
write_ports : int, optional
Number of write ports for memory.
assign : bool, default False
Perform assignment when creating the Memory (using the default properties).
"""
def
__init__
(
...
...
@@ -373,6 +382,7 @@ class Memory(Resource):
entity_name
:
Optional
[
str
]
=
None
,
read_ports
:
Optional
[
int
]
=
None
,
write_ports
:
Optional
[
int
]
=
None
,
assign
:
bool
=
False
,
):
super
().
__init__
(
process_collection
=
process_collection
,
entity_name
=
entity_name
)
if
not
all
(
...
...
@@ -401,6 +411,8 @@ class Memory(Resource):
raise
ValueError
(
f
"
At least
{
write_ports_bound
}
write ports required
"
)
self
.
_input_count
=
write_ports
self
.
_memory_type
=
memory_type
if
assign
:
self
.
assign
()
memory_processes
=
[
cast
(
MemoryProcess
,
process
)
for
process
in
process_collection
...
...
This diff is collapsed.
Click to expand it.
examples/thirdorderblwdf.py
+
17
−
4
View file @
a811046e
...
...
@@ -5,9 +5,13 @@ Third-order Bireciprocal LWDF
Small bireciprocal lattice wave digital filter.
"""
import
numpy
as
np
from
mplsignal.freq_plots
import
freqz_fir
from
b_asic.core_operations
import
Addition
,
SymmetricTwoportAdaptor
from
b_asic.schedule
import
Schedule
from
b_asic.signal_flow_graph
import
SFG
from
b_asic.signal_generator
import
Impulse
from
b_asic.simulation
import
Simulation
from
b_asic.special_operations
import
Delay
,
Input
,
Output
...
...
@@ -21,19 +25,28 @@ a = s.output(0) + D0
out0
=
Output
(
a
,
"
y
"
)
sfg
=
SFG
(
inputs
=
[
in0
],
outputs
=
[
out0
],
name
=
"
Third-order BLWDF
"
)
# %%
# The SFG looks like
sfg
# Set latencies and exection times
# %%
# Set latencies and execution times
sfg
.
set_latency_of_type
(
SymmetricTwoportAdaptor
.
type_name
(),
4
)
sfg
.
set_latency_of_type
(
Addition
.
type_name
(),
1
)
sfg
.
set_execution_time_of_type
(
SymmetricTwoportAdaptor
.
type_name
(),
1
)
sfg
.
set_execution_time_of_type
(
Addition
.
type_name
(),
1
)
sim
=
Simulation
(
sfg
,
[
lambda
n
:
0
if
n
else
1
])
# %%
# Simulate
sim
=
Simulation
(
sfg
,
[
Impulse
()])
sim
.
run_for
(
1000
)
import
numpy
as
np
from
mplsignal.freq_plots
import
freqz_fir
# %%
# Display output
freqz_fir
(
np
.
array
(
sim
.
results
[
'
0
'
])
/
2
)
# %%
# Create and display schedule
schedule
=
Schedule
(
sfg
,
cyclic
=
True
)
schedule
.
show
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment