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
d983ffea
Commit
d983ffea
authored
1 month ago
by
Simon Bjurek
Browse files
Options
Downloads
Patches
Plain Diff
rendering of dont cares now working and example is completed.
parent
67698804
No related branches found
No related tags found
1 merge request
!470
Add slack time scheduling, redid earliest deadline, added max-fan-out and hybrid scheduler, also added example
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
b_asic/core_operations.py
+62
-0
62 additions, 0 deletions
b_asic/core_operations.py
b_asic/scheduler.py
+7
-1
7 additions, 1 deletion
b_asic/scheduler.py
examples/ldlt_matrix_inverse.py
+19
-18
19 additions, 18 deletions
examples/ldlt_matrix_inverse.py
with
88 additions
and
19 deletions
b_asic/core_operations.py
+
62
−
0
View file @
d983ffea
...
...
@@ -1696,6 +1696,37 @@ class DontCare(AbstractOperation):
def
__str__
(
self
)
->
str
:
return
"
dontcare
"
def
get_plot_coordinates
(
self
,
)
->
tuple
[
tuple
[
tuple
[
float
,
float
],
...],
tuple
[
tuple
[
float
,
float
],
...]]:
# Doc-string inherited
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_input_coordinates
(
self
)
->
tuple
[
tuple
[
float
,
float
],
...]:
# doc-string inherited
return
tuple
()
def
get_output_coordinates
(
self
)
->
tuple
[
tuple
[
float
,
float
],
...]:
# doc-string inherited
return
((
0
,
0.5
),)
class
Sink
(
AbstractOperation
):
r
"""
...
...
@@ -1740,3 +1771,34 @@ class Sink(AbstractOperation):
def
__str__
(
self
)
->
str
:
return
"
sink
"
def
get_plot_coordinates
(
self
,
)
->
tuple
[
tuple
[
tuple
[
float
,
float
],
...],
tuple
[
tuple
[
float
,
float
],
...]]:
# Doc-string inherited
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_input_coordinates
(
self
)
->
tuple
[
tuple
[
float
,
float
],
...]:
# doc-string inherited
return
tuple
()
def
get_output_coordinates
(
self
)
->
tuple
[
tuple
[
float
,
float
],
...]:
# doc-string inherited
return
((
0
,
0.5
),)
This diff is collapsed.
Click to expand it.
b_asic/scheduler.py
+
7
−
1
View file @
d983ffea
from
abc
import
ABC
,
abstractmethod
from
typing
import
TYPE_CHECKING
,
Optional
,
cast
from
b_asic.core_operations
import
DontCare
from
b_asic.port
import
OutputPort
from
b_asic.special_operations
import
Delay
,
Input
,
Output
from
b_asic.types
import
TypeName
...
...
@@ -123,11 +124,16 @@ class ListScheduler(Scheduler, ABC):
self
.
_handle_outputs
(
schedule
)
schedule
.
remove_delays
()
# move all inputs
and outputs
ALAP now that operations have moved
# move all inputs ALAP now that operations have moved
for
input_op
in
schedule
.
sfg
.
find_by_type_name
(
Input
.
type_name
()):
input_op
=
cast
(
Input
,
input_op
)
schedule
.
move_operation_alap
(
input_op
.
graph_id
)
# move all dont cares ALAP
for
dc_op
in
schedule
.
sfg
.
find_by_type_name
(
DontCare
.
type_name
()):
dc_op
=
cast
(
DontCare
,
dc_op
)
schedule
.
move_operation_alap
(
dc_op
.
graph_id
)
@staticmethod
def
_candidate_is_schedulable
(
start_times
:
dict
[
"
GraphID
"
],
...
...
This diff is collapsed.
Click to expand it.
examples/ldlt_matrix_inverse.py
+
19
−
18
View file @
d983ffea
...
...
@@ -6,7 +6,7 @@ LDLT Matrix Inversion Algorithm
"""
from
b_asic.architecture
import
Architecture
,
Memory
,
ProcessingElement
from
b_asic.core_operations
import
MADS
,
C
on
stant
,
Reciprocal
from
b_asic.core_operations
import
MADS
,
D
on
tCare
,
Reciprocal
from
b_asic.core_schedulers
import
(
ALAPScheduler
,
ASAPScheduler
,
...
...
@@ -17,8 +17,9 @@ from b_asic.core_schedulers import (
)
from
b_asic.schedule
import
Schedule
from
b_asic.sfg_generators
import
ldlt_matrix_inverse
from
b_asic.special_operations
import
Input
,
Output
sfg
=
ldlt_matrix_inverse
(
N
=
3
,
is_complex
=
False
)
sfg
=
ldlt_matrix_inverse
(
N
=
3
)
# %%
# The SFG is
...
...
@@ -26,10 +27,10 @@ sfg
# %%
# Set latencies and execution times.
sfg
.
set_latency_of_type
(
C
on
stant
.
type_name
(),
0
)
sfg
.
set_latency_of_type
(
D
on
tCare
.
type_name
(),
0
)
# REMOVE!!!
sfg
.
set_latency_of_type
(
MADS
.
type_name
(),
3
)
sfg
.
set_latency_of_type
(
Reciprocal
.
type_name
(),
2
)
sfg
.
set_execution_time_of_type
(
C
on
stant
.
type_name
(),
0
)
sfg
.
set_execution_time_of_type
(
D
on
tCare
.
type_name
(),
0
)
# REMOVE!!!
sfg
.
set_execution_time_of_type
(
MADS
.
type_name
(),
1
)
sfg
.
set_execution_time_of_type
(
Reciprocal
.
type_name
(),
1
)
...
...
@@ -37,56 +38,56 @@ sfg.set_execution_time_of_type(Reciprocal.type_name(), 1)
# Create an ASAP schedule.
schedule
=
Schedule
(
sfg
,
scheduler
=
ASAPScheduler
())
print
(
"
Scheduling time:
"
,
schedule
.
schedule_time
)
#
schedule.show()
schedule
.
show
()
# %%
# Create an ALAP schedule.
schedule
=
Schedule
(
sfg
,
scheduler
=
ALAPScheduler
())
print
(
"
Scheduling time:
"
,
schedule
.
schedule_time
)
#
schedule.show()
schedule
.
show
()
# %%
# Create an EarliestDeadline schedule that satisfies the resource constraints.
resources
=
{
MADS
.
type_name
():
1
,
Reciprocal
.
type_name
():
1
}
schedule
=
Schedule
(
sfg
,
scheduler
=
EarliestDeadlineScheduler
(
resources
))
print
(
"
Scheduling time:
"
,
schedule
.
schedule_time
)
#
schedule.show()
schedule
.
show
()
# %%
# Create a LeastSlackTime schedule that satisfies the resource constraints.
schedule
=
Schedule
(
sfg
,
scheduler
=
LeastSlackTimeScheduler
(
resources
))
print
(
"
Scheduling time:
"
,
schedule
.
schedule_time
)
#
schedule.show()
schedule
.
show
()
# %%
# Create a MaxFanOutScheduler schedule that satisfies the resource constraints.
schedule
=
Schedule
(
sfg
,
scheduler
=
MaxFanOutScheduler
(
resources
))
print
(
"
Scheduling time:
"
,
schedule
.
schedule_time
)
#
schedule.show()
schedule
.
show
()
# %%
# Create a HybridScheduler schedule that satisfies the resource constraints.
schedule
=
Schedule
(
sfg
,
scheduler
=
HybridScheduler
(
resources
))
print
(
"
Scheduling time:
"
,
schedule
.
schedule_time
)
#
schedule.
edit
()
schedule
.
show
()
# %%
operations
=
schedule
.
get_operations
()
mads
=
operations
.
get_by_type_name
(
"
mads
"
)
mads
=
operations
.
get_by_type_name
(
MADS
.
type_name
()
)
mads
.
show
(
title
=
"
MADS executions
"
)
reciprocals
=
operations
.
get_by_type_name
(
"
rec
"
)
reciprocals
=
operations
.
get_by_type_name
(
Reciprocal
.
type_name
()
)
reciprocals
.
show
(
title
=
"
Reciprocal executions
"
)
c
on
s
ts
=
operations
.
get_by_type_name
(
"
c
"
)
c
on
s
ts
.
show
(
title
=
"
C
on
s
t executions
"
)
inputs
=
operations
.
get_by_type_name
(
"
in
"
)
d
ont
_care
s
=
operations
.
get_by_type_name
(
DontCare
.
type_name
()
)
d
ont
_care
s
.
show
(
title
=
"
D
ont
-care
executions
"
)
inputs
=
operations
.
get_by_type_name
(
Input
.
type_name
()
)
inputs
.
show
(
title
=
"
Input executions
"
)
outputs
=
operations
.
get_by_type_name
(
"
out
"
)
outputs
=
operations
.
get_by_type_name
(
Output
.
type_name
()
)
outputs
.
show
(
title
=
"
Output executions
"
)
mads_pe
=
ProcessingElement
(
mads
,
entity_name
=
"
mad
"
)
reciprocal_pe
=
ProcessingElement
(
reciprocals
,
entity_name
=
"
rec
"
)
c
on
s
t_pe
=
ProcessingElement
(
c
on
s
ts
,
entity_name
=
"
c
"
)
d
ont
_care
_pe
=
ProcessingElement
(
d
ont
_care
s
,
entity_name
=
"
d
c
"
)
pe_in
=
ProcessingElement
(
inputs
,
entity_name
=
'
input
'
)
pe_out
=
ProcessingElement
(
outputs
,
entity_name
=
'
output
'
)
...
...
@@ -110,7 +111,7 @@ direct.show(title="Direct interconnects")
# %%
arch
=
Architecture
(
{
mads_pe
,
reciprocal_pe
,
c
on
s
t_pe
,
pe_in
,
pe_out
},
{
mads_pe
,
reciprocal_pe
,
d
ont
_care
_pe
,
pe_in
,
pe_out
},
memories
,
direct_interconnects
=
direct
,
)
...
...
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