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
5580dc74
Commit
5580dc74
authored
1 year ago
by
Mikael Henriksson
Browse files
Options
Downloads
Patches
Plain Diff
add max and min lifetime plot test, and multi-read memory variable test (closes
#245
)
parent
d1af9c2e
No related branches found
No related tags found
1 merge request
!361
add max and min lifetime plot test, and multi-read memory variable test (closes #245)
Pipeline
#96848
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
+12
-8
12 additions, 8 deletions
b_asic/resources.py
test/baseline/test_max_min_lifetime_bar_plot.png
+0
-0
0 additions, 0 deletions
test/baseline/test_max_min_lifetime_bar_plot.png
test/test_resources.py
+54
-1
54 additions, 1 deletion
test/test_resources.py
with
66 additions
and
9 deletions
b_asic/resources.py
+
12
−
8
View file @
5580dc74
...
...
@@ -550,8 +550,8 @@ class ProcessCollection:
else
bar_start
%
self
.
_schedule_time
)
bar_end
=
(
bar_end
if
bar_end
==
self
.
_schedule_time
self
.
schedule_time
if
bar_end
and
bar_end
%
self
.
_schedule_time
==
0
else
bar_end
%
self
.
_schedule_time
)
if
show_markers
:
...
...
@@ -564,8 +564,8 @@ class ProcessCollection:
)
for
end_time
in
process
.
read_times
:
end_time
=
(
end
_time
if
end_time
==
self
.
_
schedule_time
self
.
schedule
_time
if
end_time
and
end_time
%
self
.
schedule_time
==
0
else
end_time
%
self
.
_schedule_time
)
_ax
.
scatter
(
# type: ignore
...
...
@@ -583,15 +583,19 @@ class ProcessCollection:
color
=
_WARNING_COLOR
,
)
elif
process
.
execution_time
==
0
:
# Execution time zero, don't draw the bar
pass
# Execution time zero, draw a slim bar
_ax
.
broken_barh
(
# type: ignore
[(
PAD_L
+
bar_start
,
bar_end
-
bar_start
-
PAD_L
-
PAD_R
)],
(
bar_row
+
0.55
,
0.9
),
color
=
bar_color
,
)
elif
bar_end
>
bar_start
:
_ax
.
broken_barh
(
# type: ignore
[(
PAD_L
+
bar_start
,
bar_end
-
bar_start
-
PAD_L
-
PAD_R
)],
(
bar_row
+
0.55
,
0.9
),
color
=
bar_color
,
)
else
:
# bar_end < bar_start
else
:
# bar_end <
=
bar_start
_ax
.
broken_barh
(
# type: ignore
[
(
...
...
@@ -1224,7 +1228,7 @@ class ProcessCollection:
Forward-Backward Register Allocation [1].
[1]: K. Parhi: VLSI Digital Signal Processing Systems: Design and
Implementation, Ch. 6.3.2
Implementation, Ch. 6.3.2
Parameters
----------
...
...
This diff is collapsed.
Click to expand it.
test/baseline/test_max_min_lifetime_bar_plot.png
0 → 100644
+
0
−
0
View file @
5580dc74
10.8 KiB
This diff is collapsed.
Click to expand it.
test/test_resources.py
+
54
−
1
View file @
5580dc74
import
pickle
import
re
import
matplotlib.pyplot
as
plt
...
...
@@ -145,3 +144,57 @@ class TestProcessCollectionPlainMemoryVariable:
simple_collection
.
remove_process
(
new_proc
)
assert
len
(
simple_collection
)
==
7
assert
new_proc
not
in
simple_collection
@pytest.mark.mpl_image_compare
(
style
=
'
mpl20
'
)
def
test_max_min_lifetime_bar_plot
(
self
):
fig
,
ax
=
plt
.
subplots
()
collection
=
ProcessCollection
(
{
# Process starting exactly at scheudle start
PlainMemoryVariable
(
0
,
0
,
{
0
:
0
},
"
S1
"
),
PlainMemoryVariable
(
0
,
0
,
{
0
:
5
},
"
S2
"
),
# Process starting somewhere between schedule start and end
PlainMemoryVariable
(
2
,
0
,
{
0
:
0
},
"
M1
"
),
PlainMemoryVariable
(
2
,
0
,
{
0
:
5
},
"
M2
"
),
# Process starting at the schedule end
PlainMemoryVariable
(
5
,
0
,
{
0
:
0
},
"
E1
"
),
PlainMemoryVariable
(
5
,
0
,
{
0
:
5
},
"
E2
"
),
},
schedule_time
=
5
,
)
collection
.
plot
(
ax
)
return
fig
def
test_multiple_reads_exclusion_greaph
(
self
):
# Initial collection
p0
=
PlainMemoryVariable
(
0
,
0
,
{
0
:
3
},
'
P0
'
)
p1
=
PlainMemoryVariable
(
1
,
0
,
{
0
:
2
},
'
P1
'
)
p2
=
PlainMemoryVariable
(
2
,
0
,
{
0
:
2
},
'
P2
'
)
p3
=
PlainMemoryVariable
(
3
,
0
,
{
0
:
3
},
'
P3
'
)
collection
=
ProcessCollection
({
p0
,
p1
,
p2
,
p3
},
5
,
cyclic
=
True
)
exclusion_graph
=
collection
.
create_exclusion_graph_from_ports
(
read_ports
=
1
,
write_ports
=
1
,
total_ports
=
1
,
)
for
p
in
[
p0
,
p1
,
p2
,
p3
]:
assert
p
in
exclusion_graph
assert
exclusion_graph
.
degree
(
p0
)
==
2
assert
exclusion_graph
.
degree
(
p1
)
==
2
assert
exclusion_graph
.
degree
(
p2
)
==
0
assert
exclusion_graph
.
degree
(
p3
)
==
2
# Add multi-read process
p4
=
PlainMemoryVariable
(
0
,
0
,
{
0
:
1
,
1
:
2
,
2
:
3
,
3
:
4
},
'
P4
'
)
collection
.
add_process
(
p4
)
exclusion_graph
=
collection
.
create_exclusion_graph_from_ports
(
read_ports
=
1
,
write_ports
=
1
,
total_ports
=
1
,
)
for
p
in
[
p0
,
p1
,
p2
,
p3
,
p4
]:
assert
p
in
exclusion_graph
assert
exclusion_graph
.
degree
(
p0
)
==
3
assert
exclusion_graph
.
degree
(
p1
)
==
3
assert
exclusion_graph
.
degree
(
p2
)
==
1
assert
exclusion_graph
.
degree
(
p3
)
==
3
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