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
bbbd6e40
Commit
bbbd6e40
authored
1 year ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Add assign to ProcessingElement
parent
1f4478cb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!379
Add assign to ProcessingElement
Pipeline
#97174
passed
1 year ago
Stage: test
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
b_asic/architecture.py
+32
-20
32 additions, 20 deletions
b_asic/architecture.py
with
32 additions
and
20 deletions
b_asic/architecture.py
+
32
−
20
View file @
bbbd6e40
...
@@ -225,6 +225,14 @@ class Resource(HardwareBlock):
...
@@ -225,6 +225,14 @@ class Resource(HardwareBlock):
def
is_assigned
(
self
)
->
bool
:
def
is_assigned
(
self
)
->
bool
:
return
self
.
_assignment
is
not
None
return
self
.
_assignment
is
not
None
def
assign
(
self
,
heuristic
:
str
=
'
left_edge
'
):
"""
Perform assignment of processes to resource.
See the specific resource types for more information.
"""
raise
NotImplementedError
()
@property
@property
def
content
(
self
)
->
plt
.
Figure
:
def
content
(
self
)
->
plt
.
Figure
:
"""
"""
...
@@ -277,16 +285,31 @@ class ProcessingElement(Resource):
...
@@ -277,16 +285,31 @@ class ProcessingElement(Resource):
self
.
_type_name
=
op_type
.
type_name
()
self
.
_type_name
=
op_type
.
type_name
()
self
.
_input_count
=
ops
[
0
].
input_count
self
.
_input_count
=
ops
[
0
].
input_count
self
.
_output_count
=
ops
[
0
].
output_count
self
.
_output_count
=
ops
[
0
].
output_count
self
.
_assignment
=
list
(
self
.
assign
()
self
.
_collection
.
split_on_execution_time
(
heuristic
=
"
left_edge
"
)
)
if
len
(
self
.
_assignment
)
>
1
:
raise
ValueError
(
"
Cannot map ProcessCollection to single ProcessingElement
"
)
@property
@property
def
processes
(
self
)
->
List
[
OperatorProcess
]:
def
processes
(
self
)
->
List
[
OperatorProcess
]:
return
[
cast
(
OperatorProcess
,
p
)
for
p
in
self
.
_collection
]
return
[
cast
(
OperatorProcess
,
p
)
for
p
in
self
.
_collection
]
def
assign
(
self
,
heuristic
:
str
=
"
left_edge
"
)
->
None
:
"""
Perform assignment of the processes.
Parameters
----------
heuristic : str, default:
'
left_edge
'
The assignment algorithm.
*
'
left_edge
'
: Left-edge algorithm.
*
'
graph_color
'
: Graph-coloring based on exclusion graph.
"""
self
.
_assignment
=
list
(
self
.
_collection
.
split_on_execution_time
(
heuristic
=
heuristic
)
)
if
len
(
self
.
_assignment
)
>
1
:
self
.
_assignment
=
None
raise
ValueError
(
"
Cannot map ProcessCollection to single ProcessingElement
"
)
class
Memory
(
Resource
):
class
Memory
(
Resource
):
"""
"""
...
@@ -347,26 +370,13 @@ class Memory(Resource):
...
@@ -347,26 +370,13 @@ class Memory(Resource):
# Add information about the iterator type
# Add information about the iterator type
return
cast
(
Iterator
[
MemoryVariable
],
iter
(
self
.
_collection
))
return
cast
(
Iterator
[
MemoryVariable
],
iter
(
self
.
_collection
))
def
_assign_ram
(
self
,
heuristic
:
str
=
"
left_edge
"
):
"""
Perform RAM-type assignment of MemoryVariables in this Memory.
Parameters
----------
heuristic : {
'
left_edge
'
,
'
graph_color
'
}
The underlying heuristic to use when performing RAM assignment.
"""
self
.
_assignment
=
list
(
self
.
_collection
.
split_on_execution_time
(
heuristic
=
heuristic
)
)
def
assign
(
self
,
heuristic
:
str
=
"
left_edge
"
)
->
None
:
def
assign
(
self
,
heuristic
:
str
=
"
left_edge
"
)
->
None
:
"""
"""
Perform assignment of the memory variables.
Perform assignment of the memory variables.
Parameters
Parameters
----------
----------
heuristic : str
heuristic : str
, default:
'
left_edge
'
The assignment algorithm. Depending on memory type the following are
The assignment algorithm. Depending on memory type the following are
available:
available:
...
@@ -377,7 +387,9 @@ class Memory(Resource):
...
@@ -377,7 +387,9 @@ class Memory(Resource):
* ...
* ...
"""
"""
if
self
.
_memory_type
==
"
RAM
"
:
if
self
.
_memory_type
==
"
RAM
"
:
self
.
_assign_ram
(
heuristic
=
heuristic
)
self
.
_assignment
=
self
.
_collection
.
split_on_execution_time
(
heuristic
=
heuristic
)
else
:
# "register"
else
:
# "register"
raise
NotImplementedError
()
raise
NotImplementedError
()
...
...
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