How to get number of parity bits for given number of string length
6 visualizzazioni (ultimi 30 giorni)
Walter Roberson il 23 Gen 2019
"parity bit" is a family of techniques, not one particular technique.
A parity bit calculation involves the bitwise exclusive "or" of a number of positions in the data, and the parity bit is then set so that when it is included in the calculation, the end result is either 1 ("odd parity") or 0 ("even parity"). But where the parity bits are placed relative to the other bits is up to the implementation, and which bits are taken together to form a particular parity bit is up to the installation, including the possibility that some inputs bits might contribut to multiple output bits.
For example it would be a valid scheme to say that odd parity is to be calculated for the first 9 bits, and even parity is to be calculated for the next 5 bits, and then odd parity is to be calculated on bits 1:2:19 and then even parity is to be calculated on bits 2:2:20 and then those 4 parity bits are to be placed after the 20 input bits to form a 24 bit system in which bits 1:14 contribute to two different parity bits but bits 15:20 contribute to only 1 parity bit.
We therefore cannot answer the question of how many parity bits should be used for a given string length: it depends on what parity pattern you are using.
Historically it has not been uncommon for packet-oriented protocols to have either one octet (8 bits) or one nibble (4 bits) of parity per packet.
Parity is typically only used for basic sanity checks, not for any serious purpose. There are other techniques that work much better for error detection and error correction.