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
8b14ad6d
Commit
8b14ad6d
authored
5 years ago
by
angloth
Browse files
Options
Downloads
Patches
Plain Diff
Remove old code and fix imports and typing to make code runnable
parent
d274e43b
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!2
Integrated ID system, traversing and som signal tests
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
b_asic/core_operations.py
+5
-5
5 additions, 5 deletions
b_asic/core_operations.py
b_asic/graph_id.py
+5
-4
5 additions, 4 deletions
b_asic/graph_id.py
b_asic/signal_flow_graph.py
+3
-2
3 additions, 2 deletions
b_asic/signal_flow_graph.py
with
13 additions
and
11 deletions
b_asic/core_operations.py
+
5
−
5
View file @
8b14ad6d
...
@@ -4,7 +4,7 @@ TODO: More info.
...
@@ -4,7 +4,7 @@ TODO: More info.
"""
"""
from
b_asic.port
import
InputPort
,
OutputPort
from
b_asic.port
import
InputPort
,
OutputPort
from
b_asic.operation
import
Operation
Id
,
Operation
from
b_asic.operation
import
Operation
from
b_asic.basic_operation
import
BasicOperation
from
b_asic.basic_operation
import
BasicOperation
from
b_asic.graph_id
import
GraphIDType
from
b_asic.graph_id
import
GraphIDType
from
numbers
import
Number
from
numbers
import
Number
...
@@ -26,7 +26,7 @@ class Constant(BasicOperation):
...
@@ -26,7 +26,7 @@ class Constant(BasicOperation):
TODO: More info.
TODO: More info.
"""
"""
def
__init__
(
self
,
identifier
:
OperationId
,
value
:
Number
):
def
__init__
(
self
,
value
:
Number
):
"""
"""
Construct a Constant.
Construct a Constant.
"""
"""
...
@@ -46,11 +46,11 @@ class Addition(BasicOperation):
...
@@ -46,11 +46,11 @@ class Addition(BasicOperation):
TODO: More info.
TODO: More info.
"""
"""
def
__init__
(
self
,
identifier
:
OperationId
):
def
__init__
(
self
):
"""
"""
Construct an Addition.
Construct an Addition.
"""
"""
super
().
__init__
(
identifier
)
super
().
__init__
(
self
)
self
.
_input_ports
=
[
InputPort
(
1
),
InputPort
(
1
)]
# TODO: Generate appropriate ID for ports.
self
.
_input_ports
=
[
InputPort
(
1
),
InputPort
(
1
)]
# TODO: Generate appropriate ID for ports.
self
.
_output_ports
=
[
OutputPort
(
1
)]
# TODO: Generate appropriate ID for ports.
self
.
_output_ports
=
[
OutputPort
(
1
)]
# TODO: Generate appropriate ID for ports.
...
@@ -67,7 +67,7 @@ class ConstantMultiplication(BasicOperation):
...
@@ -67,7 +67,7 @@ class ConstantMultiplication(BasicOperation):
TODO: More info.
TODO: More info.
"""
"""
def
__init__
(
self
,
identifier
:
OperationId
,
coefficient
:
Number
):
def
__init__
(
self
,
coefficient
:
Number
):
"""
"""
Construct a ConstantMultiplication.
Construct a ConstantMultiplication.
"""
"""
...
...
This diff is collapsed.
Click to expand it.
b_asic/graph_id.py
+
5
−
4
View file @
8b14ad6d
...
@@ -14,7 +14,7 @@ class GraphIDGenerator:
...
@@ -14,7 +14,7 @@ class GraphIDGenerator:
A class that generates Graph IDs for objects.
A class that generates Graph IDs for objects.
"""
"""
_next_id_number
:
DefaultDict
(
GraphIDType
,
GraphIDNumber
)
_next_id_number
:
DefaultDict
[
GraphIDType
,
GraphIDNumber
]
def
__init__
(
self
):
def
__init__
(
self
):
self
.
_next_id_number
=
defaultdict
(
lambda
:
1
)
# Initalises every key element to 1
self
.
_next_id_number
=
defaultdict
(
lambda
:
1
)
# Initalises every key element to 1
...
@@ -46,7 +46,7 @@ class GraphID:
...
@@ -46,7 +46,7 @@ class GraphID:
def
__str__
(
self
)
->
str
:
def
__str__
(
self
)
->
str
:
return
graph_id_type
+
str
(
graph_id_number
)
return
self
.
graph_id_type
+
str
(
self
.
graph_id_number
)
def
__repr__
(
self
)
->
str
:
def
__repr__
(
self
)
->
str
:
...
@@ -57,12 +57,13 @@ class GraphID:
...
@@ -57,12 +57,13 @@ class GraphID:
return
hash
(
str
(
self
))
return
hash
(
str
(
self
))
def
__eq__
(
self
,
other
:
GraphID
)
->
bool
:
def
__eq__
(
self
,
other
:
object
)
->
bool
:
assert
isinstance
(
other
,
GraphID
),
"
Other object not an instance of GraphID
"
return
self
.
graph_id_type
==
other
.
graph_id_type
and
\
return
self
.
graph_id_type
==
other
.
graph_id_type
and
\
self
.
graph_id_number
==
other
.
graph_id_number
self
.
graph_id_number
==
other
.
graph_id_number
def
get_next_id
(
self
)
->
GraphID
:
def
get_next_id
(
self
)
->
'
GraphID
'
:
"""
"""
Returns a new GraphID of the same type with an incremented id number.
Returns a new GraphID of the same type with an incremented id number.
"""
"""
...
...
This diff is collapsed.
Click to expand it.
b_asic/signal_flow_graph.py
+
3
−
2
View file @
8b14ad6d
...
@@ -7,8 +7,9 @@ from b_asic.operation import Operation
...
@@ -7,8 +7,9 @@ from b_asic.operation import Operation
from
b_asic.basic_operation
import
BasicOperation
from
b_asic.basic_operation
import
BasicOperation
from
b_asic.signal
import
Signal
,
SignalSource
,
SignalDestination
from
b_asic.signal
import
Signal
,
SignalSource
,
SignalDestination
from
b_asic.simulation
import
SimulationState
,
OperationState
from
b_asic.simulation
import
SimulationState
,
OperationState
from
b_asic.graph_id
import
GraphIDGenerator
,
GraphID
from
typing
import
List
,
Dict
,
Union
from
typing
import
List
,
Dict
,
Union
from
graph_id
import
GraphIDGenerator
,
GraphID
class
SFG
(
BasicOperation
):
class
SFG
(
BasicOperation
):
...
@@ -17,7 +18,7 @@ class SFG(BasicOperation):
...
@@ -17,7 +18,7 @@ class SFG(BasicOperation):
TODO: More info.
TODO: More info.
"""
"""
_graph_objects
:
Dict
(
GraphID
,
Union
(
Operation
,
Signal
))
_graph_objects
:
Dict
[
GraphID
,
Union
[
Operation
,
Signal
]]
_graph_id_generator
:
GraphIDGenerator
_graph_id_generator
:
GraphIDGenerator
def
__init__
(
self
,
input_destinations
:
List
[
SignalDestination
],
output_sources
:
List
[
SignalSource
]):
def
__init__
(
self
,
input_destinations
:
List
[
SignalDestination
],
output_sources
:
List
[
SignalSource
]):
...
...
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