Add test for edge cases that were previously buggy
authorMichael Nolan <mtnolan2640@gmail.com>
Wed, 20 May 2020 15:15:10 +0000 (11:15 -0400)
committerMichael Nolan <mtnolan2640@gmail.com>
Wed, 20 May 2020 15:15:10 +0000 (11:15 -0400)
src/soc/fu/logical/test/test_pipe_caller.py

index 6223a3dd1886a86bb851f2b71628bd1607858722..05e1a816967ac3f019c8a407ce348bb72688a1c8 100644 (file)
@@ -153,6 +153,14 @@ class LogicalTestCase(FHDLTestCase):
             initial_regs[1] = random.randint(0, (1<<64)-1)
             self.run_tst_program(Program(lst), initial_regs)
 
+    def test_popcnt_edge(self):
+        insns = ["popcntb", "popcntw", "popcntd"]
+        for choice in insns:
+            lst = [f"{choice} 3, 1"]
+            initial_regs = [0] * 32
+            initial_regs[1] = -1
+            self.run_tst_program(Program(lst), initial_regs)
+
     def test_cmpb(self):
         lst = ["cmpb 3, 1, 2"]
         initial_regs = [0] * 32