EvalCompiled Module
Per-component reducers, chosen and bound once when the simulation is built.
fastReduce works out afresh, for every component of every clock step, things that were
settled when the simulation was built: which component type this is, whether it is on the
uint32 or the bigint path, which of its inputs are bigints, what its bus masks are, and
which arrays its ports live in. A reducer built here has all of that already: it closes
over the step arrays themselves and over the constants, and its body is only the work that
actually differs from step to step.
reducerFor returns None for a component type it does not handle, and the caller falls back
to fastReduce. So this file can be filled in a type at a time, and the fallback is always
the definition of what a reducer must do.
Two rules the closures depend on, both guaranteed by the caller (see installReducers):
- The step arrays captured here must be the ones the simulation actually uses. Reducers
are therefore installed after every re-linking pass, including the one
addWavesToFastSimulation does for custom components, and only for components that are
reduced. Capturing an array that is later re-pointed would silently simulate the wrong
signal.
- Values in the step arrays are already within their bus width (the masking invariant), so
a reducer masks its result exactly when its own operation can overflow, and reads
without masking. On the uint32 path a width of exactly 32 needs care: 1u <<< 32 is 1u.
Functions and values
| Function or value | Description |
|
Build the reducer for one component, or None to leave it to fastReduce. One reducer serves both the combinational and the clocked pass. Only the hybrid components - asynchronous RAM, which is reduced once as each - need to tell the two apart, and they are not handled here, so they fall back to EvalReference where the flag still applies. Taking the flag as a parameter here would be worse than useless: it was one, nothing read it, and the caller duly built every reducer twice - which for a ROM meant building and keeping two copies of its lookup table. Anything added here that does depend on the pass must take the flag back.
|