o1553_codec: Verification Plan¶
1. Overview¶
The codec is verified through its ports. The far end of both buses is the bus model of tb/, a behavioural model of
the bus, of the other terminals and of the two transceivers, written from MIL-STD-1553B independently of the RTL:
- It runs in continuous time (
wait forwith real delays), not onClk. A word is generated half bit by half bit as the line states the receiver of the core would see: positive, negative and zero, with a programmable bit rate deviation, a programmable deviation of every zero crossing, a zero window at every crossing (the time the line needs to pass the threshold band of the receiver, which also delays the start and advances the end of the activity by half the window) and glitches at given times. - It injects every word validation error of MIL 4.4.1.1: a sync half of wrong length, a missing or shifted mid-bit transition at a given bit, words that end before the parity bit or have bits after it, even parity, Manchester bits without a sync; and gaps of any length between words.
- It decodes
Bus_TxPandBus_TxNof each bus by sampling the middle of every half bit of the transmission, logs every transmitted word and the start, end and number of complete words of every transmission, and checks thatBus_TxPandBus_TxNare never '1' together, that a bus transmits only while itsBus_TxInhis '0' and that every transition lies on the half-bit grid of the transmission. - As the transceiver, it can pass the own transmission of a bus back to its receiver outputs with a delay, and corrupt or drop words of that echo.
- It does not model amplitudes, rise times, noise or collisions of two transmitters: its receiver outputs are the OR of the words of the model and the echo.
The bench computes every expected word and every expected time from the stimulus and from the specification. It
computes rxLatency and txLatency from the generics with the formulas of the architecture; it takes from
o1553_codec_pkg only the codes of the validation result and of the transmission result, which are part of the
interface (specification, CD-IF-03 and CD-IF-04). The random data and deviations use seeds that differ between the
configurations.
2. Test configuration¶
| Testbench | Harness | DUT and environment |
|---|---|---|
o1553_codec_tb |
o1553_codec_th |
o1553_codec; the bus model of tb/ on Bus_* of both buses; the test sequence drives the transmit stream and the control inputs itself; the harness logs the word events of both buses (with the clock cycle of every event), the transmission results, the loopback errors, the acceptance cycles of further words and the edges of Tx_Busy |
| VUnit configuration | ClkFreq_g, SyncStages_g |
Purpose |
|---|---|---|
c100 |
100 MHz, 2 | Nominal clock; all tests |
c16 |
16 MHz, 2 | Lowest clock: coarsest sampling, smallest decoder margins (architecture section 7.4) |
c400 |
400 MHz, 2 | Highest clock: largest counters and the longest glitch filter |
c100_s3 |
100 MHz, 3 | Synchroniser of three stages |
c100_s4 |
100 MHz, 4 | Longest synchroniser: rxLatency and the decoder with four stages |
The tests marked "all" run in every configuration; the others in c100 only. Every test runs under a VUnit watchdog
of 20 ms of simulated time, and every wait for an output of the codec has a time-out.
Shared verification components (tb/): o1553_tb_pkg (test end procedure that fails on unexpected and on missing
expected alerts, timed waits that check their condition), o1553_tb_bus_pkg (word, fault and timing types, the
protected type that controls the model and holds its logs), o1553_tb_bus_var_pkg (the control object),
o1553_tb_bus (the bus model entity).
3. Test cases¶
| Test ID | Description | Requirements |
|---|---|---|
test_reset_idle (TC-CD-01) |
After the reset both buses are idle (Bus_TxP = Bus_TxN = '0', Bus_TxInh = '1'), no event, no shutdown, no fail-safe state, Bus_RxEn follows Cfg_BusEn in all four combinations; a valid word sent at once after the reset is decoded (all) |
CD-CF-02, CD-EN-10, CD-BS-04, CD-IF-01 |
test_encode_words (TC-CD-02) |
Single-word transmissions on both buses with both sync types and the data 0x0000, 0xFFFF, 0x5555, 0xAAAA, 0x8000, 0x7FFF, 0x0001 and 100 random words: the model decodes sync type, data and parity; every transition on the half-bit grid; both sync shapes; Bus_TxInh low exactly over the 20 bit times, starting txLatency cycles after the word was presented; the other bus idle; Bus_TxP and Bus_TxN never '1' together (all) |
CD-EN-01, CD-EN-02, CD-EN-03, CD-EN-04, CD-EN-09, CD-EN-10, CD-IF-02, CD-BS-01 |
test_encode_transmissions (TC-CD-03) |
Transmissions of 1, 2, 3, 32 and 33 words with mixed sync types: no gap between the words (Bus_TxInh low for exactly 20 us per word), Tx_Ready for a further word only in the first cycle of the parity bit, the first sync starts txLatency cycles after the first word was presented, Tx_Busy rises at the acceptance of the first word and falls with the last half bit at the encoder, one cycle before the outputs return to idle, Tx_Done with "complete" in the same cycle |
CD-EN-05, CD-EN-06, CD-IF-03 |
test_encode_underrun (TC-CD-04) |
The next word is presented one cycle after the start of the parity bit of the current word: the transmission ends after the current word with "ended after an underrun", the late word starts a new transmission later; the same word presented in the first cycle of the parity bit continues the transmission without a gap | CD-EN-06, CD-EN-07 |
test_encode_abort (TC-CD-05) |
Tx_Abort in the sync, in a data bit, in the parity bit of a word with a next word accepted, and while idle: the bus goes idle in the next cycle, Tx_Done with "aborted", the accepted next word is not sent; while idle nothing happens |
CD-EN-08 |
test_decode_words (TC-CD-06) |
The model sends both sync types in all four combinations of a sync merged or not merged with the bit before and the bit after (each pair checked), and 40 random single words on both buses; every word is reported once with its sync type, data and the result valid; every bit position is decoded as '0' and as '1' (all) | CD-DE-04, CD-DE-05, CD-DE-06, CD-IF-04 |
test_decode_latency (TC-CD-07) |
For 50 words the clock cycle of the event minus the time of the reference crossing at the ports lies between half a cycle before and one cycle after rxLatency (architecture section 7.6, within the +/- 1 cycle of CD-DE-08), also with zero windows and crossing deviations (all) |
CD-DE-08, CD-DE-01 |
test_decode_tolerance (TC-CD-08) |
Pairs of words, the first after an idle line, the second contiguous, for every combination of the bit rates 0.99, 0.995, 1.0, 1.005 and 1.01 Mb/s, the deviations of every zero crossing with respect to the previous one (random within +/- 150 ns, alternately +150 ns and -150 ns, +150 ns on every sync half and -150 ns on the interval after it, -150 ns on every sync half and +150 ns on the interval after it) and the zero windows 0, 50, 100 and 200 ns, and pairs with a zero window of 300 ns without deviation: two events per pair, every word valid and correct (all) | CD-DE-03, CD-DE-04 |
test_decode_glitches (TC-CD-09) |
Pulses of the opposite polarity and of zero of 20 ns, 40 ns and 49 ns inside a level of the data bits, in the sync and on the idle line: the words stay valid and no event is added; a pulse of the opposite polarity of 50 ns plus two clock periods in the middle of a level of 1.0 us gives a Manchester error; a zero dip of that length is no crossing and the word stays valid (all) | CD-DE-02 |
test_decode_errors (TC-CD-10) |
Negative tests, one word each, followed by a valid word: sync second half of 1.0 us and of 2.5 us; mid-bit transition missing in bit 0 and bit 7 (Manchester error) and in the parity bit (bit count error: no reference crossing before the line returns to zero); mid-bit transition shifted by 300 ns; the line returns to zero after the first bit, after eight bits and before the parity bit; one and two bits after a parity bit '1' (two half-bit intervals after the reference crossing) and one bit after a parity bit '0' (a full-bit interval); even parity: every word is reported once with the expected error kind and the bits decoded so far, the valid word after it is decoded; a sync of each type followed by an idle line: sync error; after the boundary crossing behind the parity bit a crossing of class Q2 before the check time (the next command sync with a first half of 0.9 us): the word is valid at the check time; a parity error ended by the next sync before the check time (mid-sync crossing 1.4 us after the reference crossing): parity error, the next word decoded (all) | CD-DE-06, CD-DE-07, CD-DE-08, CD-DE-11 |
test_decode_no_sync (TC-CD-11) |
17 Manchester bits without a sync, and 51 contiguous random Manchester bits without a sync (no level lasts longer than one bit time, so nothing resembles a sync half): no event; a valid word that follows is decoded | CD-DE-11 |
test_decode_gap (TC-CD-12) |
Pairs of words whose mid-sync crossings come 1.8, 2.0, 2.35, 2.45 and 2.5 us after the reference crossing of the first word (no zero gap, the first sync half shortened or stretched), 1.4 and 1.65 us after it (the first sync half merged with the second half of the parity bit), and 4.0 us and 70000 clock cycles (700 us) after it (idle line between the words): the gap in clock cycles within one cycle of the stimulus, contiguous for 1.65 to 2.35 us, not contiguous at 1.4 us and from 2.45 us; the gap saturates for 70000 cycles and is all ones for the first word after the reset and after an invalid word that follows a long idle; a word after a zero gap of 0.5 us with the same polarity on both sides (above the idle threshold of 0.4 us) is decoded and not contiguous | CD-DE-09, CD-DE-11 |
test_both_buses (TC-CD-13) |
Words on both buses with the same timing (events in the same cycle) and offset by a few cycles; a command decoded on bus B while the codec transmits 32 words on bus A; both reported correctly and independently | CD-DE-12, CD-IF-04 |
test_bus_disable (TC-CD-14) |
Cfg_BusEn(1) = '0': Bus_RxEn(1) '0', no events of bus B also with words on it, a transmission on bus B ends with Tx_Suppressed and idle outputs, bus A works; disabling bus A during a word: no event for that word, the bus restarts cleanly when enabled again; bus B disabled and enabled again during the third word of a transmission: the outputs stay idle until its end, no partial word, Tx_Suppressed |
CD-BS-02, CD-BS-04, CD-DE-12 |
test_shutdown (TC-CD-15) |
Sd_Set(0): a transmission on bus A has idle outputs and ends with Tx_Suppressed, Stat_Shutdown(0) and Stat_TxEn(0) show it, a word of the model on bus A during a suppressed transmission on bus A is reported without the own flag, bus B transmits; Sd_Set during a transmission makes the bus idle in the next cycles, and Sd_Clr during the rest of that transmission does not resume it; Sd_Clr(0) enables bus A again; the reset clears both shutdowns; Tx_Suppressed as a level at every clock edge: '1' without a transmission, '0' while bus B is driven, '1' from the cycle after the shutdown to Tx_Done and after it |
CD-BS-01, CD-BS-02, CD-BS-03, CD-DE-10, CD-IF-03, CD-IF-05 |
test_fail_safe (TC-CD-16) |
A transmission of 33 words runs to its end (660 us) without fail-safe; two transmissions of 33 words with a pause of one idle cycle (back to back) or of 1.5 us between them count as one and are cut after 700 us of transmission, with a pause of 4.0 us both run to their end; a transmission of 40 words on bus B is cut 700 us after its start (within one cycle): Bus_TxInh(1) '1', Bus_TxP(1) and Bus_TxN(1) '0', Stat_FailSafe(1) '1', bus A unaffected; the next transmission on bus B is suppressed; Fs_Clr(0) does not release bus B, Fs_Clr(1) does; Fs_Clr(1) during the rest of a cut transmission does not resume it; the reset clears the state |
CD-FS-01, CD-FS-02, CD-FS-03, CD-BS-02 |
test_own_words (TC-CD-17) |
The model echoes the transmission of the bus with 400 ns and with 1.0 us delay: every echoed word carries the own flag. A valid command of the model whose mid-sync crossing comes 4.0 us after the reference crossing of the last own word (the minimum gap), with the echo enabled, is reported valid and without the own flag; so is a word on the other bus during the transmission. With the echo off, a word whose mid-sync crossing lies 0.6 us after the end of a transmission carries the own flag, one 1.4 us after it does not (all) | CD-DE-10 |
test_monitor (TC-CD-18) |
With Cfg_MonEn = '1' and a correct echo: no loopback error over 33 words; the model flips one data bit of an echoed word (parity error), flips two adjacent data bits (a valid word with other data), inverts the parity bit, inverts the sync (a valid word of the other sync type) and drops an echoed word: one loopback error of the bus for each, at the event or 4 us after the end of the word; with Cfg_MonEn = '0' the same faults give no error; with the echo missing, a word of another source on the bus (its sync error reported within the deadline, not own) does not end the wait: one loopback error 4 us after the end of the word; suppressed words and the echo of an aborted word give no error |
CD-MO-01, CD-MO-02, CD-IF-05 |
test_decode_first_sync (TC-CD-19) |
After an idle line, words whose first sync half lasts 0.85, 1.0 and 1.2 us (normal second half) are decoded valid; a first half of 0.65 us is no sync half and gives no valid word (one sync error for the apparent sync that follows); a first half of 1.0 us followed by a second half of 1.0 us gives a sync error; a valid word after them is decoded (all) | CD-DE-04, CD-DE-07 |
test_line_activity (TC-CD-20) |
Rx_Active after the reset '0'; for a word, two contiguous words with zero windows of 200 ns, two words with a zero gap of 0.3 us, Manchester bits without a sync and a pulse of 50 ns plus two clock periods on the idle line: one period of activity that rises SyncStages_g + F + 1 and falls SyncStages_g + ceil(0.8H) + 2 cycles (at most one cycle less) after the start and the end of the activity at the ports; two words with a zero gap of 0.5 us: two periods; a pulse of 49 ns: no activity; a bus disabled during a word: activity ends within three cycles, none while disabled; both receiver outputs at '1' for 5 us on the idle line: no activity and no word; a word between two such periods: one period of activity, the word valid (all) |
CD-DE-01, CD-DE-13 |
test_activity_without_word (TC-CD-21) |
Manchester bits without a sync; pulses of 0.5 us, 3 us and 30 us and one longer than 2^16 cycles on the idle line of each bus: one event Rx_NoWord in the cycle in which Rx_Active falls, with Rx_NoWordLen the cycles of Rx_Active = '1' (all ones for the long one), no word event; a valid word, a word with a sync error and a word with a parity error: no such event; a pulse of 49 ns: no activity and no event; the bus disabled during the activity: no event; activity on both buses at once: one event per bus (all) |
CD-DE-14, CD-IF-06 |
lint/synth_check.py |
Elaboration and synthesis of o1553_codec with ClkFreq_g = 16, 100 and 400 MHz and SyncStages_g = 2, 3 and 4 succeed without latches; 15, 125, 156.25 and 402 MHz stop with the message of CD-CF-01 |
CD-CF-01 |
4. Negative tests¶
| Check | Proven by |
|---|---|
| Sync validation (CD-DE-07, sync error) | TC-CD-10, second sync half of 1.0 us and 2.5 us, a sync followed by an idle line; TC-CD-19, first half of 0.65 us and second half of 1.0 us |
| Manchester validation (Manchester error) | TC-CD-10, missing and shifted mid-bit transitions; TC-CD-09, long glitch |
| Bit count, both directions (bit count error) | TC-CD-10, early end and extra bits after both parity values |
| Parity (parity error) | TC-CD-10 |
| Contiguity (CD-DE-09) | TC-CD-12, 1.4 us, 2.45 us and 2.5 us |
| Glitch filter | TC-CD-09, 49 ns ignored and 50 ns plus two periods detected |
| Line activity (CD-DE-13) | TC-CD-20, zero gap of 0.3 us (active) and 0.5 us (idle), pulse of 49 ns |
| Own-transmission window (CD-DE-10) | TC-CD-17, words after the end of the window; TC-CD-15, suppressed transmission |
| Fail-safe timer (CD-FS-01) | TC-CD-16, 40-word transmission cut; pauses of one cycle and 1.5 us do not restart the timer, 4.0 us does |
| Transmission monitor (CD-MO-01) | TC-CD-18, corrupted, invalid, other data, other sync type and missing echo, a word of another source while the echo is missing |
| Line state of both outputs at '1' (CD-DE-01) | TC-CD-20, no activity and no word |
| Underrun (CD-EN-07) | TC-CD-04 |
| Elaboration check (CD-CF-01) | lint/synth_check.py, invalid frequencies |
5. Functional coverage¶
The bins are enumerated by the loops of the tests, and every bin is checked on its own (an event count and the word contents per bin).
| Coverpoint | Requirements | Bins | Goal |
|---|---|---|---|
BIT_RATE |
CD-DE-03 | 0.99, 0.995, 1.0, 1.005, 1.01 Mb/s | 100 % |
CROSSING_DEVIATION |
CD-DE-03 | none, random within +/- 150 ns, alternating +/- 150 ns, stretched sync halves, shrunk sync halves | 100 % |
ZERO_WINDOW |
CD-DE-03 | 0 ns, 50 ns, 100 ns, 200 ns with deviations; 300 ns without | 100 % |
SYNC_MERGE |
CD-DE-04 | sync type x (merged with the bit before: yes, no) x (merged with the bit after: yes, no) | 100 % |
FIRST_SYNC_HALF |
CD-DE-04 | after an idle line: 0.65 us (rejected), 0.85 us, 1.0 us, 1.2 us, 1.5 us | 100 % |
DATA_BITS |
CD-DE-05, CD-EN-03 | each of the 16 bit positions at '0' and at '1', decoded and encoded | 100 % |
ERROR_KIND |
CD-DE-07 | sync, Manchester, bit count (short), bit count (long, after both parity values), parity | 100 % |
TRANSMISSION_LENGTH |
CD-EN-05 | 1, 2 to 31, 32, 33 words | 100 % |
ECHO_FAULT |
CD-MO-01 | one data bit, two data bits, parity bit, sync, missing word | 100 % |
6. Generic coverage¶
| Generic | Declared range | Simulated | Synthesised |
|---|---|---|---|
ClkFreq_g |
16 MHz to 400 MHz, multiples of 2 MHz | 16, 100, 400 MHz | 16, 100, 400 MHz |
SyncStages_g |
2 to 4 | 2, 3, 4 | 2, 3, 4 |
7. Traceability¶
Every requirement of the specification is covered by the test cases of section 3; python tools/compliance.py
lists the test cases per requirement and per clause in the compliance matrix.