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
b496973b
Commit
b496973b
authored
1 year ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Rename copy_component to copy
parent
bcf36af7
No related branches found
Branches containing commit
No related tags found
1 merge request
!261
Replaceop
Pipeline
#93192
passed
1 year ago
Stage: test
Stage: deploy
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
b_asic/graph_component.py
+2
-2
2 additions, 2 deletions
b_asic/graph_component.py
b_asic/operation.py
+3
-5
3 additions, 5 deletions
b_asic/operation.py
b_asic/signal_flow_graph.py
+4
-4
4 additions, 4 deletions
b_asic/signal_flow_graph.py
test/test_operation.py
+2
-2
2 additions, 2 deletions
test/test_operation.py
with
11 additions
and
13 deletions
b_asic/graph_component.py
+
2
−
2
View file @
b496973b
...
...
@@ -83,7 +83,7 @@ class GraphComponent(ABC):
raise
NotImplementedError
@abstractmethod
def
copy
_component
(
self
,
*
args
,
**
kwargs
)
->
"
GraphComponent
"
:
def
copy
(
self
,
*
args
,
**
kwargs
)
->
"
GraphComponent
"
:
"""
Get a new instance of this graph component type with the same name, id and
parameters.
...
...
@@ -160,7 +160,7 @@ class AbstractGraphComponent(GraphComponent):
def
set_param
(
self
,
name
:
str
,
value
:
Any
)
->
None
:
self
.
_parameters
[
name
]
=
value
def
copy
_component
(
self
,
*
args
,
**
kwargs
)
->
GraphComponent
:
def
copy
(
self
,
*
args
,
**
kwargs
)
->
GraphComponent
:
new_component
=
self
.
__class__
(
*
args
,
**
kwargs
)
new_component
.
name
=
copy
(
self
.
name
)
new_component
.
graph_id
=
copy
(
self
.
graph_id
)
...
...
This diff is collapsed.
Click to expand it.
b_asic/operation.py
+
3
−
5
View file @
b496973b
...
...
@@ -853,7 +853,7 @@ class AbstractOperation(Operation, AbstractGraphComponent):
last_operations
=
[
last_operations
]
outputs
=
[
Output
(
o
)
for
o
in
last_operations
]
except
TypeError
:
operation_copy
:
Operation
=
cast
(
Operation
,
self
.
copy
_component
())
operation_copy
:
Operation
=
cast
(
Operation
,
self
.
copy
())
inputs
=
[]
for
i
in
range
(
self
.
input_count
):
input_
=
Input
()
...
...
@@ -864,10 +864,8 @@ class AbstractOperation(Operation, AbstractGraphComponent):
return
SFG
(
inputs
=
inputs
,
outputs
=
outputs
)
def
copy_component
(
self
,
*
args
,
**
kwargs
)
->
GraphComponent
:
new_component
:
Operation
=
cast
(
Operation
,
super
().
copy_component
(
*
args
,
**
kwargs
)
)
def
copy
(
self
,
*
args
,
**
kwargs
)
->
GraphComponent
:
new_component
:
Operation
=
cast
(
Operation
,
super
().
copy
(
*
args
,
**
kwargs
))
for
i
,
_input
in
enumerate
(
self
.
inputs
):
new_component
.
input
(
i
).
latency_offset
=
_input
.
latency_offset
for
i
,
output
in
enumerate
(
self
.
outputs
):
...
...
This diff is collapsed.
Click to expand it.
b_asic/signal_flow_graph.py
+
4
−
4
View file @
b496973b
...
...
@@ -505,8 +505,8 @@ class SFG(AbstractOperation):
return
input_indexes_required
def
copy
_component
(
self
,
*
args
,
**
kwargs
)
->
GraphComponent
:
return
super
().
copy
_component
(
def
copy
(
self
,
*
args
,
**
kwargs
)
->
GraphComponent
:
return
super
().
copy
(
*
args
,
**
kwargs
,
inputs
=
self
.
_input_operations
,
...
...
@@ -1030,7 +1030,7 @@ class SFG(AbstractOperation):
)
->
GraphComponent
:
if
original_component
in
self
.
_original_components_to_new
:
raise
ValueError
(
"
Tried to add duplicate SFG component
"
)
new_component
=
original_component
.
copy
_component
()
new_component
=
original_component
.
copy
()
self
.
_original_components_to_new
[
original_component
]
=
new_component
if
not
new_component
.
graph_id
or
new_component
.
graph_id
in
self
.
_used_ids
:
new_id
=
self
.
_graph_id_generator
.
next_id
(
...
...
@@ -1397,7 +1397,7 @@ class SFG(AbstractOperation):
# Make `factor` copies of the sfg
new_ops
=
[
[
cast
(
Operation
,
op
.
copy
_component
())
for
op
in
self
.
operations
]
[
cast
(
Operation
,
op
.
copy
())
for
op
in
self
.
operations
]
for
_
in
range
(
factor
)
]
...
...
This diff is collapsed.
Click to expand it.
test/test_operation.py
+
2
−
2
View file @
b496973b
...
...
@@ -229,7 +229,7 @@ class TestCopyOperation:
def
test_copy_butterfly_latency_offsets
(
self
):
bfly
=
Butterfly
(
latency_offsets
=
{
"
in0
"
:
4
,
"
in1
"
:
2
,
"
out0
"
:
10
,
"
out1
"
:
9
})
bfly_copy
=
bfly
.
copy
_component
()
bfly_copy
=
bfly
.
copy
()
assert
bfly_copy
.
latency_offsets
==
{
"
in0
"
:
4
,
...
...
@@ -242,7 +242,7 @@ class TestCopyOperation:
add
=
Addition
()
add
.
execution_time
=
2
add_copy
=
add
.
copy
_component
()
add_copy
=
add
.
copy
()
assert
add_copy
.
execution_time
==
2
...
...
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