/// <summary> /// Add an entry to the reorder buffer /// </summary> /// <param name="instr">the instruction you need to add an entry for</param> public void addEntry(Instruction instr) { if (Config.numReorderBufferEntries - this.buffer.Count > 0) { RobEntry newEntry = new RobEntry(); newEntry.busy = true; newEntry.finished = false; newEntry.instruction = instr; newEntry.valid = this.isNewEntryValid(); newEntry.renameReg = CPU.rrf.findFirstEmptySlot(); this.buffer.Enqueue(newEntry); } }
public void runCycle() { if (CPU.rob.buffer.Count != 0) { while (CPU.rob.buffer.Count > 0 && CPU.rob.buffer.Peek().finished == true) { RobEntry robEntry = CPU.rob.buffer.Dequeue(); foreach (ArfEntry arfEntry in CPU.arf.regFile) { if (arfEntry.tag == robEntry.renameReg) { arfEntry.busy = false; } } //TODO: Make sure that the reservation stations are updated CPU.rrf.rrfTable[robEntry.renameReg].busy = false; Statistics.instructionsCompleted++; if (robEntry.instruction.isLastInstruction) { CPU.lastInstructionCompleted = true; } } } }