static void Show_WriteBack() { Text txt = GameObject.Find("Canvas/PipeLine_Panel/W_State/Value").GetComponent <Text>(); txt.text = Get_State(Write_back.Show_W_state()); txt = GameObject.Find("Canvas/PipeLine_Panel/W_Instr/Value").GetComponent <Text>(); txt.text = Get_Ins(Write_back.Show_W_icode(), Write_back.Show_W_ifun()); txt = GameObject.Find("Canvas/PipeLine_Panel/W_dstE/Value").GetComponent <Text>(); txt.text = Get_Reg(Write_back.Show_W_dstE()); txt = GameObject.Find("Canvas/PipeLine_Panel/W_dstM/Value").GetComponent <Text>(); txt.text = Get_Reg(Write_back.Show_W_dstM()); txt = GameObject.Find("Canvas/PipeLine_Panel/W_valE/Value").GetComponent <Text>(); txt.text = Get_Fmt(Write_back.Show_W_valE()); txt = GameObject.Find("Canvas/PipeLine_Panel/W_valM/Value").GetComponent <Text>(); txt.text = Get_Fmt(Write_back.Show_W_valM()); }
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(); }