本文整理匯總了Python中control.Control.signalIn方法的典型用法代碼示例。如果您正苦於以下問題:Python Control.signalIn方法的具體用法?Python Control.signalIn怎麽用?Python Control.signalIn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類control.Control
的用法示例。
在下文中一共展示了Control.signalIn方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Pipelinecpu
# 需要導入模塊: from control import Control [as 別名]
# 或者: from control.Control import signalIn [as 別名]
#.........這裏部分代碼省略.........
else:
self.signalWIR = 0
self.signalWPC = 0
'''
elif self.opcode == 9:
self.signalWPC = not(self.exe_mem.signalWreg & (self.exe_mem.signalSld |self.exe_mem.regD == self.readReg2))
self.signalWPC = int(self.signalWPC)
self.signalWIR = self.signalWPC
'''
if self.signalWPC:
self.pc = self.nextPC
else:
self.pc = self.pc
if self.signalWIR:
self.if_id.instruction = bin_instruction
self.if_id.inst = instruction
else:
self.if_id.instruction = self.if_id.instruction
self.if_id.inst = self.if_id.inst
return self.pc
## Instruction Decode Stage
def __cpuStageID(self):
#self.id_exe = self.if_id # Pipeline shift
## instruction Decode
self.opcode = (self.if_id.instruction & 0xFC000000) >> 26 # inst[31:26]
# Sets control based on opcode and zeroResult
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)