Skip to content
Snippets Groups Projects
Commit 688796f3 authored by angloth's avatar angloth
Browse files

Move OperationID from operation to signal_flow_graph and change sfg operations...

Move OperationID from operation to signal_flow_graph and change sfg operations datastructure to a dict
parent aacf7a83
No related branches found
No related tags found
1 merge request!2Integrated ID system, traversing and som signal tests
......@@ -11,23 +11,12 @@ if TYPE_CHECKING:
from b_asic.port import InputPort, OutputPort
from b_asic.simulation import SimulationState
OperationId = NewType("OperationId", int)
class Operation(ABC):
"""
Operation interface.
TODO: More info.
"""
@abstractmethod
def identifier(self) -> OperationId:
"""
Get the unique identifier.
TODO: Move id info to SFG, remove id class members.
"""
pass
@abstractmethod
def inputs(self) -> "List[InputPort]":
"""
......
......@@ -3,11 +3,14 @@ B-ASIC Signal Flow Graph Module.
TODO: More info.
"""
from b_asic.operation import OperationId, Operation
from b_asic.operation import Operation
from b_asic.basic_operation import BasicOperation
from b_asic.signal import SignalSource, SignalDestination
from b_asic.simulation import SimulationState, OperationState
from typing import List
from typing import List, Dict
# Types
OperationId = NewType("OperationId", int)
class SFG(BasicOperation):
......@@ -16,7 +19,7 @@ class SFG(BasicOperation):
TODO: More info.
"""
_operations: List[Operation]
_operations: Dict[OperationID, Operation]
def __init__(self, identifier: OperationId, input_destinations: List[SignalDestination], output_sources: List[SignalSource]):
"""
......@@ -24,7 +27,9 @@ class SFG(BasicOperation):
"""
super().__init__(identifier)
# TODO: Allocate input/output ports with appropriate IDs.
self._operations = []
self._operations = dict # Map Operation ID to Operation objects
# TODO: Traverse the graph between the inputs/outputs and add to self._operations.
# TODO: Connect ports with signals with appropriate IDs.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment