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
7a0e9bb9
Commit
7a0e9bb9
authored
5 years ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Changed the graph-ID system a bit
parent
9ade7216
No related branches found
No related tags found
2 merge requests
!71
Better schedule, including plotting
,
!69
Some basic functionality for plotting a schedule
Pipeline
#16835
passed
5 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
b_asic/signal_flow_graph.py
+11
-4
11 additions, 4 deletions
b_asic/signal_flow_graph.py
with
11 additions
and
4 deletions
b_asic/signal_flow_graph.py
+
11
−
4
View file @
7a0e9bb9
...
@@ -31,10 +31,14 @@ class GraphIDGenerator:
...
@@ -31,10 +31,14 @@ class GraphIDGenerator:
"""
Construct a GraphIDGenerator.
"""
"""
Construct a GraphIDGenerator.
"""
self
.
_next_id_number
=
defaultdict
(
lambda
:
id_number_offset
)
self
.
_next_id_number
=
defaultdict
(
lambda
:
id_number_offset
)
def
next_id
(
self
,
type_name
:
TypeName
)
->
GraphID
:
def
next_id
(
self
,
type_name
:
TypeName
,
used_ids
:
MutableSet
=
set
()
)
->
GraphID
:
"""
Get the next graph id for a certain graph id type.
"""
"""
Get the next graph id for a certain graph id type.
"""
self
.
_next_id_number
[
type_name
]
+=
1
self
.
_next_id_number
[
type_name
]
+=
1
return
type_name
+
str
(
self
.
_next_id_number
[
type_name
])
new_id
=
type_name
+
str
(
self
.
_next_id_number
[
type_name
])
while
(
new_id
in
used_ids
):
self
.
_next_id_number
[
type_name
]
+=
1
new_id
=
type_name
+
str
(
self
.
_next_id_number
[
type_name
])
return
new_id
@property
@property
def
id_number_offset
(
self
)
->
GraphIDNumber
:
def
id_number_offset
(
self
)
->
GraphIDNumber
:
...
@@ -89,6 +93,7 @@ class SFG(AbstractOperation):
...
@@ -89,6 +93,7 @@ class SFG(AbstractOperation):
name
=
name
,
input_sources
=
input_sources
)
name
=
name
,
input_sources
=
input_sources
)
self
.
_components_by_id
=
dict
()
self
.
_components_by_id
=
dict
()
self
.
_used_ids
=
set
()
self
.
_components_by_name
=
defaultdict
(
list
)
self
.
_components_by_name
=
defaultdict
(
list
)
self
.
_components_dfs_order
=
[]
self
.
_components_dfs_order
=
[]
self
.
_operations_dfs_order
=
[]
self
.
_operations_dfs_order
=
[]
...
@@ -101,6 +106,7 @@ class SFG(AbstractOperation):
...
@@ -101,6 +106,7 @@ class SFG(AbstractOperation):
self
.
_original_output_signals_to_indices
=
{}
self
.
_original_output_signals_to_indices
=
{}
self
.
_precedence_list
=
None
self
.
_precedence_list
=
None
# Setup input signals.
# Setup input signals.
if
input_signals
is
not
None
:
if
input_signals
is
not
None
:
for
input_index
,
signal
in
enumerate
(
input_signals
):
for
input_index
,
signal
in
enumerate
(
input_signals
):
...
@@ -688,9 +694,10 @@ class SFG(AbstractOperation):
...
@@ -688,9 +694,10 @@ class SFG(AbstractOperation):
assert
original_component
not
in
self
.
_original_components_to_new
,
"
Tried to add duplicate SFG component
"
assert
original_component
not
in
self
.
_original_components_to_new
,
"
Tried to add duplicate SFG component
"
new_component
=
original_component
.
copy_component
()
new_component
=
original_component
.
copy_component
()
self
.
_original_components_to_new
[
original_component
]
=
new_component
self
.
_original_components_to_new
[
original_component
]
=
new_component
if
not
new_component
.
graph_id
or
new_component
.
graph_id
in
self
.
_
components_by
_id
:
if
not
new_component
.
graph_id
or
new_component
.
graph_id
in
self
.
_
used
_id
s
:
new_id
=
self
.
_graph_id_generator
.
next_id
(
new_component
.
type_name
())
new_id
=
self
.
_graph_id_generator
.
next_id
(
new_component
.
type_name
()
,
self
.
_used_ids
)
new_component
.
graph_id
=
new_id
new_component
.
graph_id
=
new_id
self
.
_used_ids
.
add
(
new_component
.
graph_id
)
self
.
_components_by_id
[
new_component
.
graph_id
]
=
new_component
self
.
_components_by_id
[
new_component
.
graph_id
]
=
new_component
self
.
_components_by_name
[
new_component
.
name
].
append
(
new_component
)
self
.
_components_by_name
[
new_component
.
name
].
append
(
new_component
)
return
new_component
return
new_component
...
...
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