Skip to content

o1553_codec: Architecture and Design Description

1. Block diagram

Block diagram of o1553_codec: the transmit path from the word stream through the encoder (CD-2), the bus selector
(CD-6) and the fail-safe timers with the output registers (CD-4) to the transmit signals of both buses; the receive
path from the receiver signals through the input synchronisers (CD-1) and one decoder per bus (CD-3) to the word
events; the transmission monitor (CD-5) between them

The transmit path runs from right to left: the encoder turns the word stream into a sequence of half-bit symbols, the bus selector routes the symbols to one bus and gates them with the transmitter enable of that bus, and the fail-safe timer of each bus registers the transmit signals and cuts a transmission that lasts too long. The receive path runs from left to right: the synchronisers of CD-1 bring the comparator outputs into Clk, and each decoder turns the line state of its bus into word events.

2. Interfaces

2.1 Generics

Generic Type Default Range Description
ClkFreq_g real none 16.0e6 to 400.0e6, integer multiple of 2.0e6 Frequency of Clk in Hz
SyncStages_g positive 2 2 to 4 Synchroniser stages of the receiver inputs

2.2 Ports

Port Width Direction Description
Clk 1 in Clock
Rst 1 in Synchronous reset, high-active
Bus_TxP, Bus_TxN 2 out Positive and negative halves of the Manchester signal per bus (index 0 bus A, 1 bus B)
Bus_TxInh 2 out Transmitter inhibit per bus, '1' = off
Bus_RxEn 2 out Receiver enable per bus
Bus_RxP, Bus_RxN 2 in Comparator outputs of the receivers, asynchronous
Cfg_BusEn 2 in Host enable per bus (transmitter and receiver)
Cfg_MonEn 1 in Enable of the transmission monitor
Tx_Valid, Tx_Ready 1 in, out Handshake of the transmit word stream
Tx_Sync 1 in '1' command/status sync, '0' data sync
Tx_Data 16 in Data bits, bit 15 sent first
Tx_Last 1 in Last word of the transmission
Tx_Bus 1 in Bus of the transmission ('0' A, '1' B), taken with the first word
Tx_Abort 1 in One-cycle command: end the transmission at once
Tx_Busy 1 out Transmission in progress
Tx_Done 1 out One-cycle event: the transmission has ended
Tx_Result 2 out With Tx_Done: "00" complete, "01" ended after an underrun, "10" aborted
Tx_Suppressed 1 out Level. During a transmission: the outputs of its bus have been idle in at least one of its cycles, this cycle included; with Tx_Done: the same for the whole transmission; '1' outside a transmission
Rx_Valid 2 out One-cycle word event per bus
Rx_Sync 2 out Sync type per bus ('1' command/status)
Rx_Data 32 out Data bits, bus b in bits 16b+15 to 16b
Rx_Error 6 out Validation result per bus, bus b in bits 3b+2 to 3b: "000" valid, "001" sync, "010" Manchester, "011" bit count, "100" parity
Rx_Contig 2 out Contiguous flag per bus
Rx_Gap 32 out Gap per bus in clock cycles, bus b in bits 16b+15 to 16b, all ones when not known or longer
Rx_Own 2 out Own-transmission flag per bus
Rx_Active 2 out Line activity per bus (CD-DE-13)
Rx_NoWord 2 out One-cycle event per bus: line activity without a word has ended (CD-DE-14)
Rx_NoWordLen 32 out With Rx_NoWord: the cycles of that activity, bus b in bits 16b+15 to 16b, all ones when more
Sd_Set, Sd_Clr 2 in One-cycle commands: shut the transmitter of a bus down, enable it again
Fs_Clr 2 in One-cycle command: valid command received on the bus, release its fail-safe state
Stat_TxEn 2 out Effective transmitter enable per bus
Stat_Shutdown 2 out Shutdown state per bus
Stat_FailSafe 2 out Fail-safe state per bus
Mon_Error 2 out One-cycle event: loopback error of a bus

The word fields of Rx_* are valid in the cycle of Rx_Valid only.

2.3 Package o1553_codec_pkg

Item Value Use
halfBitCycles(ClkFreq_g) H = ClkFreq_g / 2.0e6 Encoder half bit, decoder classes and timers
glitchCycles(ClkFreq_g) F = ceil(50 ns x ClkFreq_g) + 1 Glitch filter (CD-DE-02)
txLatency 2 Clock cycles from the acceptance of the first word to the start of its sync at the ports (CD-EN-06)
loopDelayMax, loopCycles(ClkFreq_g) 1.0 us, 2H Largest transceiver loop delay of the own-transmission window (CD-DE-10)
rxLatency(ClkFreq_g, SyncStages_g) SyncStages_g + F + 3H + 1 Clock cycles from the reference crossing at the ports to the word event (CD-DE-08)
oddParity(Data) not xor of the 16 bits Parity bit of a word
checkClkFreq(ClkFreq_g) assertion text Elaboration check of CD-CF-01

3. Transceiver interface (CD-1, in o1553_codec)

  • One olo_intf_sync (Width_g = 4, SyncStages_g, SyncTmr_g = true, RstLevel_g = '0') synchronises Bus_RxP and Bus_RxN of both buses.
  • The line state of a bus is positive for (RxP, RxN) = ('1', '0'), negative for ('0', '1') and zero otherwise.
  • Bus_RxEn is a register that follows Cfg_BusEn. A disabled bus holds its decoder in reset (CD-DE-12).
  • The transmit signals are registered in the fail-safe timers (section 6), so every bus output comes from a register.

4. Encoder (CD-2, o1553_codec_encoder)

4.1 Symbols

A word is 40 half bits, numbered 0 to 39. The symbol of half bit i is:

Half bits Command/status sync Data sync
0 to 2 positive negative
3 to 5 negative positive
6 + 2k (first half of bit k, k = 0 to 16) positive for a one, negative for a zero same
7 + 2k (second half of bit k) the opposite of the first half same

Bits 0 to 15 are Tx_Data(15) to Tx_Data(0); bit 16 is the parity bit oddParity(Tx_Data). The encoder outputs the symbol (positive or negative), the active flag and the bus of the transmission.

4.2 State machine

State Behaviour Next state
Idle_s Tx_Ready = '1'. With Tx_Valid the word, its sync type, its last flag and Tx_Bus are taken; half bit 0 starts in the next cycle Send_s
Send_s A counter counts H cycles per half bit. In the first cycle of half bit 38 (start of the parity bit) Tx_Ready = '1' if the current word is not the last; a valid word is taken into the next-word register, otherwise an underrun is noted for a word that is not the last. At the end of half bit 39 the next word starts at half bit 0, or the transmission ends with Tx_Done Send_s, Idle_s
any Tx_Abort: Tx_Done with "aborted", next-word register cleared Idle_s
others Recovery (section 10) Idle_s

Tx_Busy and the active flag are '1' in Send_s. Because half bit 0 of a following word starts in the cycle after half bit 39 of the word before, the words are contiguous (CD-EN-05).

5. Bus selector (CD-6, o1553_codec_bus_selector)

  • Shutdown(b) is set by Sd_Set(b), cleared by Sd_Clr(b) and by the reset.
  • TxEn(b) = Cfg_BusEn(b) and not Shutdown(b) and not FailSafe(b); it is output as Stat_TxEn.
  • Cut is set in the cycle after one in which the encoder is active and TxEn of its bus is '0', and cleared when the encoder is idle: once the outputs of a transmission went idle they stay idle until the transmission ends, also when TxEn returns in the meantime, so that no partial word follows (CD-BS-02).
  • The bus of the transmission is driven while the encoder is active, TxEn is '1' and Cut is '0': TxP = symbol positive, TxN = symbol negative, TxInh = '0'. Otherwise, and on the other bus, the outputs are idle.
  • Sel_TxActive(b) is '1' while bus b is driven; it opens the own-transmission window of the decoder (section 7.6), so a transmission with idle outputs marks no word on its bus as own (CD-DE-10).
  • The encoder clears its suppressed flag when it takes the first word of a transmission and sets it in every cycle in which it is active and its bus is not driven. Tx_Suppressed is the flag or Enc_TxOff while the encoder is active, the flag in the cycle of Tx_Done, and '1' otherwise: a user can sample it at any time of a transmission, also when it ends the transmission with Tx_Abort.
  • The selector is combinational apart from Shutdown and Cut, so the fail-safe registers are the only register stage between the encoder and the ports: txLatency = 2 (encoder state register, output register).

6. Fail-safe timer and output registers (CD-4, o1553_codec_fail_safe, one per bus)

  • The entity holds the output registers Bus_TxP, Bus_TxN and Bus_TxInh of its bus.
  • A counter counts the cycles in which the registered Bus_TxInh is '0'. It is cleared only when Bus_TxInh has been '1' for 4H cycles (2 us): the transmissions of one terminal are at least 4 us apart, while a protocol engine that runs away and starts transmissions back to back (one idle cycle between them) keeps the counter running. When it reaches 700 us x ClkFreq_g, FailSafe is set.
  • While FailSafe is set, the output registers load TxP = TxN = '0' and TxInh = '1' whatever the selector presents. Fs_Clr and the reset clear FailSafe.
  • The timer observes only the registered outputs, so it cuts a transmission also when the encoder or the selector fails (CD-FS-01). A transmission of 33 words keeps Bus_TxInh at '0' for 1320 H cycles (660 us), below the limit (CD-FS-02).

7. Decoder (CD-3, o1553_codec_decoder, one per bus)

7.1 Overview

Decoder of one bus: glitch filter, crossing detector, interval classifier, word state machine with the bit shift
register, check timer, gap counter and own-transmission window

All times are taken from a free-running 16-bit cycle counter. A crossing time has half-cycle resolution: it is the middle between the last sample of the old polarity and the first sample of the new one. Intervals of interest are at most 2.25 us (900 cycles at 400 MHz), so the 16-bit difference of two time stamps is exact.

7.2 Glitch filter

The filter accepts a new line state after F consecutive samples of it and keeps the time stamp of its first sample. A pulse shorter than (F - 1) clock periods is seen in fewer than F samples and ignored; a pulse of F clock periods or longer is accepted. With F = ceil(50 ns x ClkFreq_g) + 1 this gives CD-DE-02. The filter delays the accepted state by F cycles but not its time stamp, so intervals are not affected.

7.3 Crossing detector

Accepted change Event
positive to negative, or negative to positive Crossing at the middle between the last sample of the old and the first sample of the new state
positive or negative to zero, then the opposite polarity before 0.4 us Crossing at the middle of the zero interval
positive or negative to zero, then the same polarity before 0.4 us None (a dip of the amplitude)
zero for 0.4 us (ceil(0.8H) cycles) Idle; the next non-zero state is a start of activity, with the time stamp of its first sample

Every crossing carries its direction: falling (positive to negative) or rising (negative to positive).

The zero window of a crossing (the time the line needs to pass the threshold band of the receiver) is at most 300 ns for the waveforms of MIL 4.5.2.1.2.1 at the transceiver outputs; the idle threshold of 0.4 us lies above it. A zero gap between two words that is shorter than the idle threshold is not legal (words of a message are contiguous, messages are at least 4.0 us apart); when the levels on both sides of such a gap have the same polarity, the interval to the next crossing can fall outside the sync classes, and the word is then not recognised (CD-DE-11).

7.4 Interval classes

The interval from the previous crossing (or from the start of activity) to a crossing is classified in half-cycle units against multiples of H:

Class Interval Nominal
Q1 0.25 us to 0.75 us half bit
Q2 0.75 us to 1.25 us bit
Q3 1.25 us to 1.75 us sync half
Q4 1.75 us to 2.25 us sync half merged with a half bit
bad shorter than 0.25 us or longer than 2.25 us none

Worst case at 16 MHz: a crossing estimate is off by at most half a cycle (31.25 ns), an interval by one cycle (62.5 ns). With 150 ns zero-crossing deviation and a bit rate 1 % off, a Q4 interval reaches at most 2.0 x 1.01 + 0.15 + 0.0625 = 2.2325 us and a Q3 interval at least 1.5 x 0.99 - 0.15 - 0.0625 = 1.2725 us; every class keeps at least 17 ns to its bounds (CD-DE-03). At 48 MHz and above the margin is at least 59 ns.

The first interval after an idle line runs from the start of activity to the mid-sync crossing. Its start is no zero crossing: the receiver threshold delays it by up to half the zero window (150 ns), and the deviation of the mid-sync crossing is not bounded by a crossing before it. It lasts at least 1.5 x 0.99 - 0.15 - 0.15 - 0.0625 = 1.12 us at 16 MHz, below Q3. For this interval only, Q2 also counts as a sync half: a sync after an idle line is recognised from 0.75 us (specification, section 6). Manchester bits without a sync have their first crossing 0.5 us after the start of activity (at most 0.72 us), so they still do not start a sync.

7.5 Word state machine

Word state machine of the decoder: Hunt_s, SyncEnd_s, Bits_s and Check_s

State Event Action Next state
Hunt_s Crossing after a Q3 or Q4 interval, or after a Q2 interval from the start of activity (first sync half after an idle line, section 7.4) Mid-sync crossing: falling = command/status sync, rising = data sync; store its time SyncEnd_s
Hunt_s Other crossing, idle None Hunt_s
SyncEnd_s Crossing after Q3 in the direction of a bit boundary Boundary crossing before bit 0 Bits_s (boundary phase)
SyncEnd_s Crossing after Q4 Mid-bit crossing of bit 0: falling = one, rising = zero Bits_s (mid phase)
SyncEnd_s Other interval, idle Sync error Hunt_s
Bits_s, boundary phase Crossing after Q1 Mid-bit crossing: bit value from the direction Bits_s (mid phase)
Bits_s, mid phase Crossing after Q1 Boundary crossing (next bit equal to this one) Bits_s (boundary phase)
Bits_s, mid phase Crossing after Q2 Mid-bit crossing of the next bit (opposite value) Bits_s (mid phase)
Bits_s Mid-bit crossing of bit 16 (parity) Reference crossing: store its time, start the check timer Check_s
Bits_s Other interval Manchester error Hunt_s
Bits_s Idle Bit count error (too few bits) Hunt_s
Check_s Crossing after Q2 from the reference, or a second Q1 after a Q1 Bit count error (a bit follows the parity bit) Hunt_s
Check_s Crossing after a sync half (the classes of Hunt_s) before the check timer ends Word event: valid, or parity error; the crossing is the mid-sync crossing of the next word SyncEnd_s
Check_s Check timer at 3H + F cycles after the reference crossing Word event: valid, or parity error when the parity is even Hunt_s
others in every cycle, also without a crossing Recovery (section 10) Hunt_s

The interval context (time and direction of the last crossing) is kept across the states, so that a boundary crossing seen in Check_s is the start of the first sync half of a contiguous next word in Hunt_s. Only a Q3 or Q4 interval can start a sync, and data bits produce only Q1 and Q2 intervals: after an error the decoder therefore finds the next word at its sync (CD-DE-11). The rest of a corrupted word can contain a level of 1.5 us or 2.0 us that looks like a sync half; the error lock (set by an error event, cleared by an idle line or a valid word) suppresses the error events of such a burst, so that every corrupted word is reported once. A word reported with an error carries the data bits decoded so far, the others '0'.

7.6 Event timing, gap and contiguity

  • The check timer ends 3H + F cycles after the reference crossing, later than any crossing that could reveal an extra bit (at most 1.3 us plus the filter delay). Counted from the reference crossing at the ports, the event comes rxLatency = SyncStages_g + F + 3H + 1 cycles later, at most half a cycle earlier and at most one cycle later (CD-DE-08). The input register of the line state and the event register add two cycles; the crossing time estimated to half a cycle and the check timer, which ends on a whole cycle, place the event 0.5 to 2 cycles before the end of these two cycles.
  • A gap counter starts at 0 at the reference crossing of every valid word and counts up to 65535. At a mid-sync crossing its value (corrected by the half-cycle of the stamps) is the gap of the new word; contiguous is 2.0 us +/- 0.4 us, that is 3.2H to 4.8H cycles (CD-DE-09). Before the first valid word and after the counter saturated, the gap is all ones.
  • The own-transmission window of a bus is '1' while the encoder drives this bus (Sel_TxActive, section 5) and for loopCycles + SyncStages_g + F + 2 cycles after, where loopCycles = 2H (1.0 us, loopDelayMax); the extension aligns the window with the time at which the decoder accepts a crossing. The window is sampled when the mid-sync crossing of a word is accepted, and the sample is the own flag of that word (CD-DE-10). The decision is taken per word from its own sync, not at its event: an echo has its mid-sync crossing at most 1.0 us after the mid-sync crossing of the word sent, inside the transmission, while the earliest foreign word (a command 4.0 us after the reference crossing of the last word sent) has it 3.5 us after the end of the transmission.
  • Rx_Active is '1' while the crossing detector has an accepted polarity (LastPol): from the start of activity (section 7.3) to the idle event. The start is accepted F samples after the first sample of the new state, which reaches the decoder SyncStages_g + 1 cycles after the ports; the idle event comes ceil(0.8H) cycles after the first zero sample. With the output register, Rx_Active rises SyncStages_g + F + 1 and falls SyncStages_g + ceil(0.8H) + 2 cycles after the line at the ports, at most one cycle earlier depending on the sampling phase (CD-DE-13). A zero window or a zero gap shorter than 0.4 us does not end the activity.
  • Activity without a word (CD-DE-14): a flag, cleared when the activity starts, is set when the decoder recognises a sync half; a counter, cleared when the activity starts, counts the cycles of Rx_Active = '1' and saturates at all ones. When Rx_Active falls with the flag at '0', the event Rx_NoWord is given with the count. Flag, counter and event are added beside the existing registers and change none of them.

8. Transmission monitor (CD-5, o1553_codec_monitor)

  • At the end of half bit 39 of every word whose outputs were not suppressed, the encoder hands the word (sync type, data, bus) to the monitor; the monitor holds it as the expected word with a deadline of 8H cycles (4 us).
  • A word event of that bus with the own-transmission flag ends the expectation: a valid word with the same sync type and data is a match, anything else a loopback error.
  • The deadline without such an event is a loopback error. The expectation of a word has always ended when the next word is complete (the timer register holds less than 8 us of cycles, also after an upset, and a word lasts 20 us), so a new expected word replaces nothing.
  • Own words while no word is expected are ignored (for example the echo of a word cut by an abort).
  • With Cfg_MonEn = '0' no word is expected and no error is reported (CD-MO-02).

9. Timing budget at the core ports

Quantity Value
Acceptance of the first word to the start of its sync 2 cycles (txLatency)
Start of the sync to the mid-sync crossing 3H cycles (1.5 us)
Reference crossing to the word event rxLatency = SyncStages_g + F + 3H + 1 cycles (1.59 us at 100 MHz, 1.81 us at 16 MHz), -0.5 to +1 cycle
Contiguous next word: reference crossing to mid-sync crossing 4H cycles (2.0 us) nominal

A protocol engine that answers a command with a response time T (reference crossing of the last received word to the mid-sync crossing of its first word, both at the ports) presents the first word T - 3H - txLatency cycles after the reference crossing, that is at least T - 3H - 2 - (rxLatency + 1) cycles after the word event (the event at its latest). At the shortest response time, T = 4.0 us at the ports (at the bus the transceiver delays add to it), the engine has this many clock cycles between the word event and the first word:

ClkFreq_g SyncStages_g H F rxLatency Event to first word at T = 4.0 us
16 MHz 2 8 2 29 cycles (1.8125 us) 8 cycles (0.5 us)
16 MHz 4 8 2 31 cycles (1.9375 us) 6 cycles (0.375 us)
100 MHz 2 50 6 159 cycles (1.59 us) 88 cycles (0.88 us)
400 MHz 2 200 21 624 cycles (1.56 us) 373 cycles (0.9325 us)

The 4.0 us minimum is therefore reachable at the largest latency (16 MHz, four synchroniser stages) when the protocol engine decides within 6 clock cycles; the RT specification states the lower bound of its programmable response time from this table.

10. Reset and fault tolerance

  • After the reset: encoder Idle_s, all buses idle, no shutdown, no fail-safe state, decoders in Hunt_s with no previous crossing and the gap all ones (CD-CF-02).
  • Every state machine has a when others branch to its idle state that is evaluated in every cycle, in the decoder also without line activity. All registers rely on the TMR of the synthesis tool; the input synchronisers are triplicated by olo_intf_sync (SyncTmr_g = true).
  • The codec has no memory and therefore no ECC.