Commits

Sam Mussmann committed f38a589

Rename 'cur_state' to 'state'.

Comments (0)

Files changed (1)

     like RAW dependences and structural hazards/dependences.
     """
     _new_state = None
-    cur_state = 'unissued'
+    state = 'unissued'
     states = set(('unissued', 'IS', 'reservation-station', 'queued-for-EX',
           'EX', 'queued-for-WB', 'WB', 'waiting-for-commit', 'CM'))
     dependence_count = 0
       if self. _new_state:
         if self._new_state in set(('IS', 'EX', 'WB', 'CM')):
           self.history.append((self._new_state, new_cycle))
-        if self.cur_state == 'EX':
+        if self.state == 'EX':
           self.history.append(('EX-end', new_cycle - 1))
-        self.cur_state = self._new_state
+        self.state = self._new_state
         self._new_state = None
         
     def issue(self):
       self._set_state('CM')
 
     def ready_to_commit(self):
-      return self.cur_state in ('WB', 'waiting-for-commit')
+      return self.state in ('WB', 'waiting-for-commit')
 
     def __repr__(self):
       return str(self)
 
     def __str__(self):
       return ('{0.index}: {0.opcode} {0.write_register} {0.read_registers} state: '
-          '{0.cur_state} pending state: {0._new_state} d_c: '
+          '{0.state} pending state: {0._new_state} d_c: '
           '{0.dependence_count}'.format(self))
 
     def final_dict(self):
                          i, instr in enumerate(instructions)]
 
   def issue_next(self, reorder_buffer):
-    unissued = filter(lambda i: i.cur_state == "unissued", self.instructions)
+    unissued = filter(lambda i: i.state == "unissued", self.instructions)
     if unissued and not reorder_buffer.is_full():
       reorder_buffer.add(unissued[0])
       unissued[0].issue()
   def update(self, new_cycle):
     for instruction in self.instructions:
       instruction.update(new_cycle)
-    if self.instructions[-1].cur_state == 'CM':
+    if self.instructions[-1].state == 'CM':
       return True
     if new_cycle > 1000:
       print "failed to stop"
       self.storage.pop(0)
 
   def IS_instruction_iterator(self, instruction_tracker):
-    return itertools.ifilter(lambda i: i.cur_state == "IS", self.storage)
+    return itertools.ifilter(lambda i: i.state == "IS", self.storage)
 
 class _FunctionalUnits:
   class FunctionalUnit: