示例#1
0
        // FUNCTION:- execute RegAndImmShReg operand2
        //          - update field RmRegVal which contains the Rm register actual content value
        public void execute_RegShReg()
        {
            // shift XReg by shiftNum accoding to shift type bits.
            switch (shiftTypeUInt)                                // bits:  6  5
            {
            case 0:
                shiftedRegUInt = BarrelShifter.lsl(RmRegVal, RsRegVal);                // 0  0 = LSL
                break;

            case 1:
                shiftedRegUInt = BarrelShifter.lsr(RmRegVal, RsRegVal);                // 0  1 = LSR
                break;

            case 2:
                shiftedRegUInt = BarrelShifter.asr(RmRegVal, RsRegVal);                // 1  0 = ASR
                break;

            case 3:
                /* if (_shiftNum == 0) TODO: this no supported for sim I
                 *   XReg = BarrelShifter.lsl(XReg, this.shiftNum);           // 1  1 = RRX
                 * else*/
                shiftedRegUInt = BarrelShifter.ror(RmRegVal, RsRegVal);            // 1  1 = ROR
                break;

            default:
                Debug.WriteLine("ERROR in file 'Operand2' RegAndImmShReg.execute_Imm(): type is out of range.");
                break;
            }

            //this.shiftedRegUInt = XReg;
            // write back the copy into the register specified by Rm only if write back specified
            // this.registers.updateRegisterN(this.Rm, XReg);
        }
示例#2
0
        // FUNCTION:
        //      -Using instruction field update fields: rotNum, _8BitImmediate, rotatedImmediate
        public void decode_Imm()
        {
            // update field rotNum
            this.rotNum = (instruction >> 8) & 0xf;

            // update field _8BitImmediate
            this._8BitImmediate = instruction & 0xff;

            // update field rotatedImmediate
            this.rotatedImmediate = this._8BitImmediate;
            this.rotatedImmediate = BarrelShifter.ror(this.rotatedImmediate, rotNum * 2); // rotate 8bit immediate in a 32 bit address
        }