Bit Pack
Component Type: Program
Status: Implemented
Overview
CProgBitPack combines multiple typed inputs into one packed output bitstream.
Each input contributes its logical bits starting at the configured bit
offset. bool contributes one logical bit per element; other fixed-width
scalar dtypes contribute their raw element bit pattern.
This is the inverse of CProgBitSplit.
Implementation
Standalone program (CProgCommon-based), no thread.
Registers notification callbacks on all notify-capable inputs.
Rebuilds the packed output buffer from all current input values on each callback.
The output is producer-owned by
bitpack: deferredvirtoutputs are initialized with the dimension required to hold the highest configured input bit range, and configured writable outputs are validated before use.Input objects are consumer-side only and must already be usable before
bitpackstarts.Unsupported dtypes:
charandblock.
Logical bit model
For
boolIOs, each element contributes one bit.For other supported fixed-width scalar dtypes, each element contributes
dtype_size * 8bits.The
bitfield is the start offset in the packed output bitstream.Example:
uint8[4]atbit: 0can produce0x44332211when the input bytes are[0x11, 0x22, 0x33, 0x44]and the output isuint32oruint64with enough capacity.
Configuration
Kconfig
CONFIG_DAWN_PROG_BITPACK: enables the program.
YAML
programs:
- id: my_bitpack
type: bitpack
config:
inputs:
- io: flag_a
bit: 0
- io: flag_b
bit: 1
- io: u8_bytes
bit: 8
output: packed
Supported descriptor patterns include:
bool + bool -> uint32bitmask packinguint8[4] -> uint32oruint64bool -> uint64