added defaults for expected state parameters
authorklehman <klehman9@comcast.net>
Thu, 16 Sep 2021 17:43:19 +0000 (13:43 -0400)
committerklehman <klehman9@comcast.net>
Thu, 16 Sep 2021 17:43:19 +0000 (13:43 -0400)
src/openpower/test/state.py

index a4d62fc390a1fedf263f38c120b9e967c2e3b8c9..57f77fcff41936944eddccf7f008d6dc10c82afe 100644 (file)
@@ -112,9 +112,18 @@ class SimState(State):
 
 
 class ExpectedState(State):
-    def __init__(self, intregs, pc, crregs, so, ov, ca):
-        self.intregs = intregs
+    def __init__(self, int_regs = None, pc = 0, crregs = None,
+                 so = 0, ov = 0, ca=0):
+        if int_regs is None:
+            int_regs = 32
+        if isinstance(int_regs, int):
+            int_regs = [0] * int_regs
+        self.intregs = int_regs
         self.pc = pc
+        if crregs is None:
+            crregs = 8
+        if isinstance(int_regs, int):
+            crregs = [0] * crregs
         self.crregs = crregs
         self.so = so
         self.ov = ov
@@ -146,7 +155,7 @@ def state_add(name, kls):
     state_factory[name] = kls
 
 
-def TestState(state_type, to_test, dut, code):
+def TestState(state_type, to_test, dut, code = 0):
     state_class = state_factory[state_type]
     state = state_class(to_test)
     state.to_test = to_test