add count leading zero test into logical test_pipe_caller.py
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 15 May 2020 13:19:53 +0000 (14:19 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 15 May 2020 13:19:53 +0000 (14:19 +0100)
src/soc/logical/test/test_pipe_caller.py

index 9fd92cc389a5bf5e08e91c54a0c2f03d2689eef3..76f93a547f23ce302083cf84b1f309c0c59eb20f 100644 (file)
@@ -123,6 +123,16 @@ class LogicalTestCase(FHDLTestCase):
             initial_regs[1] = random.randint(0, (1<<64)-1)
             self.run_tst_program(Program(lst), initial_regs)
 
+    def test_cntz(self):
+        insns = ["cntlzd", "cnttzd"]
+        for i in range(10):
+            choice = random.choice(insns)
+            lst = [f"{choice} 3, 1"]
+            print(lst)
+            initial_regs = [0] * 32
+            initial_regs[1] = random.randint(0, (1<<64)-1)
+            self.run_tst_program(Program(lst), initial_regs)
+
     def test_parity(self):
         insns = ["prtyw", "prtyd"]
         for i in range(10):