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
02c41cd0
Commit
02c41cd0
authored
5 years ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Added schedulilng and plotting of inputs and outputs in schedule
parent
8d31ed8c
No related branches found
No related tags found
2 merge requests
!71
Better schedule, including plotting
,
!69
Some basic functionality for plotting a schedule
Pipeline
#16677
failed
5 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
b_asic/schema.py
+21
-11
21 additions, 11 deletions
b_asic/schema.py
b_asic/special_operations.py
+17
-3
17 additions, 3 deletions
b_asic/special_operations.py
with
38 additions
and
14 deletions
b_asic/schema.py
+
21
−
11
View file @
02c41cd0
...
@@ -126,11 +126,19 @@ class Schema:
...
@@ -126,11 +126,19 @@ class Schema:
print
(
"
Empty signal flow graph cannot be scheduled.
"
)
print
(
"
Empty signal flow graph cannot be scheduled.
"
)
return
return
non_schedulable_ops
=
set
((
outp
.
operation
.
graph_id
for
outp
in
pl
[
0
]))
non_schedulable_ops
=
set
()
for
outport
in
pl
[
0
]:
op
=
outport
.
operation
if
op
.
type_name
()
not
in
[
Delay
.
type_name
()]:
if
op
.
graph_id
not
in
self
.
_start_times
:
# Set start time of all operations in the first iter to 0
self
.
_start_times
[
op
.
graph_id
]
=
0
else
:
non_schedulable_ops
.
add
(
op
.
graph_id
)
for
outport
in
pl
[
1
]:
for
outport
in
pl
[
1
]:
op
=
outport
.
operation
op
=
outport
.
operation
if
op
not
in
self
.
_start_times
:
if
op
.
graph_id
not
in
self
.
_start_times
:
# Set start time of all operations in the first iter to 0
# Set start time of all operations in the first iter to 0
self
.
_start_times
[
op
.
graph_id
]
=
0
self
.
_start_times
[
op
.
graph_id
]
=
0
...
@@ -164,6 +172,9 @@ class Schema:
...
@@ -164,6 +172,9 @@ class Schema:
op_start_time
,
op_start_time_from_in
)
op_start_time
,
op_start_time_from_in
)
self
.
_start_times
[
op
.
graph_id
]
=
op_start_time
self
.
_start_times
[
op
.
graph_id
]
=
op_start_time
for
output
in
self
.
_sfg
.
find_by_type_name
(
Output
.
type_name
()):
source_port
=
output
.
inputs
[
0
].
signals
[
0
].
source
self
.
_start_times
[
output
.
graph_id
]
=
self
.
_start_times
[
source_port
.
operation
.
graph_id
]
+
source_port
.
latency_offset
self
.
_remove_delays
()
self
.
_remove_delays
()
def
plot_schedule
(
self
)
->
None
:
def
plot_schedule
(
self
)
->
None
:
...
@@ -235,15 +246,14 @@ class Schema:
...
@@ -235,15 +246,14 @@ class Schema:
for
output_port
in
op
.
outputs
:
for
output_port
in
op
.
outputs
:
for
output_signal
in
output_port
.
signals
:
for
output_signal
in
output_port
.
signals
:
dest_op
=
output_signal
.
destination
.
operation
dest_op
=
output_signal
.
destination
.
operation
if
dest_op
.
type_name
()
and
dest_op
.
type_name
()
!=
Output
.
type_name
():
dest_start_time
=
self
.
_start_times
[
dest_op
.
graph_id
]
dest_start_time
=
self
.
_start_times
[
dest_op
.
graph_id
]
dest_ypos
=
ypositions
[
dest_op
.
graph_id
]
dest_ypos
=
ypositions
[
dest_op
.
graph_id
]
dest_in_coords
,
_
=
output_signal
.
destination
.
operation
.
get_io_coordinates
()
dest_in_coords
,
_
=
output_signal
.
destination
.
operation
.
get_io_coordinates
()
_draw_offset_arrow
(
out_coords
[
output_port
.
index
],
_draw_offset_arrow
(
out_coords
[
output_port
.
index
],
dest_in_coords
[
output_signal
.
destination
.
index
],
dest_in_coords
[
output_signal
.
destination
.
index
],
[
op_start_time
,
source_ypos
],
[
op_start_time
,
source_ypos
],
[
dest_start_time
,
dest_ypos
],
name
=
op_id
,
[
dest_start_time
,
dest_ypos
],
name
=
op_id
,
laps
=
self
.
_laps
[
output_signal
.
graph_id
])
laps
=
self
.
_laps
[
output_signal
.
graph_id
])
plt
.
yticks
(
ytickpositions
,
yticklabels
)
plt
.
yticks
(
ytickpositions
,
yticklabels
)
plt
.
axis
([
-
1
,
self
.
_schedule_time
+
1
,
0
,
ypos
])
plt
.
axis
([
-
1
,
self
.
_schedule_time
+
1
,
0
,
ypos
])
...
...
This diff is collapsed.
Click to expand it.
b_asic/special_operations.py
+
17
−
3
View file @
02c41cd0
...
@@ -5,7 +5,7 @@ normal operations in an SFG.
...
@@ -5,7 +5,7 @@ normal operations in an SFG.
"""
"""
from
numbers
import
Number
from
numbers
import
Number
from
typing
import
Optional
,
Sequence
from
typing
import
Optional
,
Sequence
,
Tuple
,
List
from
b_asic.operation
import
AbstractOperation
,
ResultKey
,
DelayMap
,
MutableResultMap
,
MutableDelayMap
from
b_asic.operation
import
AbstractOperation
,
ResultKey
,
DelayMap
,
MutableResultMap
,
MutableDelayMap
from
b_asic.graph_component
import
Name
,
TypeName
from
b_asic.graph_component
import
Name
,
TypeName
...
@@ -21,7 +21,7 @@ class Input(AbstractOperation):
...
@@ -21,7 +21,7 @@ class Input(AbstractOperation):
def
__init__
(
self
,
name
:
Name
=
""
):
def
__init__
(
self
,
name
:
Name
=
""
):
"""
Construct an Input operation.
"""
"""
Construct an Input operation.
"""
super
().
__init__
(
input_count
=
0
,
output_count
=
1
,
name
=
name
)
super
().
__init__
(
input_count
=
0
,
output_count
=
1
,
name
=
name
,
latency_offsets
=
{
'
out0
'
:
0
}
)
self
.
set_param
(
"
value
"
,
0
)
self
.
set_param
(
"
value
"
,
0
)
@classmethod
@classmethod
...
@@ -41,6 +41,13 @@ class Input(AbstractOperation):
...
@@ -41,6 +41,13 @@ class Input(AbstractOperation):
"""
Set the current value of this input.
"""
"""
Set the current value of this input.
"""
self
.
set_param
(
"
value
"
,
value
)
self
.
set_param
(
"
value
"
,
value
)
def
get_plot_coordinates
(
self
)
->
Tuple
[
List
[
List
[
Number
]],
List
[
List
[
Number
]]]:
return
([[
-
0.5
,
0
],
[
-
0.5
,
1
],
[
-
0.25
,
1
],
[
0
,
0.5
],
[
-
0.25
,
0
],
[
-
0.5
,
0
]],
[[
-
0.5
,
0
],
[
-
0.5
,
1
],
[
-
0.25
,
1
],
[
0
,
0.5
],
[
-
0.25
,
0
],
[
-
0.5
,
0
]])
def
get_io_coordinates
(
self
)
->
Tuple
[
List
[
List
[
Number
]],
List
[
List
[
Number
]]]:
return
([],
[[
0
,
0.5
]])
class
Output
(
AbstractOperation
):
class
Output
(
AbstractOperation
):
"""
Output operation.
"""
Output operation.
...
@@ -53,7 +60,7 @@ class Output(AbstractOperation):
...
@@ -53,7 +60,7 @@ class Output(AbstractOperation):
def
__init__
(
self
,
src0
:
Optional
[
SignalSourceProvider
]
=
None
,
name
:
Name
=
""
):
def
__init__
(
self
,
src0
:
Optional
[
SignalSourceProvider
]
=
None
,
name
:
Name
=
""
):
"""
Construct an Output operation.
"""
"""
Construct an Output operation.
"""
super
().
__init__
(
input_count
=
1
,
output_count
=
0
,
super
().
__init__
(
input_count
=
1
,
output_count
=
0
,
name
=
name
,
input_sources
=
[
src0
])
name
=
name
,
input_sources
=
[
src0
]
,
latency_offsets
=
{
'
in0
'
:
0
}
)
@classmethod
@classmethod
def
type_name
(
cls
)
->
TypeName
:
def
type_name
(
cls
)
->
TypeName
:
...
@@ -62,6 +69,13 @@ class Output(AbstractOperation):
...
@@ -62,6 +69,13 @@ class Output(AbstractOperation):
def
evaluate
(
self
,
_
):
def
evaluate
(
self
,
_
):
return
None
return
None
def
get_plot_coordinates
(
self
)
->
Tuple
[
List
[
List
[
Number
]],
List
[
List
[
Number
]]]:
return
([[
0
,
0
],
[
0
,
1
],
[
0.25
,
1
],
[
0.5
,
0.5
],
[
0.25
,
0
],
[
0
,
0
]],
[[
0
,
0
],
[
0
,
1
],
[
0.25
,
1
],
[
0.5
,
0.5
],
[
0.25
,
0
],
[
0
,
0
]])
def
get_io_coordinates
(
self
)
->
Tuple
[
List
[
List
[
Number
]],
List
[
List
[
Number
]]]:
return
([[
0
,
0.5
]],
[])
class
Delay
(
AbstractOperation
):
class
Delay
(
AbstractOperation
):
"""
Unit delay operation.
"""
Unit delay operation.
...
...
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