internal static void VerifyCircuitState(CircuitGraph graph, VCDTimeline timeline, bool isVerilogVCD) { graph.SetState(timeline.GetStateAtTime(timeline.TimeInterval.StartInclusive), isVerilogVCD); Stopwatch timer = new Stopwatch(); timer.Start(); int i = 0; foreach (var state in timeline.GetAllDistinctStates()) { if (state.Time == timeline.TimeInterval.InclusiveEnd()) { break; } graph.SetState(state, isVerilogVCD); graph.ComputeRemainingGraphFast(); const int reportEveryXTimeStates = 20_000; if (i++ % reportEveryXTimeStates == 0) { timer.Stop(); float msPerState = (float)timer.ElapsedMilliseconds / reportEveryXTimeStates; float statesPerMs = 1.0f / msPerState; float statesPerSecs = statesPerMs * 1000.0f; float totalRemainingMs = msPerState * (timeline.StateCount - i); const int msPerSec = 1_000; float remainingSeconds = totalRemainingMs / msPerSec; Console.WriteLine($"{i}/{timeline.StateCount} Remaining: {remainingSeconds.ToString("N0")} States/sec: {statesPerSecs.ToString("N0")}"); timer.Restart(); } } timer.Stop(); }
public void SetCircuitState(ulong time) { StateLimiter.AddWork(time, stateTime => { Graph.SetState(Timeline.GetStateAtTime(stateTime), IsVerilogVCD); Graph.ComputeRemainingGraph(); if (RootModCtrl != null) { foreach (var modUI in ModControllers) { modUI.PrepareToRerenderLayout(); } RootModCtrl.Render(); } }); }