コード例 #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);
            }
        }
コード例 #2
0
 public static JTypeInstruction FromInteger(uint b)
 {
     var jt = new JTypeInstruction()
     {
         JumpType = (JumpType)(b >> 26),
         Target = b & 0x3FFFFFF
     };
     return jt;
 }
コード例 #3
0
        public static JTypeInstruction FromInteger(uint b)
        {
            var jt = new JTypeInstruction()
            {
                JumpType = (JumpType)(b >> 26),
                Target   = b & 0x3FFFFFF
            };

            return(jt);
        }