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
521e5598
Commit
521e5598
authored
2 years ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Fix code and add helper method to SFG
parent
fcec0280
No related branches found
No related tags found
No related merge requests found
Pipeline
#96096
failed
2 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
b_asic/core_operations.py
+0
-4
0 additions, 4 deletions
b_asic/core_operations.py
b_asic/signal_flow_graph.py
+26
-9
26 additions, 9 deletions
b_asic/signal_flow_graph.py
with
26 additions
and
13 deletions
b_asic/core_operations.py
+
0
−
4
View file @
521e5598
...
@@ -288,10 +288,6 @@ class AddSub(AbstractOperation):
...
@@ -288,10 +288,6 @@ class AddSub(AbstractOperation):
def
is_swappable
(
self
)
->
bool
:
def
is_swappable
(
self
)
->
bool
:
return
self
.
is_add
return
self
.
is_add
def
swap_io
(
self
)
->
None
:
if
self
.
is_add
:
super
().
swap_io
()
class
Multiplication
(
AbstractOperation
):
class
Multiplication
(
AbstractOperation
):
r
"""
r
"""
...
...
This diff is collapsed.
Click to expand it.
b_asic/signal_flow_graph.py
+
26
−
9
View file @
521e5598
...
@@ -748,6 +748,21 @@ class SFG(AbstractOperation):
...
@@ -748,6 +748,21 @@ class SFG(AbstractOperation):
Signal
(
output_port
,
new_operation
)
Signal
(
output_port
,
new_operation
)
signal
.
set_source
(
new_operation
)
signal
.
set_source
(
new_operation
)
def
swap_io_of_operation
(
self
,
operation_id
:
GraphID
)
->
None
:
"""
Swap the inputs (and outputs) of operation.
Parameters
----------
graph_id : GraphID
The GraphID of the operation to swap.
"""
operation
=
cast
(
Operation
,
self
.
find_by_id
(
operation_id
))
if
operation
is
None
:
return
None
operation
.
swap_io
()
def
remove_operation
(
self
,
operation_id
:
GraphID
)
->
Union
[
"
SFG
"
,
None
]:
def
remove_operation
(
self
,
operation_id
:
GraphID
)
->
Union
[
"
SFG
"
,
None
]:
"""
"""
Returns a version of the SFG where the operation with the specified GraphID
Returns a version of the SFG where the operation with the specified GraphID
...
@@ -1399,7 +1414,8 @@ class SFG(AbstractOperation):
...
@@ -1399,7 +1414,8 @@ class SFG(AbstractOperation):
branch_node : bool, default: False
branch_node : bool, default: False
Add a branch node in case the fan-out of a signal is two or more.
Add a branch node in case the fan-out of a signal is two or more.
port_numbering : bool, default: True
port_numbering : bool, default: True
Show the port number in case the number of ports (input or output) is two or more.
Show the port number in case the number of ports (input or output) is two or
more.
splines : {
"
spline
"
,
"
line
"
,
"
ortho
"
,
"
polyline
"
,
"
curved
"
}, default:
"
spline
"
splines : {
"
spline
"
,
"
line
"
,
"
ortho
"
,
"
polyline
"
,
"
curved
"
}, default:
"
spline
"
Spline style, see https://graphviz.org/docs/attrs/splines/ for more info.
Spline style, see https://graphviz.org/docs/attrs/splines/ for more info.
...
@@ -1503,7 +1519,8 @@ class SFG(AbstractOperation):
...
@@ -1503,7 +1519,8 @@ class SFG(AbstractOperation):
branch_node : bool, default: False
branch_node : bool, default: False
Add a branch node in case the fan-out of a signal is two or more.
Add a branch node in case the fan-out of a signal is two or more.
port_numbering : bool, default: True
port_numbering : bool, default: True
Show the port number in case the number of ports (input or output) is two or more.
Show the port number in case the number of ports (input or output) is two or
more.
splines : {
"
spline
"
,
"
line
"
,
"
ortho
"
,
"
polyline
"
,
"
curved
"
}, default:
"
spline
"
splines : {
"
spline
"
,
"
line
"
,
"
ortho
"
,
"
polyline
"
,
"
curved
"
}, default:
"
spline
"
Spline style, see https://graphviz.org/docs/attrs/splines/ for more info.
Spline style, see https://graphviz.org/docs/attrs/splines/ for more info.
...
@@ -1599,8 +1616,8 @@ class SFG(AbstractOperation):
...
@@ -1599,8 +1616,8 @@ class SFG(AbstractOperation):
new_source_op
=
new_ops
[
layer
][
source_op_idx
]
new_source_op
=
new_ops
[
layer
][
source_op_idx
]
source_op_output
=
new_source_op
.
outputs
[
source_op_output_index
]
source_op_output
=
new_source_op
.
outputs
[
source_op_output_index
]
# If this is the last layer, we need to create a new delay element
and connect it instead
# If this is the last layer, we need to create a new delay element
# of the copied port
#
and connect it instead
of the copied port
if
layer
==
factor
-
1
:
if
layer
==
factor
-
1
:
delay
=
Delay
(
name
=
op
.
name
)
delay
=
Delay
(
name
=
op
.
name
)
delay
.
graph_id
=
op
.
graph_id
delay
.
graph_id
=
op
.
graph_id
...
@@ -1630,14 +1647,14 @@ class SFG(AbstractOperation):
...
@@ -1630,14 +1647,14 @@ class SFG(AbstractOperation):
new_destination
=
new_dest_op
.
inputs
[
sink_op_output_index
]
new_destination
=
new_dest_op
.
inputs
[
sink_op_output_index
]
new_destination
.
connect
(
new_source_port
)
new_destination
.
connect
(
new_source_port
)
else
:
else
:
# Other opreations need to be re-targeted to the corresponding
output in the
# Other opreations need to be re-targeted to the corresponding
# current layer, as long as that output is not a
delay, as that has been solved
#
output in the
current layer, as long as that output is not a
# above.
#
delay, as that has been solved
above.
# To avoid double connections, we'll only re-connect inputs
# To avoid double connections, we'll only re-connect inputs
for
input_num
,
original_input
in
enumerate
(
op
.
inputs
):
for
input_num
,
original_input
in
enumerate
(
op
.
inputs
):
original_source
=
original_input
.
connected_source
original_source
=
original_input
.
connected_source
# We may not always have something connected to the input, if we
don't
# We may not always have something connected to the input, if we
# we can abort
#
don't
we can abort
if
original_source
is
None
:
if
original_source
is
None
:
continue
continue
...
...
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