back.pysim: implement modulus operator.
This commit is contained in:
parent
4601dd0a69
commit
7b9c8b440f
2 changed files with 10 additions and 0 deletions
|
|
@ -110,6 +110,13 @@ class SimulatorUnitTestCase(FHDLTestCase):
|
|||
self.assertStatement(stmt, [C(2, 4), C(2, 4)], C(1, 8))
|
||||
self.assertStatement(stmt, [C(7, 4), C(2, 4)], C(3, 8))
|
||||
|
||||
def test_mod(self):
|
||||
stmt = lambda y, a, b: y.eq(a % b)
|
||||
self.assertStatement(stmt, [C(2, 4), C(0, 4)], C(0, 8))
|
||||
self.assertStatement(stmt, [C(2, 4), C(1, 4)], C(0, 8))
|
||||
self.assertStatement(stmt, [C(2, 4), C(2, 4)], C(0, 8))
|
||||
self.assertStatement(stmt, [C(7, 4), C(2, 4)], C(1, 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…
Add table
Add a link
Reference in a new issue