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


Python Control.getShift方法代码示例

本文整理汇总了Python中control.Control.getShift方法的典型用法代码示例。如果您正苦于以下问题:Python Control.getShift方法的具体用法?Python Control.getShift怎么用?Python Control.getShift使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在control.Control的用法示例。


在下文中一共展示了Control.getShift方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Pipelinecpu

# 需要导入模块: from control import Control [as 别名]
# 或者: from control.Control import getShift [as 别名]

#.........这里部分代码省略.........

        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)
        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'):
开发者ID:xycoco,项目名称:pipelineCPU,代码行数:70,代码来源:pipelinecpu.py


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