Ans: To check if a generator polynomial can detect bit error, we apply the rules 2a in the CRC coding handout page 13.
2a. All double-bit errors E(x)=xi+xj=xi(1+xj-i),
if G(x) is a primitive with degree of c and the length of codeword is
less than 2c-1. It implies that j-i <=2c-1.
g1(x)
has a degree of 5. To check if g(x) is a primitive polynomial, we need
to check if it is not a divsor of 1+xm for any m<25-1=31.
We use the chkprimitive.pl for this. The result is shown in
http://cs.uccs.edu/~cs522/hw/hwF2003/hw5ex4a.txt.
It indicated that this is a primitive polynomial and therefore it can
detect any double bit error up to a codeword length of 31.
m(x)=10011101 g(x)=11 length(m(x))=8 length(g(x))=2 degree(m(x))=7 degree(g(x))=1 m(x)=x^7+x^4+x^3+x^2+1 g(x)=x^1+1 mx=1 0 0 1 1 1 0 1 len=1, indexmx=7 d(x)=1 0 0 1 1 1 0 1 0 dx=100111010 1 0 0 1 1 1 0 1 0 1 1 1 0 0 1 1 1 0 1 0 1 1 -------- 1 0 1 1 -------- 1 1 1 1 -------- 0 1 0 0 -------- 1 1 1 1 -------- 0 0 0 0 -------- 0 1 0 0 -------- 1 0 1 1 -------- 1 r(x)= 1 q(x)=1 1 1 0 1 0 0 1 codewordPacked=100111011
c(x)=111001100 g(x)=11 length(c(x))=9 length(g(x))=2 degree(c(x))=8 degree(g(x))=1 c(x)=x^8+x^7+x^6+x^3+x^2 g(x)=x^1+1 d(x)=1 1 1 0 0 1 1 0 0 dx=111001100 1 1 1 0 0 1 1 0 0 1 1 1 1 1 1 -------- 0 1 0 0 -------- 1 0 1 1 -------- 1 0 1 1 -------- 1 1 1 1 -------- 0 1 0 0 -------- 1 0 1 1 -------- 1 0 1 1 -------- 1 r(x)= 1 q(x)=1 0 1 1 1 0 1 1 crc check detects error!
Ans:
g1(x)=x^5+x^2+1; g2(x)=x+1;
x^5+
x^2+ 1
*
x+ 1
x^5+
x^2+
1
x^6+
x^3+ x
x^6+x^5+
x^3+x^2+x+ 1
Yes, G(x)=g1(x)*g2(x)
Assume we use the data bit pattern 11111111. Note that with
g1(x) we can only cover double bit error up to 31 bits (not 2^6-1).
Use encode.pl 11111111 1101111 we got codeword=1 1 1 1 1 1
1 1 1 0 1 0 0 0
Assume we garble first and last bit. The garbled codedword
is 0 1 1 1 1 1 1 1 1 0 1 0 0 1
Use decode.pl 01111111101001 1101111
c(x)=01111111101001 g(x)=1101111 length(c(x))=14 length(g(x))=7 degree(c(x))=13 degree(g(x))=6 c(x)=+x^12+x^11+x^10+x^9+x^8+x^7+x^6+x^5+x^3+1 g(x)=x^6+x^5+x^3+x^2+x^1+1 d(x)=0 1 1 1 1 1 1 1 1 0 1 0 0 1 dx=01111111101001 0 1 1 1 1 1 1 1 1 0 1 0 0 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 0 0 0 0 0 0 0 -------- 1 1 1 1 1 1 1 1 1 0 1 1 1 1 -------- 0 1 0 0 0 0 1 0 0 0 0 0 0 0 -------- 1 0 0 0 0 1 0 1 1 0 1 1 1 1 -------- 1 0 1 1 0 1 1 1 1 0 1 1 1 1 -------- 1 1 0 1 0 0 0 1 1 0 1 1 1 1 -------- 0 0 0 1 1 1 0 0 0 0 0 0 0 0 -------- 0 0 1 1 1 0 1 0 0 0 0 0 0 0 -------- 0 1 1 1 0 1 r(x)= 0 1 1 1 0 1 q(x)=0 1 0 1 1 1 0 0 crc check detects error!
c(x)=00000111101000 g(x)=1101111 length(c(x))=14 length(g(x))=7 degree(c(x))=13 degree(g(x))=6 c(x)=+x^8+x^7+x^6+x^5+x^3 g(x)=x^6+x^5+x^3+x^2+x^1+1 d(x)=0 0 0 0 0 1 1 1 1 0 1 0 0 0 dx=00000111101000 0 0 0 0 0 1 1 1 1 0 1 0 0 0 1 1 0 1 1 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 -------- 0 0 0 0 1 1 1 0 0 0 0 0 0 0 -------- 0 0 0 1 1 1 1 0 0 0 0 0 0 0 -------- 0 0 1 1 1 1 0 0 0 0 0 0 0 0 -------- 0 1 1 1 1 0 1 0 0 0 0 0 0 0 -------- 1 1 1 1 0 1 0 1 1 0 1 1 1 1 -------- 0 1 0 1 0 1 0 0 0 0 0 0 0 0 -------- 1 0 1 0 1 0 0 1 1 0 1 1 1 1 -------- 1 1 1 0 1 1 r(x)= 1 1 1 0 1 1 q(x)=0 0 0 0 0 1 0 1 crc check detects error!
Therefore the G(x) can detect 5 bit error (odd number bit error).
Ans:
1. The sequence numbers for the first batch of packets sent are 0, 1,
2, 3, 4, 5, 6.
2. The acknowledgement RN field value will be 7 (The receiver expects
to receive frame with sequence number 7).
3. The sequence numbers for the second batch of packets sent are 7, 0,
1, 2, 3, 4, 5.
4. The acknowledgement RN field value will be 6.
5. The acknowledgement RN field value will be 7 (different from 6 above).
Therefore the sender can distinguish the two cases.