phanrahan / mantle

mantle library
Other
42 stars 10 forks source link

DefineAdd and DefineSub #155

Open phanrahan opened 5 years ago

phanrahan commented 5 years ago

The loam test:

% py.test --target ice40  test_arith.py 
test_arith.py ...FFFF.                                                   [100%]

=================================== FAILURES ===================================
______________________________ test_binary[2-Add] ______________________________

op = 'Add', width = 2

    @pytest.mark.parametrize("op", [
        "Add",
        "Sub",
    ])
    @pytest.mark.parametrize("width", [2,4])
    def test_binary(op,width):
        Test = getattr(mantle, op)
>       com(f'{op}{width}', binary(Test, width))

test_arith.py:35: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../harness.py:95: in binary
    test = Test(width)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

n = 2, cin = False, cout = False, T = Bits, kwargs = {}

    def Add(n, cin=False, cout=False, T=m.Bits, **kwargs):
>       return DefineAdd(n, cin=cin, cout=cout, T=T)(**kwargs)
E       TypeError: DefineAdd() got an unexpected keyword argument 'T'

fails. Seems like Add and DefineAdd are incompatible for the ice40. Same for Sub and DefineSub.