use common TestCase class in logical
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 4 Jun 2020 20:01:11 +0000 (21:01 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 4 Jun 2020 20:01:11 +0000 (21:01 +0100)
src/soc/fu/logical/test/test_pipe_caller.py

index c74dbe45192b5ebe47dfc40d06c5eb6dd49a3e35..07ef8150530cc9369de74693004ad75907df4225 100644 (file)
@@ -11,18 +11,12 @@ from soc.decoder.selectable_int import SelectableInt
 from soc.simulator.program import Program
 from soc.decoder.isa.all import ISA
 
+from soc.fu.test.common import TestCase
 from soc.fu.logical.pipeline import LogicalBasePipe
 from soc.fu.logical.pipe_data import LogicalPipeSpec
 import random
 
 
-class TestCase:
-    def __init__(self, program, regs, sprs, name):
-        self.program = program
-        self.regs = regs
-        self.sprs = sprs
-        self.name = name
-
 def get_cu_inputs(dec2, sim):
     """naming (res) must conform to LogicalFunctionUnit input regspec
     """
@@ -89,8 +83,8 @@ class LogicalTestCase(FHDLTestCase):
         super().__init__(name)
         self.test_name = name
 
-    def run_tst_program(self, prog, initial_regs=[0] * 32, initial_sprs={}):
-        tc = TestCase(prog, initial_regs, initial_sprs, self.test_name)
+    def run_tst_program(self, prog, initial_regs=None, initial_sprs=None):
+        tc = TestCase(prog, self.test_name, initial_regs, initial_sprs)
         self.test_data.append(tc)
 
     def test_rand(self):