Esempio n. 1
0
 public InstructionI(int opcode, CpuReg rs, CpuReg rt, int immediate)
 {
     OpCode    = opcode;
     Rs        = rs;
     Rt        = rt;
     Immediate = immediate;
 }
Esempio n. 2
0
 public InstructionI(int opcode, CpuReg rs, CpuReg rt, int immediate)
 {
     OpCode = opcode;
     Rs = rs;
     Rt = rt;
     Immediate = immediate;
 }
Esempio n. 3
0
 public InstructionR(int opcode, CpuReg rs, CpuReg rt, CpuReg rd, int shamt, int funct)
 {
     OpCode = opcode;
     Rs     = rs;
     Rt     = rt;
     Rd     = rd;
     Shamt  = shamt;
     Funct  = funct;
 }
Esempio n. 4
0
 public InstructionR(int opcode, CpuReg rs, CpuReg rt, CpuReg rd, int shamt, int funct)
 {
     OpCode = opcode;
     Rs = rs;
     Rt = rt;
     Rd = rd;
     Shamt = shamt;
     Funct = funct;
 }
Esempio n. 5
0
        public static InstructionI Emit(InstructionMnemonic mnemonic, 
										   CpuReg rs, CpuReg rt, 
			                               int immediate)
        {
            var instruction = ISA.GetInstruction (mnemonic);
            if (instruction.Format != InstructionFormat.I) {
                throw new Exception ("Wrong instruction type.");
            }
            return new InstructionI {
                Instruction = instruction.Instruction,
                OpCode = instruction.OpCode,
                Rs = rs,
                Rt = rt,
                Immediate = immediate
            };
        }
Esempio n. 6
0
        public static InstructionR Emit(InstructionMnemonic mnemonic, 
										   CpuReg rs, CpuReg rt, CpuReg rd, 
										   int shamt)
        {
            var instruction = ISA.GetInstruction (mnemonic);
            if (instruction.Format != InstructionFormat.R) {
                throw new Exception ("Wrong instruction type.");
            }
            return new InstructionR {
                Instruction = instruction.Instruction,
                OpCode = instruction.OpCode,
                Rs = rs,
                Rt = rt,
                Rd = rd,
                Shamt = shamt,
                Funct = instruction.Function
            };
        }
Esempio n. 7
0
        public static InstructionI Emit(InstructionMnemonic mnemonic,
                                        CpuReg rs, CpuReg rt,
                                        int immediate)
        {
            var instruction = ISA.GetInstruction(mnemonic);

            if (instruction.Format != InstructionFormat.I)
            {
                throw new Exception("Wrong instruction type.");
            }
            return(new InstructionI {
                Instruction = instruction.Instruction,
                OpCode = instruction.OpCode,
                Rs = rs,
                Rt = rt,
                Immediate = immediate
            });
        }
Esempio n. 8
0
        public static InstructionR Emit(InstructionMnemonic mnemonic,
                                        CpuReg rs, CpuReg rt, CpuReg rd,
                                        int shamt)
        {
            var instruction = ISA.GetInstruction(mnemonic);

            if (instruction.Format != InstructionFormat.R)
            {
                throw new Exception("Wrong instruction type.");
            }
            return(new InstructionR {
                Instruction = instruction.Instruction,
                OpCode = instruction.OpCode,
                Rs = rs,
                Rt = rt,
                Rd = rd,
                Shamt = shamt,
                Funct = instruction.Function
            });
        }
Esempio n. 9
0
        static PropertyInfo GetPropertyInfo(CpuReg r)
        {
            var propertyInfo = typeof(CPU).GetProperty(r.ToString(), BindingFlags.Public | BindingFlags.Static);

            return(propertyInfo);
        }
Esempio n. 10
0
        public static void SetRegister(CpuReg r, int value)
        {
            var propertyInfo = GetPropertyInfo(r);

            propertyInfo.SetValue(null, value);
        }
Esempio n. 11
0
        public static int GetRegister(CpuReg r)
        {
            var propertyInfo = GetPropertyInfo(r);

            return((int)propertyInfo.GetValue(null, null));
        }
Esempio n. 12
0
File: CPU.cs Progetto: thild/umipss
 static PropertyInfo GetPropertyInfo(CpuReg r)
 {
     var propertyInfo = typeof(CPU).GetProperty (r.ToString (), BindingFlags.Public | BindingFlags.Static);
     return propertyInfo;
 }
Esempio n. 13
0
File: CPU.cs Progetto: thild/umipss
 public static void SetRegister(CpuReg r, int value)
 {
     var propertyInfo = GetPropertyInfo (r);
     propertyInfo.SetValue (null, value);
 }
Esempio n. 14
0
File: CPU.cs Progetto: thild/umipss
 public static int GetRegister(CpuReg r)
 {
     var propertyInfo = GetPropertyInfo (r);
     return (int)propertyInfo.GetValue (null, null);
 }