From cd0c4b1429ceb02c0a4305de1c79a7b0b92db8fb Mon Sep 17 00:00:00 2001 From: Tom Clarke Date: Thu, 8 Sep 2022 22:08:15 +0100 Subject: [PATCH] fix new simulation bug that leads to missing waveforms --- src/Renderer/Simulator/FastCreate.fs | 3 ++- src/Renderer/UI/UpdateHelpers.fs | 11 ++++++----- src/Renderer/UI/WaveSim/WaveSim.fs | 11 +++++++++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/Renderer/Simulator/FastCreate.fs b/src/Renderer/Simulator/FastCreate.fs index cc0d73b2c..da62d1ddb 100644 --- a/src/Renderer/Simulator/FastCreate.fs +++ b/src/Renderer/Simulator/FastCreate.fs @@ -479,7 +479,8 @@ let addComponentWaveDrivers (f:FastSimulation) (fc: FastComponent) (pType: PortT | SplitWire _ | BusSelection _ | MergeWires - | Constant _ + | Constant1 _ -> + [||] | Output _ when fc.SubSheet <> [] -> [||] | Input1 _ when fc.SubSheet <> [] -> diff --git a/src/Renderer/UI/UpdateHelpers.fs b/src/Renderer/UI/UpdateHelpers.fs index 858c7a490..fe4986b88 100644 --- a/src/Renderer/UI/UpdateHelpers.fs +++ b/src/Renderer/UI/UpdateHelpers.fs @@ -154,12 +154,13 @@ let shortDisplayMsg (msg:Msg) = | FinishUICmd | ReadUserData _ | SetUserData _ - | ExecCmd _ - | ExecFuncInMessage _ - | ExecFuncAsynch _ - | ExecCmdAsynch _ - | SendSeqMsgAsynch _ | SetThemeUserData _ -> None + | ExecCmd _ -> Some "ExecCmd" + | ExecFuncInMessage _ -> Some "ExecFuncInMessage" + | ExecFuncAsynch _ -> Some "ExecFuncAsync" + | ExecCmdAsynch _ -> Some "ExecCmdAsynch" + | SendSeqMsgAsynch _ -> Some "SendSeqMsgAsynch" + diff --git a/src/Renderer/UI/WaveSim/WaveSim.fs b/src/Renderer/UI/WaveSim/WaveSim.fs index 896b1943a..a69c03b1b 100644 --- a/src/Renderer/UI/WaveSim/WaveSim.fs +++ b/src/Renderer/UI/WaveSim/WaveSim.fs @@ -82,6 +82,9 @@ let waveformIsUptodate (ws: WaveSimModel) (wave:Wave) = /// Generates or updates the SVG for a specific waveform if necessary /// Assumes that the fast simulation data has not changed and has enough cycles let generateWaveform (ws: WaveSimModel) (index: WaveIndexT) (wave: Wave): Wave = + //if wave.ViewerDisplayName.StartsWith "DATAPATH.MUX" then + //let wave1 = {wave with SVG=None ; WaveValues = {wave.WaveValues with Step = Array.empty}} + //printfn $"Generating waveform '{wave.ViewerDisplayName}'\n wave={wave1}" let waveform = match wave.Width with | 0 -> failwithf "Cannot have wave of width 0" @@ -763,16 +766,19 @@ let rec refreshWaveSim (newSimulation: bool) (wsModel: WaveSimModel) (model: Mod getWaves wsModel fs else wsModel.AllWaves + let simulationIsUptodate = wsModel.FastSim.ClockTick > wsModel.ShownCycles + wsModel.StartCycle let wavesToBeMade = allWaves |> Map.filter (fun wi wave -> // Only generate waveforms for selected waves. // Regenerate waveforms whenever they have changed let hasChanged = not <| waveformIsUptodate wsModel wave - let simulationIsUptodate = wsModel.FastSim.ClockTick > wsModel.ShownCycles + wsModel.StartCycle //if List.contains index ws.SelectedWaves then List.contains wi wsModel.SelectedWaves && hasChanged && simulationIsUptodate) |> Map.toList + + //|> (fun lst -> lst |> List.iter (fun (wi,wave) -> + //printfn $"wave={wi.SimArrayIndex},{wi.PortNumber},{wi.PortType},{wave.ViewerDisplayName}"); lst) |> List.map fst let model, allWaves, spinnerPayload, numToDo = @@ -787,7 +793,8 @@ let rec refreshWaveSim (newSimulation: bool) (wsModel: WaveSimModel) (model: Mod failwithf "What? makewaveformsWithTimeOut must make at least one waveform" | numToDo, Some t when float wavesToBeMade.Length * t / float numDone < Constants.maxSimulationTimeWithoutSpinner -> - model, allWaves, None, numToDo + let (allWaves, numDone, timeOpt) = makeWaveformsWithTimeOut None wsModel allWaves wavesToBeMade + model, allWaves, None, numToDo - numDone | numToDo, _ -> let payload = Some ("Making waves", refreshWaveSim false {wsModel with AllWaves = allWaves} >> fst) model, allWaves, payload, numToDo)