Protocols | Parity Information

Parity Bits Explained

Parity bits are used to detect errors in data transmission between boards. The transmitting board counts up the number of 1's and if this number is ODD then the corresponding parity bit is SET. If the number of 1's is EVEN the corresponding parity bit is ZERO. Depending on who you talk to this is called "Even Parity" or "Odd Parity". So to avoid confusion I wrote this webpage with actual examples! ;-)

Based on the incoming data the receiver calculates what the the parity bits should be and compares the actual and expected parity bits. If there is any disagreement then a parity error bit is latched and remains set until manually cleared by a user (press the "clear history" button).

In theory, using both horizontal and vertical parity bits enables the receiver to not only detect a single bit error, but to also correct a single bit error and detect a double bit error. In practice only parity error detection is done in the DFE firmware, however. Correction requires the entire data record to be buffered before processing can begin, and in most cases this additional latency would kill the timing budget. So we live with parity error detection and don't bother trying to correct the data. The good news is that the links used in the system have really low bit error rates and can run for weeks without a single parity error. :-)

Horizontal and Vertical Parity

The example below shows Horizontal (blue) and Vertical (green) parity bits added to block of 16 bits.

HP D3 D2 D1 D0
0 1 1 0 0
1 0 0 1 0
1 1 0 1 1
0 0 0 0 0
0 1 0 1

Number of Objects

Many L2 records are varible length. The length field (aka number of objects #OBJ) is one of the most important fields in the header of these records because it tells the receiver when to begin processing the data. Because this field is so important it has extra parity bits associated with it. NOTE: the DFE firmware does perform correction on this field if the parity bits show a problem.

The number of objects field is always a 6-bit unsigned number: D5, D4, D3, D2, D1, D0 (with D5 being the most significant bit). The vertical (VP) and horizontal (HP) parity bits are calculated as follows:

HP1 D5 D4 D3
HP0 D2 D1 D0
VP2 VP1 VP0

An example: the number of objects is 17. Converting 17 decimal to binary results in "010001". So in the L2 record header the number of objects is "010001", the number of objects vertical parity field is "011", and the number of objects horizontal parity field is "11". Viola, that's all there is to it. :-)


jamieson@fnal.gov
Last modified: Wed Jan 4 10:43:40 2006