The testbench isp_conv_tb sends window streams to the module, programs its coefficient registers through the
AXI4-Lite slave and checks every output pixel against a reference model. It uses the shared
testbench components: the source with the window as its data, the sink with the
contract checker (the dimensions of the image that the window stream carries), the register script ispRegsRun and
a pulse counter of Err_Config.
The reference model conv of tools/isp_model.py computes every output pixel with the definitions of the
specification (section 1.1) in unbounded integers: S = sum of c(k) x e(k), q = 0 for S < 0, otherwise min(S, 2^B - 1).
It finds the image starts from the packets as the specification defines them (the first beat of a packet with the
sequence flags "01" or "11"), and keeps a model of the registers: the stored bits and the parity flag of every
coefficient register, CTRL.HOLD, STATUS.ERR_CONFIG and the expected read values. At every image start it takes
the coefficient set as the specification says and counts Err_Config.
The coefficient generic Coef_g is a vector of integers, which GHDL cannot set from the command line. The testbench
takes the coefficients as a string generic (decimal values separated by commas) and converts them with a function of
tb/isp_tb_pkg.vhd; lint/synth_check.py uses a wrapper entity in lint/ with the coefficient sets of its
configurations.
Simulators: GHDL (regression, CI) and QuestaSim (code coverage at the release); VUnit with UVVM, test end
ispTestEnd. Tests observe ports and the AXI4-Lite interface only. The latency for the drain time of the test end is
3 + log2ceil(T) cycles.
n = 1 to 16: window n x (17 - n), 8-bit pixels, 8-bit coefficients, run time
Every value of WinX_g and WinY_g
Taps
1 x 1, 1 x 2, 1 x 3, 2 x 2, 1 x 5, 2 x 4, 3 x 11 (33), 2 x 16 (32), 5 x 13 (65), 4 x 16 (64), 10 x 13 (130), 8 x 16 (128), 15 x 16 (240), 16 x 16 (256); 6-bit pixels, 6-bit coefficients, constant
Every depth of the adder tree (0 to 8 levels) with a full and a partly filled last level
Every output beat (pixel, Out_Last, Out_User) equals the model
Sink
CNV-IF-02, CNV-FN-01, CNV-FN-02
Output contract with the dimensions of the image (tests with well-formed images)
Sink
CNV-FN-02
The number of Err_Config pulses equals the model
Testbench
CNV-IF-04
Control outputs free of metavalues after the first reset, Out_Valid and Err_Config 0 after every reset; no metavalue in an output pixel while Out_Valid is high
Four images of random windows with the coefficients of the generic, plus in every image a window of largest elements (the largest sum) and of zero elements, and windows that give the most negative sum and a sum of exactly 0; back to back and with pauses
CNV-IF-01, CNV-IF-02, CNV-FN-01 to 03, CNV-FN-05
test_runtime (TC-CNV-02)
Coefficient sets written between images: random sets, both bounds, a set that changes the sign of every coefficient; a set written during an image takes effect with the next image; every coefficient read back sign-extended
CNV-FN-01, CNV-FN-04, CNV-RG-03
test_hold (TC-CNV-03)
CTRL.HOLD 1: coefficients written over two images, which keep the set before; CTRL.HOLD 0: the next image takes the whole new set; CTRL.HOLD 1 with a register of bad parity takes no set and reports nothing
CNV-FN-04
test_parity (TC-CNV-04)
INJECT for every coefficient in turn for T up to 16; above, the first, the last and eight random ones, because the parity paths of all coefficients come from one generate loop of the RTL: the next image and every further image use the generic with one Err_Config each until the register is written; two injections in one set; a second injection that restores the parity; an index of T or above without effect. INJECT.CTRL_PARITY with CTRL.HOLD 1: the held set is taken at every image start, with one Err_Config each, until CTRL is written. With RuntimeCoef_g false no effect. Partial writes (PKG-08): an injection, then a write that keeps a byte with bits of the register and a write of only bytes without bits: the next images still use the generics with Err_Config; a write of every byte with bits clears the mismatch; a partial write without a mismatch is taken (one random coefficient; with CoefBits_g above 8 both kinds of write). An injection without the strobe of byte 1 has the index 0: coefficient 0 loses its parity, and its write restores it
ID, PARAM, the reset values of all coefficients (the generic, sign-extended); writes with every single byte strobe; writes to read-only registers and with RuntimeCoef_g false to the coefficients without effect; the addresses above the last coefficient and the gaps read 0, a write there changes no register; a write of CTRL without the strobe of byte 0 has no effect; reads at an address that is not a multiple of 4 between two coefficient registers return 0 (the coefficient is not 0), a write at such an address acts on the coefficient at the aligned address; STATUS.ERR_CONFIG set, kept by a write of 0, cleared by a write of 1; INJECT reads 0
CNV-RG-01, CNV-RG-02, CNV-RG-03, CNV-IF-03
test_flag_coincidence (TC-CNV-06)
The clear of STATUS.ERR_CONFIG swept cycle by cycle across an Err_Config pulse, as in isp_crop (TC-CRP-07)
CNV-RG-02
test_exhaustive (TC-CNV-07)
Configurations exhaustive and exhaustive_sat: every coefficient pair (64 sets) as a run-time set, each over an image of all 64 element pairs: every sign, carry and saturation case of the arithmetic
CNV-FN-01
test_packets (TC-CNV-08)
Streams that isp_window does not produce but that define the image start: a "01" packet after "00" packets, single-window packets, In_Last on every beat, other flags on the later beats of a packet, images back to back without a gap; the contract checker is off
CNV-FN-02, CNV-FN-04, CNV-FN-05
test_reset (TC-CNV-09)
Resets idle, held and running, of one and two cycles, also between the image start and the first output pixel; the window stream stops at the reset and the next image follows, as from an isp_window reset with the module; after the reset the registers hold the generic and the next image uses it
CNV-IF-05, CNV-FT-03, CNV-FT-01
test_rate (TC-CNV-10)
Configurations rate_*: images back to back with In_Valid and Out_Ready high: one window per cycle at the input and one pixel per cycle at the output, every pixel exactly 3 + log2ceil(T) cycles after its window
CNV-PF-01, CNV-PF-02
TC-CNV-11 (lint/synth_check.py)
GHDL synthesis without latches at the bounds of section 2.3 and both values of RuntimeCoef_g; elaboration stops with the message naming the generic for: PixelBits_g 33, WinX_g 17, WinY_g 17, CoefBits_g 1 and 19, OutBits_g 65, a Coef_g with T - 1 and T + 1 values, a coefficient of 2^(CoefBits_g - 1) and of -2^(CoefBits_g - 1) - 1
CNV-CF-01, CNV-CF-02
TC-CNV-12 (lint/libero_synth.py)
Preliminary synthesis on PolarFire MPF100T (Libero, Synplify Pro) with a clock of 125 MHz, the Timing level (architecture, section 10): 3 x 3 and 5 x 5 with 12-bit pixels and 16-bit run-time coefficients (the defaults of the MTF filter), 16 x 16 run-time (the largest), 1 x 4 ones (the binning); the resources and the estimated worst slack recorded in the verification report, a pre-layout estimate. The default configuration meets 125 MHz in the estimate; a further configuration records the frequency it reaches
The when others branch of the register decoder and of olo_axi_lite_slave (Open Logic).
With RuntimeCoef_g false the coefficient registers and the parity logic do not exist; their coverage comes from
the configurations with RuntimeCoef_g true.
The elements of the windows are random over the full range of PixelBits_g, independently for every element, with
the extreme windows of test_static added. The coefficient sets are random within their range and at their bounds;
test_exhaustive covers every combination of the small configurations.