public void Run() { VCDSignalsSnapshot topLevelSnapshot = new VCDSignalsSnapshot("TOP"); var controlScope = topLevelSnapshot.Scope("Control"); var clockSignal = controlScope.Add(new VCDVariable("Clock", true, 1)); _topLevel.PopulateSnapshot(topLevelSnapshot); _vcdBuilder?.Init(topLevelSnapshot); var clock = 0; var stageIteration = 0; while (clock < MaxClockCycles && (IsRunning?.Invoke(_topLevel) ?? true)) { var currentTime = clock * 2 * MaxStageIterations; clockSignal.Value = true; stageIteration = 0; do { currentTime++; var modified = _topLevel.Stage(stageIteration); _topLevel.PopulateSnapshot(topLevelSnapshot); _vcdBuilder?.Snapshot(currentTime, topLevelSnapshot); // no modules were modified during stage iteration, all converged if (!modified) { break; } }while (++stageIteration < MaxStageIterations); if (stageIteration >= MaxStageIterations) { throw new MaxStageIterationReachedException(); } OnPostStage?.Invoke(_topLevel); currentTime = clock * 2 * MaxStageIterations + MaxStageIterations; clockSignal.Value = false; _topLevel.PopulateSnapshot(topLevelSnapshot); _vcdBuilder?.Snapshot(currentTime, topLevelSnapshot); _topLevel.Commit(); clock++; } }
public void Test() { var vcd = new VCDBuilder(@"C:\tmp\1.vcd"); var topScope = new VCDSignalsSnapshot("TOP"); topScope.Add(new VCDVariable("data", (byte)0, 1)); var childScope = topScope.Scope("ChildScope1"); var signal1 = childScope.Add(new VCDVariable("Signal1", true, 1)); var signal2 = childScope.Add(new VCDVariable("Signal2", "Value", 1)); vcd.Init(topScope); signal1.Value = false; signal2.Value = "NewValue"; vcd.Snapshot(10, topScope); vcd.Snapshot(20, null); }
protected virtual void TraceSignals() { if (_vcdBuilder == null) { return; } _topLevel.PopulateSnapshot(_topLevelSnapshot, _snapshotConfig); _vcdBuilder.Snapshot(_simulatorContext.CurrentTime, _topLevelSnapshot); }
public void Test() { if (!Debugger.IsAttached) { Assert.Inconclusive("Run under debugger"); } var vcd = new VCDBuilder(@"C:\tmp\1.vcd"); var topScope = new VCDSignalsSnapshot("TOP"); topScope.Add(new VCDVariable("data", (byte)0, 1)); var childScope = topScope.Scope("ChildScope1"); var signal1 = childScope.Add(new VCDVariable("Signal1", true, 1)); var signal2 = childScope.Add(new VCDVariable("Signal2", "Value", 1)); vcd.Init(topScope); signal1.Value = false; signal2.Value = "NewValue"; vcd.Snapshot(10, topScope); vcd.Snapshot(20, null); }