How can I encode 0000 to 11110 in 4B/5B encoding scheme

S. M. Fahad Ahmad picture S. M. Fahad Ahmad · Jul 9, 2017 · Viewed 8.3k times · Source

4B/5B encoding

4B/5B ecoding

From the 4B/5B encoding scheme dataward 0000 in encoded to 11110 codeword similarly 0001 is encoded to 01001 etc.

Here the result of XOR operation between two codewords will be another valid codeword.

For example XOR of 11110 and 01001 is another codeword 10111 whose dataword is 1011.Here I have no problem.

Again, to avoid dc component NRZ-I line coding scheme is used. As a result there is not three consecutive Zero's in the output codewords. There is no more one heading and two tailing zero's in codewords. We have no worry about the number of one's in NRZ-I coding scheme.

But, how can I encode 0000 to 11110 or 0001 to 01001 and which algorithm I should apply for this encoding scheme.

I search google and study books too. But everywhere they are telling only the same thing but I did not get my answer.

Thanks in advance

Answer

Crazy Coder picture Crazy Coder · Jul 14, 2017

Decimal Representation

To understand this mechanism properly we should consider all codewords’ decimal value. Observe the above table carefully I converted all binary value of your table to decimal form.

Now to avoid dc component during transmission we should consider only the codewords which don’t have more than one starting and two tailing zeros . So we get every two consecutive datawords are assigned to another two consecutive codewords.

Like this

(2,3) to (20,21),

(4,5) to (10,11)

(6,7) to (14,15)

(8,9) to (18,19)

(10,11) to (22,23)

(12, 13) to (26,27)

(14,15) to (28,29)

Exception

(0,1) to (30,9)

1 is assigned to 9 because all codewords from 0 to 8 (inclusive) are invalid because of having excessive zero . So first valid codeword 9 is assigned to 1. If all valid codewords are assigned consecutively then changing only one bit (single bit error) during transmission it will convert to next or previous codeword and this error will remain undetected.

We know that in block coding if a valid codeword is convert to another valid codeword during transmission as a result of error , it will remain undetected and this a limitation of block coding. So to avoid this these all valid codewords are not consecutively assigned with datawords.