Skip to content
Snippets Groups Projects
Commit 7d53d11f authored by Kevin's avatar Kevin
Browse files

added test case for replacing multiply-and-add with MAC

parent 60a87ac1
No related branches found
No related tags found
2 merge requests!44Resolve "Operation Replacement in a SFG",!42Resolve "Operation to SFG Conversion"
Pipeline #14014 failed
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
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