Revert "inorder.py: Use insn_trace more consistently."
authorAndrey Miroshnikov <andrey@technepisteme.xyz>
Tue, 22 Aug 2023 08:54:43 +0000 (08:54 +0000)
committerAndrey Miroshnikov <andrey@technepisteme.xyz>
Tue, 22 Aug 2023 08:54:43 +0000 (08:54 +0000)
This reverts commit 755b918d6dad6fc2d1a2a75beb1fdd39223679c7.

src/openpower/cyclemodel/inorder.py

index c0a42ccda6b3a7e12c33226c396faaa5a9d8e713..da5cbbe0df1260be6482e34dd023eedeeac144ae 100644 (file)
@@ -69,10 +69,6 @@ def read_file(fname):
     this function is a generator, it yields a list comprising each line:
     ["insn", Hazard(...), Hazard(....), ....]
 
-    The ["insn", Hazard(...), Hazard(....), ....] format has been given the
-    name 'insn_trace', because 'insn' already refers to the assembler
-    instruction string.
-
     fname may be a *file* (an object) with a function named "read",
     in which case the Contract is that it is the *CALLER* that must
     take responsibility for the file: opening, closing, seeking.
@@ -86,10 +82,10 @@ def read_file(fname):
 
     for line in fname.readlines():
         (specs, insn) = map(str.strip, line.strip().split("#"))
-        insn_trace = [insn]
+        line = [insn]
         for spec in specs.split(" "):
-            insn_trace.append(Hazard._make(spec.split(":")))
-        yield insn_trace
+            line.append(Hazard._make(spec.split(":")))
+        yield line
     if not is_file:
         fname.close()
 
@@ -364,11 +360,11 @@ class TestTrace(unittest.TestCase):
             "r:GPR:3:0:64 r:GPR:2:0:64 w:GPR:1:0:64 # add  1, 3, 2",
         )
         f = io.StringIO("\n".join(lines))
-        insn_traces = list(read_file(f))
+        lines = read_file(f)
         basic_cpu.print_headings()
-        for insn_trace in insn_traces:
-            #print(insn_trace)
-            basic_cpu.process_instructions(insn_trace)
+        for trace in lines:
+            #print(trace)
+            basic_cpu.process_instructions(trace)
 
 def help():
     print ("-t             runs unit tests")