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
ea8159f7
Commit
ea8159f7
authored
1 year ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Correct scheduling
parent
337b6655
No related branches found
No related tags found
1 merge request
!308
Correct scheduling
Pipeline
#95696
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/schedule.py
+25
-49
25 additions, 49 deletions
b_asic/schedule.py
b_asic/scheduler_gui/main_window.py
+0
-2
0 additions, 2 deletions
b_asic/scheduler_gui/main_window.py
b_asic/scheduler_gui/scheduler_event.py
+1
-1
1 addition, 1 deletion
b_asic/scheduler_gui/scheduler_event.py
with
26 additions
and
52 deletions
b_asic/schedule.py
+
25
−
49
View file @
ea8159f7
...
@@ -174,6 +174,8 @@ class Schedule:
...
@@ -174,6 +174,8 @@ class Schedule:
for
output_port
in
operation
.
outputs
:
for
output_port
in
operation
.
outputs
:
output_slacks
=
{}
output_slacks
=
{}
available_time
=
start_time
+
cast
(
int
,
output_port
.
latency_offset
)
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
:
for
signal
in
output_port
.
signals
:
destination
=
cast
(
InputPort
,
signal
.
destination
)
destination
=
cast
(
InputPort
,
signal
.
destination
)
...
@@ -232,6 +234,8 @@ class Schedule:
...
@@ -232,6 +234,8 @@ class Schedule:
+
self
.
_start_times
[
source
.
operation
.
graph_id
]
+
self
.
_start_times
[
source
.
operation
.
graph_id
]
-
self
.
_schedule_time
*
self
.
_laps
[
signal
.
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
input_slacks
[
signal
]
=
usage_time
-
available_time
ret
[
input_port
]
=
input_slacks
ret
[
input_port
]
=
input_slacks
return
ret
return
ret
...
@@ -518,6 +522,7 @@ class Schedule:
...
@@ -518,6 +522,7 @@ class Schedule:
time : int
time : int
The time to move. If positive move forward, if negative move backward.
The time to move. If positive move forward, if negative move backward.
"""
"""
print
(
f
"
schedule.move_operation(
{
graph_id
!r}
,
{
time
}
)
"
)
if
graph_id
not
in
self
.
_start_times
:
if
graph_id
not
in
self
.
_start_times
:
raise
ValueError
(
f
"
No operation with graph_id
{
graph_id
}
in schedule
"
)
raise
ValueError
(
f
"
No operation with graph_id
{
graph_id
}
in schedule
"
)
...
@@ -528,7 +533,8 @@ class Schedule:
...
@@ -528,7 +533,8 @@ class Schedule:
f
"
between
{
-
backward_slack
}
and
{
forward_slack
}
.
"
f
"
between
{
-
backward_slack
}
and
{
forward_slack
}
.
"
)
)
tmp_start
=
self
.
_start_times
[
graph_id
]
+
time
old_start
=
self
.
_start_times
[
graph_id
]
tmp_start
=
old_start
+
time
new_start
=
tmp_start
%
self
.
_schedule_time
new_start
=
tmp_start
%
self
.
_schedule_time
# Update input laps
# Update input laps
...
@@ -537,42 +543,22 @@ class Schedule:
...
@@ -537,42 +543,22 @@ class Schedule:
tmp_usage
=
tmp_start
+
cast
(
int
,
in_port
.
latency_offset
)
tmp_usage
=
tmp_start
+
cast
(
int
,
in_port
.
latency_offset
)
new_usage
=
tmp_usage
%
self
.
_schedule_time
new_usage
=
tmp_usage
%
self
.
_schedule_time
for
signal
,
signal_slack
in
signal_slacks
.
items
():
for
signal
,
signal_slack
in
signal_slacks
.
items
():
# New slack
new_slack
=
signal_slack
+
time
new_slack
=
signal_slack
+
time
old_laps
=
self
.
_laps
[
signal
.
graph_id
]
# Compute a lower limit on laps
laps
=
new_slack
//
self
.
_schedule_time
# Compensate for cases where above is not correct
tmp_prev_available
=
tmp_usage
-
new_slack
tmp_prev_available
=
tmp_usage
-
new_slack
prev_available
=
tmp_prev_available
%
self
.
_schedule_time
prev_available
=
tmp_prev_available
%
self
.
_schedule_time
laps
=
new_slack
//
self
.
_schedule_time
# If prev_available == 0 it will come from previous lap, unless it comes
# from an Input
source_op
=
signal
.
source_operation
source_op
=
signal
.
source_operation
if
prev_available
==
0
and
not
isinstance
(
source_op
,
Input
):
prev_available
=
self
.
_schedule_time
# Usage time (new_usage) < available time (prev_available) within a
# schedule period
if
new_usage
<
prev_available
:
if
new_usage
<
prev_available
:
print
(
"
Incrementing input laps 1
"
)
laps
+=
1
if
(
prev_available
==
0
and
new_usage
==
0
and
(
tmp_prev_available
>
0
or
tmp_prev_available
==
0
and
not
isinstance
(
source_op
,
Input
)
)
):
print
(
"
Incrementing input laps 2
"
)
laps
+=
1
laps
+=
1
print
(
[
"
Input
"
,
signal
.
source
.
operation
,
time
,
tmp_start
,
signal_slack
,
new_slack
,
old_laps
,
laps
,
new_usage
,
prev_available
,
tmp_usage
,
tmp_prev_available
,
]
)
self
.
_laps
[
signal
.
graph_id
]
=
laps
self
.
_laps
[
signal
.
graph_id
]
=
laps
# Update output laps
# Update output laps
...
@@ -581,29 +567,19 @@ class Schedule:
...
@@ -581,29 +567,19 @@ class Schedule:
tmp_available
=
tmp_start
+
cast
(
int
,
out_port
.
latency_offset
)
tmp_available
=
tmp_start
+
cast
(
int
,
out_port
.
latency_offset
)
new_available
=
tmp_available
%
self
.
_schedule_time
new_available
=
tmp_available
%
self
.
_schedule_time
for
signal
,
signal_slack
in
signal_slacks
.
items
():
for
signal
,
signal_slack
in
signal_slacks
.
items
():
# New slack
new_slack
=
signal_slack
-
time
new_slack
=
signal_slack
-
time
# Compute a lower limit on laps
laps
=
new_slack
//
self
.
_schedule_time
# Compensate for cases where above is not correct
tmp_next_usage
=
tmp_available
+
new_slack
tmp_next_usage
=
tmp_available
+
new_slack
next_usage
=
tmp_next_usage
%
self
.
_schedule_time
next_usage
=
tmp_next_usage
%
self
.
_schedule_time
laps
=
new_slack
//
self
.
_schedule_time
# Usage time (new_usage) < available time (prev_available) within a
if
next_usage
<
new_available
:
# schedule period
laps
+=
1
print
(
"
Incrementing output laps 1
"
)
if
new_available
==
0
and
(
new_slack
>
0
or
next_usage
==
0
):
if
new_available
==
0
and
(
new_slack
>
0
or
next_usage
==
0
):
print
(
"
Incrementing output laps 2
"
)
new_available
=
self
.
_schedule_time
if
next_usage
<
new_available
:
laps
+=
1
laps
+=
1
print
(
[
"
Output
"
,
signal_slack
,
new_slack
,
old_laps
,
laps
,
new_available
,
next_usage
,
tmp_available
,
tmp_next_usage
,
]
)
self
.
_laps
[
signal
.
graph_id
]
=
laps
self
.
_laps
[
signal
.
graph_id
]
=
laps
# Set new start time
# Set new start time
...
...
This diff is collapsed.
Click to expand it.
b_asic/scheduler_gui/main_window.py
+
0
−
2
View file @
ea8159f7
...
@@ -55,8 +55,6 @@ from b_asic.schedule import Schedule
...
@@ -55,8 +55,6 @@ from b_asic.schedule import Schedule
from
b_asic.scheduler_gui.axes_item
import
AxesItem
from
b_asic.scheduler_gui.axes_item
import
AxesItem
from
b_asic.scheduler_gui.operation_item
import
OperationItem
from
b_asic.scheduler_gui.operation_item
import
OperationItem
from
b_asic.scheduler_gui.scheduler_item
import
SchedulerItem
from
b_asic.scheduler_gui.scheduler_item
import
SchedulerItem
sys
.
path
.
insert
(
0
,
"
icons/
"
)
# Needed for *.rc.py files in ui_main_window
from
b_asic.scheduler_gui.ui_main_window
import
Ui_MainWindow
from
b_asic.scheduler_gui.ui_main_window
import
Ui_MainWindow
if
TYPE_CHECKING
:
if
TYPE_CHECKING
:
...
...
This diff is collapsed.
Click to expand it.
b_asic/scheduler_gui/scheduler_event.py
+
1
−
1
View file @
ea8159f7
...
@@ -213,7 +213,7 @@ class SchedulerEvent: # PyQt5
...
@@ -213,7 +213,7 @@ class SchedulerEvent: # PyQt5
if
redraw
:
if
redraw
:
item
.
setX
(
pos_x
)
item
.
setX
(
pos_x
)
self
.
_redraw_lines
(
item
)
self
.
_redraw_lines
(
item
)
self
.
_signals
.
component_moved
.
emit
(
item
.
graph_id
)
self
.
_signals
.
component_moved
.
emit
(
item
.
graph_id
)
###################################
###################################
# Event Handlers: GraphicsLineTem #
# Event Handlers: GraphicsLineTem #
...
...
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