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
5e5056c6
Commit
5e5056c6
authored
4 years ago
by
Kevin
Browse files
Options
Downloads
Patches
Plain Diff
Added MAD operation to core_operations.py and function definition for replacing operations
parent
7d53d11f
No related branches found
No related tags found
2 merge requests
!44
Resolve "Operation Replacement in a SFG"
,
!42
Resolve "Operation to SFG Conversion"
Pipeline
#14015
failed
4 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
b_asic/core_operations.py
+15
-0
15 additions, 0 deletions
b_asic/core_operations.py
b_asic/signal_flow_graph.py
+10
-0
10 additions, 0 deletions
b_asic/signal_flow_graph.py
with
25 additions
and
0 deletions
b_asic/core_operations.py
+
15
−
0
View file @
5e5056c6
...
@@ -229,3 +229,18 @@ class Butterfly(AbstractOperation):
...
@@ -229,3 +229,18 @@ class Butterfly(AbstractOperation):
def
evaluate
(
self
,
a
,
b
):
def
evaluate
(
self
,
a
,
b
):
return
a
+
b
,
a
-
b
return
a
+
b
,
a
-
b
class
MAD
(
AbstractOperation
):
"""
Multiply-and-add operation.
TODO: More info.
"""
def
__init__
(
self
,
src0
:
Optional
[
SignalSourceProvider
]
=
None
,
src1
:
Optional
[
SignalSourceProvider
]
=
None
,
name
:
Name
=
""
):
super
().
__init__
(
input_count
=
3
,
output_count
=
1
,
name
=
name
,
input_sources
=
[
src0
,
src1
])
@property
def
type_name
(
self
)
->
TypeName
:
return
"
mad
"
def
evaluate
(
self
,
a
,
b
,
c
):
return
a
*
b
+
c
This diff is collapsed.
Click to expand it.
b_asic/signal_flow_graph.py
+
10
−
0
View file @
5e5056c6
...
@@ -405,6 +405,16 @@ class SFG(AbstractOperation):
...
@@ -405,6 +405,16 @@ class SFG(AbstractOperation):
# The old SFG will be deleted by Python GC
# The old SFG will be deleted by Python GC
return
self
()
return
self
()
def
replace_operations
(
self
,
inputs
:
Sequence
[
Input
],
outputs
:
Sequence
[
Output
],
operation
:
Operation
):
"""
Replace one or more operations in the sfg with a operation that have same number of inputs and outputs.
Then return a new deepcopy of the sfg.
Arguments:
inputs: The inputs for the operations we are replacing.
outputs: The outputs for the operations we are replacing.
operation: The replacing operation.
"""
def
_evaluate_source
(
self
,
src
:
OutputPort
,
results
:
MutableResultMap
,
registers
:
MutableRegisterMap
,
prefix
:
str
)
->
Number
:
def
_evaluate_source
(
self
,
src
:
OutputPort
,
results
:
MutableResultMap
,
registers
:
MutableRegisterMap
,
prefix
:
str
)
->
Number
:
src_prefix
=
prefix
src_prefix
=
prefix
if
src_prefix
:
if
src_prefix
:
...
...
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