Saturate
Component Type: Program
Status: Implemented
Overview
CProgSaturate is a saturating limiter: it clamps every input sample into
a configured [min, max] range and writes the result to an output IO.
Unlike IO limits, which reject out-of-range config writes, it conditions the
data itself.
Implementation
CProgSaturate is a CProgProcess program: each notify-capable source
is clamped into its output on every notification, batches included. A
deferred virt output takes the source’s dimension, batch and notify
support; other outputs get the latest sample of a batch.
Supported types:
bool, 8/16/32-bit integers,float,doubleandb16. Bounds are encoded in the source type: two’s complement or plain words for integers, a float word for real types, a 16.16 word forb16.The output type must match the input type; a mismatched output is not written.
Either bound may be omitted; that side then defaults to the type limit.
A NaN input passes through to the output.
Runtime configuration
min and max are runtime-writable when their config items are marked
rw (a config IO targeting them); a new bound applies from the next
sample.
Configuration
Kconfig
CONFIG_DAWN_PROG_SATURATE: enables the Saturate program (requiresCONFIG_DAWN_DTYPE_NUMERIC).
YAML
programs:
- id: cur_sat
type: saturate
dtype: int32 # must match the source dtype
config:
sources: [cur]
outputs: [cur_sat]
min: 0
max: 0x0fff
dawnpy checks that the program dtype matches the source dtype and that the
bounds fit its range.
External Control
ControlIO: not supported.
TriggerIO: not supported.