Skip to content
Snippets Groups Projects
Commit 47b8658e authored by angloth's avatar angloth
Browse files

Remove identifier from basic operation and operation ID from simulation, needs...

Remove identifier from basic operation and operation ID from simulation, needs some rework on simulation
parent f8334097
No related branches found
No related tags found
1 merge request!2Integrated ID system, traversing and som signal tests
......@@ -5,7 +5,7 @@ TODO: More info.
from b_asic.port import InputPort, OutputPort
from b_asic.signal import SignalSource, SignalDestination
from b_asic.operation import OperationId, Operation
from b_asic.operation import Operation
from b_asic.simulation import SimulationState, OperationState
from abc import ABC, abstractmethod
from typing import List, Dict, Optional, Any
......@@ -18,7 +18,6 @@ class BasicOperation(Operation):
TODO: More info.
"""
_identifier: OperationId
_input_ports: List[InputPort]
_output_ports: List[OutputPort]
_parameters: Dict[str, Optional[Any]]
......@@ -27,7 +26,6 @@ class BasicOperation(Operation):
"""
Construct a BasicOperation.
"""
self._identifier = identifier
self._input_ports = []
self._output_ports = []
self._parameters = {}
......@@ -39,9 +37,6 @@ class BasicOperation(Operation):
"""
pass
def id(self) -> OperationId:
return self._identifier
def inputs(self) -> List[InputPort]:
return self._input_ports.copy()
......
......@@ -39,12 +39,22 @@ class SFG(BasicOperation):
def add_operation(self, operation: Operation) -> GraphID:
"""
Adds the entered operation to the SFG's dictionary of graph objects and
generates and returns a GraphID for it.
returns a generated GraphID for it.
"""
graph_id = self._graph_id_generator.get_next_id("op")
self._graph_objects[graph_id] = operation
return graph_id
return self._add_graph_obj(operation, 'op')
def _generate_id(self)
def add_signal(self, signal: Signal) -> GraphID:
"""
Adds the entered signal to the SFG's dictionary of graph objects and returns
a generated GraphID for it.
"""
return self._add_graph_obj(signal, 's')
def _add_graph_obj(self, obj: Union[Operation, Signal], operation_id_type: str):
graph_id = self._graph_id_generator.get_next_id(operation_id_type)
self._graph_objects[graph_id] = obj
return graph_id
......@@ -3,6 +3,7 @@ B-ASIC Simulation Module.
TODO: More info.
"""
from signal_flow_graph import OperationId
from numbers import Number
from typing import List, Dict
......
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