add test_0_moduw and correct name to trunc_rem
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 19 Jun 2020 14:30:45 +0000 (15:30 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 19 Jun 2020 14:30:45 +0000 (15:30 +0100)
src/soc/decoder/pseudo/parser.py
src/soc/simulator/test_div_sim.py

index 6446a2df822db8e33b92e80a9863b4522ca21caa..8bdcd86816b6e7ee687f3f5ad38d663adb1eae6a 100644 (file)
@@ -619,7 +619,7 @@ class PowerParser:
                     if p[2] == '/':
                         fn = 'trunc_div'
                     else:
-                        fn = 'trunc_mod'
+                        fn = 'trunc_rem'
                     # return "function trunc_xxx(l, r)"
                     p[0] =  ast.Call(ast.Name(fn, ast.Load()), (l, r), [])
                 else:
index b84a10c61a941d5835ea298e852c4c209a2354a3..2129de3338f266dfd31d22856b47528161feaab7 100644 (file)
@@ -32,6 +32,14 @@ class DivTestCases(FHDLTestCase):
         with Program(lst) as program:
             self.run_tst_program(program, [1, 2, 3])
 
+    def test_0_moduw(self):
+        lst = ["addi 1, 0, 0x5678",
+               "addi 2, 0, 0x1234",
+               "moduw  3, 1, 2",
+               ]
+        with Program(lst) as program:
+            self.run_tst_program(program, [1, 2, 3])
+
     def run_tst_program(self, prog, initial_regs=None, initial_sprs=None,
                                     initial_mem=None):
         initial_regs = [0] * 32