EE345S: Real Time DSP Lab Tasks Lab 4: Data scramblers

Objective:

·  In this lab, we will be generating pseudo – random (noise, PN) binary sequences using linear feedback shift registers (data scramblers).

·  We will also be implementing the descrambler to extract the original data.

Slides:

·  Please refer to Tretter manual’s recitation slides posted here: http://users.ece.utexas.edu/~bevans/courses/realtime/lectures/laboratory/c6713/SLIDES/scrambler.pdf

·  I will be quoting slide numbers from this pdf.

Task 1: Data scrambler (Do this in the lab)

·  Here, we implement the PN sequence generator (data scrambler) using the block diagram on Slide 9-2.

·  We will refer to the previous values of the output as the states i.e. y(n-1), y(n-2) etc.,

·  Connection polynomial to implement: 1+D2+D5.

·  Write a “scrambler” function which takes one input, the states and generate the output. This function is also responsible for updating the states.

·  Notice all the data will be binary data i.e. 0 or 1.

·  All additions refers to modulo – 2 addition which is essentially the EX-OR operation.

·  Usage of % is prohibited.

·  Assume initial state of 5 i.e. 00101 for states of the previous output states going from the most recent to the oldest, left to right.

·  States implementation can be done 2 ways:

Less memory, more math: The states are passed as a single integer and the appropriate bits are extracted and modified within the function.

More memory, less math: The states are passed as separate integers (shorts). No bit extraction is necessary in this method. However, it takes up more memory.

·  We will be using the first method: “less memory and more math” option.

·  All the inputs are “0”s.

·  In the main code, you will call the scrambler within a loop.

·  Each time a new “0” input is passed to the scrambler and the output and the state are recorded.

·  You should have a table with the first 100 entries of input, state (integer, not the individual bits) and output.

·  Lab report: Present the table above table in the lab report.

Task 2: Data scrambler data analysis (Do this offline)

·  From the data table you generated, look for one period. One period is defined as the number of samples when the states start to cycle through again i.e. the states start back from state 5 which is your original state.

·  Now, perform point 4 from Slide 9-15.

·  Lab report: Present tabulated results from above step for the lab report and accordance with theoretical value.

·  Now, perform point 5 from Slide 9-15.

·  Lab report: Present tabulated results from above step for the lab report and accordance with theoretical value.

·  Also, take 2 periods worth of data and perform the scaled autocorrelation as mentioned on slide 9-10. For this step, you can first transform the data to obtain . Then, pass the data to the xcorr function in Matlab. If you need help with xcorr, you should type doc xcorr from the Matlab command window.

·  Lab report: Present the above graph for the lab report and accordance with theoretical value.

Task 3: Descrambler (Do this in the lab)

·  Now, we will implement the descrambler. The block diagram is shown on Slide 9-13.

·  Write a “descrambler” function, similar to the scrambler function above.

·  Initialize the descrambler state to 5 (00101).

·  The connection polynomial is the same as the scrambler.

·  Modify the main code to generate a “1” input every time.

·  Scramble this data using the scrambler.

·  Pass the output to the descrambler.

·  Create a table for 2 periods with the following entries: Scrambler input, state, output, Descrambler state and output.

·  Lab report: Present the above table in the lab report.

·  Make sure that the descrambler output is the same as your scrambler input.

Karthik Raghavan Page 2 3/4/2008