From ca8b98b228d255fbae087bdcf3e9848193032462 Mon Sep 17 00:00:00 2001 From: angloth <angus.lothian@hotmail.com> Date: Thu, 27 Feb 2020 17:20:38 +0100 Subject: [PATCH] Add use of operation name when creating graph id for operation to sfg --- b_asic/signal_flow_graph.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/b_asic/signal_flow_graph.py b/b_asic/signal_flow_graph.py index 0f7bffa9..c87c4129 100644 --- a/b_asic/signal_flow_graph.py +++ b/b_asic/signal_flow_graph.py @@ -21,9 +21,7 @@ class SFG(BasicOperation): _graph_id_generator: GraphIDGenerator def __init__(self, input_destinations: List[SignalDestination], output_sources: List[SignalSource]): - """ - Construct a SFG. - """ + """Constructs an SFG.""" super().__init__() # TODO: Allocate input/output ports with appropriate IDs. @@ -37,19 +35,23 @@ class SFG(BasicOperation): return [] # TODO: Implement def add_operation(self, operation: Operation) -> GraphID: - """ - Adds the entered operation to the SFG's dictionary of graph objects and + """Adds the entered operation to the SFG's dictionary of graph objects and returns a generated GraphID for it. + + Keyword arguments: + operation: Operation to add to the graph. """ - return self._add_graph_obj(operation, 'op') + return self._add_graph_obj(operation, operation.get_op_name()) def add_signal(self, signal: Signal) -> GraphID: - """ - Adds the entered signal to the SFG's dictionary of graph objects and returns + """Adds the entered signal to the SFG's dictionary of graph objects and returns a generated GraphID for it. + + Keyword argumentst: + signal: Signal to add to the graph. """ - return self._add_graph_obj(signal, 's') + return self._add_graph_obj(signal, 'sig') def _add_graph_obj(self, obj: Union[Operation, Signal], operation_id_type: str): -- GitLab