split out bmask into test_bmask.py
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 22 Jun 2022 14:31:44 +0000 (15:31 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 22 Jun 2022 14:31:50 +0000 (15:31 +0100)
openpower/sv/bmask.py
openpower/sv/test_bmask.py [new file with mode: 0644]

index 2d91aee55b322f96476f7c54c823c20aa0c6df13..d190f06f456f6c85b32dcde27d6aa80073379494 100644 (file)
@@ -27,24 +27,3 @@ SBF = 0b01010
 SOF = 0b01001
 SIF = 0b10000 # 10011 also works no idea why yet
 
-if __name__ == '__main__':
-   for SBF in range(32):
-     print("mode", bin(SBF))
-     m  = 0b11000011
-     v3 = 0b10010100 # vmsbf.m v2, v3
-     v2 = 0b01000011 # v2
-     RT = bmask(SBF, v3, m, zero=True)
-     print(bin(v3), bin(v2), bin(RT))
-     v3 = 0b10010100 # vmsbf.m v2, v3
-     v2 = 0b00000011 # v2 contents
-     RT = bmask(SBF, v3)
-     print(bin(v3), bin(v2), bin(RT))
-     v3 = 0b10010101 # vmsbf.m v2, v3
-     v2 = 0b00000000 # v2
-     RT = bmask(SBF, v3)
-     print(bin(v3), bin(v2), bin(RT))
-     v3 = 0b00000000 # vmsbf.m v2, v3
-     v2 = 0b11111111 # v2
-     RT = bmask(SBF, v3)
-     print(bin(v3), bin(v2), bin(RT))
-     print()
diff --git a/openpower/sv/test_bmask.py b/openpower/sv/test_bmask.py
new file mode 100644 (file)
index 0000000..ae3faec
--- /dev/null
@@ -0,0 +1,23 @@
+from bmask import bmask
+
+if __name__ == '__main__':
+   for SBF in range(32):
+     print("mode", bin(SBF))
+     m  = 0b11000011
+     v3 = 0b10010100 # vmsbf.m v2, v3
+     v2 = 0b01000011 # v2
+     RT = bmask(SBF, v3, m, zero=True)
+     print(bin(v3), bin(v2), bin(RT))
+     v3 = 0b10010100 # vmsbf.m v2, v3
+     v2 = 0b00000011 # v2 contents
+     RT = bmask(SBF, v3)
+     print(bin(v3), bin(v2), bin(RT))
+     v3 = 0b10010101 # vmsbf.m v2, v3
+     v2 = 0b00000000 # v2
+     RT = bmask(SBF, v3)
+     print(bin(v3), bin(v2), bin(RT))
+     v3 = 0b00000000 # vmsbf.m v2, v3
+     v2 = 0b11111111 # v2
+     RT = bmask(SBF, v3)
+     print(bin(v3), bin(v2), bin(RT))
+     print()