OpenCompact User Guide¶
OpenCompact compresses multispectral and hyperspectral images according to CCSDS 123.0-B-2, Low-Complexity Lossless and Near-Lossless Multispectral and Hyperspectral Image Compression. This guide explains how to integrate the core: sources, generics, interfaces, operating sequence, protection scope, integration constraints, performance, the conformance statement, the reference data, the decompression of compressed images and the corrected defects.
1. Sources¶
| Library | Files | Content |
|---|---|---|
olo |
All of open-logic/src/base, open-logic/src/axi and open-logic/src/ft in the order of open-logic/compile_order.txt (used: olo_ft_ram_sdp, olo_ft_fifo_sync, olo_base_pl_stage, olo_base_wconv_n2m, olo_axi_lite_slave and their dependencies) |
Open Logic, fault-tolerant fork, tag 4.8.0-ft.2 (based on Open Logic 4.8.0) |
opencompact |
hdl/<module>/src/*.vhd of every module of component_list.txt, in the order of compile_order.txt: the modules in the order of component_list.txt, within a module packages first |
OpenCompact; top level ocp_core, or ocp_channel (section 4.3) |
All sources are VHDL-2008 and contain no vendor primitive. tools/synth_libero.py shows a complete synthesis and
place and route flow (Microchip Libero SoC); tools/ocp_wrapper.py writes a synthesis top level with the generics of a
configuration for any other tool.
2. Generics¶
All parameters of CCSDS 123.0-B-2 are generics of ocp_core; the header of the compressed image is computed from
them. Per-band tables are integer_vector generics: element z belongs to band z and the last element repeats for the
remaining bands, so (0 => 2) gives the value 2 to every band.
2.1 Image and compressed image¶
| Generic | Default | Range | Header field (CCSDS) |
|---|---|---|---|
XSize_g, YSize_g, ZSize_g |
8, 8, 4 | 1 to 65536 | X, Y, Z Size (5.3.2.2) |
DynamicRange_g |
16 | 2 to 32 | Dynamic Range, Large Dynamic Range Flag |
SignedSamples_g |
false | Sample Type | |
UserData_g |
0 | 0 to 255 | User-Defined Data |
EncodingOrder_g |
"BI" | "BI", "BSQ" | Sample Encoding Order (5.4.2) |
SubFrameDepth_g |
4 | 1 to NZ | Sub-Frame Interleaving Depth M (BI order) |
OutputWordSize_g |
1 | 1 to 8 | Output Word Size B (5.2.2) |
EntropyCoder_g |
"SAMPLE_ADAPTIVE" | "SAMPLE_ADAPTIVE", "HYBRID", "BLOCK_ADAPTIVE" | Entropy Coder Type |
SupTableCount_g |
0 | 0 to 15 | Supplementary Information Table Count |
SupTableData_g |
x"00" | Supplementary Information Tables subpart (5.3.2.3), byte-aligned, as encoded by the user |
2.2 Predictor¶
| Generic | Default | Range | Header field (CCSDS) |
|---|---|---|---|
PredictionBands_g |
3 | 0 to 15 | Number of Prediction Bands P (4.2) |
PredictionMode_g |
"FULL" | "FULL", "REDUCED" | Prediction Mode (4.3) |
LocalSum_g |
"WIDE_NEIGHBOR" | "WIDE_NEIGHBOR", "NARROW_NEIGHBOR", "WIDE_COLUMN", "NARROW_COLUMN" | Local Sum Type (4.4) |
RegisterSize_g |
64 | max(32, D + Omega + 2) to 64 | Register Size R (4.7.2) |
WeightResolution_g |
13 | 4 to 19 | Weight Component Resolution Omega (4.6.1) |
WeightUpdateInterval_g |
6 | 4 to 11 | log2 of the Weight Update Scaling Exponent Change Interval tinc (4.10.2) |
WeightUpdateVmin_g, WeightUpdateVmax_g |
-1, 3 | -6 <= vmin <= vmax <= 9 | Weight Update Scaling Exponent Initial and Final Parameter |
WeightExpOffsetsUsed_g |
false | Weight Exponent Offset Flag (4.10.4) | |
WeightExpOffsetTable_g |
false | Weight Exponent Offset Table in the header (5.3.3.3.3) | |
WeightExpOffsets_g |
(0 => 0) | -6 to 5 | Per band: intra-band offset (full mode), then Pz* inter-band offsets, in the order of the table |
CustomWeights_g |
false | Weight Initialization Method (4.6.3) | |
WeightInitTable_g |
false | Weight Initialization Table in the header (5.3.3.3.2) | |
WeightInitResolution_g |
0 | 3 to Omega + 3 | Weight Initialization Resolution Q |
WeightInitValues_g |
(0 => 0) | Q-bit signed | Per band Cz components, in the order of the table |
2.3 Quantizer and sample representatives¶
| Generic | Default | Range | Header field (CCSDS) |
|---|---|---|---|
Fidelity_g |
"LOSSLESS" | "LOSSLESS", "ABSOLUTE", "RELATIVE", "ABSOLUTE_RELATIVE" | Quantizer Fidelity Control Method (4.8.2.1) |
PeriodicUpdate_g, UpdatePeriodExp_g |
false, 0 | u: 0 to 9 | Periodic Updating Flag, Update Period Exponent (4.8.2.4) |
AbsBandDependent_g, AbsBitDepth_g, AbsErrorLimits_g |
false, 1, (0 => 0) | DA: 1 to min(D - 1, 16) | Absolute Error Limit block (5.3.3.4.3) |
RelBandDependent_g, RelBitDepth_g, RelErrorLimits_g |
false, 1, (0 => 0) | DR: 1 to min(D - 1, 16) | Relative Error Limit block (5.3.3.4.4) |
SampleRepResolution_g |
0 | 0 to 4 | Sample Representative Resolution Theta; above 0 the Sample Representative subpart is included (5.3.3.5) |
DampingBandVarying_g, DampingTable_g, Damping_g |
false, false, (0 => 0) | 0 to 2^Theta - 1 | Damping phi_z (4.9.1) |
OffsetBandVarying_g, OffsetTable_g, Offset_g |
false, false, (0 => 0) | 0 to 2^Theta - 1 | Offset psi_z |
With periodic updating, AbsErrorLimits_g and RelErrorLimits_g are not used: the limits come from the Lim port.
2.4 Entropy coders¶
| Generic | Default | Range | Header field (CCSDS) |
|---|---|---|---|
UnaryLimit_g |
16 | 8 to 32 | Unary Length Limit Umax |
RescaleCounterSize_g |
6 | max(4, gamma0 + 1) to 11 | Rescaling Counter Size gamma* |
InitialCountExp_g |
1 | 1 to 8 | Initial Count Exponent gamma0 |
AccuInitBandVarying_g, AccuInitTable_g, AccuInit_g |
false, false, (0 => 3) | 0 to min(D - 2, 14) | Sample-adaptive coder: Accumulator Initialization Constant K (first element) or the values k''_z per band, and their table (5.3.4.2) |
HybridAccuInit_g, HybridAccuInitHigh_g |
(0 => 0), (0 => 0) | 0 to 2^(D + gamma0) - 1 | Hybrid coder: initial high-resolution accumulator per band, HybridAccuInitHigh_g 2^31 + HybridAccuInit_g (5.4.3.3.4.3, not in the header); with RuntimeParams_g they set the smallest gamma0 an image can use (section 4.5) |
BlockSize_g |
16 | 8, 16, 32, 64 | Block-adaptive coder: Block Size J |
RestrictedCodes_g |
false | D <= 4 | Restricted Code Options Flag |
RefInterval_g |
4096 | 1 to 4096 | Reference Sample Interval r |
2.5 Implementation¶
| Generic | Default | Range | Description |
|---|---|---|---|
OutWidth_g |
8 | 8, 16, 32, 64 | Width of the compressed image interface in bits (section 4) |
Speculation_g |
true | Speculative weight loop of the predictor where it applies (section 8) | |
UseInLast_g |
false | Image framing with In_Last: early and missing image ends are detected, flagged and resynchronised (section 4.2) |
|
RuntimeConfig_g |
false | Image dimensions and band-independent error limit values of every image from the configuration ports (section 4.4); XSize_g, YSize_g and ZSize_g are then the maxima |
|
RuntimeParams_g |
false | true only with RuntimeConfig_g |
User-defined data, M, the weight update parameters and the entropy coder parameters of every image from the configuration ports (section 4.5); SubFrameDepth_g, RescaleCounterSize_g and RefInterval_g are then the maxima, the other parameter generics the values after a reset |
RamStyle_g |
"auto" | Implementation of the memories: passed unchanged to RamStyle_g of the Open Logic RAMs and FIFOs, which set the synthesis attributes ram_style and ramstyle with it (values of the synthesis tool, for example "block" or "distributed"); the simulation does not depend on it |
The stride order of the predictor is used wherever it applies (section 8.1); it has no generic at the core level.
With RuntimeConfig_g it is not used.
The elaboration stops for parameter values that the standard does not allow (section 7). Every value of a generic that
changes the structure of the core is simulated, and the bounds of every numeric range are synthesised; the
verification report of ocp_core lists the simulated and synthesised values of every generic. The image dimensions
are verified in part: NX, NY, NZ and M are simulated from 1 to 64, 64, 48 and 48 (the CCSDS test data set reaches 66
columns, 513 rows, 239 bands and M = 32) and synthesised in these ranges and at 65536, with the other dimensions at 1
or 2. Larger images are not verified.
The supplementary information tables are given as their encoded subpart: per table the 16 bits of table type, purpose,
structure and user-defined data, then the Table Data subblock with its fill bits (5.3.2.3). The function
sup_table_hex of tools/ocp_generics.py produces the value of SupTableData_g from the table values.
3. Clock and reset¶
The core has one clock Clk. Rst is synchronous and high-active and must last at least one clock cycle; the
integrator synchronises it, for example with olo_base_reset_gen (SyncTmr_g = true for a triplicated
synchroniser). After the reset the core waits for the first sample
of an image. A reset at any time aborts the image in progress (header, body or tail); the next image is compressed
from the initial state of the standard. The memories need no initialisation: the core uses data read from a memory
only after it has been written in the same image.
From the release of Rst on, every memory address, every control signal and every output port of the core is
defined, except the data of a stream whose valid is '0' (CO-RS-02). The datapath registers of the pipeline stages
have no reset; until the first image they hold undefined values that are never used, because their stages hold no
valid item. A simulation with the warnings of the IEEE packages (numeric_std) therefore reports a bounded burst
of metavalue warnings after a reset: the comparisons of the datapath on these values while they pass the
pipeline of the predictor once, at most one pipeline depth (up to about 35 clock cycles) after the release of
Rst, and none after it. These warnings never come from a memory access. A change of an input of the core while
In_Valid is '0', before the first image, can repeat the burst. A testbench that checks streams for metavalues
qualifies the data with the valid, as the AXI4-Stream protocol checks do.
A reset during an image also ends its output, in ocp_core and in ocp_channel. From the first rising edge of Clk
with Rst = '1', Out_Valid and Out_Last are '0', and the words of the compressed image that the output stream has
not taken are discarded. The packet of that image therefore ends without Out_Last; a word taken at the clock edge
at which Rst is first '1' belongs to it. After the reset the next word is the first word of the next compressed
image. A block that frames the compressed image stream into packets or chunks must be reset in the same clock cycle
as the core, for example by a reset group that resets both from one source (section 7); otherwise it adds the next
image to the open packet.
4. Interfaces¶
| Port | Direction | Width | Description |
|---|---|---|---|
In_Valid, In_Ready, In_Data |
in, out, in | D | Samples, unsigned or two's complement, in the input order of the compressed image |
In_Last |
in | 1 | '1' with the last sample of every image (UseInLast_g, section 4.2); unused otherwise, may stay open |
In_Error |
in | 1 | With In_Last: the image ends with an error (UseInLast_g, section 4.2); unused otherwise, may stay open |
Lim_Valid, Lim_Ready, Lim_Data |
in, out, in | 16 | Error limit values for periodic updating (unused otherwise) |
Out_Valid, Out_Ready, Out_Data, Out_Keep, Out_Last |
out, in, out, out, out | OutWidth_g, OutWidth_g / 8 |
Compressed image in words: byte n of a word in Out_Data bits 8n + 7 to 8n, so the first byte of the image is in bits 7 to 0 of the first word; Out_Last on the last word of an image, whose valid bytes Out_Keep marks (bit n for byte n, contiguous from bit 0); all other words are complete |
Out_Error |
out | 1 | Valid with Out_Last: '1' when the image had a framing error (section 4.2); '0' on every other word and without UseInLast_g |
Ecc_Sec, Ecc_Ded |
out | 1 | One-cycle pulses: corrected single error, detected double error in a memory |
Ev_ImageError |
out | 1 | One-cycle pulse per image with a framing error (section 4.2), for a counter or an interrupt |
ErrInj_Channel, ErrInj_Double, ErrInj_Valid |
in | 4, 1, 1 | Error injection for tests: a pulse on ErrInj_Valid flips one bit (ErrInj_Double = '0') or two bits of the next word written into the memory of channel ErrInj_Channel (section 4.1); tie to '0' in operation |
All streams use the AXI4-Stream handshake: a transfer takes place in a cycle with valid and ready high.
The compressed image is a sequence of bytes; within a byte the first bit is the most significant bit (CCSDS 1.6.3).
The bytes are placed in increasing order of their position in the word, the order of byte-addressed memory buses (AXI
puts the byte at address offset n on bits 8n + 7 to 8n) and of the Open Logic width converters: a word written into
memory keeps the byte order of the compressed image, and the 8-bit stream after olo_base_wconv_xn2n is the
compressed image itself. Example with
OutWidth_g = 32 and an image of the six bytes B0 to B5 (B = 1, 2, 3 or 6):
| Word | Out_Data 31:24 |
23:16 | 15:8 | 7:0 | Out_Keep |
Out_Last |
|---|---|---|---|---|---|---|
| 1 | B3 | B2 | B1 | B0 | "1111" | '0' |
| 2 | - | - | B5 | B4 | "0011" | '1' |
The input order (CCSDS 5.4.2) is:
- BI with depth M: for every row y, for every group of M bands (the last group may be smaller), for every column x, the bands of the group in increasing order. M = NZ is BIP, M = 1 is BIL.
- BSQ: band by band, every band row by row.
With periodic error limit updating, the core reads the error limit values at the start of every frame y with y mod 2^u = 0, before the first sample of that frame: the absolute limits (A, or a_0 to a_(NZ-1)) followed by the relative limits (R, or r_0 to r_(NZ-1)), each as a 16-bit value of which DA or DR bits are used.
4.1 Memories and error injection¶
Every memory of the core is protected by a SECDED code: a single bit error in a word is corrected when the word is
read (Ecc_Sec), a double bit error is detected (Ecc_Ded). The tables of the configuration (low-entropy codes,
initial weights and accumulators, damping and offset values) are constants and map to logic. The channels of the error
injection:
| Channel | Memory | Present |
|---|---|---|
| 0 | Sample representatives of the current line of every band | always |
| 1 | Window of the previous line of every band | BI order with M > 1 |
| 2 | Sample representative of the previous sample of every band | always |
| 3 | First sample representative of the line of every band | always |
| 4 | Central local differences of the previous bands | P > 0 in BSQ order or in BI order with M < NZ |
| 5 | Weights of every band | C > 0, except with the speculative weight loop in BSQ order and in single-band images |
| 6 | Band-dependent absolute error limits | periodic error limit updating with band-dependent absolute limits |
| 7 | Band-dependent relative error limits | periodic error limit updating with band-dependent relative limits |
| 8 | Output FIFO of the predictor | always |
| 9, 10, 11 | Input buffer, output buffer and local differences of the stride order | stride order (section 8.1) |
| 12 | Statistics of the entropy coder | sample-adaptive and hybrid coder |
| 13 | Codeword buffer of the entropy coder | always |
The flags count only in cycles in which the core takes the read data for an item: an upset of a word that is not read
again, or that is read only in a cycle without an item, raises no alarm. An injection into a channel without memory has
no effect.
tools/ocp_throughput.py (ecc_channels) lists the channels of a configuration.
4.2 Image framing¶
The core counts the NX NY NZ samples of an image by itself. When samples get lost upstream, for example in a lost
packet, it would compress the samples of the next image as the rest of the damaged one, and every following image
would start at the wrong sample. With UseInLast_g the core checks the image end marker In_Last against its count
and resynchronises:
| Case | Behaviour of the core |
|---|---|
In_Last with the last sample |
Correct image: Out_Error = '0' on its last word |
In_Last before the last sample (samples lost inside the image) |
The image is aborted: it ends with the sample with In_Last. The compressed image is the compressed image of the samples taken (the header of the complete image, the codewords of the samples taken, the end of the image of the entropy coder and the fill bits up to a multiple of B bytes), independent of the timing, and its last word carries Out_Error = '1'. The next sample starts a new image with its own header; no sample of it is lost. |
No In_Last with the last sample (the end marker was lost) |
The image is completed normally; its last word carries Out_Error = '1'. The core then takes the following samples and discards them, one per clock cycle, up to and including the next sample with In_Last; the sample after it starts a new image. |
In_Last and In_Error with the last sample (the source knows that samples of the image are faulty) |
The image is completed normally and identical to the image without In_Error; its last word carries Out_Error = '1'. The next sample starts a new image. Before the last sample, In_Last and In_Error abort the image as In_Last alone; In_Error without In_Last has no effect. |
Ev_ImageError pulses once for every image with an error, when the error is detected at the input (with In_Error on
the last sample: when that sample is taken). An aborted image is the compressed image of the samples taken; a decoder
that is given the number of samples taken (L + 1, with L the index of the sample with the early In_Last in the input
order of the image, counted from 0) decodes it; the header announces the complete image (NX NY NZ samples), so a decoder
that relies on the header alone expects the codewords of all samples and does not decode it. The samples taken before
the loss are those of the image; tools/ocp_model.py (compress_aborted) reproduces the compressed image. An image
without its end marker is complete, but its last samples may belong to the next image. The system marks or discards both
kinds by Out_Error. The stream stays aligned to B bytes, so the next image starts like after a correct one.
Error limit values (periodic updating): after an early In_Last the core takes none for three clock cycles, after a
missing In_Last none until the sample with In_Last; the next value it takes belongs to the first frame of the next
image. A source that computes the values on request (Lim_Ready) needs no action; a source that delivers them ahead (a
buffer) drops the remaining values of the damaged image within two clock cycles of Ev_ImageError. The limit values are
part of the compressed image, so values that do not match their frame change only the compression of that image, never
its decodability.
Integration with OpenSPP: ocp_channel (section 4.3) takes the SDUs of the receive port, sets In_Last from the end
mark of the SDUs and In_Error for faulty SDUs, and counts the affected images.
4.3 Compression channel (ocp_channel)¶
ocp_channel is the core packaged for a system: the samples arrive as service data units (SDUs) on a byte stream,
for example from the receive port of an OpenSPP core, every compressed image leaves as one packet of a byte stream,
and an AXI4-Lite slave reports the configuration and counts the images and errors. It consists of ocp_input_adapter,
ocp_core with the image framing, an output width converter and ocp_mib; the adapter and the MIB are library
entities that can also be used on their own around ocp_core. Specifications:
ocp_channel,
ocp_input_adapter, ocp_mib.
Generics: all generics of ocp_core with the same names and meanings (OutWidth_g is the width of the words of the
core), except UseInLast_g, which is always true, and:
| Generic | Default | Range | Description |
|---|---|---|---|
InStreamWidth_g |
128 | 8, 16, 32, 64, 128 | Width of the SDU stream in bits |
OutStreamWidth_g |
128 | 8, 16, 32, 64, 128 | Width of the compressed image stream in bits |
UserWidth_g |
1 | 1 to 64 | Width of the user signal of the SDU stream |
UserLastMask_g, UserLastValue_g |
(others => '0') | UserWidth_g bits |
End mark: an SDU with (In_User and UserLastMask_g) = UserLastValue_g is the last SDU of an image |
UserErrorMask_g |
(others => '0') | UserWidth_g bits |
Faults: an SDU with (In_User and UserErrorMask_g) /= 0 is faulty |
Ports: In_Valid, In_Ready, In_Data, In_Keep, In_Last, In_User (SDU stream); Out_Valid, Out_Ready,
Out_Data, Out_Keep, Out_Last, Out_Error (compressed images); S_AxiLite_* (8-bit address, 32-bit data);
Lim_*, Ecc_Sec, Ecc_Ded, Ev_ImageError and ErrInj_* as on ocp_core.
SDUs: every SDU carries a whole number of samples in the input order, each in a container of ceil(D/8) bytes, the
first byte of a container its most significant byte and the value in its D least significant bits (two's complement
for signed samples); byte n of a beat is in bits 8n + 7 to 8n, all bytes are valid except in the last beat of an SDU,
whose valid bytes are contiguous from byte 0. The user signal counts with the last beat of an SDU. sdu_payload of
tools/ocp_model.py turns the samples of an image into this byte stream.
Errors: an SDU that is flagged by UserErrorMask_g or does not hold a whole number of containers ends its image with an
error, and the SDUs after it up to and including the next end mark are discarded; a lost or late end mark is handled by
the image framing of the core (section 4.2). Every image with an error leaves as a packet with Out_Error on its last
beat: aborted (the compressed image of the samples taken, section 4.2) or, when the faulty SDU completed the image, the
complete compressed image. The channel specification lists the counter steps of every case.
Status registers: register map, C header sw/ocp_regs.h. ID 0x4F435003; the
generics that define the compressed images (image size, dynamic range, order, output word size, coder, predictor,
weights and coder parameters); 32-bit saturating counters IMAGES_DONE, IMAGES_ABORTED, SDU_ERRORS, SDUS_DISCARDED,
ECC_CORRECTED and ECC_UNCORRECTABLE, each cleared by a write. tools/ocp_mib_words.json holds the expected
configuration registers of the configurations of tools/ocp_configs.py.
Runtime configuration (RuntimeConfig_g, section 4.4): software writes the configuration of the next images into
NEXT_X, NEXT_Y, NEXT_Z and NEXT_LIMITS (they read back what is written) and writes '1' to CONTROL.COMMIT. The COMMIT
checks every value (NX, NY, NZ from 1 to the maxima, NX from 2 with full prediction or neighbour-oriented local sums,
the error limit values of the methods in use below 2^DA and 2^DR): valid values reach the core in one clock cycle
and STATUS.CFG_PENDING stays '1' until the core takes them at its next image start; a value out of range sets
STATUS.CFG_ERROR (cleared by writing '1') and changes nothing. IMAGE_X, IMAGE_Y, IMAGE_Z, ORDER.SUB_FRAME_DEPTH and
LIMITS show the values of the last image that started, as the core took them. A configuration committed while an
image is compressed applies to the next image; a COMMIT in the clock cycle of the image start applies to the image
after it. Without the runtime configuration the five registers read zero and ignore writes, and LIMITS reads the
error limit values of the generics.
Runtime parameters (RuntimeParams_g, section 4.5): NEXT_SAMPLES, NEXT_ORDER, NEXT_WEIGHTS, NEXT_ADAPTIVE and
NEXT_BLOCK hold the parameters of the next images in the field layout of SAMPLES, ORDER, WEIGHTS, ADAPTIVE and BLOCK,
so one field definition serves both. The same COMMIT checks them with the dimensions (the ranges of section 4.5, the
dependent ones against the pending values: gamma* against gamma0, vmax against vmin, M against NEXT_Z) and passes
everything in one clock cycle; the parameter fields of SAMPLES to BLOCK then show the values of the last image that
started. Fields of options not in use (M in BSQ order, the coder parameters of the other coders, K with band-varying
accumulator initialisation) read zero and ignore writes. Without the runtime parameters the five registers read zero
and ignore writes. GENERICS.RUNTIME_PARAMS shows the generic; the ID reads version 3 of the register map.
Integration with OpenSPP: connect the receive port of the Octet String Service (M_Rx_*, DataWidth_g =
InStreamWidth_g) and set UserWidth_g = 22, UserLastMask_g = 22x"3FC000" and UserLastValue_g = 22x"004000" (the
sender marks the last SDU of an image with the CPTP User Application value 1), UserErrorMask_g = 22x"003000" (Data
Loss Indicator, bit 12, with the continuity check of the APID enabled; receive buffer error, bit 13).
Sources without an image end mark: ocp_channel always ends an image at the end mark of an SDU. A source that cannot
mark the last SDU of an image uses the blocks of ocp_channel around ocp_core with UseInLast_g = false instead:
ocp_input_adapter with UserErrorMask_g as needed (with the end mark generics at their defaults it marks every SDU,
which the core then ignores), ocp_core, which ends every image after NX NY NZ samples (CO-FR-01, section 4.2),
olo_base_wconv_n2m from OutWidth_g to the width of the output stream, and ocp_mib with Ev_ImageDone from the
last word of every compressed image and Ev_ImageAborted at '0'. A faulty SDU is then counted (SDU_ERRORS) but does not
end its image: the images stay aligned only while the source delivers exactly NX NY NZ samples per image, and a lost or
added sample shifts every later image until a reset. With the end mark, ocp_channel starts the next image at the next
end mark instead. This assembly is not tested as a whole; its blocks are.
4.4 Runtime configuration¶
With RuntimeConfig_g = true the image dimensions NX, NY, NZ and the band-independent absolute and relative error
limit values can change from image to image. XSize_g, YSize_g and ZSize_g are then the maxima, for which the
memories and counters are sized; all other parameters stay generics. ocp_channel sets the values through its
AXI4-Lite registers (section 4.3); ocp_core alone takes them from its configuration ports:
| Port | Direction | Width | Description |
|---|---|---|---|
Cfg_XSize, Cfg_YSize, Cfg_ZSize |
in | 17 | NX, NY, NZ of the next image, 1 to the maxima |
Cfg_AbsLimit, Cfg_RelLimit |
in | 16 | Absolute and relative error limit value of the next image, 0 to 2^DA - 1 and 2^DR - 1 (unused for a method not in use) |
Cfg_Taken |
out | 1 | Pulse in the clock cycle in which the core takes the configuration inputs |
Act_XSize, Act_YSize, Act_ZSize, Act_AbsLimit, Act_RelLimit |
out | 17, 16 | The values the core took for the last image, from the clock cycle after Cfg_Taken (after a reset the maxima and the first error limit values of the generics; zero for a method not in use) |
The core takes the five inputs in the clock cycle in which it accepts the first sample of an image (Cfg_Taken) and
uses them for the whole image: its samples, its header and, with the image framing, its early end or the samples
discarded after it. A change of the inputs at any other time does not affect the image in progress, so the
configuration of the next image can be set while an image is compressed. The inputs change together in one clock
cycle (ocp_mib does): inputs that change in different cycles around an image start can give the image a mix of the
previous and the new values. In BI order the image uses M = min(SubFrameDepth_g, NZ).
The core checks every value when it takes it. A value outside its range is taken as the nearest valid value (NX, NY,
NZ below 1 as 1 and above the maximum as the maximum; NX = 1 as 2 where images must be at least two samples wide; an
error limit value above 2^DA - 1 or 2^DR - 1 as that value), and a simulation assertion of severity warning reports
it. The image is compressed with the values taken, its header carries them and the Act_ outputs show them. An
upset of the configuration registers therefore cannot make the core address outside its memories or lose the end of
an image.
The quantizer fidelity (Fidelity_g) is a generic and cannot change from image to image. An image that must be
reconstructed exactly is compressed with the error limit value 0 of every method in use: the maximum error is then 0
(CCSDS 4.8.2.1) and every decompressed sample equals the original sample. The header of such an image declares
near-lossless compression with the limit 0, which every CCSDS 123.0-B-2 decompressor decodes. The error limit value 0
means an exact reconstruction, not the bytes of a lossless compression. Without damping the body of the compressed image
equals that of the same configuration in lossless mode and only the header differs (a few bytes). With damping the
sample representatives (CCSDS 4.9) and with them the prediction differ, so the body differs too: in a check with the
reference model, an image of a runtime configuration of the regression with damping (rc02) was 4 bytes longer than in
lossless mode, 3 of them in the header.
The header carries the values of every image: X Size, Y Size, Z Size, the sub-frame interleaving depth (BI order) and the absolute and relative error limit values replace the bits of the header of the maxima at fixed positions, so the length of the header does not change. The elaboration stops for the configurations whose header or quantizer cannot follow values that change from image to image: periodic error limit updating, band-dependent error limits, header tables whose length depends on NZ (weight initialisation table, weight exponent offset table, band-varying damping or offset table, accumulator initialisation table) and supplementary information tables. Per-band values that are not in the header (table flags false) are given for the maximum NZ; an image of NZ bands uses the first NZ of them, and the decompressor must know them (section 7).
The predictor computes the issue conditions of every image before its first sample (image-start sequencer, see the architecture of the predictor) and does not use the stride order; the throughput is that of section 8.1 for the dimensions of the image, plus 8 to 10 clock cycles per image.
4.5 Runtime parameters¶
With RuntimeParams_g = true (and RuntimeConfig_g = true) every image also takes its own user-defined data, its
sub-frame interleaving depth M (BI order), its weight update parameters and the parameters of the entropy coder of
EntropyCoder_g. The core takes them with the configuration of section 4.4, in the same clock cycle (Cfg_Taken):
| Port | Width | Value (range) | Used with |
|---|---|---|---|
Cfg_UserData |
8 | User-defined data (0 to 255) | Always |
Cfg_M |
17 | M (1 to min(SubFrameDepth_g, NZ)) |
BI order |
Cfg_WeightInterval |
4 | log2 t_inc (4 to 11) | Always |
Cfg_WeightVmin, Cfg_WeightVmax |
5 each | vmin (-6 to 9), vmax (vmin to 9), two's complement | Always |
Cfg_UnaryLimit |
6 | Umax (8 to 32) | Sample-adaptive and hybrid coder |
Cfg_InitCountExp |
4 | gamma0 (1 to min(8, RescaleCounterSize_g - 1); with the hybrid coder from the smallest value for which every initial accumulator of HybridAccuInit_g is below 2^(D + gamma0)) |
Sample-adaptive and hybrid coder |
Cfg_RescaleSize |
4 | gamma* (max(4, gamma0 + 1) to RescaleCounterSize_g) |
Sample-adaptive and hybrid coder |
Cfg_AccuInit |
4 | K (0 to min(D - 2, 14)) | Sample-adaptive coder with AccuInitBandVarying_g false |
Cfg_RefInterval |
13 | r (1 to RefInterval_g) |
Block-adaptive coder |
The outputs Act_UserData to Act_RefInterval (the same widths) show the values taken for the last image, from the
clock cycle after Cfg_Taken; after a reset they show the values of the generics, and zero for a parameter not in
use. Inputs of parameters not in use are ignored.
A value outside its range is taken as the nearest valid value, as in section 4.4, and a simulation assertion of severity warning reports it. A range that depends on another parameter is applied after that one with its limited value: gamma* after gamma0, vmax after vmin, M after NZ. The image is compressed with the values taken; its header carries them in their fields (User-Defined Data, Sub-Frame Interleaving Depth, the weight update fields of the predictor metadata and the fields of the entropy coder metadata) at fixed positions, so the length of the header does not change.
The core holds the parameters of every image that has started until its header and its coder have used them, for up
to 16 images (the queue of section 4.4), in the encoding of their header fields and only for the options in use: 31 to
51 bits per image (specification of ocp_core, table 2). The predictor carries the weight update parameters with
every sample, so two images in its pipeline use their own values; the coders take theirs with the first item of an
image and keep them to its last item (the hybrid coder to the end of its tail). The throughput is that of section 4.4
with the M of every image.
The elaboration stops when RuntimeParams_g is true without RuntimeConfig_g, and with the hybrid coder when no
gamma0 up to min(8, RescaleCounterSize_g - 1) keeps every initial accumulator below 2^(D + gamma0).
5. Operating sequence¶
- Release the reset.
- Send the samples of the image in the input order (and the error limit values when they are requested). The header of the compressed image is output once the first sample or error limit value has been accepted.
- Take the compressed image from
OutuntilOut_Last. Its size is a multiple of the output word size B; the next image starts with a new word. - Send the next image; it is compressed independently with the same parameters. The samples of the next image may follow the last sample of an image without a gap.
- With
UseInLast_g, setIn_Laston the last sample of every image and checkOut_Erroron the last word of every compressed image (section 4.2). - With
RuntimeConfig_g, set the configuration of an image before its first sample: inocp_channelNEXT_X to NEXT_LIMITS and CONTROL.COMMIT, checking STATUS.CFG_ERROR; atocp_corethe configuration ports (section 4.4). The configuration of the next image can be set while an image is compressed; STATUS.CFG_PENDING shows when the core has taken it. WithRuntimeParams_gwrite NEXT_SAMPLES to NEXT_BLOCK before the same COMMIT (section 4.5).
The output can be stalled at any time; the core then stops taking samples after its internal buffers are full.
A detected double error (Ecc_Ded) may falsify the compressed image in progress; the core continues to the end of the
image. The system discards that image and resets the core before the next image. A corrected single error changes
nothing; its counter is a measure of the upset rate.
6. Protection scope¶
The core is designed for radiation environments together with the triple modular redundancy (TMR) of the synthesis tool, like the Open Logic ft entities it is built on. It protects the parts in the first rows itself and relies on TMR for all other logic:
| Part | Protection | Indication and test |
|---|---|---|
Memories of the predictor (sample representatives, window of the previous line, previous and first sample representatives, central local differences, weights, band-dependent error limits, output FIFO, buffers of the stride order) and of the entropy coder (statistics, codeword buffer): olo_ft_ram_sdp and olo_ft_fifo_sync, channels 0 to 13 of section 4.1 |
SECDED ECC of the Open Logic ft entities: a single error is corrected, a double error is detected; the compressed image in progress may then be wrong, and the system discards it and resets the core before the next image (section 5) | Ecc_Sec, Ecc_Ded; error injection through ErrInj_Channel, ErrInj_Double and ErrInj_Valid (section 4.1) |
| Clock domain crossings and reset synchronisers | None in the core: it runs in one clock domain, and the release of Rst is synchronised outside the core (section 3). Use triplicated synchronisers there (SyncTmr_g = true, for example olo_base_reset_gen): three synchroniser chains and a majority voter. Their registers carry the Synplify attribute syn_radhardlevel = none, so the TMR of the synthesis tool adds no voters between the stages |
none |
| State machines | Recovery state through the when others branch and the reset |
none |
| All other logic: registers of the control and data paths, counters, pointers, pipeline registers | TMR of the synthesis tool (for example syn_radhardlevel = tmr with Synplify, or the equivalent setting of the tool chain). The core adds no protection of its own for this logic; without TMR, an upset in it is not covered |
synthesis report |
ocp_channel adds no memory: the input adapter, the output converter and the status and configuration registers of
ocp_mib are registers and rely on TMR like all other logic. The block buffers of the block-adaptive coder, the error
flags of the image framer and the configurations of the runtime configuration (section 4.4) are registers: attributes
keep
synthesis from mapping them into RAM primitives without ECC, and they rely on TMR like all other logic. Out_Error and
Ev_ImageError report framing errors of the input (section 4.2), not memory errors. The tables of the configuration
(section 4.1) are constants and belong to the configuration memory of the FPGA.
The integrator:
- enables the TMR of the synthesis tool for the core and the logic around it,
- checks in the synthesis report that TMR was applied, that the synchroniser chains of the crossings were not triplicated a second time, and that no register-based storage meant to be protected by TMR was inferred as a RAM primitive,
- requests safe state machines, so that synthesis keeps the
when othersbranches (AMD Vivado: propertyFSM_SAFE_STATE=default_stateon the state registers; Synplify: attributesyn_encoding=safe), - protects the configuration memory of SRAM-based FPGAs by scrubbing; this is part of the FPGA design, not of the core.
With a synthesis tool that has no built-in TMR (AMD Vivado has no counterpart of syn_radhardlevel), the integrator
either triplicates the logic in a separate flow (a synthesis tool or a netlist flow that supports TMR for the target
family) or decides at system level how much unprotected logic the mission accepts, for example with two cores that
compress the same images and a comparison of their outputs that discards an image on a mismatch. The memories keep their
SECDED protection in every case, since it is part of the core.
The ECC paths are verified in simulation by error injection. Whether the protection as a whole meets the requirements of a mission is shown by a radiation test with the core in operation (TRL 5).
7. Integration constraints¶
| Constraint | Reason |
|---|---|
| Periodic error limit updating requires BI order | CCSDS 4.8.2.4.4 |
| An image of width 1 requires reduced prediction and column-oriented local sums | CCSDS 4.3.1, 4.4.1 (elaboration stops otherwise) |
| The elaboration stops for the parameter values of section 2 that the standard does not allow: register size below max(32, D + Omega + 2), width 1 with full prediction or neighbour-oriented local sums, vmin above vmax, periodic updating in BSQ order, M above NZ, block sizes other than 8, 16, 32 and 64, restricted code options with D above 4, rescaling counter sizes below max(4, gamma0 + 1) and accumulator initialisation values above min(D - 2, 14). The user keeps the other ranges of the standard, for example the values of the error limit and weight tables | The header fields have the widths of the standard and would carry most of these values; the compressed image would contradict its header |
| The decompressor must know the tables that are not included in the header (table flags false) and the initial accumulators of the hybrid coder | CCSDS 5.3.3.3.2.1, 5.4.3.3.4.3 |
The hybrid coder needs the end of the compressed image to decode it in reverse; Out_Last marks it |
CCSDS 5.4.3.3.1 |
| A block that frames the compressed image stream (packetizer, chunker) is reset in the same clock cycle as the core | A reset during an image ends its packet without Out_Last (section 3); a block that keeps its state adds the next image to the open packet |
| TMR of the synthesis tool enabled for the core | The core protects its memories itself and relies on TMR for all other logic (section 6) |
| Images larger than the verified range (NX, NY, NZ and M up to 64, 64, 48 and 48 in the regression; the CCSDS test data set up to 66 columns, 513 rows and 239 bands) are simulated by the integrator with the image sizes of the mission | Larger images are synthesised but not simulated (section 2.5); a defect that depends on the image size would not show in the verification of the core |
With UseInLast_g, In_Last accompanies the last sample of every image |
Otherwise every image is flagged and the samples up to the next In_Last are discarded (section 4.2) |
ocp_channel: every SDU carries a whole number of samples and no other bytes (no secondary header) |
Every byte is sample data; an SDU with a partial sample ends its image with an error (section 4.3) |
ocp_channel: a receiver that must identify the images with an error uses Out_Error or the counters |
An image ended by a faulty last SDU is complete and has the bytes of a correct image (section 4.3) |
With RuntimeConfig_g: no periodic error limit updating, no band-dependent error limits, no header tables whose length depends on NZ, no supplementary information tables |
The header and the quantizer follow the values of every image only for the other parameters; the elaboration stops otherwise (section 4.4) |
With RuntimeConfig_g, the configuration ports of ocp_core hold values in their ranges and change together in one clock cycle (ocp_mib checks the values and changes them together) |
A value out of range is taken as the nearest valid value and reported by a simulation warning; inputs that change in different clock cycles around an image start can give the image a mix of values (section 4.4) |
With RuntimeConfig_g, the decompressor knows the per-band values that are not in the header for the NZ of every image |
An image of NZ bands uses the first NZ values (section 4.4) |
RuntimeParams_g only with RuntimeConfig_g; with the hybrid coder some gamma0 up to min(8, RescaleCounterSize_g - 1) keeps every initial accumulator below 2^(D + gamma0) |
The parameters travel with the configuration of an image; CCSDS 5.4.3.3.4.3 (elaboration stops otherwise, section 4.5) |
With RuntimeParams_g, the parameter ports of ocp_core hold values in their ranges and change together with the configuration ports |
A value out of range is taken as the nearest valid value; inputs that change in different clock cycles around an image start can give the image a mix of values (section 4.5) |
8. Resources and performance¶
8.1 Throughput¶
The predictor is a pipeline that starts one sample per clock cycle as long as dependent samples are far enough apart (see the architecture of the predictor). The rate depends on the configuration:
| Configuration | Mechanism | Samples per clock cycle |
|---|---|---|
| BI order with M at least the weight loop (7 to 11 cycles), lossless | Pipeline | 1 |
| BSQ order or BI order with M = 1, at most three local differences (C <= 3); lossless, or absolute error limits with narrow local sums and reduced prediction | Speculative weight loop (Speculation_g) |
1 |
| BI order with M = NZ, near-lossless with P > 0 or narrow local sums (no periodic updating) | Stride order | 1 for NZ above about 33; NZ / 33 otherwise; plus about (NZ - 1) S cycles per image |
| BSQ order or BI order with small M otherwise | Pipeline | M / (loop length): 1/8 to 1/11 in lossless, about 1/33 in near-lossless compression |
The entropy coders take one item per clock cycle. The bit packer outputs OutWidth_g bits per clock cycle: with
16-bit samples and an interface of 32 bits the output keeps up with one sample per cycle down to a compression ratio
of 0.5. The header of the next image takes a few cycles that the codeword buffers absorb. tools/ocp_throughput.py
computes the cycle in which the predictor takes every sample of a configuration:
python tools/ocp_throughput.py # all configurations of tools/ocp_configs.py
python tools/ocp_throughput.py c25_tp_bsq_lossless
Cycles per sample of the predictor for the configurations of the regression (throughput model, checked by the testbenches cycle by cycle):
| Configuration | Order, mode | Cycles per sample |
|---|---|---|
| c01, c09, c11, c12, c15, c18, c22, c27 | BIP or BI with M >= 8, lossless | 1.00 |
| c14, c20, c24 | BIP with 3 to 6 bands, lossless | 1.33 |
| c23 | BIP with 4 bands and five local differences, lossless | 1.98 |
| c36 | BSQ without local differences (reduced prediction, P = 0), lossless | 1.00 |
| c13, c25 | One band (BI) or BSQ, lossless, speculative weight loop | 1.00 |
| c26, c28, c35 | BIL or BSQ, near-lossless, speculative weight loop (c35 with periodic error limit updating) | 1.00 to 1.02 |
| c29, c30 | BIP with 40 and 48 bands, near-lossless, stride order | 1.00 per sample, plus (NZ - 1)(S - 1) cycles per image |
| c04, c06, c16 | BIP with 10 to 16 bands, near-lossless, stride order | 2.3 to 3.8 |
| c33 | BIP with 6 bands, near-lossless, stride order, image of 20 pixels | 14.2 (the per-image cycles of the stride order dominate) |
| c02, c03, c07, c08, c17, c34, c37 | BIL or BSQ with more than three local differences, lossless | 7.5 to 8.0 |
| c05, c10, c19, c21, c31, c32, c38 | BI with M < NZ or with periodic error limit updating, near-lossless | 17.5 to 31.5 |
Runtime configuration (section 4.4): the predictor runs as for constant dimensions equal to those of the image,
without the stride order (a near-lossless BIP configuration that would use the stride order runs at the pipeline rate
of the last row of the table). The speculative weight loop is used where the maxima give it (BSQ order, or BI order
with SubFrameDepth_g = 1); a single-band image of a configuration with M > 1 runs without it. The first sample of
every image is accepted with the configuration and issued once the image-start sequencer is done, imageStartCycles + 1
cycles later (7 to 9 cycles of the sequencer, 7 or 8 in lossless and 9 in near-lossless compression); the next sample
follows as without the runtime configuration. runtime_accept_cycles(g, dims) of tools/ocp_throughput.py gives the
cycle of every sample of a sequence of images; the testbenches check the first sample of every image exactly
(TC-PR-41, TC-CO-54).
Consecutive images: image_period(g) of tools/ocp_throughput.py gives the cycles between the first samples of two
images that follow each other without gaps and without back pressure. Outside stride order an image follows the
previous one like the samples of one image: its first sample waits only for the samples it depends on. In stride
order the next image starts once all slots of the image have passed and its last item has been read from the output
buffer; the input buffer takes the first sample of the next image four cycles after that read. The period then
exceeds the input span of an image by the stride skew and the latency of the output buffer (c29: 4322 cycles for
2880 samples). TC-CO-50 checks the period exactly.
The hybrid coder takes no item for 19 + NZ clock cycles after the last item of an image: its pipeline empties, it
outputs the flush words and the final accumulators of the NZ bands (the compressed image tail). The output FIFO of the
predictor absorbs the items of the next image during that time; once it is full, the predictor holds back the next
samples. A sequence of images that each fill the FIFO again (images of a single pixel, or images at one sample per
cycle) therefore takes about 19 + NZ cycles per image more than the predictor alone: c22_single_pixel_hybrid (6
samples per image) takes 31 cycles per image instead of 6 once the FIFO is full, c26_tp_bil_near_abs 1945 cycles per
image instead of 1920. issue_cycles(g, images=n) of tools/ocp_throughput.py includes the tail (it simulates the
output FIFO and the coder cycle by cycle), and so does image_period; for the two images of the configurations of
TC-CO-50 the tail does not change the period. The other coders take one item per cycle.
Size of a compressed image: max_image_bytes(cfg) of tools/ocp_model.py is a strict upper bound on the size of
the compressed image of any image of a configuration; its docstring names the clause of every term:
| Part | Bits |
|---|---|
| Header | 8 H, with H bytes from header(cfg) |
| Error limit values (periodic updating) | DA per absolute and DR per relative value: NZ or 1 of each at every update frame |
| Sample-adaptive coder | D per band (first index) plus Umax + D per further index |
| Hybrid coder | D per band (first index) plus Umax + D + 21 per further index (length-limited codeword or escape residual, and the longest low-entropy output codeword), one bit per rescaling of the statistics of a band (counted from the counter, which does not depend on the data), and the tail: 130 (longest flush codeword of each low-entropy code) + NZ (2 + D + gamma*) + 1 |
| Block-adaptive coder | ceil((NX NY NZ + error limit values) / J) blocks of at most ID + J D bits (no-compression option; option identifier ID of 1 to 5 bits) |
| Fill bits | Up to the next multiple of B bytes |
Every compressed image of the regression and of the CCSDS test data set is at most this size (TC-CO-51). For incompressible images the block-adaptive bound is reached to 99 % (c18, D = 24, noise in every second band: 4629 of 4659 bytes) and the sample-adaptive bound to 70 % (c15, noise: 2145 of 3083 bytes); small images of the test data set reach it exactly. The hybrid bound is reached to 35 % (c20, D = 28: 2315 of 6605 bytes): it allows an escape residual and the longest low-entropy output codeword for every index, more than any image produces at every index.
8.2 Resources¶
Resources and clock frequency with Libero SoC 2025.2 (Synplify Pro and SmartTime) for a PolarFire MPF100T (FCG484, STD speed grade, industrial range) and a 32-bit interface. The clock frequencies are the place and route results for a 100 MHz constraint; the cycles per sample are those of the throughput model (section 8.1; for c29 and c30 the small test images make the per-image skew of the stride order visible). The runs are those of the RTL of version 0.3.0, except c11, which was run again on 2026-11-18 with the RTL of version 0.3.2 (with version 0.3.0: 81160 LUT and 75 MHz). The change of the predictor in version 0.3.2 (registers of the runtime configuration with a defined value when the generics disable them) left c01 and c27 identical in a separate run; the other rows were not repeated.
| Configuration | Cycles per sample | LUT | Flip-flops | LSRAM | uSRAM | Math blocks | Clock frequency |
|---|---|---|---|---|---|---|---|
| c01: 32 x 12 x 16, D = 16, BIP, lossless, P = 3 full, sample-adaptive | 1.00 | 11517 | 5460 | 1 | 34 | 13 | 131 MHz |
| c03: 20 x 10 x 8, D = 8, BSQ, lossless, P = 2 full, narrow local sums, sample-adaptive | 7.93 | 12088 | 4230 | 1 | 17 | 7 | 118 MHz |
| c04: 24 x 12 x 12, D = 16, BIP, absolute error limit, P = 3 full, hybrid (stride order) | 3.14 | 21089 | 13797 | 3 | 41 | 36 | 118 MHz |
| c06: 24 x 12 x 10, D = 16, BIP, absolute and relative error limits, P = 4 full, block-adaptive (stride order) | 3.78 | 19397 | 16991 | 3 | 40 | 23 | 112 MHz |
| c11: 12 x 8 x 18, D = 32, BIP, lossless, P = 15 full, Omega = 19, R = 64, sample-adaptive | 1.00 | 38695 | 15204 | 12 | 34 | 74 | 79 MHz |
| c20: 12 x 10 x 6, D = 28, BIP, lossless, P = 3 full, hybrid | 1.33 | 22222 | 7331 | 1 | 41 | 31 | 124 MHz |
| c25: 32 x 12 x 6, D = 16, BSQ, lossless, P = 3 reduced, narrow local sums, sample-adaptive (speculative weight loop) | 1.00 | 13466 | 4107 | 3 | 17 | 49 | 107 MHz |
| c26: 40 x 8 x 6, D = 16, BIL, absolute error limit, P = 3 reduced, narrow column-oriented local sums, hybrid (speculative weight loop) | 1.00 | 23161 | 11585 | 1 | 34 | 68 | 104 MHz |
| c27: 16 x 8 x 24, D = 16, BIP, lossless, P = 3 full, block-adaptive | 1.00 | 19783 | 7367 | 1 | 33 | 25 | 103 MHz |
| c29: 12 x 6 x 40, D = 12, BIP, absolute error limit, P = 3 full, sample-adaptive (stride order) | 1.49 | 16252 | 11779 | 5 | 38 | 11 | 124 MHz |
| c30: 10 x 5 x 48, D = 16, BIP, absolute and relative error limits, P = 2 reduced, hybrid (stride order) | 1.67 | 18713 | 10721 | 7 | 33 | 25 | 119 MHz |
All configurations reach 100 MHz except c11, which combines the widest values of D, Omega, P and R and reaches 79 MHz. The clock frequency of the predictor for this corner is an open item of the roadmap.
The logic grows with the number of local differences C, with the widths D, Omega and R, with near-lossless
compression, with the hybrid and the block-adaptive coder and with the runtime parameters. The math blocks grow with
C: a product of a local difference (D + 3 bits) and a weight (Omega + 3 bits) takes one or two blocks, four when both
operands are wider than 18 bits, and the speculative weight loop has four products per local difference. The
memories grow with the image (NX NZ D bits for the sample representatives in BI order, the input and output buffers
of the stride order) and with C (Omega + 3) bits per band for the weights. The image framing (UseInLast_g)
adds no memory; it puts one more multiplexer level between the codeword buffer and the bit packer, which in c01 is
the critical path. Measured on 2026-11-03 with the RTL of version 0.3.0, c01 with the image framing needs 32 LUTs and
34 flip-flops more and reached 135 MHz after place and route (131 MHz without the image framing).
python tools/synth_libero.py --config <configuration> [--impl] [--in-last] repeats a run (Libero from --libero,
the environment variable OCP_LIBERO or the PATH); python tools/libero_summary.py lists the results.
Estimate of a configuration¶
The Open Space Composer shows the estimate of the memories, the logic, the
clock frequency and the throughput of any configuration of OpenCompact. It uses the JavaScript modules of
tools/estimate/ (MIT licence); tools/ocp_estimate.py and tools/ocp_throughput.py are the same models in Python,
and the CI checks that both give the same results for every configuration of the regression.
| Quantity | Model | Accuracy |
|---|---|---|
Memories (memories, ramBits) |
Depth, data width and stored SECDED codeword width of every memory, from the generics | Exact: equal to the memories of the GHDL netlist of 126 configurations (lint/memory_check.py) |
| LUT, flip-flops | Linear model over the structure of the configuration (datapath widths times their number, the optional blocks), fitted to 56 of 61 Libero synthesis runs | LUT: RMS 5.6 %, max 16.2 % over all runs; for the configurations of the table RMS 7.1 %, max 13.6 % (c30). Flip-flops: RMS 3.7 %, max 14.3 % |
| Clock frequency | Linear model of the clock period, fitted to 11 of the 16 place and route runs | RMS 4.1 %, max 11.9 % |
Throughput (imagePeriod, headerBytes, maxImageBytes) |
Throughput model of section 8.1 | Exact: the testbench of the predictor checks it cycle by cycle |
LUT, flip-flops and clock frequency hold for the target and tool of the table; the runs cover the configurations of
the table and variations of one parameter at a time around three base configurations, and five configurations of
the table (c04, c06, c20, c26, c30) are kept out of the fits as a check. The memory figures do not depend on the
vendor; how a tool maps a memory (block RAM, distributed RAM or registers) does.
tools/tests/calibration_polarfire.json holds the synthesis results, python tools/ocp_estimate_fit.py fits the
models to them and writes
tools/estimate/ocp_models.mjs, and python tools/ocp_estimate.py <configuration> prints the memories of a
configuration of tools/ocp_configs.py.
9. Conformance statement¶
The implementation conformance statement of CCSDS 123.0-B-2 annex A for the compressor ocp_core: every item of the
requirements list is supported with the full range of values of the standard.
| Table | Items | Support | Values supported |
|---|---|---|---|
| A-1 Image | I1 signed samples, I2 unsigned samples, I3 to I5 X, Y, Z size, I6 dynamic range, I7 supplementary information tables | Y | NX, NY, NZ: 1 to 2^16; D: 2 to 32 |
| A-2 Supplementary information tables | S1 number of tables, S2 purpose, S3 unsigned, S4 signed, S5 float tables with all bit depths, exponent bias and structures | Y | 0 to 15 tables, as encoded by the user (SupTableData_g) |
| A-3 Prediction | P1 number of prediction bands, P2 full and P3 reduced mode, P4 to P7 the four local sum types, P8 register size, P9 sample representative resolution, P10 band-varying damping, P11 damping, P12 band-varying offset, P13 offset | Y | P: 0 to 15; R: max(32, D + Omega + 2) to 64; Theta: 0 to 4; phi, psi: 0 to 2^Theta - 1 |
| A-4 Weights | W1 weight resolution, W2 default and W3 custom initialisation, W3.1 resolution Q, W4 vmin, W5 vmax, W6 tinc, W7 intra-band and W8 inter-band weight exponent offsets | Y | Omega: 4 to 19; Q: 3 to Omega + 3; vmin, vmax: -6 to 9; tinc: 2^4 to 2^11; offsets: -6 to 5 |
| A-5 Quantization | Q1 lossless, Q2 absolute and Q3 relative error limits (bit depths, band-dependent and band-independent assignment, values), Q4 periodic error limit updating with u | Y | DA, DR: 1 to min(D - 1, 16); u: 0 to 9 |
| A-6 Encoder | E1 output word size, E2 BI order with E2.1 depth M, E3 BSQ order, E4 sample-adaptive, E5 hybrid, E6 block-adaptive coder | Y | B: 1 to 8; M: 1 to NZ |
| A-7 Header | H1 to H9: all header parts, subparts and optional tables | Y | Tables included or omitted by generics |
| A-8 Sample-adaptive coder | ES1 gamma0, ES2 accumulator initialisation table, ES3 accumulator initialisation constant, ES4 gamma*, ES5 Umax | Y | gamma0: 1 to 8; k''_z, K: 0 to min(D - 2, 14); gamma*: max(4, gamma0 + 1) to 11; Umax: 8 to 32 |
| A-9 Hybrid coder | EH1 gamma0, EH2 initial high-resolution accumulators, EH3 gamma*, EH4 Umax | Y | Accumulators: 0 to 2^(D + gamma0) - 1 |
| A-10 Block-adaptive coder | EB1 block size, EB2 reference sample interval, EB3 basic and EB4 restricted code options | Y | J: 8, 16, 32, 64; r: 1 to 4096 |
The decompressor is not part of the core. The verification compares the compressed images of the core with those of the CNES reference software for the configurations of the regression; the compliance matrix traces every clause to its requirements and test cases.
10. Generating reference data¶
tools/golden.py regenerates the golden data of the regression (tb/golden/) with the CNES reference software for
CCSDS 123.0-B-2 (Linux executables, on Windows through WSL):
python tools/golden.py --cnes-bin /path/to/cnes/bin # all configurations of tools/ocp_configs.py
python tools/golden.py --cnes-bin /path/to/cnes/bin c01_lossless_bip
python tools/golden.py --aborted # aborted images (reference model only)
The aborted images (aborted_<n>.bin, the image ended early on sample n) come from the reference model, which
reproduces the CNES encoder for every complete image; the CNES software cannot produce them.
python tools/golden.py --decoded --cnes-bin /path/to/cnes/bin writes the images that the CNES decoder reconstructs
from the compressed images of the near-lossless configurations into tools/tests/golden_decoded/; the tests of the
decoder of the reference model (python -m pytest tools/tests, section 11) compare its output with them.
A new configuration is a new entry in tools/ocp_configs.py; the testbenches pick it up automatically. The random
configurations r01_random to r24_random come from random_config(seed) in the same file: every parameter is drawn
in the range of the standard, with a small test image.
The CCSDS test data set (images compressed with randomly chosen configurations) is not part of the repository.
tools/ocp_testvectors.py selects test vectors from it that together cover the parameter values of the data set,
converts them into the golden format and writes them into a directory; the core, predictor and entropy coder
testbenches then run them as well:
python tools/ocp_testvectors.py /path/to/testdata --out /path/to/selection --count 300
OCP_TESTVECTORS=/path/to/selection python run.py -p 4
11. Decompression¶
The reference model has a decoder: ocp_model.decompress() in Python, without other software. It reads the header,
decodes the body of each of the three entropy coders (the hybrid coder from the end of the compressed image, CCSDS
5.4.3.3.1) and runs the predictor in the decompressor's direction. The decoded image holds the clipped quantizer bin
centers (CCSDS 4.1, 4.8.2.1): the samples under lossless compression, values within the maximum error mz(t) of every
sample under near-lossless compression. The CNES reference decoder reconstructs the same values.
import ocp_model # tools/ocp_model.py
cfg, img, max_error = ocp_model.decompress(data, tables=channel_cfg)
# cfg: the configuration of the header; img[z][y][x]: the decoded image; max_error[z][y][x]: mz(t)
datais the compressed image, header and body. With the hybrid coder it must end with the compressed image, which is decoded from its end; with the other coders bytes after it are ignored.- A table that the header leaves out (a table flag of '0': weight initialisation, weight exponent offsets, damping,
offset, accumulator initialisation) is taken from
tables, a configuration dict such as the one given toocp_model.compress()(only its table entries are used), or fromoptional_tables, the bytes of the optional tables file of the CNES software. With the runtime configuration these are the values of the generics for the largest NZ; an image of NZ bands uses the first NZ of them (section 4.4). - Data that cannot be the compressed image of its header (it ends early, a codeword does not decode, the body does
not end where the header says, a table is missing) raises
ocp_model.DecodeError. ocp_model.image_samples(cfg, img)gives the samples in the input order of the compressor, the order of the raw image files;ocp_model.image_from_samples()is its inverse.
tools/ocp_decompress.py decodes a compressed image file, writes the decoded image in the format of the raw images
of the testbenches (input order of the compressor, little-endian 8, 16 or 32-bit samples) and compares it with the
original: identical under lossless compression, every sample within its maximum error under near-lossless
compression (exit code 1 otherwise):
python tools/ocp_decompress.py compressed.bin -o decoded.raw --compare image.raw
12. Corrected defects¶
| Defect | Affected | Effect | Correction |
|---|---|---|---|
BlockSize_g other than 8, 16, 32 and 64 was accepted |
All versions before the generic range checks | The header carries the block size code of 64 while the block-adaptive coder codes blocks of the given size, so the compressed image cannot be decompressed | The elaboration stops (CO-CF-02, section 7) |
| Memory reads at undefined addresses before the first image | All versions up to 0.3.1 | Before the first image after a reset the statistics memory of the sample-adaptive and the hybrid coder and, in BI order, the weight memory of the predictor are read at an undefined address: a simulation with the warnings of the IEEE packages reports a metavalue warning in every clock cycle. The data read are not used; the compressed images and the hardware are not affected | The addresses are defined from the reset (CO-RS-02); what remains is the bounded burst of warnings after a reset from the datapath of the pipeline stages without a valid item (section 3) |