diff --git a/b_asic/signal_flow_graph.py b/b_asic/signal_flow_graph.py index 6483cfc1476047bcbe897b871cc179990b894c4d..00269bfc1342faa380d9153c608f84fbaf9858b8 100644 --- a/b_asic/signal_flow_graph.py +++ b/b_asic/signal_flow_graph.py @@ -543,6 +543,12 @@ class SFG(AbstractOperation): # Recreate the newly coupled SFG so that all attributes are correct. return sfg_copy() + def explode(self) -> Tuple[Sequence[Signal, Sequence[Signal]], Sequence[Tuple[Signal, Sequence[Signal]]]: + """Destroy the sfg by making it unusable in the future and + return all of the intermidetry operations, the input operations and the output operations. + """ + return + def _evaluate_source(self, src: OutputPort, results: MutableOutputMap, registers: MutableRegisterMap, prefix: str) -> Number: src_prefix = prefix if src_prefix: diff --git a/test/test_sfg.py b/test/test_sfg.py index 5f86739517b0d4c7bc9b242de24c3777222b51d2..976a59847a24d54e668b901e727590cb39af27aa 100644 --- a/test/test_sfg.py +++ b/test/test_sfg.py @@ -319,6 +319,22 @@ class TestInsertComponent: assert _sfg.find_by_name("bfly2")[0].input(0).signals[0].source.operation is _sfg.find_by_name("n_bfly")[0] assert _sfg.find_by_name("bfly2")[0].input(1).signals[0].source.operation is _sfg.find_by_name("n_bfly")[0] +class TestExplode: + def test_correct_lengths(self, large_operation_tree): + sfg = SFG(outputs=[Output(large_operation_tree)]) + operations, inputs, outputs = sfg.explode() + assert len(operations) == 3 + assert len(inputs) == 4 + assert len(outputs) == 1 + + def test_sfg_unusable(self, large_operation_tree): + sfg = SFG(outputs=[Output(large_operation_tree)]) + sfg.explode() + assert sfg is None + + def test_functions_of_sfg_used(self): + with pytest.raises(AssertionError): + pass class TestFindComponentsWithTypeName: def test_mac_components(self):