2 from soc
.decoder
.power_enums
import (XER_bits
, Function
)
4 from soc
.fu
.trap
.test
.test_pipe_caller
import get_cu_inputs
5 from soc
.fu
.trap
.test
.test_pipe_caller
import TrapTestCase
# creates the tests
7 from soc
.fu
.test
.common
import ALUHelpers
8 from soc
.fu
.compunits
.compunits
import TrapFunctionUnit
9 from soc
.fu
.compunits
.test
.test_compunit
import TestRunner
12 class TrapTestRunner(TestRunner
):
13 def __init__(self
, test_data
):
14 super().__init
__(test_data
, TrapFunctionUnit
, self
,
17 def get_cu_inputs(self
, dec2
, sim
):
18 """naming (res) must conform to TrapFunctionUnit input regspec
20 res
= yield from get_cu_inputs(dec2
, sim
)
23 def check_cu_outputs(self
, res
, dec2
, sim
, code
):
24 """naming (res) must conform to TrapFunctionUnit output regspec
29 yield from ALUHelpers
.get_sim_int_o(sim_o
, sim
, dec2
)
30 yield from ALUHelpers
.get_wr_fast_spr1(sim_o
, sim
, dec2
)
31 yield from ALUHelpers
.get_wr_fast_spr2(sim_o
, sim
, dec2
)
32 ALUHelpers
.get_sim_nia(sim_o
, sim
, dec2
)
33 ALUHelpers
.get_sim_msr(sim_o
, sim
, dec2
)
35 print ("sim output", sim_o
)
37 ALUHelpers
.check_int_o(self
, res
, sim_o
, code
)
38 ALUHelpers
.check_fast_spr1(self
, res
, sim_o
, code
)
39 ALUHelpers
.check_fast_spr2(self
, res
, sim_o
, code
)
40 ALUHelpers
.check_nia(self
, res
, sim_o
, code
)
41 ALUHelpers
.check_msr(self
, res
, sim_o
, code
)
44 if __name__
== "__main__":
45 unittest
.main(exit
=False)
46 suite
= unittest
.TestSuite()
47 suite
.addTest(TrapTestRunner(TrapTestCase
.test_data
))
49 runner
= unittest
.TextTestRunner()