public Responce machinestart([FromBody] Input Input) { Excute Inter = new Excute(); Responce Res = Inter.HandleInfo(Input); return(Res); }
static public void Init_All() { Intl = true; Clock = Nbub = 0; Program.Renew(Control.States.SAOK); Excute.Updata_CC(true, false, false); Fetch.Updata(0); Decode.Updata(Control.States.SAOK, Control.Codes.INOP, 0, Control.Registers.RNONE, Control.Registers.RNONE, 0, 0); Excute.Updata(Control.States.SAOK, Control.Codes.INOP, 0, 0, 0, 0, Control.Registers.RNONE, Control.Registers.RNONE, Control.Registers.RNONE, Control.Registers.RNONE); Memory.Updata(Control.States.SAOK, Control.Codes.INOP, 0, false, 0, 0, Control.Registers.RNONE, Control.Registers.RNONE); Write_back.Updata(Control.States.SAOK, Control.Codes.INOP, 0, 0, 0, Control.Registers.RNONE, Control.Registers.RNONE); Program.Renew(Control.States.SAOK); Decode.Init_Reg(); Memory.Init_Mem(); Run.ck = false; Read_ys.Init(); Control.Init(); BreakControl.Init(); Display.nlog++; StreamWriter sw = new StreamWriter(@"./log.out", false); sw.Close(); // print("?"); }
static void Show_ConditionCode() { Text txt = GameObject.Find("Canvas/PipeLine_Panel/IOF/Value").GetComponent <Text>(); txt.text = Excute.Show_OF().ToString(); txt = GameObject.Find("Canvas/PipeLine_Panel/ISF/Value").GetComponent <Text>(); txt.text = Excute.Show_SF().ToString(); txt = GameObject.Find("Canvas/PipeLine_Panel/IZF/Value").GetComponent <Text>(); txt.text = Excute.Show_ZF().ToString(); }
static void Updata_Excute() { if (!Control.Show_E_bubble() && !Control.Show_E_stall()) { Excute.Updata(Decode.Show_d_state(), Decode.Show_d_icode(), Decode.Show_d_ifun(), Decode.Show_d_valC(), Decode.Show_d_valA(), Decode.Show_d_valB(), Decode.Show_d_dstE(), Decode.Show_d_dstM(), Decode.Show_d_srcA(), Decode.Show_d_srcB()); } if (Control.Show_E_bubble()) { Excute.Updata(Control.States.SAOK, Control.Codes.INOP, 0, 0, 0, 0, Control.Registers.RNONE, Control.Registers.RNONE, Control.Registers.RNONE, Control.Registers.RNONE); } }
static public void Step() { // print(Fetch.Show_F_predPC().ToString("X2")); // print(((int)Write_back.Show_W_state()).ToString("X2")); if (state == Control.States.SAOK) { Control.Work(); Updata.Work(); Write_back.Work(); Memory.Work(); Excute.Work(); Decode.Work(); Fetch.Work(); Display.Shown_Log(); BreakControl.Jmp_Break(); } // print(Fetch.Show_F_predPC().ToString("X2")); // print(((int)Write_back.Show_W_state()).ToString("X2")); // print("-------------------------------------------"); }
static public void Work() { F_stall = D_stall = E_stall = false; // F_bubble = D_bubble = E_bubble = false; W_bubble = M_bubble; M_bubble = E_bubble; E_bubble = D_bubble; D_bubble = F_bubble; F_bubble = false; bool ld = false, rt = false, wj = false; if ((Excute.Show_E_icode() == Codes.IMRMOVQ || Excute.Show_E_icode() == Codes.IPOPQ) && (Excute.Show_E_dstM() == Decode.Show_d_srcA() || Excute.Show_E_dstM() == Decode.Show_d_srcB())) { ld = true; } if ((Excute.Show_E_icode() == Codes.IRET) || (Memory.Show_M_icode() == Codes.IRET) || (Decode.Show_D_icode() == Codes.IRET)) { rt = true; } if (!Excute.Show_e_Cnd() && Excute.Show_e_icode() == Codes.IJXX) { wj = true; } if (ld && !rt) { F_stall = D_stall = E_bubble = true; //LOAD_USE } if (rt && !ld) { F_stall = D_bubble = true; //RET } if (wj) { E_bubble = D_bubble = true; //WRONG_JXX } if (ld && rt) { E_bubble = D_stall = F_stall = true; //LOAD_USE && RET } }
static void Show_Excute() { Text txt = GameObject.Find("Canvas/PipeLine_Panel/E_State/Value").GetComponent <Text>(); txt.text = Get_State(Excute.Show_E_state()); txt = GameObject.Find("Canvas/PipeLine_Panel/E_Instr/Value").GetComponent <Text>(); txt.text = Get_Ins(Excute.Show_E_icode(), Excute.Show_E_ifun()); txt = GameObject.Find("Canvas/PipeLine_Panel/E_dstE/Value").GetComponent <Text>(); txt.text = Get_Reg(Excute.Show_E_dstE()); txt = GameObject.Find("Canvas/PipeLine_Panel/E_dstM/Value").GetComponent <Text>(); txt.text = Get_Reg(Excute.Show_E_dstM()); txt = GameObject.Find("Canvas/PipeLine_Panel/E_srcA/Value").GetComponent <Text>(); txt.text = Get_Reg(Excute.Show_E_srcA()); txt = GameObject.Find("Canvas/PipeLine_Panel/E_srcB/Value").GetComponent <Text>(); txt.text = Get_Reg(Excute.Show_E_srcB()); txt = GameObject.Find("Canvas/PipeLine_Panel/E_valA/Value").GetComponent <Text>(); txt.text = Get_Fmt(Excute.Show_E_valA()); txt = GameObject.Find("Canvas/PipeLine_Panel/E_valB/Value").GetComponent <Text>(); txt.text = Get_Fmt(Excute.Show_E_valB()); txt = GameObject.Find("Canvas/PipeLine_Panel/E_valC/Value").GetComponent <Text>(); txt.text = Get_Fmt(Excute.Show_E_valC()); }
static public long Fwd(Control.Registers src, long rval) { if (src == Excute.Show_e_dstE()) { return(Excute.Show_e_valE()); } if (src == Memory.Show_M_dstM()) { return(Memory.Show_m_valM()); } if (src == Memory.Show_M_dstE()) { return(Memory.Show_M_valE()); } if (src == Write_back.Show_W_dstM()) { return(Write_back.Show_W_valM()); } if (src == Write_back.Show_W_dstE()) { return(Write_back.Show_W_valE()); } return(rval); }
static public void Shown_Log() { if (nlog == 10000) { return; } nlog++; System.IO.StreamWriter sw = new StreamWriter(@"./log.out", true); sw.WriteLine("Clock = " + Updata.Clock.ToString("X")); sw.WriteLine("Fetch:"); sw.WriteLine("Pred_PC = " + Fetch.Show_F_predPC().ToString("X")); sw.WriteLine("Decode:"); sw.Write("state = " + Decode.Show_D_state().ToString() + " ; "); sw.Write("Instr = " + Get_Ins(Decode.Show_D_icode(), Decode.Show_D_ifun()) + " ; "); sw.Write("rA = " + Get_Reg(Decode.Show_D_rA()) + " ; "); sw.Write("rB = " + Get_Reg(Decode.Show_D_rB()) + " ; "); sw.WriteLine(""); sw.Write("valC = " + Decode.Show_D_valC().ToString("X") + " ; "); sw.Write("valP = " + Decode.Show_D_valP().ToString("X") + " ; "); sw.WriteLine(""); sw.WriteLine("Excute:"); sw.Write("state = " + Excute.Show_E_state().ToString() + " ; "); sw.Write("Instr = " + Get_Ins(Excute.Show_E_icode(), Excute.Show_E_ifun()) + " ; "); sw.Write("dstE = " + Get_Reg(Excute.Show_E_dstE()) + " ; "); sw.Write("dstM = " + Get_Reg(Excute.Show_E_dstM()) + " ; "); sw.Write("srcA = " + Get_Reg(Excute.Show_E_srcA()) + " ; "); sw.Write("srcB = " + Get_Reg(Excute.Show_E_srcB()) + " ; "); sw.WriteLine(""); sw.Write("valA = " + Excute.Show_E_valA().ToString("X") + " ; "); sw.Write("valB = " + Excute.Show_E_valB().ToString("X") + " ; "); sw.Write("valC = " + Excute.Show_E_valC().ToString("X") + " ; "); sw.WriteLine(""); sw.Write("OF = " + Excute.Show_OF().ToString() + " ; " + "ZF = " + Excute.Show_ZF().ToString() + " ; "); sw.WriteLine("SF = " + Excute.Show_SF().ToString() + " ; "); sw.WriteLine("Memory:"); sw.Write("state = " + Memory.Show_M_state().ToString() + " ; "); sw.Write("Instr = " + Get_Ins(Memory.Show_M_icode(), Memory.Show_M_ifun()) + " ; "); sw.Write("dstE = " + Get_Reg(Memory.Show_M_dstE()) + " ; "); sw.Write("dstM = " + Get_Reg(Memory.Show_M_dstM()) + " ; "); sw.WriteLine(""); sw.Write("valA = " + Memory.Show_M_valA().ToString("X") + " ; "); sw.Write("valE = " + Memory.Show_M_valE().ToString("X") + " ; "); sw.Write("Cnd = " + Memory.Show_M_Cnd().ToString() + " ; "); sw.WriteLine(""); sw.WriteLine("Write_Back:"); sw.Write("state = " + Write_back.Show_W_state().ToString() + " ; "); sw.Write("Instr = " + Get_Ins(Write_back.Show_W_icode(), Write_back.Show_W_ifun()) + " ; "); sw.Write("dstE = " + Get_Reg(Write_back.Show_W_dstE()) + " ; "); sw.Write("dstM = " + Get_Reg(Write_back.Show_W_dstM()) + " ; "); sw.WriteLine(""); sw.Write("valE = " + Write_back.Show_W_valE().ToString("X") + " ; "); sw.Write("valM = " + Write_back.Show_W_valM().ToString("X") + " ; "); sw.WriteLine(""); for (int i = 0; i < 15; i++) { sw.Write(((Control.Registers)i).ToString() + " = " + Decode.Read_reg(i).ToString("X") + " ; "); if ((i + 1) % 3 == 0) { sw.WriteLine(""); } } sw.WriteLine(""); sw.Close(); }
public DelegateCommand(Excute executeDelegate, CanExcute canExecuteDelegate) { this.executeDelegate = executeDelegate; this.canExecuteDelegate = canExecuteDelegate; }
public DelegateCommand(Excute executeDelegate) : this(executeDelegate, null) { }
static void Updata_Memory() { Memory.Updata(Excute.Show_e_state(), Excute.Show_e_icode(), Excute.Show_e_ifun(), Excute.Show_e_Cnd(), Excute.Show_e_valE(), Excute.Show_e_valA(), Excute.Show_e_dstE(), Excute.Show_e_dstM()); }