WaveData Module
Where the waveform viewer gets its data, whichever simulator produced it. Two sources answer the same two questions. `Local` reads the renderer's own `FastSimulation` step arrays in place, which is what the viewer has always done. `Fetched` answers from the window most recently pulled off the .NET sidecar, which holds only the samples the current view draws - that being the whole point, since a sidecar simulation is sized for the machine's memory rather than a browser heap and its step arrays are far too large to ship. **Both questions are answered with a slice**, even the point reads: a cursor column is one sample of every selected wave, which is a window of one. That keeps one shape on the wire, one shape in the cache and one shape for the drawing code - and it is the shape that will carry run-length encoded waveforms when they arrive (see WaveSlice). **Why the source is module state.** The functions here are called from view code - `getWaveValue` while laying out the value column, the hover cache while building a tooltip - which has no model to thread a flag through, and reaching for a global is what that code already does for the simulation itself (`Simulator.simCache`). This mirrors it deliberately rather than inventing a second convention: set when the waveform simulator refreshes, cleared when it ends, and read from view code. See docs/mutableState.md - this is a cache of what the app is displaying, not model state.
Types
Functions and values
| Function or value | Description |
|
|
|
|
|
The window this wave's samples cover, when it has some. What the viewer can draw for it RIGHT NOW, which while a view is being scrolled is neither the window on screen nor the one the controls ask for: it is whatever the last fetch to land carried. Drawing that rather than keeping what is on screen is what makes a fast scroll move.
|
Full Usage:
holdNothing epoch
Parameters:
int
|
Read from the sidecar session `epoch`, holding nothing yet: every wave has to be asked for. NOT the same as Local, which is what the renderer's own simulation is. In .NET mode the renderer's step arrays exist but are never run, so reading through to them would draw a column of zeros with the confidence of simulation output. This says "ask", where Local says "look".
|
Full Usage:
needFetching handles window
Parameters:
SignalHandle list
window : Window
Returns: SignalHandle list
|
The waves, of those being drawn, that do not hold the window they are drawn over. Derived, every time it is asked for, from the cache and the view. Nothing records which waves are outstanding: a wave needs fetching exactly when it has not got the cycles it is being drawn over, and that is a question with an answer at any moment.
|
|
Add what a fetch of session `epoch` carried, keeping any waves already held that it did not carry - a fetch asks only for the waves that were missing, so the rest are still current. **Refused unless the cache is of that session** (invariant D4). This is written from inside the promise that fetched, where the model - and so which session is on screen - is not reachable; the alternative was to write regardless and check somewhere later, and there is no later that comes before the next render. A reply from a build that has been replaced would otherwise land under driver indices the new build has reused, and be drawn under the new signal's name until something moved. A wave short of its own samples is reported AND kept out (invariant D3). A short reply is silent: reading past the end of a typed array is `undefined` in JavaScript rather than a fault, so every wave after the truncation point drew somebody else's samples - or NaNs - as confidently as the rest. Reporting it and then storing it anyway made the check a description of the failure instead of a stop to it. A wave with no entry draws nothing, which is what the viewer already does for one whose data has not arrived.
|
Full Usage:
setLocal lookup clock
Parameters:
SignalHandle -> IOArray option
clock : unit -> int
|
|
Full Usage:
setNoDriver epoch handles window
Parameters:
int
handles : DriverIndex list
window : Window
|
Record that these waves were asked for over this window under session `epoch`, and the simulation cannot name them. Not an error and not a gap to be retried: a wave whose driver the simulation does not offer is one this build has no way of fetching, so what is recorded is that answer. It goes in the cache rather than in a list of exceptions because the question - "has this wave got the window it is drawn over" - is the same one, and one answer is easier to keep true than two. Session-checked exactly as `setFetched` is, and for the same reason: "no driver" is an answer about one build, and the next build may well have one.
|
|
|
|