**Aim of the Experiment**

In this experiment, you will generate pseudo-random binary sequences using linear feedback shift registers. You will also learn about the self-synchronizing digital data scrambler and descrambler. These binary sequences will be used to simulate binary data sources for the remaining experiments. Please check out the DSP boards as per usual.

**Applications of Pseudo-Random Binary Sequences**

Pseudo-random binary sequences are also known as pseudo-noise (PN) sequences because the sequences resemble noise. These binary sequences appear to be random but instead have structure. They have all frequencies present; i.e., there are no nulls in the magnitude spectrum.

PN sequences are widely used to

- generate test, measurement and calibration signals
- generate training signals in communication systems
- scramble and descramble data in communication systems
- generate additive dither in data converters

The first application is to use a PN sequence to estimate an impulse response of an unknown subsystem, e.g. the cascade of a source, empty chamber, and receiver in a biomedical instrument. Once the impulse response is known, calibration of the system can proceed by means of a linear time-invariant filter in the transmitter (known as a predistorter) or receiver (known as an equalizer) to compensate for the distortion in the subsystem.

As a training signal, the PN sequence would be the digital data to be transmitted over the unknown communication channel. The receiver knows the bits that had been transmitted, and can use that knowledge adapt receiver settings to improve communication performance (signal quality). The receiver can also estimate the impulse response of the communication channel if needed.

In data scramblers, PN sequences are used to prevent long strings of 0's and 1's. For baseband transmission, during a long string of 0's or 1's, the primary frequency component in the signal would be at DC, and DC does not get passed by some communication channels (e.g. voiceband and acoustic channels). For bandpass transmission, during a long string of 0's or 1's, the primary frequency of the message signal (DC) would be upconverted to sit at the carrier frequency. This presents at least two problems:

- The receiver may have more difficulty for the receiver to lock onto the carrier frequency and phase
- The receiver will have greater difficulty performing symbol synchronization if the symbol synchronization algorithm uses frequency content at the transmission bandwidth's edges for the symbol timing estimate.

The primary application of PN sequences in lab #4 is for data scrambling and descrambling.

The WWM book also mentions a legacy application of the PN sequences in 2G cell phones that used code division multiple access (CDMA) pioneered by Qualcomm in 1990s. In 2G CDMA cell phones, PN sequences are used in the uplink direction (from mobile to basestation) to enable the basestation to distinguish one user from another. This is discussed in Appendix L of the reader and in lecture 21 slides.

*Real-Time Digital Signal Processing from MATLAB to C with the TMS320C6x DSP s*(Jan. 2012) by Thad B. Welch, Cameron H. G. Wright and Michael G. Morrow,- Section 5.5

*Software Receiver Design*by C. Richard Johnson, Jr., William A. Sethares and Andrew Klein- Chapter 8

- Course reader
- Appendix L: Direct Sequence Spreading
- Lecture 21: Spread Spectrum Communications on Code Division Multiple Access (CDMA) cellular systems based on direct sequence spread spectrum approaches

**Downloads**

Recitation Slides by Ms. Debarati Kundu and Mr. Andrew Mark, The University of Texas at Austin

Lab #4 instructions by Ms. Debarati Kundu and Mr. Andrew Mark, The University of Texas at Austin

LabVIEW transmitter demonstration by Dr. Zukang Shen to show how labs 1-6 fit together

Overview Slides by Prof. Steven Tretter, University of Maryland (from Jan. 2008 lab manual)

Data scrambling in voiceband modems

**Using Mathematica to analyze connection polynomials**

A connection polynomial is irreducible if it cannot be factored into simpler polynomials over modulo-2 arithmetic. We can test whether or not the following polynomial is irreducible

2 3 4 1 + x + x + x + xby using the following Mathematica command:

In[6]:= Factor[ 1 + x + x^2 + x^3 + x^4, Modulus -> 2 ] 2 3 4 Out[6]= 1 + x + x + x + xSo, it is irreducible.

A polynomial of order m is primitive if the smallest value of
*N* for which the polynomial *x*^{N} - 1 is
divisible by the connection polynomial equals 2^{m} - 1.
So, we can search over all *N* from 1 to 2^{m} - 1
inclusive.

The connection polynomial above is not primitive because it divides
*x*^{5} - 1:

In[29]:= Factor[ x^5 - 1, Modulus -> 2 ] 2 3 4 Out[29]= (1 + x) (1 + x + x + x + x )

**Coding Guidelines**

The scrambler and descrambler will be used in the remaining labs. In later labs, a different (longer) polynomial will be used.

**Suggested Implementation**

Put the scrambler and descrambler in separate functions. Each should process a single bit at a time. An extremely modular program would also use separate functions for initializing the states of each.

**Debugging and Troubleshooting Tips**

All x86 processors have a timer called the Time Stamp Counter (TSC) that increments on every clock cycle, starting at zero for any given process. You can use the C function rdtsc to determine the clock cycles passed at two points, and take their difference to measure the execution time. More information, along with some copy-and-paste code can be found in Wikipedia. (contributed by Michael Graczyk).

**Assignment**

*Submitting this assignment is optional,
but doing it would be useful with your QUIZ preparations*