add popcount test
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 14 May 2020 18:18:15 +0000 (19:18 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 14 May 2020 18:18:15 +0000 (19:18 +0100)
src/soc/logical/test/test_pipe_caller.py

index 58c331fb93e0221f612eba0b92d749b4fccb98af..eaff75d9fb85db11802fe42a838887352fc67eee 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_popcnt(self):
+        insns = ["popcntb", "popcntw", "popcntd"]
+        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_cmpb(self):
         lst = ["cmpb 3, 1, 2"]
         initial_regs = [0] * 32