Exemplo n.º 1
0
        private void updateInstructionStringWithImm_sh_reg()
        {
            // get offset string
            // add base register
            string offsetStr = "[" + registers.getRegisterName(Rn) + ", ";


            // if op2 is register only
            if (imm_sh_reg.getShiftNum() == 0)
            {
                // add a minus (-) sign if immediate is negative
                if (!U)
                {
                    offsetStr += "-";
                }

                offsetStr += registers.getRegisterName(imm_sh_reg.getRm());
            }
            else // if op2 is immediate shifted register
            {
                offsetStr += imm_sh_reg.getOp2String();
            }

            offsetStr += "]";

            // update whole instruction string
            instructionString += " " + registers.getRegisterName(Rd) + ", " + offsetStr;
        }
Exemplo n.º 2
0
        // BIC (Bit Clear) performs a bitwise AND of one value with the complement of a second value. The first value
        // comes from a register. The second value can be either an immediate value or a value from a register, and can
        // be shifted before the BIC operation.
        // BIC can optionally update the condition code flags, based on the result.
        // SYNTAX: BIC{<cond>}{S} <Rd>, <Rn>, <shifter_operand>
        // USES FIELDS: Rd, Rn, RnRegVal operand2
        private void BIC()
        {
            //Console.WriteLine("DataProcessing.BIC(): is a bic inst");
            // Immediate
            if (bit25 == true)
            {
                uint Rn_BIC_Op2 = RnRegVal & (~immediate.getRotatedImmediate());
                registers.updateRegisterN(Rd, Rn_BIC_Op2);
                instructionString += " " + registers.getRegisterName(Rd) + ", " + immediate.getImmString();
            }


            // Register and Immediate Shifted Register
            if (bit25 == false && bit4 == false)
            {
                // do shift on reg (told by Rm) by shiftNum
                reg_and_imm_sh_reg.execute_RegAndImmShReg();

                // do operation requested
                uint shiftedRegUInt = reg_and_imm_sh_reg.getRmRegVal();
                uint Rn_BIC_Op2     = RnRegVal & (~shiftedRegUInt);

                // move shifted register value into into a register
                registers.updateRegisterN(Rd, Rn_BIC_Op2);

                string op2String = reg_and_imm_sh_reg.getOp2String();
                instructionString += " " + registers.getRegisterName(Rd) + ", " + op2String;
            }


            // Register Shifted Register
            if (bit25 == false && bit4 == true)
            {
                //Console.WriteLine("DataProcesing.BIC(): inst. is a Register Shifted Register ");
                reg_sh_reg.execute_RegShReg();

                // move rototed reg val by reg
                uint shiftedRegUInt = reg_sh_reg.getShiftedRegUInt();
                uint Rn_BIC_Op2     = RnRegVal & (~shiftedRegUInt);
                registers.updateRegisterN(Rd, shiftedRegUInt);

                string op2String = reg_sh_reg.getOp2String();
                instructionString += " " + registers.getRegisterName(Rd) + ", " + op2String;
            }
        }