void CPU_OnThreadDone(object sender, OperationEventArgs args) { // if all threads are done (use bools) switch (args.CurrentThreadType) { case ThreadType.Fetch: fetchDone = true; break; case ThreadType.Decode: decodeDone = true; break; case ThreadType.Execute: executeDone = true; break; case ThreadType.Store: storeDone = true; break; } lock (allThreadsDoneLock) { if (fetchDone && decodeDone && executeDone && storeDone) { allThreadsDone.Set(); } } }
void myCPU_OnExecuteDone(object sender, OperationEventArgs args) { MethodInvoker method = delegate { this.executeLabel.Text = myCPU.instToString(args.CurrentIR); }; if (this.InvokeRequired) { this.Invoke(method); } else { method.Invoke(); } }
void myCPU_OnFetchDone(object sender, OperationEventArgs args) { MethodInvoker method = delegate { this.irLabel.Text = "0x" + args.CurrentIR.ToString("x8"); this.fetchLabel.Text = myCPU.instToString(args.CurrentIR); }; if (this.InvokeRequired) { this.Invoke(method); } else { method.Invoke(); } }