From c8b2c5d2c984cc444880187679c2a9589bae0526 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Thu, 4 May 2023 19:19:29 -0700 Subject: [PATCH] add initial fmv/fcvt tests, though they're broken due to FPSCR being unimplemented --- openpower/isatables/fields.text | 2 +- .../decoder/isa/test_caller_fmv_fcvt.py | 34 +++ src/openpower/test/fmv_fcvt/__init__.py | 0 src/openpower/test/fmv_fcvt/fmv_fcvt.py | 193 ++++++++++++++++++ 4 files changed, 228 insertions(+), 1 deletion(-) create mode 100644 src/openpower/decoder/isa/test_caller_fmv_fcvt.py create mode 100644 src/openpower/test/fmv_fcvt/__init__.py create mode 100644 src/openpower/test/fmv_fcvt/fmv_fcvt.py diff --git a/openpower/isatables/fields.text b/openpower/isatables/fields.text index 89ad7530..6560b147 100644 --- a/openpower/isatables/fields.text +++ b/openpower/isatables/fields.text @@ -557,7 +557,7 @@ FRB (16:20) Field used to specify an FPR to be used as a source. - Formats: A, MM, X, XFL, Z23, DCT + Formats: A, MM, X, XFL, XO, Z23, DCT FRBp (16:20) Field used to specify an even/odd pair of FPRs to be concatenated and used as a source. diff --git a/src/openpower/decoder/isa/test_caller_fmv_fcvt.py b/src/openpower/decoder/isa/test_caller_fmv_fcvt.py new file mode 100644 index 00000000..cf5730b7 --- /dev/null +++ b/src/openpower/decoder/isa/test_caller_fmv_fcvt.py @@ -0,0 +1,34 @@ +""" fmv/fcvt tests +""" + +import unittest + +from openpower.test.fmv_fcvt.fmv_fcvt import (FMvFCvtCases, + SVP64FMvFCvtCases) +from openpower.test.runner import TestRunnerBase + +# writing the test_caller invocation this way makes it work with pytest + + +class TestFMvFCvtCases(TestRunnerBase): + def __init__(self, test): + assert test == 'test' + super().__init__(FMvFCvtCases().test_data, fp=True) + + def test(self): + # dummy function to make unittest try to test this class + pass + + +class TestSVP64FMvFCvtCases(TestRunnerBase): + def __init__(self, test): + assert test == 'test' + super().__init__(SVP64FMvFCvtCases().test_data, fp=True) + + def test(self): + # dummy function to make unittest try to test this class + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/src/openpower/test/fmv_fcvt/__init__.py b/src/openpower/test/fmv_fcvt/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/openpower/test/fmv_fcvt/fmv_fcvt.py b/src/openpower/test/fmv_fcvt/fmv_fcvt.py new file mode 100644 index 00000000..674bd96e --- /dev/null +++ b/src/openpower/test/fmv_fcvt/fmv_fcvt.py @@ -0,0 +1,193 @@ +from openpower.test.common import TestAccumulatorBase, skip_case +from openpower.sv.trans.svp64 import SVP64Asm +from openpower.test.state import ExpectedState +from openpower.simulator.program import Program +from openpower.decoder.isa.caller import SVP64State +import struct +import math + + +class FMvFCvtCases(TestAccumulatorBase): + def js_toint32(self, inp, expected, test_title=""): + inp = float(inp) + inp_bits = struct.unpack("