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
a43ef562
Commit
a43ef562
authored
2 years ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Improve variable names and use axvline
parent
a0621925
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!162
Improve variable names and use axvline
Pipeline
#88829
passed
2 years ago
Stage: test
Stage: deploy
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
b_asic/schedule.py
+40
-33
40 additions, 33 deletions
b_asic/schedule.py
test/baseline/test__get_figure_no_execution_times.png
+0
-0
0 additions, 0 deletions
test/baseline/test__get_figure_no_execution_times.png
with
40 additions
and
33 deletions
b_asic/schedule.py
+
40
−
33
View file @
a43ef562
...
...
@@ -590,7 +590,7 @@ class Schedule:
if
operation_gap
is
None
:
operation_gap
=
OPERATION_GAP
y_location
=
self
.
_y_locations
[
graph_id
]
if
y_location
==
None
:
if
y_location
is
None
:
# Assign the lowest row number not yet in use
used
=
set
(
loc
for
loc
in
self
.
_y_locations
.
values
()
if
loc
is
not
None
...
...
@@ -701,54 +701,60 @@ class Schedule:
ax
.
set_axisbelow
(
True
)
ax
.
grid
()
for
graph_id
,
op_start_time
in
self
.
_start_times
.
items
():
ypos
=
self
.
_get_y_position
(
graph_id
,
operation_gap
=
operation_gap
)
y
_
pos
=
self
.
_get_y_position
(
graph_id
,
operation_gap
=
operation_gap
)
op
=
self
.
_sfg
.
find_by_id
(
graph_id
)
# Rewrite to make better use of NumPy
latency_coords
,
execution_time_coords
=
op
.
get_plot_coordinates
()
_x
,
_y
=
zip
(
*
latency_coords
)
(
latency_coordinates
,
execution_time_coordinates
,
)
=
op
.
get_plot_coordinates
()
_x
,
_y
=
zip
(
*
latency_coordinates
)
x
=
np
.
array
(
_x
)
y
=
np
.
array
(
_y
)
xy
=
np
.
stack
((
x
+
op_start_time
,
y
+
ypos
))
p
=
Polygon
(
xy
.
T
,
fc
=
_LATENCY_COLOR
)
ax
.
add_patch
(
p
)
if
execution_time_coords
:
_x
,
_y
=
zip
(
*
execution_time_coords
)
xy
=
np
.
stack
((
x
+
op_start_time
,
y
+
y_pos
))
ax
.
add_patch
(
Polygon
(
xy
.
T
,
fc
=
_LATENCY_COLOR
))
if
execution_time_coordinates
:
_x
,
_y
=
zip
(
*
execution_time_coordinates
)
x
=
np
.
array
(
_x
)
y
=
np
.
array
(
_y
)
ax
.
plot
(
x
+
op_start_time
,
y
+
ypos
,
y
+
y
_
pos
,
color
=
_EXECUTION_TIME_COLOR
,
linewidth
=
3
,
)
ytickpositions
.
append
(
ypos
+
0.5
)
ytickpositions
.
append
(
y
_
pos
+
0.5
)
yticklabels
.
append
(
self
.
_sfg
.
find_by_id
(
graph_id
).
name
)
for
graph_id
,
op_start_time
in
self
.
_start_times
.
items
():
op
=
self
.
_sfg
.
find_by_id
(
graph_id
)
_
,
out_coords
=
op
.
get_io_coordinates
()
source_ypos
=
self
.
_get_y_position
(
_
,
out_coord
inate
s
=
op
.
get_io_coordinates
()
source_y
_
pos
=
self
.
_get_y_position
(
graph_id
,
operation_gap
=
operation_gap
)
for
output_port
in
op
.
outputs
:
for
output_signal
in
output_port
.
signals
:
dest_op
=
output_signal
.
destination
.
operation
dest_start_time
=
self
.
_start_times
[
dest_op
.
graph_id
]
dest_ypos
=
self
.
_get_y_position
(
dest_op
.
graph_id
,
operation_gap
=
operation_gap
destination_op
=
output_signal
.
destination
.
operation
destination_start_time
=
self
.
_start_times
[
destination_op
.
graph_id
]
destination_y_pos
=
self
.
_get_y_position
(
destination_op
.
graph_id
,
operation_gap
=
operation_gap
)
(
dest_in_coords
,
dest
ination
_in_coord
inate
s
,
_
,
)
=
(
output_signal
.
destination
.
operation
.
get_io_coordinates
()
)
_draw_offset_arrow
(
out_coords
[
output_port
.
index
],
dest_in_coords
[
output_signal
.
destination
.
index
],
[
op_start_time
,
source_ypos
],
[
dest_start_time
,
dest_ypos
],
out_coordinates
[
output_port
.
index
],
destination_in_coordinates
[
output_signal
.
destination
.
index
],
[
op_start_time
,
source_y_pos
],
[
destination_start_time
,
destination_y_pos
],
name
=
graph_id
,
laps
=
self
.
_laps
[
output_signal
.
graph_id
],
)
...
...
@@ -758,23 +764,24 @@ class Schedule:
# Get operation with maximum position
max_pos_graph_id
=
max
(
self
.
_y_locations
,
key
=
self
.
_y_locations
.
get
)
yposmax
=
(
y
_
pos
ition_
max
=
(
self
.
_get_y_position
(
max_pos_graph_id
,
operation_gap
=
operation_gap
)
+
1
+
(
OPERATION_GAP
if
operation_gap
is
None
else
operation_gap
)
)
ax
.
axis
([
-
1
,
self
.
_schedule_time
+
1
,
yposmax
,
0
])
# Inverted y-axis
ax
.
axis
(
[
-
1
,
self
.
_schedule_time
+
1
,
y_position_max
,
0
]
)
# Inverted y-axis
ax
.
xaxis
.
set_major_locator
(
MaxNLocator
(
integer
=
True
))
ax
.
add_line
(
Line2D
([
0
,
0
],
[
0
,
yposmax
],
linestyle
=
"
--
"
,
color
=
"
black
"
)
ax
.
axvline
(
0
,
linestyle
=
"
--
"
,
color
=
"
black
"
,
)
ax
.
add_line
(
Line2D
(
[
self
.
_schedule_time
,
self
.
_schedule_time
],
[
0
,
yposmax
],
linestyle
=
"
--
"
,
color
=
"
black
"
,
)
ax
.
axvline
(
self
.
_schedule_time
,
linestyle
=
"
--
"
,
color
=
"
black
"
,
)
def
_reset_y_locations
(
self
):
...
...
This diff is collapsed.
Click to expand it.
test/baseline/test__get_figure_no_execution_times.png
+
0
−
0
View replaced file @
a0621925
View file @
a43ef562
25.8 KiB
|
W:
|
H:
25.9 KiB
|
W:
|
H:
2-up
Swipe
Onion skin
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