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);
            }
        }
 public static CoProcessorInstruction FromInteger(uint v)
 {
     var cp = new CoProcessorInstruction()
     {
         Opcode = (MIPSI.Opcode)(v >> 26),
         Format = (CoProcessorFormat)((v >> 21) & 0x1f),
         Rt = (v >> 16) & 0x1f,
         Rd = (v >> 11) & 0x1f
     };
     return cp;
 }
Ejemplo n.º 3
0
        public static CoProcessorInstruction FromInteger(uint v)
        {
            var cp = new CoProcessorInstruction()
            {
                Opcode = (MIPSI.Opcode)(v >> 26),
                Format = (CoProcessorFormat)((v >> 21) & 0x1f),
                Rt     = (v >> 16) & 0x1f,
                Rd     = (v >> 11) & 0x1f
            };

            return(cp);
        }