3F4 Line Coding Dr. I. J. Wassell Introduction • Line coding is the procedure used to convert an incoming bit stream, bk to symbols ak which are then sent as pulses akhT(t-kT) on to the channel • The line coding technique affect the properties of the transmitted signal • Desirable properties are – Self Synchronisation. There should be sufficient information in the transitions and zero-crossings to permit symbol timing clock regeneration Introduction – Spectrum suited to the channel. The PSD of the transmitted signal should be compatible with the channel frequency response Hc(w), eg, • Many channels cannot pass dc (zero frequency) owing to ac coupling • Lowpass response limits the ability to carry high frequencies Line Codes for Copper Cables • Following a qualitative introduction to some practical line codes, we will look at a framework for their quantitative analysis • Unipolar Binary – – – – binary symbols transmitted pulse weightings, ak=0 or A Volts, eg, ‘0’ and ‘1’ no guarantee of transitions (for timing regeneration) transmitted signal has non-zero mean, so the channel must be able to pass dc. If not, errors will occur with long runs of ‘1’s in the data Unipolar Binary 1 A 0 0 1 1 0 0 0 0 1 1 0 1 Line Codes for Copper Cables • Polar Binary (do not confuse with bipolar) – – – – binary symbols transmitted pulse weightings, ak=-A or A Volts, eg, ‘0’ and ‘1’ no guarantee of transitions (for timing regeneration) transmitted signal is zero mean (provided data is equiprobable), but there is still a high PSD at low frequencies, therefore still a problem with channels which do not pass dc Polar Binary 1 A 0 -A 0 1 1 0 0 0 0 1 1 0 1 Line Codes for Copper Cables • Bipolar (or Alternate Mark Inversion (AMI)) – ternary (3 level) symbols transmitted – pulse weightings, ak=0 or either -A or +A Volts, eg, ‘0’ or ‘1’, that is, • ‘0’ sent as ak=0 • ‘1’ sent as ak=-A or +A alternately – no guarantee of transitions (for timing regeneration) – signal mean is always zero (independent of data) – Spectral null at dc means there is no longer a problem if channel does not pass dc – 1 binary symbol sent as 1 ternary symbol, 1B1T code Bipolar (AMI) 1 A 0 -A 0 1 1 0 0 0 0 1 1 0 1 Line Codes for Copper Cables • High Density Bipolar (HDBn) – modified bipolar codes which guarantee transitions despite runs of zeros. – thus substitute runs of more than n zeros – an alternative name is BnZS • in this case substitute runs of n or more zeros – HDB3 is a popular code • note HDB3 is equivalent to B4ZS HDB3 • Any run of 4 zeros is replaced by the special pattern: B00D – D is sent as +/- A, such that successive D’s have alternating polarity (1st D is arbitrary) – B is sent as 0 or +/- A. Select B such that the next D violates the AMI alternating polarity result, ie send B as 0 if D violates the polarity rule. Otherwise send B=D to force a violation of the alternating polarity rule • Equivalently, HDB3 – B is sent as 0 if there has been an odd number of input ‘1’s since the last special sequence B00D – B is sent as +/- A if there has been an even number of input ‘1’s since the last special sequence B00D • All other symbols obey the AMI rules • The scheme allows the unique detection of the special sequences, since polarity violations correspond with the D symbols. • An overall mean of zero is achieved HDB3 1 A 0 -A 0 1 1 0 0 0 0 1 1 0 1 HDB3 • There are never more than 3 consecutive zeros, so plenty of edges for timing regeneration • The channel is not required to pass dc • The transmit power requirement is a little greater than AMI (about 10%) Power Spectra for Line Codes • We can use the earlier results concerning power spectra to derive the PSD for PAM schemes • Initially we will consider the case where the symbols are transmitted as weighted impulses. • We will then generalise to arbitrary pulse shapes Signal TX as impulse train • A PAM signal sent as a weighted impulse train is, x(t ) a (t nT ) n n s Where Ts is the symbol period. We will show that the PSD of x(t) is given by, and 1 S x (w ) Ts R(m)e m jmwTs 1 R(0) 2 R(m) cos(wmTs ) Ts m1 R(m) E[an anm ] Which is the discrete Autocorrelation function (ACF). Also note that R(m) = R(-m) for real valued an Proof • Using direct method, ie, lim E[ X T (w ) ] S x (w ) T T 2 • The truncated signal xT(t) is, xT (t ) N a (t nT ), n N n s T (2 N 1)Ts • Now, X T (w ) xT (t )e jwt dt And substituting for xT(t) gives, Proof X T (w ) Now, N a (t nT )e n N n N n N jwt s dt jwt a ( t nT ) e dt n s N jnwTs a e n n N X T (w ) X T (w ) X (w ) 2 * T Proof | X T (w ) |2 • Now, N jnwTs a e n n N N N jkwTs a e k k N N j ( k n )wTs a a e nk n N k N N N j ( k n )wTs 2 E | X T (w ) | E an ak e n N k N N N j ( k n )wTs E [ a a ] e n k n N k N Proof k nm • Let, E | X (w ) | E[a a N N n 2 T m k n and so n n N m N n N nm ]e j ( n m n )wTs N n jmwTs R ( m ) e n N m N n • Replace the outer sum over index n by 2N+1, E | X T (w ) |2 (2 N 1) N n jmwTs R ( m ) e m N n Proof • Now, lim E[ X T (w ) ] S x (w ) T T 2 Where T=(2N+1)Ts, so N n 1 S x (w ) (2 N 1) R(m)e jmwTs N (2 N 1)Ts m N n lim 1 Ts jmwTs R ( m ) e m Proof 1 1 jmwTs jmwTs R(0) R(m)e R ( m) e Ts m m 1 1 jmwTs jmwTs R(0) R(m)e R ( m) e Ts m 1 m 1 1 jmwTs jmwTs R(0) R(m) e e Ts m 1 1 R(0) 2 R(m) cos(wm Ts ) Ts m 1 Remembering that R(m) = R(-m) for real valued an Proof • Note that for R(m)=0 for all m except zero, the PSD reduces to R(0) S x (w ) Ts e.g., for polar binary line coding. For Arbitrary Pulse Shapes • Recall that a PAM signal with a desired pulse shape h(t) may be generated by filtering (actually convolving) the weighted impulse train with a filter whose impulse response is h(t) • From the power spectra results we obtain, S y (w ) H (w ) S x (w ) 2 1 H (w ) R(0) 2 R(m) cos(wmTs ) Ts m1 2 PSD of Specific Schemes • Given a particular line coding scheme which generates symbols ak, the transmitted PSD is calculated as follows: – Determine the discrete ACF M R(m) E[ak ak m ] Ri pi i 1 Where, •M is the number of possible values that akak+m can take on •Ri is the ith value of akak+m •pi is the probability that Ri occurs PSD of Specific Schemes • Evaluate impulse train PSD – Substitute R(m) into the PSD formula, 1 S x (w ) R(0) 2 R(m) cos(wmTs ) Ts m1 • Evaluate PSD with pulse shaping – Multiply Sx(w) by |H(w)|2, S y (w ) H (w ) S x (w ) 2 Example- Polar Binary bk : 0,1 ak : 1,1 m 0 1 bk ....bk m ak ....ak m Ri ak ak m M pi R(m) Ri pi i 1 0...0 1... 1 R1 1 p1 0.5 1...1 1...1 R2 1 p2 0.5 0...0 0...1 1... 1 R1 1 1...0 1...1 1... 1 1...1 1...1 R(0) (1 0.5) (1 0.5) R(0) 1 p1 0.25 R( 1) (1 0.25) R2 1 p2 0.25 (1 0.25) (1 0.25) R3 1 p3 0.25 (1 0.25) R4 1 p4 0.25 R( 1) 0 Example- Polar Binary • So, 1 S x (w ) R(0) 2 R(m) cos(wmTs ) Ts m1 1 Ts Example- Polar Binary • Now extend to pulses with a rectangular shape and duration Ts. To do this we convolve the impulse stream with a filter h(t) with a rectangular impulse response, i.e., from the E and I Data Book, h(t) -b/2 a 0 FT b/2 t wb H w ab sinc 2 sin x where, sinc x x Example- Polar Binary • In our example, b=Ts and a=1, so the filter frequency response is, wTs H w Ts sinc 2 This response has an amplitude of Ts at w = 0 and zero crossings at multiples of 2p/Ts rad/s or 1/Ts Hz. Example- Polar Binary • Now the PSD at the output of the filter H(w) is, S y (w ) S x (w ) H (w ) 2 1 wTs Ts sinc Ts 2 2 2 wTs Ts sinc 2 This response has an amplitude of Ts at w = 0 and zero crossings at multiples of 2p/Ts rad/s or 1/Ts Hz. This is consistent with the PSD plot for polar binary signalling with rectangular pulses. Example- Polar Binary PSD*Ts PSD*Ts f *Ts Impulse Train PSD f *Ts Rectangular Pulse PSD bk : 0,1 Example- Bipolar (AMI) ak : 0,1,1 m 0 1 2 2 bk ....bk m ak ....ak m Ri ak ak m M pi R(m) Ri pi i 1 Example- Bipolar (AMI) • So, 1 S x (w ) R(0) 2 R(m) cos(wmTs ) Ts m1 1 1 1 2 cos(wTs ) Ts 2 4 1 1 cos(wTs ) 2Ts 1 2 wTs sin Ts 2 Example- Bipolar (AMI) • Note that if rectangular pulses are employed as in the previous Polar example, the resulting PSD is given by, S y (w ) S x (w ) H (w ) Where, 2 wTs H w Ts sinc 2 Note the zero crossings at multiples of 2p/Ts rad/s or 1/Ts Hz and the lowering of the frequency sidelobes evident in the PSD plot. Example- Bipolar (AMI) PSD*Ts PSD*Ts f *Ts Impulse Train PSD f *Ts Rectangular Pulse PSD ACF With Non-Zero Mean Data • Sometimes the line coded data will have a non-zero mean value. • This could be due to – The line coding scheme, e.g., unipolar – The probability distribution of the data – Incorrect signalling voltages owing to faults • The result is that the R(m) will have finite values for m in the range +/- infinity ACF With Non-Zero Mean Data • The result for Sx(w) is valid but is hard to interpret physically • The solution is to express R(m) as the sum of two parts – The first part has a constant value of R over the range of m from + to - infinity – The second part has non-zero values of R over a finite range of m ACF With Non-Zero Mean Data • The advantage of this approach is that the first term can be represented in a format that is consistent with physical observations. • We will now show that this representation comprises a sequence of spikes (impulses) in the frequency domain, occurring at multiples of the bit rate. ACF With Non-Zero Mean Data • Suppose that R(m)=R for all m, then we can express the PSD as follows 1 S x (w ) Ts R Ts jmwTs R ( m ) e m jmwTs e m • Note the similarity in form to the Fourier series representation of an impulse train, 1 (t kT0 ) T0 k e k jk 2p t T0 Note in time domain ACF With Non-Zero Mean Data • Reminder, the Fourier Series (FS) for a periodic function is, x(t ) ck e jkwot where, w0 2p T0 k i.e., a weighted (complex) sum of phasors. • We now wish to find the FS of the rectangular pulse train x(t), t x(t) A 0 To t ACF With Non-Zero Mean Data • Now the coefficients are given by, t 1 ck T0 2 jkw 0t Ae dt t 2 A kpt sin pk T0 For the case where t goes to zero and At = 1 (i.e., a unit impulse train), kpt sin lim 1 T0 1 ck t 0 T0 kpt T0 T0 ACF With Non-Zero Mean Data • So we know, x(t ) ck e jkwot k Remembering that ck=1/T0 when x(t) is a sequence of unit impulses we can write, 1 (t kT0 ) T0 k 1 T0 e jkwot k e k jk 2p t T0 ACF With Non-Zero Mean Data • If we substitute, w=t, m=k and T0=2p/Ts, to get the equivalent relation in the frequency domain, Ts jmTsw 2p (w m ) e Ts 2p m m 2 p 2p jmTsw e (w m ) Ts m Ts m And hence we may express Sx(w) as a series of impulses in the frequency domain, R jmwTs S x (w ) e Ts m 2pR 2p 2 (w m ) Ts m Ts ACF With Non-Zero Mean Data • The PSD due to a constant R for all m consists of spikes, known as line spectral components, at multiples of wo=2p/Ts • This result enables simplified calculation of PSDs when R(i) can be written in the form, R(i) C (i) R with C (i) 0 for | i | L First calculate the PSD for R(i)=C(i), then add on the line spectrum for R(i)=R Example- Unipolar Binary bk : 0,1 ak : 0,1 m 0 1 bk ....bk m ak ....ak m Ri ak ak m M pi R(m) Ri pi i 1 0...0 0...0 R1 0 p1 0.5 1...1 1...1 R2 1 p2 0.5 0...0 0...1 0...0 R1 0 1...0 1...1 1...0 1...1 0...1 R(0) (0 0.5) (1 0.5) R(0) 0.5 p1 0.25 R( 1) (0 0.25) R2 0 p2 0.25 (0 0.25) (0 0.25) R3 0 p3 0.25 (1 0.25) R4 1 p4 0.25 R( 1) 0.25 Example- Unipolar Binary • So, 1 jmwTs S x (w ) R ( m ) e Ts m 1 1 1 jmwTs e Ts 4 4 m 1 jmwTs 1 e 4Ts m 1 4Ts 2p 1 T s 1 p 2 4Ts 2Ts 2p w m Ts m 2p w m Ts m The second term is known as a line spectrum Example- Unipolar Binary PSD*Ts PSD*Ts f *Ts Impulse Train PSD f *Ts Rectangular Pulse PSD Scrambling • Some components of a transmission system work better if the bit sequence bk is random, ie, independent and uncorrelated – Timing regeneration not possible with some line codes if long sequences of ‘0’s or ‘1’s occur – Equalisers (see next section) rely on random bit sequences for successful operation • A common solution is to randomise (or scramble) the input bit sequences (in a known manner) prior to line coding Scrambling • The received signals then appear as if they come from a random source • Unscrambling after detection restores the correct bit sequence • A simple way to generate scramblers is to XOR the data with the output of a feedback shift register arrangement. Scrambling • For example we may utilise the so called frame-synchronised scrambler (also called a cryptographic scrambler S XOR PRBS T T XOR R PRBS AB 00 01 10 11 XOR 0 1 1 0 PRBS- Pseudo Random Binary Sequence generator. Usually a Maximal Length (ML) linear feedback shift register arrangement. PRBS at TX and RX must be synchronised Scrambling • An alternative is the Self-Synchronised scrambler. Is susceptible to error propagation. • Similar arrangements used for error rate testing. 5 5 4 4 XOR S XOR 3 2 3 2 1 1 T XOR T R XOR Summary • In this section we have – Examined the need for line codes and looked at some practical examples – Seen how to calculate the power spectra for various line codes – Briefly looked at scrambling to randomise data