From: Luke Kenneth Casson Leighton Date: Wed, 22 Jun 2022 14:31:44 +0000 (+0100) Subject: split out bmask into test_bmask.py X-Git-Tag: opf_rfc_ls005_v1~1599 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e9d9b90467d92a33e191e476f381782f020e92e9;p=libreriscv.git split out bmask into test_bmask.py --- diff --git a/openpower/sv/bmask.py b/openpower/sv/bmask.py index 2d91aee55..d190f06f4 100644 --- a/openpower/sv/bmask.py +++ b/openpower/sv/bmask.py @@ -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 index 000000000..ae3faecbe --- /dev/null +++ b/openpower/sv/test_bmask.py @@ -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()