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 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(); }
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 } }