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
ff218ffa
Commit
ff218ffa
authored
1 month ago
by
Simon Bjurek
Browse files
Options
Downloads
Patches
Plain Diff
added schedule __str__ function that prints id, start time, backward slack and forward slack
parent
1135959b
No related branches found
Branches containing commit
No related tags found
1 merge request
!471
Added schedule _str_ function
Pipeline
#156519
passed
1 month ago
Stage: test
Stage: deploy
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
b_asic/schedule.py
+34
-0
34 additions, 0 deletions
b_asic/schedule.py
with
34 additions
and
0 deletions
b_asic/schedule.py
+
34
−
0
View file @
ff218ffa
...
...
@@ -124,6 +124,40 @@ class Schedule:
elif
schedule_time
<
max_end_time
:
raise
ValueError
(
f
"
Too short schedule time. Minimum is
{
max_end_time
}
.
"
)
def
__str__
(
self
)
->
str
:
"""
Return a string representation of this Schedule.
"""
res
:
List
[
Tuple
[
GraphID
,
int
,
int
,
int
]]
=
[
(
op
.
graph_id
,
self
.
start_time_of_operation
(
op
.
graph_id
),
cast
(
int
,
self
.
backward_slack
(
op
.
graph_id
)),
self
.
forward_slack
(
op
.
graph_id
),
)
for
op
in
self
.
_sfg
.
operations
]
res
.
sort
(
key
=
lambda
tup
:
tup
[
0
])
res_str
=
[
(
r
[
0
],
r
[
1
],
f
"
{
r
[
2
]
}
"
.
rjust
(
8
)
if
r
[
2
]
<
sys
.
maxsize
else
"
oo
"
.
rjust
(
8
),
f
"
{
r
[
3
]
}
"
.
rjust
(
8
)
if
r
[
3
]
<
sys
.
maxsize
else
"
oo
"
.
rjust
(
8
),
)
for
r
in
res
]
string_io
=
io
.
StringIO
()
header
=
[
"
Graph ID
"
,
"
Start time
"
,
"
Backward slack
"
,
"
Forward slack
"
]
string_io
.
write
(
"
|
"
.
join
(
f
"
{
col
:
^
15
}
"
for
i
,
col
in
enumerate
(
header
))
+
"
\n
"
)
string_io
.
write
(
"
-
"
*
(
15
*
len
(
header
)
+
len
(
header
)
-
1
)
+
"
\n
"
)
for
r
in
res_str
:
row_str
=
"
|
"
.
join
(
f
"
{
str
(
item
)
:
^
15
}
"
for
i
,
item
in
enumerate
(
r
))
string_io
.
write
(
row_str
+
"
\n
"
)
return
string_io
.
getvalue
()
def
start_time_of_operation
(
self
,
graph_id
:
GraphID
)
->
int
:
"""
Return the start time of the operation with the specified by *graph_id*.
...
...
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