Expand description
Q16.16 fixed-point ingress path for FPGA and bare-metal deployment.
quantize_q16_16 / dequantize_q16_16, saturation arithmetic.
Enables deployment on RISC-V RV32I, Cortex-M0, and custom FPGA pipelines
without a hardware FPU. Mode label "fixed_q16_16" for SigMF provenance.
Fixed-point ingress path for FPGA soft-core and bare-metal deployment.
§Context
While dsfb-rf is purely f32-based in the observer hot path, a number
of deployment targets lack a hardware FPU:
- RISC-V RV32I without the
Fextension (e.g.,riscv32imac-unknown-none-elf) - Cortex-M0/M0+ (ARMv6-M — no FPU)
- FPGA soft-cores (MicroBlaze without DSP48, PicoRV32)
- Custom ASICs / VLSI pipelines in e.g. C-UAS / EW front-ends
In these contexts, the ADC lane residual arrives as a raw integer sample
and converting to f32 before the observer introduces software FPU
overhead. The Q16.16 fixed-point format provides:
- 16 integer bits: supports residual norms up to 65535 (far beyond any normalised IQ residual)
- 16 fractional bits: resolution of 2⁻¹⁶ ≈ 1.526 × 10⁻⁵ — comfortably below the 14-bit ADC quantisation step on typical SDRs
- 32-bit arithmetic: fits in a single 32-bit ALU word; multiply in
i64then shift avoids overflow
§Format conventions
An i32 in Q16.16 format represents the real number x = raw / 2^16.
quantize(x) = round(x × 2^16) [f64 → Q16.16 i32]
dequantize(raw) = raw as f64 / 2^16 [Q16.16 i32 → f64]
to_f32(raw) = raw as f32 / 65536.0 [Q16.16 i32 → f32 for observer]Saturation on overflow prevents undefined behaviour and limits anomaly injection from wildly out-of-range inputs.
§DSFB-Semiotics-Engine source
The quantize_q16_16 / dequantize_q16_16 pair mirrors the reference
implementation in dsfb-semiotics-engine/math/fixed_point.rs (de Beer 2026).
The mode label "fixed_q16_16" is preserved for provenance traceability
in SigMF annotations.
§Design
no_std,no_alloc, zerounsafe- All functions are
#[inline]for zero-cost abstraction - No
libmdependency — arithmetic is pure integer + bit-shift
Structs§
- Periodic
Resync Config - Configuration for periodic fixed-point accumulator resynchronisation.
Constants§
- FRAC_
BITS - Fractional bits in the Q16.16 format.
- MAX_
VALUE - Maximum representable value in Q16.16 as
f64. - MIN_
VALUE - Minimum representable value in Q16.16 as
f64. - MODE_
LABEL - Provenance mode label for SigMF annotation.
- RESOLUTION
- Resolution (1 LSB) of the Q16.16 format in real units.
- SCALE
- Scale factor: 2^FRAC_BITS.
Functions§
- add_
q16_ 16 - Add two Q16.16 values with saturation.
- apply_
periodic_ resync - Apply a periodic resynchronisation correction to one Q16.16 accumulator.
- dequantize_
q16_ 16 - Dequantise a Q16.16
i32back tof64. - mul_
q16_ 16 - Multiply two Q16.16 values and return a Q16.16 result.
- q16_
16_ to_ f32 - Convert a Q16.16
i32directly to anf32for the observer hot path. - quantize_
f32 - Quantise an
f32into Q16.16. - quantize_
q16_ 16 - Quantise a
f64value into Q16.16 fixed-point format (i32).