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
82977168
Commit
82977168
authored
2 years ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Refactor slack computation
parent
fb3b6eda
No related branches found
No related tags found
1 merge request
!333
Refactor slack computation
Pipeline
#96307
passed
2 years ago
Stage: test
Stage: deploy
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
b_asic/schedule.py
+40
-28
40 additions, 28 deletions
b_asic/schedule.py
with
40 additions
and
28 deletions
b_asic/schedule.py
+
40
−
28
View file @
82977168
...
@@ -182,22 +182,28 @@ class Schedule:
...
@@ -182,22 +182,28 @@ class Schedule:
start_time
=
self
.
_start_times
[
graph_id
]
start_time
=
self
.
_start_times
[
graph_id
]
operation
=
cast
(
Operation
,
self
.
_sfg
.
find_by_id
(
graph_id
))
operation
=
cast
(
Operation
,
self
.
_sfg
.
find_by_id
(
graph_id
))
for
output_port
in
operation
.
outputs
:
for
output_port
in
operation
.
outputs
:
output_slacks
=
{}
ret
[
output_port
]
=
self
.
_output_slacks
(
output_port
,
start_time
)
available_time
=
start_time
+
cast
(
int
,
output_port
.
latency_offset
)
if
available_time
>
self
.
_schedule_time
:
available_time
-=
self
.
_schedule_time
for
signal
in
output_port
.
signals
:
destination
=
cast
(
InputPort
,
signal
.
destination
)
usage_time
=
(
cast
(
int
,
destination
.
latency_offset
)
+
self
.
_start_times
[
destination
.
operation
.
graph_id
]
+
self
.
_schedule_time
*
self
.
_laps
[
signal
.
graph_id
]
)
output_slacks
[
signal
]
=
usage_time
-
available_time
ret
[
output_port
]
=
output_slacks
return
ret
return
ret
def
_output_slacks
(
self
,
output_port
:
"
OutputPort
"
,
start_time
:
Optional
[
int
]
=
None
)
->
Dict
[
Signal
,
int
]:
if
start_time
is
None
:
start_time
=
self
.
_start_times
[
output_port
.
operation
.
graph_id
]
output_slacks
=
{}
available_time
=
start_time
+
cast
(
int
,
output_port
.
latency_offset
)
if
available_time
>
self
.
_schedule_time
:
available_time
-=
self
.
_schedule_time
for
signal
in
output_port
.
signals
:
destination
=
cast
(
InputPort
,
signal
.
destination
)
usage_time
=
(
cast
(
int
,
destination
.
latency_offset
)
+
self
.
_start_times
[
destination
.
operation
.
graph_id
]
+
self
.
_schedule_time
*
self
.
_laps
[
signal
.
graph_id
]
)
output_slacks
[
signal
]
=
usage_time
-
available_time
return
output_slacks
def
backward_slack
(
self
,
graph_id
:
GraphID
)
->
int
:
def
backward_slack
(
self
,
graph_id
:
GraphID
)
->
int
:
"""
"""
Return how much an operation can be moved backward in time.
Return how much an operation can be moved backward in time.
...
@@ -234,22 +240,28 @@ class Schedule:
...
@@ -234,22 +240,28 @@ class Schedule:
start_time
=
self
.
_start_times
[
graph_id
]
start_time
=
self
.
_start_times
[
graph_id
]
operation
=
cast
(
Operation
,
self
.
_sfg
.
find_by_id
(
graph_id
))
operation
=
cast
(
Operation
,
self
.
_sfg
.
find_by_id
(
graph_id
))
for
input_port
in
operation
.
inputs
:
for
input_port
in
operation
.
inputs
:
input_slacks
=
{}
ret
[
input_port
]
=
self
.
_input_slacks
(
input_port
,
start_time
)
usage_time
=
start_time
+
cast
(
int
,
input_port
.
latency_offset
)
for
signal
in
input_port
.
signals
:
source
=
cast
(
OutputPort
,
signal
.
source
)
available_time
=
(
cast
(
int
,
source
.
latency_offset
)
+
self
.
_start_times
[
source
.
operation
.
graph_id
]
-
self
.
_schedule_time
*
self
.
_laps
[
signal
.
graph_id
]
)
if
available_time
>
self
.
_schedule_time
:
available_time
-=
self
.
_schedule_time
input_slacks
[
signal
]
=
usage_time
-
available_time
ret
[
input_port
]
=
input_slacks
return
ret
return
ret
def
_input_slacks
(
self
,
input_port
:
InputPort
,
start_time
:
Optional
[
int
]
=
None
)
->
Dict
[
Signal
,
int
]:
if
start_time
is
None
:
start_time
=
self
.
_start_times
[
input_port
.
operation
.
graph_id
]
input_slacks
=
{}
usage_time
=
start_time
+
cast
(
int
,
input_port
.
latency_offset
)
for
signal
in
input_port
.
signals
:
source
=
cast
(
OutputPort
,
signal
.
source
)
available_time
=
(
cast
(
int
,
source
.
latency_offset
)
+
self
.
_start_times
[
source
.
operation
.
graph_id
]
-
self
.
_schedule_time
*
self
.
_laps
[
signal
.
graph_id
]
)
if
available_time
>
self
.
_schedule_time
:
available_time
-=
self
.
_schedule_time
input_slacks
[
signal
]
=
usage_time
-
available_time
return
input_slacks
def
slacks
(
self
,
graph_id
:
GraphID
)
->
Tuple
[
int
,
int
]:
def
slacks
(
self
,
graph_id
:
GraphID
)
->
Tuple
[
int
,
int
]:
"""
"""
Return the backward and forward slacks of operation *graph_id*. That is, how
Return the backward and forward slacks of operation *graph_id*. That is, how
...
...
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