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
Merge requests
!434
Add support for removing empty resources from architecture
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add support for removing empty resources from architecture
removeresource
into
master
Overview
0
Commits
1
Pipelines
2
Changes
2
Merged
Oscar Gustafsson
requested to merge
removeresource
into
master
1 year ago
Overview
0
Commits
1
Pipelines
2
Changes
2
Expand
The removal part of
#267
.
0
0
Merge request reports
Compare
master
version 1
9758f784
1 year ago
master (base)
and
latest version
latest version
2c217489
1 commit,
1 year ago
version 1
9758f784
1 commit,
1 year ago
2 files
+
67
−
10
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
b_asic/architecture.py
+
59
−
3
Options
@@ -764,19 +764,75 @@ of :class:`~b_asic.architecture.ProcessingElement`
d_out
[
i
][
v
]
+=
1
return
[
dict
(
d
)
for
d
in
d_in
],
[
dict
(
d
)
for
d
in
d_out
]
def
resource_from_name
(
self
,
name
:
str
):
def
resource_from_name
(
self
,
name
:
str
)
->
Resource
:
"""
Get :class:`Resource` based on name.
Parameters
----------
name : str
Name of the resource.
Returns
-------
:class:`Resource`
"""
re
=
{
p
.
entity_name
:
p
for
p
in
chain
(
self
.
memories
,
self
.
processing_elements
)}
return
re
[
name
]
def
remove_resource
(
self
,
resource
:
Union
[
str
,
Resource
],
)
->
None
:
"""
Remove an empty :class:`Resource` from the architecture.
Parameters
----------
resource : :class:`b_asic.architecture.Resource` or str
The resource or the resource name to remove.
"""
if
isinstance
(
resource
,
str
):
resource
=
self
.
resource_from_name
(
resource
)
if
resource
.
collection
:
raise
ValueError
(
"
Resource must be empty
"
)
if
resource
in
self
.
memories
:
self
.
memories
.
remove
(
resource
)
elif
resource
in
self
.
processing_elements
:
self
.
processing_elements
.
remove
(
resource
)
else
:
raise
ValueError
(
'
Resource not in architecture
'
)
def
assign_resources
(
self
,
heuristic
:
str
=
"
left_edge
"
)
->
None
:
"""
Convenience method to assign all resources in the architecture.
Parameters
----------
heuristic : str, default:
"
left_edge
"
The heurstic to use.
See Also
--------
Memory.assign
ProcessingElement.assign
"""
for
resource
in
chain
(
self
.
memories
,
self
.
processing_elements
):
resource
.
assign
(
heuristic
=
heuristic
)
def
move_process
(
self
,
proc
:
Union
[
str
,
Process
],
re_from
:
Union
[
str
,
Resource
],
re_to
:
Union
[
str
,
Resource
],
assign
:
bool
=
False
,
):
)
->
None
:
"""
Move a :class:`b_asic.process.Process` from one
r
esource to another.
Move a :class:`b_asic.process.Process` from one
:class:`R
esource
`
to another.
Both the resource moved from and will become unassigned after a process has been
moved, unless *assign* is set to True.
Loading