back.pysim: implement *.
This commit is contained in:
parent
07e9cfa939
commit
4199674edd
|
@ -113,6 +113,8 @@ class _RHSValueCompiler(AbstractValueTransformer):
|
|||
return lambda state: normalize(lhs(state) + rhs(state), shape)
|
||||
if value.op == "-":
|
||||
return lambda state: normalize(lhs(state) - rhs(state), shape)
|
||||
if value.op == "*":
|
||||
return lambda state: normalize(lhs(state) * rhs(state), shape)
|
||||
if value.op == "&":
|
||||
return lambda state: normalize(lhs(state) & rhs(state), shape)
|
||||
if value.op == "|":
|
||||
|
|
|
@ -66,6 +66,12 @@ class SimulatorUnitTestCase(FHDLTestCase):
|
|||
self.assertStatement(stmt, [C(0, 4), C(1, 4)], C(-1, 4))
|
||||
self.assertStatement(stmt, [C(0, 4), C(10, 4)], C(-10, 5))
|
||||
|
||||
def test_mul(self):
|
||||
stmt = lambda y, a, b: y.eq(a * b)
|
||||
self.assertStatement(stmt, [C(2, 4), C(1, 4)], C(2, 8))
|
||||
self.assertStatement(stmt, [C(2, 4), C(2, 4)], C(4, 8))
|
||||
self.assertStatement(stmt, [C(7, 4), C(7, 4)], C(49, 8))
|
||||
|
||||
def test_and(self):
|
||||
stmt = lambda y, a, b: y.eq(a & b)
|
||||
self.assertStatement(stmt, [C(0b1100, 4), C(0b1010, 4)], C(0b1000, 4))
|
||||
|
|
Loading…
Reference in a new issue