add first bmask unit test
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 24 Jun 2022 14:51:30 +0000 (15:51 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 24 Jun 2022 14:51:30 +0000 (15:51 +0100)
src/openpower/test/bitmanip/av_cases.py

index 926a75274faed14fdb31674e7c9df1cebf278535..b02bd5b241fab053bf3f83d9aeeeb1c53d0494ed 100644 (file)
@@ -449,3 +449,28 @@ class AVTestCase(TestAccumulatorBase):
         e.intregs[3] = reg_t
         self.add_case(Program(lst, bigendian), initial_regs, expected=e)
 
+    def case_0_bmask(self):
+        """
+        https://git.libre-soc.org/?p=libreriscv.git;a=blob;f=openpower/sv/bmask.py
+        https://git.libre-soc.org/?p=libreriscv.git;a=blob;f=openpower/sv/test_bmask.py
+        https://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=openpower/isa/av.mdwn;hb=HEAD
+        SBF = 0b01010 # set before first
+        SOF = 0b01001 # set only first
+        SIF = 0b10000 # set including first 10011 also works no idea why yet
+        """
+        lst = ["bmask 3, 1, 2, 10, 0" ]
+        lst = list(SVP64Asm(lst, bigendian))
+        last_pc = len(lst)*4
+        reg_a = 0b10010100
+        reg_b = 0b11000011
+        reg_t = 0b01000011
+
+        initial_regs = [0] * 32
+        initial_regs[1] = reg_a
+        initial_regs[2] = reg_b
+        e = ExpectedState(pc=last_pc)
+        e.intregs[1] = reg_a
+        e.intregs[2] = reg_b
+        e.intregs[3] = reg_t
+        self.add_case(Program(lst, bigendian), initial_regs, expected=e)
+