Esempio n. 1
0
        public void SetExecutionPath(int currentinstruction)
        {
            if ((InstructionDecoder.is_r_format(currentinstruction)) &&
                ((InstructionDecoder.rfunct(currentinstruction) == InstructionType.Subtract) ||
                 InstructionDecoder.rfunct(currentinstruction) == InstructionType.Add))
            {
                _regDestination = 1;
                _ALUOp          = 10;
                _ALUSrc         = 0;
                _MemRead        = 0;
                _MemWrite       = 0;
                _RegWrite       = 1;
                _MemToReg       = 0;
            }

            else if (InstructionDecoder.getOPcode(currentinstruction) == InstructionType.LoadByte)
            {
                _regDestination = 0;
                _ALUOp          = 0;
                _ALUSrc         = 1;
                _MemRead        = 1;
                _MemWrite       = 0;
                _RegWrite       = 1;
                _MemToReg       = 1;
            }

            else if (InstructionDecoder.getOPcode(currentinstruction) == InstructionType.StoreByte)
            {
                _regDestination = 0;
                _ALUOp          = 0;
                _ALUSrc         = 1;
                _MemRead        = 0;
                _MemWrite       = 1;
                _RegWrite       = 0;
                _MemToReg       = 0;
            }

            else
            {
                _regDestination = 0;
                _ALUOp          = 0;
                _ALUSrc         = 0;
                _MemRead        = 0;
                _MemWrite       = 0;
                _RegWrite       = 0;
                _MemToReg       = 0;
            }
        }