# How to perform the lfsr scrambling used in PCIe for 2 byte input?

In PCIe Gen 3 on-wards there is 128b/130b encoding used which scrambles incoming bit using a LFSR with polynomial: $$G(X) = X^{23} + X^ {21} + X^{16} + X^{8} + X^5 + X^2 + 1.$$ Is there any way to perform required scrambling on 2 bit in one clock using parallel scramblers, where output of incoming msb will be dependent on lsb's output.

• I don't think so. If you were able to, you can divide and conquer attack on a single LFSR, if I've understood correctly. – kelalaka Aug 6 '19 at 20:16
• How can we decimate the given polynomial for getting odd and even sequence out of the sequence generated by this LFSR polynomial G(X)=X23+X21+X16+X8+X5+X2+1. I need two new LFSR which will follow only the odd sequence and even sequence of that whole sequence. – Akash Pradhan Aug 6 '19 at 21:07
• Please note that the PCIe uses LFSR not for security, but to reduce excessive di/dt. – forest Aug 7 '19 at 1:32
• @forest what is di/dt – kodlu Aug 7 '19 at 2:25
• Bursts of sequential 1s and 0s can cause sudden changes in power consumption, and can cause electromagnetic interference in a high-speed bus. Using an LFSR as a stream cipher makes it so that any data going over a bus appears random. DDR3/4 does it, high-speed USB does it, PCIe does it, etc. It ensures that the electronic stress and EMI is independent of the kind of data that is being sent. – forest Aug 7 '19 at 2:43

The online magma calculator

http://magma.maths.usyd.edu.au/calc/

tells me this LFSR corresponds to a primitive polynomial since $$G(X) = X^{23} + X^ {21} + X^{16} + X^{8} + X^5 + X^2 + 1$$ is primitive.

Thus, some phase of the output sequence is given by $$tr(\alpha^t)$$ where $$tr:GF(2^{23})\rightarrow GF(2)$$ is the trace map and $$\alpha \in GF(2^{23})$$ is primitive.

The minimal polynomial of $$\alpha^2$$ is also $$G(X)$$ and it is the polynomial generating the decimation by 2 (the minimal polynomial of $$\alpha^2.$$ But this is the same polynomial since an element and its square are conjugates. This is because $$G(X)=\prod_{i=1}^{23} (X-\alpha^{2^{i-1}}),$$ from standard finite field results.

The decimation by 2 is $$s(t+2^{22})$$ if $$s(t)$$ is the original sequence in its characteristic phase, i.e., the phase that satisfies $$s(2t)=s(t)$$ for all $$t \pmod{2^{23}-1}.$$

• could you add the two polynomials? – kelalaka Aug 7 '19 at 12:11