private void DecodeBTypeInstruction(Instruction i, string[] immediate, int currentInstructionNumber)
        {
            BTypeInstruction b             = (BTypeInstruction)i;
            bool             containsLabel = DetermineIfContainsLabel(0, immediate[0]);

            if (containsLabel)
            {
                int immed = 0;
                labels.TryGetValue(immediate[0], out immed);
                b.immediateValue = immed - currentInstructionNumber - 1;
            }
            else
            {
                b.immediateValue = DetermineRegistersUsed(immediate, b.instructionSubType)[0] - 1;
            }
        }
        // Sets the conditional bits
        private void SetConditional(Instruction i, Conditional cond)
        {
            switch (i.instructionType)
            {
            case InstructionType.RType:
                RTypeInstruction r = (RTypeInstruction)i;
                r.cond = cond;
                break;

            case InstructionType.BType:
                BTypeInstruction b = (BTypeInstruction)i;
                b.cond = cond;
                break;

            case InstructionType.DType:
                DTypeInstruction d = (DTypeInstruction)i;
                d.cond = cond;
                break;
            }
        }
        // Determines which type of instruction to create based on if instruction is in a specific dictionary
        // and creates a new instruction of that type. Instructions are in the form of lw, sw, add, bal, etc.
        private Instruction CreateCorrectTypeOfInstruction(string instruction, int lineNum)
        {
            InstructionSubType subType;
            Instruction        i = null;

            if (JInstructions.TryGetValue(instruction, out subType))
            {
                JTypeInstruction j = new JTypeInstruction();
                j.instructionSubType = subType;
                i = j;
            }
            else if (BInstructions.TryGetValue(instruction, out subType))
            {
                BTypeInstruction b = new BTypeInstruction();
                b.instructionSubType = subType;
                i = b;
            }
            else if (DInstructions.TryGetValue(instruction, out subType))
            {
                DTypeInstruction d = new DTypeInstruction();
                d.instructionSubType = subType;
                i = d;
            }
            else if (RInstructions.TryGetValue(instruction, out subType))
            {
                RTypeInstruction r = new RTypeInstruction();
                r.instructionSubType = subType;
                // Determines what the OpX bits should be based on the instruction given in the form add, sub, xor, etc.
                r.OpX = (RTypeInstruction.Opx)Enum.Parse(typeof(RTypeInstruction.Opx), instruction);
                i     = r;
            }
            else
            {
                throw new InvalidInstructionException(String.Format("The instruction on line {0} is an invalid instruction.", lineNum));
            }

            return(i);
        }