Allow the formal engine to perform a same-cycle result in the ALU
[soc.git] / src / soc / simple / test / test_issuer.py
1 """simple core test, runs instructions from a TestMemory
2
3 related bugs:
4
5 * https://bugs.libre-soc.org/show_bug.cgi?id=363
6 """
7
8 # NOTE: to use cxxsim, export NMIGEN_SIM_MODE=cxxsim from the shell
9 # Also, check out the cxxsim nmigen branch, and latest yosys from git
10
11 import unittest
12 import sys
13
14 # here is the logic which takes test cases and "executes" them.
15 # in this instance (TestRunner) its job is to instantiate both
16 # a Libre-SOC nmigen-based HDL instance and an ISACaller python
17 # simulator. it's also responsible for performing the single
18 # step and comparison.
19 from soc.simple.test.test_runner import TestRunner
20
21 # test with ALU data and Logical data
22 from openpower.test.alu.alu_cases import ALUTestCase
23 from openpower.test.div.div_cases import DivTestCases
24 from openpower.test.logical.logical_cases import LogicalTestCase
25 from openpower.test.shift_rot.shift_rot_cases import ShiftRotTestCase
26 from openpower.test.shift_rot.shift_rot_cases2 import ShiftRotTestCase2
27 from openpower.test.cr.cr_cases import CRTestCase
28 from openpower.test.branch.branch_cases import BranchTestCase
29 from soc.fu.spr.test.test_pipe_caller import SPRTestCase
30 from openpower.test.ldst.ldst_cases import LDSTTestCase
31 from openpower.simulator.test_sim import (GeneralTestCases, AttnTestCase)
32 from openpower.simulator.test_helloworld_sim import HelloTestCases
33
34
35 if __name__ == "__main__":
36 svp64 = True
37 if len(sys.argv) == 2:
38 if sys.argv[1] == 'nosvp64':
39 svp64 = False
40 sys.argv.pop()
41
42 # allow list of testing to be selected by command-line
43 testing = sys.argv[1:]
44 sys.argv = sys.argv[:1]
45
46 if not testing:
47 testing = ['general', 'ldst', 'cr', 'shiftrot', 'shiftrot2',
48 'logical', 'alu',
49 'branch', 'div']
50
51 print ("SVP64 test mode enabled", svp64, testing)
52
53 unittest.main(exit=False)
54 suite = unittest.TestSuite()
55
56 # dictionary of data for tests
57 tests = {'hello': HelloTestCases.test_data,
58 'div': DivTestCases().test_data,
59 'attn': AttnTestCase.test_data,
60 'general': GeneralTestCases.test_data,
61 'ldst': LDSTTestCase().test_data,
62 'cr': CRTestCase().test_data,
63 'shiftrot': ShiftRotTestCase().test_data,
64 'shiftrot2': ShiftRotTestCase2().test_data,
65 'logical': LogicalTestCase().test_data,
66 'alu': ALUTestCase().test_data,
67 'branch': BranchTestCase().test_data,
68 'spr': SPRTestCase().test_data
69 }
70
71 # walk through all tests, those requested get added
72 for tname, data in tests.items():
73 if tname in testing:
74 suite.addTest(TestRunner(data, svp64=svp64))
75
76 runner = unittest.TextTestRunner()
77 runner.run(suite)