Skip to content
Snippets Groups Projects

Resolve "Operation Replacement in a SFG"

Closed Kevin Scott requested to merge 17-operation-replacement-in-a-sfg into develop
5 unresolved threads
1 file
+ 20
1
Compare changes
  • Side-by-side
  • Inline
+ 20
1
import pytest
from b_asic import SFG, Signal, Input, Output, Constant, Addition, Multiplication
from b_asic import SFG, Signal, Input, Output, Constant, Addition, Multiplication, MAD
class TestInit:
@@ -254,3 +254,22 @@ class TestReplaceComponents:
assert True
else:
assert False
class TestReplaceOperations:
def test_replace_mul_add_with_MAD(self):
in1 = Input()
in2 = Input()
in3 = Input()
mul1 = in1 * in2
add1 = mul1 + in3
out1 = Output(add1)
sfg = SFG(inputs=[in1, in2, in3], outputs=[out1])
assert len(sfg.operations) == 6
mad1 = MAD()
sfg.replace_operations([in1, in2, in3], [out1], mad1)
assert len(sfg.operations) == 5
assert {add1, mul1} not in sfg.operations
\ No newline at end of file
Loading