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
fb3b6eda
Commit
fb3b6eda
authored
1 year ago
by
Mikael Henriksson
Browse files
Options
Downloads
Patches
Plain Diff
resources.py: add show method (fixes
#233
)
parent
8829dcd0
No related branches found
Branches containing commit
No related tags found
1 merge request
!332
resources.py: add show method (fixes #233)
Pipeline
#96284
passed
1 year ago
Stage: test
Stage: deploy
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
b_asic/resources.py
+56
-8
56 additions, 8 deletions
b_asic/resources.py
examples/schedulingexample.py
+4
-2
4 additions, 2 deletions
examples/schedulingexample.py
test/test_resources.py
+3
-0
3 additions, 0 deletions
test/test_resources.py
with
63 additions
and
10 deletions
b_asic/resources.py
+
56
−
8
View file @
fb3b6eda
...
...
@@ -447,6 +447,7 @@ class ProcessCollection:
def
plot
(
self
,
ax
:
Optional
[
Axes
]
=
None
,
*
,
show_name
:
bool
=
True
,
bar_color
:
Union
[
str
,
Tuple
[
float
,
...]]
=
_LATENCY_COLOR
,
marker_color
:
Union
[
str
,
Tuple
[
float
,
...]]
=
"
black
"
,
...
...
@@ -454,7 +455,6 @@ class ProcessCollection:
marker_write
:
str
=
"
o
"
,
show_markers
:
bool
=
True
,
row
:
Optional
[
int
]
=
None
,
*
,
allow_excessive_lifetimes
:
bool
=
False
,
):
"""
...
...
@@ -472,10 +472,10 @@ class ProcessCollection:
Bar color in lifetime chart.
marker_color : color, default
'
black
'
Color for read and write marker.
marker_write : str, default
'
x
'
Marker at write time in the lifetime chart.
marker_read : str, default
'
o
'
Marker at read time in the lifetime chart.
marker_write : str, default
'
x
'
Marker at write time in the lifetime chart.
show_markers : bool, default True
Show markers at read and write times.
row : int, optional
...
...
@@ -581,6 +581,53 @@ class ProcessCollection:
pass
return
_ax
def
show
(
self
,
*
,
show_name
:
bool
=
True
,
bar_color
:
Union
[
str
,
Tuple
[
float
,
...]]
=
_LATENCY_COLOR
,
marker_color
:
Union
[
str
,
Tuple
[
float
,
...]]
=
"
black
"
,
marker_read
:
str
=
"
X
"
,
marker_write
:
str
=
"
o
"
,
show_markers
:
bool
=
True
,
allow_excessive_lifetimes
:
bool
=
False
,
)
->
None
:
"""
Show the process collection using the current Matplotlib backend.
Equivalent to creating a Matplotlib figure, passing it and arguments to :func:`plot`
and invoking :py:meth:`matplotlib.figure.Figure.show`.
Parameters
----------
show_name : bool, default: True
Show name of all processes in the lifetime chart.
bar_color : color, optional
Bar color in lifetime chart.
marker_color : color, default
'
black
'
Color for read and write marker.
marker_read : str, default
'
o
'
Marker at read time in the lifetime chart.
marker_write : str, default
'
x
'
Marker at write time in the lifetime chart.
show_markers : bool, default True
Show markers at read and write times.
allow_excessive_lifetimes : bool, default False
If set to true, the plot method allows ploting collections of variables with a greater lifetime
than the schedule time.
"""
fig
,
ax
=
plt
.
subplots
()
self
.
plot
(
ax
=
ax
,
show_name
=
show_name
,
bar_color
=
bar_color
,
marker_color
=
marker_color
,
marker_read
=
marker_read
,
marker_write
=
marker_write
,
show_markers
=
show_markers
,
allow_excessive_lifetimes
=
allow_excessive_lifetimes
,
)
fig
.
show
()
# type: ignore
def
create_exclusion_graph_from_ports
(
self
,
read_ports
:
Optional
[
int
]
=
None
,
...
...
@@ -721,7 +768,7 @@ class ProcessCollection:
The heuristic used when splitting based on execution times.
coloring_strategy : str, default:
'
saturation_largest_first
'
Node ordering strategy passed to :func:`networkx.coloring.greedy_color`.
Node ordering strategy passed to :func:`networkx.
algorithms.
coloring.greedy_color`.
This parameter is only considered if *heuristic* is set to
'
graph_color
'
.
One of
...
...
@@ -761,7 +808,7 @@ class ProcessCollection:
Parameters
----------
heuristic : str, default:
"
graph_color
"
The heuristic used when splitting this ProcessCollection.
The heuristic used when splitting this
:class:`
ProcessCollection
`
.
Valid options are:
*
"
graph_color
"
...
...
@@ -811,7 +858,7 @@ class ProcessCollection:
The total number of ports used when splitting process collection based on
memory variable access.
coloring_strategy : str, default:
'
saturation_largest_first
'
Node ordering strategy passed to :func:`networkx.coloring.greedy_color`
Node ordering strategy passed to :func:`networkx.
algorithms.
coloring.greedy_color`
One of
*
'
largest_first
'
*
'
random_sequential
'
...
...
@@ -884,13 +931,14 @@ class ProcessCollection:
coloring
:
Optional
[
Dict
[
Process
,
int
]]
=
None
,
)
->
Set
[
"
ProcessCollection
"
]:
"""
Perform cell assignment of the processes in this collection using graph coloring with networkx.coloring.greedy_color.
Perform cell assignment of the processes in this collection using graph coloring.
Two or more processes can share a single cell if, and only if, they have no overlaping time alive.
Parameters
----------
coloring_strategy : str, default:
"
saturation_largest_first
"
Graph coloring strategy passed to networkx.coloring.greedy_color
()
.
Graph coloring strategy passed to
:func:`
networkx.
algorithms.
coloring.greedy_color
`
.
coloring : dictionary, optional
An optional graph coloring, dictionary with Process and its associated color (int).
If a graph coloring is not provided throught this parameter, one will be created when calling this method.
...
...
This diff is collapsed.
Click to expand it.
examples/schedulingexample.py
+
4
−
2
View file @
fb3b6eda
"""
Example SFG used for scheduling in the TSTE87 course.
====================================================
Example SFG used for scheduling in the TSTE87 course
====================================================
Node numbering from the original SFG used with the Matlab toolbox
.
::
Node numbering from the original SFG used with the Matlab toolbox::
sfg=addoperand([],
'
in
'
,1,1);
sfg=addoperand(sfg,
'
constmult
'
,1,1,2,0.25);
...
...
This diff is collapsed.
Click to expand it.
test/test_resources.py
+
3
−
0
View file @
fb3b6eda
...
...
@@ -134,3 +134,6 @@ class TestProcessCollectionPlainMemoryVariable:
isinstance
(
operand
.
operation
,
ConstantMultiplication
)
for
operand
in
pc_cmul
.
collection
)
def
test_show
(
self
,
simple_collection
:
ProcessCollection
):
simple_collection
.
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