Exemplo n.º 1
0
        private void HandleRV64M(InstructionPayload payload)
        {
            Logger.Info("Multiplier extension detected");

            switch (payload.Funct3)
            {
            // mul
            case 0:
                multiplier.ExecuteMul(payload.Rd, Register.ReadBlock(payload.Rs1), Register.ReadBlock(payload.Rs2));
                break;

            // mulh
            case 1:
            // See Mlhu

            // mulhsu
            case 2:
            // See Mlhu

            // mulhu
            case 3:
                multiplier.ExecuteMulh(payload.Rd, Register.ReadBlock(payload.Rs1), Register.ReadBlock(payload.Rs2));
                break;

            // div
            case 4:
            // see divu

            // divu
            case 5:
                divider.Div(payload.Rd, Register.ReadBlock(payload.Rs1), Register.ReadBlock(payload.Rs2));
                break;

            // rem
            case 6:
            // see remu

            // remu
            case 7:
                divider.Rem(payload.Rd, Register.ReadBlock(payload.Rs1), Register.ReadBlock(payload.Rs2));
                break;

            // Error
            default:
                throw new OpCodeNotSupportedException(String.Format("OpCode = {0}, Funct3 = {1}", payload.OpCode, payload.Funct3));
            }
        }