Add test for cntlz to test_caller
authorMichael Nolan <mtnolan2640@gmail.com>
Fri, 15 May 2020 15:27:42 +0000 (11:27 -0400)
committerMichael Nolan <mtnolan2640@gmail.com>
Fri, 15 May 2020 16:34:09 +0000 (12:34 -0400)
src/soc/decoder/isa/test_caller.py

index 2c1353614b9299c02c949ac86e6a43dcc6ba0665..f15634722f8f94a46e3d7ce473f34a695a89f2ce 100644 (file)
@@ -254,6 +254,16 @@ class DecoderTestCase(FHDLTestCase):
             self.assertEqual(sim.gpr(4),
                              SelectableInt(0x2b, 64))
 
+    def test_cntlz(self):
+        lst = ["cntlzd 2, 1",
+               "cntlzw 4, 3"]
+        initial_regs = [0] * 32
+        initial_regs[1] = 0x0000beeecaffc0de
+        initial_regs[3] = 0x0000000000ffc0de
+        with Program(lst) as program:
+            sim = self.run_tst_program(program, initial_regs)
+            self.assertEqual(sim.gpr(2), SelectableInt(16, 64))
+            self.assertEqual(sim.gpr(4), SelectableInt(8, 64))
         
 
     def test_mtcrf(self):