Ejemplo n.º 1
0
        public IInstruction ReadInstruction(uint inst)
        {
            if (!Enum.IsDefined(typeof(Opcode), inst >> 26))
            {
                return(UndefinedInstruction.FromInteger(inst));
            }
            var opcode = (Opcode)(inst >> 26);

            switch (opcode)
            {
            case Opcode.RType:
                var rIns = RTypeInstruction.FromInteger(inst);
                rIns.Executor = RTypeExecutors[rIns.Function];
                return(rIns);

            case Opcode.Jump:
            case Opcode.JumpAndLink:
                var jIns = JTypeInstruction.FromInteger(inst);
                jIns.Executor = JTypeExecutors[jIns.JumpType];
                return(jIns);

            case Opcode.CoProcessor:
                var coIns = CoProcessorInstruction.FromInteger(inst);
                coIns.Executor = CoProcessorExecutors[coIns.Format];
                return(coIns);

            default:
                var iIns = ITypeInstruction.FromInteger(inst);
                iIns.Executor = ITypeExecutors[iIns.Opcode];
                return(iIns);
            }
        }
Ejemplo n.º 2
0
 public static ITypeInstruction FromInteger(uint v)
 {
     var it = new ITypeInstruction()
     {
         Opcode = (MIPSI.Opcode)(v >> 26),
         Rs = (v >> 21) & 0x1f,
         Rt = (v >> 16) & 0x1f,
         Immediate = ((ushort)((v) & 0xFFFF))
     };
     return it;
 }
Ejemplo n.º 3
0
        public static ITypeInstruction FromInteger(uint v)
        {
            var it = new ITypeInstruction()
            {
                Opcode    = (MIPSI.Opcode)(v >> 26),
                Rs        = (v >> 21) & 0x1f,
                Rt        = (v >> 16) & 0x1f,
                Immediate = ((ushort)((v) & 0xFFFF))
            };

            return(it);
        }