1. Sam Mussmann
  2. tomasulo


Sam Mussmann  committed 3a9ff45

Document main loop data structures.

  • Participants
  • Parent commits 02b9bbc
  • Branches master

Comments (0)

Files changed (1)

File tomasulo.py

View file
   cycle = 0
   instruction_tracker = _InstructionTracker(input_instructions)
   reorder_buffer = _ReorderBuffer()
+  functional_units = _FunctionalUnits()
+  # The register file is a mapping from register to either None or the index of
+  # the instruction that is currently in the process of producing the new value
+  # for that register.  It's set in the IS stage and removed in the WB stage.
   register_file = collections.defaultdict(lambda: None)
+  # The reservation station is a mapping from the index of an instruction
+  # currently in progress to a list of indices of instructions that are waiting
+  # for this value.  Instructions add themselves to this list in the IS stage if
+  # they are waiting for the key instruction to finish.  In the WB stage, we
+  # remove entries and pass them along to the functional units if they're ready
+  # to go.
   reservation_station = collections.defaultdict(list)
+  # The cdb is a list of instructions queued up to enter writeback.  At the WB
+  # stage, the instruction with the lowest index is put on the cdb, and the
+  # others wait until a later cycle.
   cdb = list()
-  functional_units = _FunctionalUnits()
   while not instruction_tracker.update(cycle):
     # Set up next instruction to issue next time
         if instr.dependence_count == 0:
       del reservation_station[instruction.index] 
     # Deal with CM stage