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
dd3e83dd
Commit
dd3e83dd
authored
2 years ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Add title argument to show
parent
9c903753
No related branches found
No related tags found
1 merge request
!347
Add title argument to show
Pipeline
#96662
passed
2 years ago
Stage: test
Stage: deploy
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
b_asic/resources.py
+5
-0
5 additions, 0 deletions
b_asic/resources.py
b_asic/schedule.py
+9
-2
9 additions, 2 deletions
b_asic/schedule.py
examples/secondorderdirectformiir_architecture.py
+10
-11
10 additions, 11 deletions
examples/secondorderdirectformiir_architecture.py
with
24 additions
and
13 deletions
b_asic/resources.py
+
5
−
0
View file @
dd3e83dd
...
@@ -591,6 +591,7 @@ class ProcessCollection:
...
@@ -591,6 +591,7 @@ class ProcessCollection:
marker_write
:
str
=
"
o
"
,
marker_write
:
str
=
"
o
"
,
show_markers
:
bool
=
True
,
show_markers
:
bool
=
True
,
allow_excessive_lifetimes
:
bool
=
False
,
allow_excessive_lifetimes
:
bool
=
False
,
title
:
Optional
[
str
]
=
None
,
)
->
None
:
)
->
None
:
"""
"""
Show the process collection using the current Matplotlib backend.
Show the process collection using the current Matplotlib backend.
...
@@ -614,6 +615,8 @@ class ProcessCollection:
...
@@ -614,6 +615,8 @@ class ProcessCollection:
allow_excessive_lifetimes : bool, default False
allow_excessive_lifetimes : bool, default False
If set to true, the plot method allows ploting collections of variables with a greater lifetime
If set to true, the plot method allows ploting collections of variables with a greater lifetime
than the schedule time.
than the schedule time.
title : str, optional
Title of plot.
"""
"""
fig
,
ax
=
plt
.
subplots
()
fig
,
ax
=
plt
.
subplots
()
self
.
plot
(
self
.
plot
(
...
@@ -626,6 +629,8 @@ class ProcessCollection:
...
@@ -626,6 +629,8 @@ class ProcessCollection:
show_markers
=
show_markers
,
show_markers
=
show_markers
,
allow_excessive_lifetimes
=
allow_excessive_lifetimes
,
allow_excessive_lifetimes
=
allow_excessive_lifetimes
,
)
)
if
title
:
fig
.
suptitle
(
title
)
fig
.
show
()
# type: ignore
fig
.
show
()
# type: ignore
def
create_exclusion_graph_from_ports
(
def
create_exclusion_graph_from_ports
(
...
...
This diff is collapsed.
Click to expand it.
b_asic/schedule.py
+
9
−
2
View file @
dd3e83dd
...
@@ -995,7 +995,9 @@ class Schedule:
...
@@ -995,7 +995,9 @@ class Schedule:
"""
"""
self
.
_plot_schedule
(
ax
,
operation_gap
=
operation_gap
)
self
.
_plot_schedule
(
ax
,
operation_gap
=
operation_gap
)
def
show
(
self
,
operation_gap
:
Optional
[
float
]
=
None
)
->
None
:
def
show
(
self
,
operation_gap
:
Optional
[
float
]
=
None
,
title
:
Optional
[
str
]
=
None
)
->
None
:
"""
"""
Show the schedule. Will display based on the current Matplotlib backend.
Show the schedule. Will display based on the current Matplotlib backend.
...
@@ -1004,8 +1006,13 @@ class Schedule:
...
@@ -1004,8 +1006,13 @@ class Schedule:
operation_gap : float, optional
operation_gap : float, optional
The vertical distance between operations in the schedule. The height of
The vertical distance between operations in the schedule. The height of
the operation is always 1.
the operation is always 1.
title : str, optional
Figure title.
"""
"""
self
.
_get_figure
(
operation_gap
=
operation_gap
).
show
()
fig
=
self
.
_get_figure
(
operation_gap
=
operation_gap
)
if
title
:
fig
.
suptitle
(
title
)
fig
.
show
()
def
_get_figure
(
self
,
operation_gap
:
Optional
[
float
]
=
None
)
->
Figure
:
def
_get_figure
(
self
,
operation_gap
:
Optional
[
float
]
=
None
)
->
Figure
:
"""
"""
...
...
This diff is collapsed.
Click to expand it.
examples/secondorderdirectformiir_architecture.py
+
10
−
11
View file @
dd3e83dd
...
@@ -39,7 +39,7 @@ sfg.set_execution_time_of_type(Addition.type_name(), 1)
...
@@ -39,7 +39,7 @@ sfg.set_execution_time_of_type(Addition.type_name(), 1)
# %%
# %%
# Create schedule
# Create schedule
schedule
=
Schedule
(
sfg
,
cyclic
=
True
)
schedule
=
Schedule
(
sfg
,
cyclic
=
True
)
schedule
.
show
()
schedule
.
show
(
title
=
'
Original schedule
'
)
# %%
# %%
# Rescheudle to only require one adder and one multiplier
# Rescheudle to only require one adder and one multiplier
...
@@ -48,19 +48,19 @@ schedule.move_operation('cmul5', -5)
...
@@ -48,19 +48,19 @@ schedule.move_operation('cmul5', -5)
schedule
.
move_operation
(
'
cmul4
'
,
-
4
)
schedule
.
move_operation
(
'
cmul4
'
,
-
4
)
schedule
.
move_operation
(
'
cmul6
'
,
-
2
)
schedule
.
move_operation
(
'
cmul6
'
,
-
2
)
schedule
.
move_operation
(
'
cmul3
'
,
1
)
schedule
.
move_operation
(
'
cmul3
'
,
1
)
schedule
.
show
()
schedule
.
show
(
title
=
'
Improved schedule
'
)
# %%
# %%
# Extract operations and create processing elements
# Extract operations and create processing elements
operations
=
schedule
.
get_operations
()
operations
=
schedule
.
get_operations
()
adders
=
operations
.
get_by_type_name
(
'
add
'
)
adders
=
operations
.
get_by_type_name
(
'
add
'
)
adders
.
show
()
adders
.
show
(
title
=
"
Adder executions
"
)
mults
=
operations
.
get_by_type_name
(
'
cmul
'
)
mults
=
operations
.
get_by_type_name
(
'
cmul
'
)
mults
.
show
()
mults
.
show
(
title
=
"
Multiplier executions
"
)
inputs
=
operations
.
get_by_type_name
(
'
in
'
)
inputs
=
operations
.
get_by_type_name
(
'
in
'
)
inputs
.
show
()
inputs
.
show
(
title
=
"
Input executions
"
)
outputs
=
operations
.
get_by_type_name
(
'
out
'
)
outputs
=
operations
.
get_by_type_name
(
'
out
'
)
outputs
.
show
()
outputs
.
show
(
title
=
"
Output executions
"
)
p1
=
ProcessingElement
(
adders
,
entity_name
=
"
adder
"
)
p1
=
ProcessingElement
(
adders
,
entity_name
=
"
adder
"
)
p2
=
ProcessingElement
(
mults
,
entity_name
=
"
cmul
"
)
p2
=
ProcessingElement
(
mults
,
entity_name
=
"
cmul
"
)
...
@@ -69,18 +69,17 @@ p_out = ProcessingElement(outputs, entity_name='out')
...
@@ -69,18 +69,17 @@ p_out = ProcessingElement(outputs, entity_name='out')
# %%
# %%
# Extract memory variables
# Extract memory variables
# Memories
mem_vars
=
schedule
.
get_memory_variables
()
mem_vars
=
schedule
.
get_memory_variables
()
mem_vars
.
show
()
mem_vars
.
show
(
title
=
"
All memory variables
"
)
direct
,
mem_vars
=
mem_vars
.
split_on_length
()
direct
,
mem_vars
=
mem_vars
.
split_on_length
()
direct
.
show
()
direct
.
show
(
title
=
"
Direct interconnects
"
)
mem_vars
.
show
()
mem_vars
.
show
(
title
=
"
Non-zero time memory variables
"
)
mem_vars_set
=
mem_vars
.
split_on_ports
(
read_ports
=
1
,
write_ports
=
1
,
total_ports
=
1
)
mem_vars_set
=
mem_vars
.
split_on_ports
(
read_ports
=
1
,
write_ports
=
1
,
total_ports
=
1
)
memories
=
set
()
memories
=
set
()
for
i
,
mem
in
enumerate
(
mem_vars_set
):
for
i
,
mem
in
enumerate
(
mem_vars_set
):
memories
.
add
(
Memory
(
mem
,
entity_name
=
f
"
memory
{
i
}
"
))
memories
.
add
(
Memory
(
mem
,
entity_name
=
f
"
memory
{
i
}
"
))
mem
.
show
()
mem
.
show
(
title
=
f
"
memory
{
i
}
"
)
# %%
# %%
# Create architecture
# Create architecture
...
...
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