本文整理匯總了Python中control.Control.getWreg方法的典型用法代碼示例。如果您正苦於以下問題:Python Control.getWreg方法的具體用法?Python Control.getWreg怎麽用?Python Control.getWreg使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類control.Control
的用法示例。
在下文中一共展示了Control.getWreg方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Pipelinecpu
# 需要導入模塊: from control import Control [as 別名]
# 或者: from control.Control import getWreg [as 別名]
#.........這裏部分代碼省略.........
self.control.signalIn(self.opcode, self.exe_mem.zeroResult)
self.readReg1 = (self.if_id.instruction & 0x001F0000) >> 16 # inst[20:16]
if self.control.getSst(): # store
self.readReg2 = (self.if_id.instruction & 0x03E00000) >> 21 #inst[25:21]
else:
self.readReg2 = (self.if_id.instruction & 0x0000001F) # inst[4:0]
# Forwarding Detect
self.__forwardingUnit()
self.id_exe.regD = ((self.if_id.instruction & 0x03E00000) >> 21) # rd
# Sets ID_EXE registers based on register data
self.signalShift = self.control.getShift()
if self.signalShift:
self.id_exe.readData1 = self.readReg1 # sa for shift instructions
else:
self.id_exe.readData1 = self.register.readRegister(self.readReg1)
self.id_exe.readData2 = self.register.readRegister(self.readReg2)
# Stores the necessary control bits in ID_EXE registers
self.id_exe.signalisStore = self.control.getisSTORE()
self.id_exe.signalBtaken = self.control.getBtaken()
self.id_exe.signalQDEPEN = int(self.signalQDEPEN)
self.id_exe.signalADEPEN = self.signalADEPEN
#print 'ADEPEN', self.id_exe.signalADEPEN
self.id_exe.signalBDEPEN = self.signalBDEPEN
#print 'BDEPEN', self.id_exe.signalBDEPEN
self.id_exe.signalAluOp = self.control.getAluOp()
#print 'ALUOP', self.id_exe.signalAluOp
self.id_exe.signalWz = self.control.getWz() & (self.signalLOADDEPEN | (self.opcode == 9)) & (not self.exe_mem.signalBtaken)
self.id_exe.signalWreg = self.control.getWreg() & (self.signalLOADDEPEN | (self.opcode == 9)) & (not self.exe_mem.signalBtaken)
self.id_exe.signalWmem = self.control.getWmem() & (self.signalLOADDEPEN | (self.opcode == 9)) & (not self.exe_mem.signalBtaken)
self.id_exe.signalSld = self.control.getSld()
self.id_exe.inst = self.if_id.inst
# Sets ID_EXE registers immediateValue based on control signal sext
if self.control.getSext():
self.id_exe.immediateValue = twos_to_int(self.if_id.instruction & 0xFFFF, 16)
else:
self.id_exe.immediateValue = self.if_id.instruction & 0xFFFF
self.istransfer = (self.opcode == 10 or self.opcode == 11 or self.opcode == 12)
self.iswrite = (self.id_exe.signalWreg or self.id_exe.signalWmem)
if (not self.istransfer) & self.iswrite:
self.tempinst = self.id_exe.inst
elif self.istransfer & (self.exe_mem.inst == 'stall'):
self.tempinst = self.id_exe.inst
elif self.id_exe.inst == '':
self.tempinst = self.id_exe.inst
elif self.istransfer & (self.opcode == 12):
self.tempinst = self.id_exe.inst
else:
self.tempinst = 'stall'
## Instruction Execution Stage
def __cpuStageEXE(self):
self.exe_mem.inst = self.tempinst
self.exe_mem.signalisStore = self.id_exe.signalisStore
self.exe_mem.signalBtaken = self.id_exe.signalBtaken
self.exe_mem.signalADEPEN = self.id_exe.signalADEPEN
self.exe_mem.signalBDEPEN = self.id_exe.signalBDEPEN
self.exe_mem.signalAluOp = self.id_exe.signalAluOp
self.exe_mem.readData2 = self.id_exe.readData2
self.exe_mem.regD = self.id_exe.regD