/// <summary>
        /// FUNCTION:
        ///     -Using instruction field update fields: instructionString, opcode, Rn, Rd, operand2.
        /// </summary>
        public void decodeDP()
        {
            // update field: instructionString, opcode
            opcode = (instruction >> 21) & 0xf;
            updateInstructionName();

            // update field Rn
            Rn = (instruction >> 16) & 0xf;

            // update field RnRegVal
            // if Rn is PC, then RnRegVal should be currentAddress + 8 bytes. else it it's the content of register Rn
            if (Rn == 15)
            {
                RnRegVal = instructAddress + 8;
            }
            else
            {
                RnRegVal = registers.getRegNValue(Rn);
            }

            // update field Rd
            Rd = (instruction >> 12) & 0xf;


            /*  Decode the operand2 of the intruction and update field operand2
             *  Steps to do this:
             *    1. check bits 25 & 4 for operand 2 types
             *    2. if 8 bit immediate
             *            initialize _8BitImmediate object and decode_Imm
             *       if register or immediate shifted register
             *            initialize  RegAndImmShReg object and decode_Imm
             *       if register shifted register
             *            initialize RegShReg object and decode_Imm
             */
            if (bit25 == true)                        // Immediate
            {
                immediate = new Immediate(memory, registers, instruction, instructAddress);
                immediate.decode_Imm();
            }


            if (bit25 == false && bit4 == false) // Register and Immediate Shifted Register
            {
                reg_and_imm_sh_reg = new RegAndImmShReg(memory, registers, instruction, instructAddress);
                reg_and_imm_sh_reg.decode_RegAndImmShReg();
            }

            // TODO: not implemented in sim I
            if (this.bit25 == false && this.bit4 == true)  // Register Shifted Register
            {
                this.reg_sh_reg = new RegShReg(this.memory, this.registers, this.instruction, this.instructAddress);
                this.reg_sh_reg.decode_RegShReg();
            }
        }
        private bool bit4;  //data processing addressing mode flag


        public DataProcessing(Memory _memory, Registers _registers, uint _currentInstruction, uint _currentInstAddress)
        {
            this.instructionString = "Not Found Yet";
            this.instruction       = _currentInstruction;
            this.instructAddress   = _currentInstAddress;

            // initialize operand2 types to null
            this.immediate          = null;
            this.reg_and_imm_sh_reg = null;
            this.reg_sh_reg         = null;

            // hook up registers and mememory object references
            this.registers = _registers;
            this.memory    = _memory;

            // setting up data processing addressing mode flags // -4 because pc gor incremented by 4 bytes when the instruction was fetched
            this.bit25 = memory.TestFlag(registers.getProgramCounter() - 4, 25);  //data processing addressing mode flag
            this.bit4  = memory.TestFlag(registers.getProgramCounter() - 4, 4);   //data processing addressing mode flag
        }