Data Notes: Introduction to Error Detection & Error Correction

Introduction to VPC, LPC, CRC, ECC

Example 1 (VPC)

==========================================================================
title: page-01-vpc.txt
ref  :
1) https://bitsavers.org/pdf/hp/tape/7970/
2) https://bitsavers.org/pdf/dec/magtape/tu16/
notes:
1) this info applies to 9-track tape systems like the HP-7970e
2) this example shows a hypothetical 16-byte block without LPC/BCC/CRC
   (an end-of-block gap exists after the last data byte)
3) dp (data parity) is also called VPC (vertical parity check)
4) during a write operation, data bits are supplied from the computer. The
   tape system uses these data bits to compute the VPC bit which is
   recorded with the rest
5) during a read operation, data bits are supplied by the tape medium. The
   tape system uses these bits to compute the parity bit which is compared
   with the VPC bit (match=good data; mismatch=error)
6) NRZI encoding employed odd parity so that something was written to tape
   even when all data bits were zero
7) this example demonstrates odd parity (all vertical data bits + VPC = 1)
   so we need an odd number of ones in each vertical column
8) ASCII bit 'f3' = X (was written as '0' but is being read as '1')
   expected parity: 1
   VPC data       : 0 (so column f is in error but the row is unknown)
9) WARNING: VPC will only detect single-bit errors. Two errors will escape
notice. ========================================================================== +-------------------------------------------- IBM / HP track number | +------------------------------------------ ANSI track number | | ++++------------------------------------- ASCII bit designations | | |||| 0 1 2 3 4 5 6 7 8 9 a b c d e f ---- per-block character count | | |||| | | | | | | | | | | | | | | | | +--- end-of-block gap 0 7 d0/Z 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 . binary data 0 7 2 d1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 . binary data 1 6 8 d2 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 . binary data 2 5 1 d3 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 X . binary data 3 4 9 d4 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 . binary data 4 3 3 d5 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 . binary data 5 2 5 d6 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 . binary data 6 1 6 d7 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 . binary data 7 P 4 dp/P 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 . parity data (VPC) ==========================================================================

Example 2 (LPC / LRC / LRCC)

==========================================================================
title: page-02-lpc.txt
ref  :
1) https://bitsavers.org/pdf/hp/tape/7970/
2) https://bitsavers.org/pdf/dec/magtape/tu16/
notes:
1) this info applies to 9-track tape systems like the HP-7970e
2) this example shows a hypothetical 16-byte block with trailing LPC
   (an end-of-data block gap separates data from LPC)
3) see 'page-01-vpc.txt' for info about VPC
4) LPC (Longitudinal Parity Check) is also known as LRC (R=redundancy)
5) this example shows odd parity (all horizontal data bits + LPC = 1)
   so we need an odd number of ones on each horizontal row
6) ASCII bit 'f3' = X (was written as '0' but is being read as '1')
   expected VPC parity: 1
   VPC data           : 0 (so column f is in error)
   expected LPC parity: 0
   LPC data           : 1 (so row    3 is in error)
6) Now that we know that bit f3 is in error we can correct it
7) Also notice that the very last bit is protecting both the VPC
   row and LPC column (error checking the parity scheme)
==========================================================================
+---------------------------------------------- IBM / HP track number
| +-------------------------------------------- ANSI track number
| | ++++--------------------------------------- ASCII bit designations
| | |||| 0 1 2 3 4 5 6 7 8 9 a b c d e f ------ per-block character count
| | |||| | | | | | | | | | | | | | | | | +----- end-of-block gap 
| | |||| | | | | | | | | | | | | | | | | | +--- LPC (LRC)
0 7 d0/Z 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 . 1    binary data 0
7 2 d1   0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 . 1    binary data 1
6 8 d2   0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 . 1    binary data 2
5 1 d3   0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 X . 1    binary data 3
4 9 d4   0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 . 1    binary data 4
3 3 d5   0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 . 1    binary data 5
2 5 d6   0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 . 1    binary data 6
1 6 d7   1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 . 1    binary data 7
P 4 dp/P 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 . 1    parity data (VPC)
==========================================================================

Example 3 (CRC)

==========================================================================
title: page-03-crc.txt
ref  :
1) https://bitsavers.org/pdf/hp/tape/7970/
2) https://bitsavers.org/pdf/dec/magtape/tu16/
3) https://en.wikipedia.org/wiki/Cyclic_redundancy_check
notes:
1) this info applies to 9-track tape systems like the HP-7970e
2) this example shows a hypothetical 16-byte block with LPC + CRC
2a shown this way for clarity but the CRC is always written before LPC
2b LPC only protects data bits but not CRC bits
3) see 'page-01-vpc.txt' for info about VPC
4) see 'page-02-lpc.txt' for info about LPC
5) CRC (cyclic redundancy check)
==========================================================================
+------------------------------------------------- IBM / HP track number
| +----------------------------------------------- ANSI track number
| | ++++------------------------------------------ ASCII bit designations
| | |||| 0 1 2 3 4 5 6 7 8 9 a b c d e f --------- per-block character count
| | |||| | | | | | | | | | | | | | | | | +-------- end-of-block gap
| | |||| | | | | | | | | | | | | | | | | | +------ LPC (LRC)
| | |||| | | | | | | | | | | | | | | | | | | +---- gap
| | |||| | | | | | | | | | | | | | | | | | | | +-- CRC
0 7 d0/Z 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 . 1 . c   binary data 0
7 2 d1   0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 . 1 . c   binary data 1
6 8 d2   0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 . 1 . c   binary data 2
5 1 d3   0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 X . 1 . c   binary data 3
4 9 d4   0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 . 1 . c   binary data 4
3 3 d5   0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 . 1 . c   binary data 5
2 5 d6   0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 . 1 . c   binary data 6
1 6 d7   1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 . 1 . c   binary data 7
P 4 dp/P 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 . 1 . ?   parity data (VPC)
==========================================================================

Links

Tape Deck Manuals from the 1970s
Notes
https://bitsavers.org/pdf/hp/tape/7970/ HP-7970e (Hewlett-Packard) manufactured in the 1970s
(composed of discrete logic chips)
https://bitsavers.org/pdf/dec/magtape/tu16/ DEC-TU16 (Digital Equipment Corporation) manufactured in the 1970s
(composed of discrete logic chips)
https://bitsavers.org/pdf/dec/magtape/te16/ DEC-TE16 (Digital Equipment Corporation) manufactured in the 1980s
an enhanced version of TU16
(some 8-bit microprocessors appear)
http://bitsavers.org/pdf/kennedy/9100/ Kennedy Model 9100
manufactured in the early 1970s
better description of LRCC + CRC
CRC theory

https://en.wikipedia.org/wiki/Cyclic_redundancy_check

CRC live demo

http://www.sunshine2k.de/coding/javascript/crc/crc_js.html an online CRC demo calculator
https://crccalc.com/ an online CRC demo calculator
CRC demo routines in c

crc8_demo_100.c create a static data table
crc8_demo_101.c use table to generate a crc8 for specific data
Other

https://en.wikipedia.org/wiki/Error_correction_code


Back to Home
Neil Rieck
Waterloo, Ontario, Canada.