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
5ca593d6
Commit
5ca593d6
authored
4 years ago
by
Kevin
Browse files
Options
Downloads
Patches
Plain Diff
Added some tests and function definition
parent
08eaa299
Branches
82-explode-sfg
No related tags found
No related merge requests found
Pipeline
#15401
failed
4 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
b_asic/signal_flow_graph.py
+6
-0
6 additions, 0 deletions
b_asic/signal_flow_graph.py
test/test_sfg.py
+16
-0
16 additions, 0 deletions
test/test_sfg.py
with
22 additions
and
0 deletions
b_asic/signal_flow_graph.py
+
6
−
0
View file @
5ca593d6
...
...
@@ -543,6 +543,12 @@ class SFG(AbstractOperation):
# Recreate the newly coupled SFG so that all attributes are correct.
return
sfg_copy
()
def
explode
(
self
)
->
Tuple
[
Sequence
[
Signal
,
Sequence
[
Signal
]],
Sequence
[
Tuple
[
Signal
,
Sequence
[
Signal
]]]:
"""
Destroy the sfg by making it unusable in the future and
return all of the intermidetry operations, the input operations and the output operations.
"""
return
def
_evaluate_source
(
self
,
src
:
OutputPort
,
results
:
MutableOutputMap
,
registers
:
MutableRegisterMap
,
prefix
:
str
)
->
Number
:
src_prefix
=
prefix
if
src_prefix
:
...
...
This diff is collapsed.
Click to expand it.
test/test_sfg.py
+
16
−
0
View file @
5ca593d6
...
...
@@ -319,6 +319,22 @@ class TestInsertComponent:
assert
_sfg
.
find_by_name
(
"
bfly2
"
)[
0
].
input
(
0
).
signals
[
0
].
source
.
operation
is
_sfg
.
find_by_name
(
"
n_bfly
"
)[
0
]
assert
_sfg
.
find_by_name
(
"
bfly2
"
)[
0
].
input
(
1
).
signals
[
0
].
source
.
operation
is
_sfg
.
find_by_name
(
"
n_bfly
"
)[
0
]
class
TestExplode
:
def
test_correct_lengths
(
self
,
large_operation_tree
):
sfg
=
SFG
(
outputs
=
[
Output
(
large_operation_tree
)])
operations
,
inputs
,
outputs
=
sfg
.
explode
()
assert
len
(
operations
)
==
3
assert
len
(
inputs
)
==
4
assert
len
(
outputs
)
==
1
def
test_sfg_unusable
(
self
,
large_operation_tree
):
sfg
=
SFG
(
outputs
=
[
Output
(
large_operation_tree
)])
sfg
.
explode
()
assert
sfg
is
None
def
test_functions_of_sfg_used
(
self
):
with
pytest
.
raises
(
AssertionError
):
pass
class
TestFindComponentsWithTypeName
:
def
test_mac_components
(
self
):
...
...
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