📄 dispatchunit.cpp
字号:
cout << "source register : fp" << (int) srcReg << endl;#endif tag_t tag = registersBinding->GetFloatingPointRenameBuffer(srcReg); /* Get the floating point rename buffer */ rs[i].loadStore->operand0.tag = tag; /* and store its tag into the reservation station */ rs[i].loadStore->operand0.valid = false; /* make the reservation to wait for the rename buffer value */ if(tag < 0) { /* The source register is not renamed */#ifdef DEBUG if(Debug(DebugDispatchUnit)) { cout << name() << ": Reading fp" << (int) srcReg << " value from register file" << endl; if(readFloatingPointRegisterPort >= nReadFloatingPointRegisterPorts) { cout << name() << ": not enough read floating point register ports" << endl; ABORT(); } }#endif loadStoreReadingFloatingPointRegister[i] = srcReg; /* Remember that we are reading the source floating point register */ loadStoreReadingFloatingPointRenameBuffer[i] = -1; /* No floating point rename buffer is being read */ loadStoreReadingRegisters[i][0] = -1; /* No general purpose register is being read */ loadStoreReadingRenameBuffers[i][0] = -1; /* No rename buffer is being read */ outReadFloatingPointRegisterNumber[readFloatingPointRegisterPort++] = srcReg; /* Ask to the register file the value of the floating point source register hold by the floating point rename buffer */ } else { /* The source register is renamed */ if(registersBinding->FloatingPointRenameBufferValid(tag)) { /* The floating point rename buffer yet contains the right value */#ifdef DEBUG if(Debug(DebugDispatchUnit)) { cout << name() << ": Reading fp" << (int) srcReg << " value from rfp" << (int) tag << endl; if(readFloatingPointRenamePort >= nReadFloatingPointRenamePorts) { cout << name() << ": not enough read floating point rename buffer ports" << endl; ABORT(); } }#endif loadStoreReadingFloatingPointRegister[i] = -1; /* No floating point register is being read */ loadStoreReadingFloatingPointRenameBuffer[i] = tag; /* Remember that we are reading the floating point rename buffer */ loadStoreReadingRegisters[i][0] = -1; /* No general purpose register is being read */ loadStoreReadingRenameBuffers[i][0] = -1; /* No rename buffer is being read */ outReadFloatingPointRenameNumber[readFloatingPointRenamePort++] = tag; /* Ask to the register file the value of the floating point rename buffer that holds the source operand value */ } else {#ifdef DEBUG if(Debug(DebugDispatchUnit)) cout << name() << ": Waiting for fp" << (int) srcReg << " value hold by rfp" << (int) tag << endl;#endif loadStoreReadingFloatingPointRegister[i] = -1; loadStoreReadingFloatingPointRenameBuffer[i] = -1; loadStoreReadingRegisters[i][0] = -1; loadStoreReadingRenameBuffers[i][0] = -1; /* Nothing to read from register file, just wait */ } } } else { /* No source register */ loadStoreReadingFloatingPointRegister[i] = -1; loadStoreReadingFloatingPointRenameBuffer[i] = -1; loadStoreReadingRegisters[i][0] = -1; loadStoreReadingRenameBuffers[i][0] = -1; rs[i].loadStore->operand0.tag = -1; } } else { loadStoreReadingFloatingPointRegister[i] = -1; loadStoreReadingFloatingPointRenameBuffer[i] = -1; srcReg = decodedInstructions[i].io.loadStore.srcReg[0]; if(srcReg >= 0) { /* First operand is a general purpose register */#ifdef DEBUG if(Debug(DebugDispatchUnit)) cout << "source register : r" << (int) srcReg << endl;#endif tag_t tag = registersBinding->GetRenameBuffer(srcReg); /* Get the rename buffer */ rs[i].loadStore->operand0.tag = tag; /* and store its tag into the reservation station */ rs[i].loadStore->operand0.valid = false; /* make the reservation to wait for the rename buffer */ if(tag < 0) { /* The source register is not renamed */#ifdef DEBUG if(Debug(DebugDispatchUnit)) { cout << name() << ": Reading r" << (int) srcReg << " value from register file" << endl; if(readRegisterPort >= nReadRegisterPorts) { cout << name() << ": not enough read register ports" << endl; ABORT(); } }#endif loadStoreReadingRegisters[i][0] = srcReg; /* Remember that we are reading the source register */ loadStoreReadingRenameBuffers[i][0] = -1; /* No rename buffer is being read */ outReadRegisterNumber[readRegisterPort++] = srcReg; /* Ask to the register file the source register value */ } else { /* The source register is renamed */ if(registersBinding->RenameBufferValid(tag)) { /* The rename buffer yet contains the right value */#ifdef DEBUG if(Debug(DebugDispatchUnit)) { cout << name() << ": Reading r" << (int) srcReg << " value from rr" << (int) tag << endl; if(readRenamePort >= nReadRenamePorts) { cout << name() << ": not enough read rename buffer ports" << endl; ABORT(); } }#endif loadStoreReadingRegisters[i][0] = -1; /* No register is being read */ loadStoreReadingRenameBuffers[i][0] = tag; /* Remember that we are reading a rename buffer */ outReadRenameNumber[readRenamePort++] = tag; /* Ask to the register file the value of the rename buffer */ } else {#ifdef DEBUG if(Debug(DebugDispatchUnit)) cout << name() << ": Waiting for r" << (int) srcReg << " value hold by rr" << (int) tag << endl;#endif loadStoreReadingRegisters[i][0] = -1; /* No register is being read */ loadStoreReadingRenameBuffers[i][0] = -1; /* No rename buffer is being read */ /* Just wait for the value to be produced by functional units */ } } } else { /* No source register */ loadStoreReadingRegisters[i][0] = -1; loadStoreReadingRenameBuffers[i][0] = -1; rs[i].loadStore->operand0.tag = -1; } } // operand 1 srcReg = decodedInstructions[i].io.loadStore.srcReg[1]; if(srcReg >= 0) { /* Instruction has a source register */#ifdef DEBUG if(Debug(DebugDispatchUnit)) cout << "source register : r" << (int) srcReg << endl;#endif tag_t tag = registersBinding->GetRenameBuffer(srcReg); /* Get the rename buffer, */ rs[i].loadStore->operand1.tag = tag; /* and store its tag into the reservation station */ rs[i].loadStore->operand1.valid = false; /* make the reservation station to wait for the rename buffer */ if(tag < 0) { /* The source register is not renamed */#ifdef DEBUG if(Debug(DebugDispatchUnit)) { cout << name() << ": Reading r" << (int) srcReg << " value from register file" << endl; if(readRegisterPort >= nReadRegisterPorts) { cout << name() << ": not enough read register ports" << endl; ABORT(); } }#endif loadStoreReadingRegisters[i][1] = srcReg; /* Remember that we are reading a register */ loadStoreReadingRenameBuffers[i][1] = -1; /* No rename buffer is being read */ outReadRegisterNumber[readRegisterPort++] = srcReg; /* Ask to the register the value of the register */ } else { /* The source register is renamed */ if(registersBinding->RenameBufferValid(tag)) { /* The rename yet contains the right value */#ifdef DEBUG if(Debug(DebugDispatchUnit)) { cout << name() << ": Reading r" << (int) srcReg << " value from rr" << (int) tag << endl; if(readRenamePort >= nReadRenamePorts) { cout << name() << ": not enough read rename buffer ports" << endl; ABORT(); } }#endif loadStoreReadingRegisters[i][1] = -1; /* No register is being read */ loadStoreReadingRenameBuffers[i][1] = tag; /* Remember that we are reading the rename buffer */ outReadRenameNumber[readRenamePort++] = tag; /* Ask to the register the value of the rename buffer */ } else {#ifdef DEBUG if(Debug(DebugDispatchUnit)) cout << name() << ": Waiting for r" << (int) srcReg << " value hold by rr" << (int) tag << endl;#endif loadStoreReadingRegisters[i][1] = -1; loadStoreReadingRenameBuffers[i][1] = -1; /* Just wait for the value to be produced by functional units */ } } } else { /* No source register */ loadStoreReadingRegisters[i][1] = -1; loadStoreReadingRenameBuffers[i][1] = -1; rs[i].loadStore->operand1.tag = -1; } // operand 2 srcReg = decodedInstructions[i].io.loadStore.srcReg[2]; if(srcReg >= 0) { /* Instruction has a source register */#ifdef DEBUG if(Debug(DebugDispatchUnit)) cout << "source register : r" << (int) srcReg << endl;#endif tag_t tag = registersBinding->GetRenameBuffer(srcReg); /* Get the rename buffer, */ rs[i].loadStore->operand2.tag = tag; /* and store its tag into the reservation station */ rs[i].loadStore->operand2.valid = false; /* make the reservation station to wait for the rename buffer */ if(tag < 0) { /* The source register is not renamed */#ifdef DEBUG if(Debug(DebugDispatchUnit)) { cout << name() << ": Reading r" << (int) srcReg << " value from register file" << endl; if(readRegisterPort >= nReadRegisterPorts) { cout << name() << ": not enough read register ports" << endl; ABORT(); } }#endif loadStoreReadingRegisters[i][2] = srcReg; /* Remember that we are reading the source register */ loadStoreReadingRenameBuffers[i][2] = -1; /* No rename buffer is being read */ outReadRegisterNumber[readRegisterPort++] = srcReg; /* Ask to the register file the value of the source register */ } else { /* The source register is renamed */ if(registersBinding->RenameBufferValid(tag)) { /* The rename buffer yet contains the right value */#ifdef DEBUG if(Debug(DebugDispatchUnit)) { cout << name() << ": Reading r" << (int) srcReg << " value from rr" << (int) tag << endl; if(readRenamePort >= nReadRenamePorts) { cout << name() << ": not enough read rename buffer ports" << endl; ABORT(); } }#endif loadStoreReadingRegisters[i][2] = -1; /* No register is being read */ loadStoreReadingRenameBuffers[i][2] = tag; /* Remember that we are reading a rename buffer */ outReadRenameNumber[readRenamePort++] = tag; /* Ask to the register file the value of the rename buffer */ } else {#ifdef DEBUG if(Debug(DebugDispatchUnit)) cout << name() << ": Waiting for r" << (int) srcReg << " value hold by rr" << (int) tag << endl;#endif loadStoreReadingRegisters[i][2] = -1; loadStoreReadingRenameBuffers[i][2] = -1; /* Just wait for the value to be produced by the functional units */ } } } else { /* No source operand */ loadStoreReadingRegisters[i][2] = -1; loadStoreReadingRenameBuffers[i][2] = -1; rs[i].loadStore->operand2.tag = -1; } /* Store the load/store operation into the reservation station */ rs[i].loadStore->operation = decodedInstructions[i].operation.loadStore;#if defined(DEBUG) || defined(TRACE) { const InstructionQueueEntry& instructionQueueEntry = *queue[i]; rs[i].loadStore->dbgInstructionCounter = instructionQueueEntry.dbgInstructionCounter; rs[i].loadStore->dbgProgramCounter = instructionQueueEntry.pc; rs[i].loadStore->dbgInstruction = instructionQueueEntry.instruction; }#endif if(decodedInstructions[i].hasImmed) { // store the immediate value into the reservation station rs[i].loadStore->operand2.data = decodedInstructions[i].immed;#ifdef DEBUG if(Debug(DebugDispatchUnit)) { cout << "immediate : "; WriteHex(cout, decodedInstructions[i].immed); cout << endl; }#endif } // destination 0 if(decodedInstructions[i].operation.loadStore.floatingPoint) { regnum_t dstReg = decodedInstructions[i].io.loadStore.dstReg[0]; if(dstReg >= 0) { /* Instruction has a destination floating point register */#ifdef DEBUG if(Debug(DebugDispatchUnit)) cout << "destination register (0)" << ": fp" << (int) dstReg << endl;#endif /* Allocate a floating point rename buffer, and store its tag into the reservation station */ rs[i].loadStore->tags.resultTags[0] = registersBinding->AllocateFloatingPointRenameBuffer(dstReg); } else { /* Instruction has no destination floating point register */ rs[i].loadStore->tags.resultTags[0] = -1; } } else { regnum_t dstReg = decodedInstructions[i].io.loadStore.dstReg[0]; if(dstReg >= 0) { /* Instruction has a destination register */#ifdef DEBUG if(Debug(DebugDispatchUnit)) cout << "destination register (0)" << ": r" << (int) dstReg << endl;#endif /* Allocate a rename buffer, and store its tag into the reservation station */ rs[i].loadStore->tags.resultTags[0] = registersBinding->AllocateRenameBuffer(dstReg); } else { /* Instruction has no destination register */ rs[i].loadStore->tags.resultTags[0] = -1; } } // destination 1 regnum_t dstReg = decodedInstructions[i].io.loadStore.dstReg[1]; if(dstReg >= 0) { /* Instruction has a destination register */#ifdef DEBUG if(Debug(DebugDispatchUnit)) cout << "destination register (1)" << ": r" << (int) dstReg << endl;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -