当前位置: 首页>>代码示例>>Python>>正文


Python Control.getWreg方法代码示例

本文整理汇总了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
开发者ID:xycoco,项目名称:pipelineCPU,代码行数:70,代码来源:pipelinecpu.py


注:本文中的control.Control.getWreg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。