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
dd61ce7c
Commit
dd61ce7c
authored
1 year ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Improve architecture example
parent
69570573
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!390
Improve architecture example
Pipeline
#97503
passed
1 year ago
Stage: test
Stage: deploy
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/secondorderdirectformiir_architecture.py
+29
-12
29 additions, 12 deletions
examples/secondorderdirectformiir_architecture.py
with
29 additions
and
12 deletions
examples/secondorderdirectformiir_architecture.py
+
29
−
12
View file @
dd61ce7c
...
...
@@ -30,19 +30,23 @@ out1 = Output(add4, "OUT1")
sfg
=
SFG
(
inputs
=
[
in1
],
outputs
=
[
out1
],
name
=
"
Second-order direct form IIR filter
"
)
# %%
# Set latencies and execution times
# The SFG is
sfg
# %%
# Set latencies and execution times.
sfg
.
set_latency_of_type
(
ConstantMultiplication
.
type_name
(),
2
)
sfg
.
set_latency_of_type
(
Addition
.
type_name
(),
1
)
sfg
.
set_execution_time_of_type
(
ConstantMultiplication
.
type_name
(),
1
)
sfg
.
set_execution_time_of_type
(
Addition
.
type_name
(),
1
)
# %%
# Create schedule
# Create schedule
.
schedule
=
Schedule
(
sfg
,
cyclic
=
True
)
schedule
.
show
(
title
=
'
Original schedule
'
)
# %%
# Reschedule to only require one adder and one multiplier
# Reschedule to only require one adder and one multiplier
.
schedule
.
move_operation
(
'
add4
'
,
2
)
schedule
.
move_operation
(
'
cmul5
'
,
-
4
)
schedule
.
move_operation
(
'
cmul4
'
,
-
5
)
...
...
@@ -51,7 +55,7 @@ schedule.move_operation('cmul3', 1)
schedule
.
show
(
title
=
'
Improved schedule
'
)
# %%
# Extract operations and create processing elements
# Extract operations and create processing elements
.
operations
=
schedule
.
get_operations
()
adders
=
operations
.
get_by_type_name
(
'
add
'
)
adders
.
show
(
title
=
"
Adder executions
"
)
...
...
@@ -62,13 +66,13 @@ inputs.show(title="Input executions")
outputs
=
operations
.
get_by_type_name
(
'
out
'
)
outputs
.
show
(
title
=
"
Output executions
"
)
p1
=
ProcessingElement
(
adders
,
entity_name
=
"
adder
"
)
p2
=
ProcessingElement
(
mults
,
entity_name
=
"
c
mul
"
)
p_in
=
ProcessingElement
(
inputs
,
entity_name
=
'
input
'
)
p_out
=
ProcessingElement
(
outputs
,
entity_name
=
'
output
'
)
adder
=
ProcessingElement
(
adders
,
entity_name
=
"
adder
"
)
multiplier
=
ProcessingElement
(
mults
,
entity_name
=
"
mul
tiplier
"
)
p
e
_in
=
ProcessingElement
(
inputs
,
entity_name
=
'
input
'
)
p
e
_out
=
ProcessingElement
(
outputs
,
entity_name
=
'
output
'
)
# %%
# Extract and assign memory variables
# Extract and assign memory variables
.
mem_vars
=
schedule
.
get_memory_variables
()
mem_vars
.
show
(
title
=
"
All memory variables
"
)
direct
,
mem_vars
=
mem_vars
.
split_on_length
()
...
...
@@ -86,8 +90,10 @@ for i, mem in enumerate(mem_vars_set):
direct
.
show
(
title
=
"
Direct interconnects
"
)
# %%
# Create architecture
arch
=
Architecture
({
p1
,
p2
,
p_in
,
p_out
},
memories
,
direct_interconnects
=
direct
)
# Create architecture.
arch
=
Architecture
(
{
adder
,
multiplier
,
pe_in
,
pe_out
},
memories
,
direct_interconnects
=
direct
)
# %%
# The architecture can be rendered in enriched shells.
...
...
@@ -107,7 +113,7 @@ memories[2].show_content("New assigned memory2")
# %%
# Looking at the architecture it is clear that there is now only one input to
# ``memory0``, so no input multiplexer required.
# ``memory0``, so no input multiplexer
is
required.
arch
# %%
...
...
@@ -121,3 +127,14 @@ memories[2].show_content("New assigned memory2")
# %%
# However, this comes at the expense of an additional input to ``memory2``.
arch
# %%
# Finally, by noting that ``cmul1.0`` is the only variable from ``memory1`` going to
# ``in0`` of ``adder``, another multiplexer can be reduced by:
arch
.
move_process
(
'
cmul1.0
'
,
'
memory1
'
,
'
memory2
'
,
assign
=
True
)
memories
[
1
].
show_content
(
"
New assigned memory1
"
)
memories
[
2
].
show_content
(
"
New assigned memory2
"
)
# %%
# Leading to
arch
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