Objective:

advertisement
EE445S: Real Time DSP Lab Tasks
Lab 4: Generation of PN Sequences
Objective:

In this lab, we will be generating pseudo – random (noise, PN) binary sequences using linear
feedback shift registers.
Slides:


Please refer to the recitation slides of Lab 4. I will be quoting slide numbers from this ppt.
For reference please look at section 5.5 of WWM.
Task 1: Generation of PN Sequences. (To be done in lab)
For this lab, we do not have any pre-written code. Following are the instructions for running your code using
Code Composer v5 on the DSP board:



















Create the talk-through which you created following the instructions of the first introductory lab.
Open main.c file. Comment out the while(1) loop, and instead insert your code for implementing
the PN sequence.
The PN sequence should be printed out on the console. Don’t forget to include appropriate header
files for printf() calls.
Implement the PN sequence generator using the block diagram on Slide 5.
We will refer to the previous values of the output as the states i.e. y(n-1), y(n-2) etc.,
You should implement the PN sequence with the SSRG [5,2]s ( primitive polynomial
1+D^2+D^5.). Prof. Steven Tretter’s slides in the webpage contain some information on primitive
polynomials.
For an example, please refer to Slide 6.
Write a function that takes one input and the states and generates an output. This function is also
responsible for updating the states.
Note 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 going from the most recent to the oldest, left to right.
States implementation can be done 2 ways:
o Less memory, more maths: The states are passed as a single integer and the
appropriate bits are extracted and modified within the function.
o 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.
In the main code, you will call the function within a loop.
Each time the function is called, the output and the state are recorded.
You should have a table with the first 100 entries of state (integer, not the individual bits) and
output.
Also, calculate the number of clock cycles required to output a bit of the PN sequence, by using the
using method of inserting breakpoints in Code Composer. Make sure to comment out the printf()
statements while profiling.
Lab report: Present the table above table in the lab report.
Task 2: Implement a data scrambler and descrambler (To be done in lab)




Implement a data scrambler function in C (Slide 7). Use the same connection polynomial as in
Task 1.
Implement a descrambler function in C (Slide 8).
Verify that data fed into the scrambler function is properly descrambled by the descrambler
function.
For the scrambler and descrambler, the two functions should operate in a cascade, i.e. don’t save
the 100 or so scrambled bits first in an array, and then descramble them in a batch. The scrambled
bit should go to the descrambler directly.
Debarati Kundu
Page 1
2/12/2016
EE445S: Real Time DSP Lab Tasks



Lab 4: Generation of PN Sequences
Make sure not to mix up the state variables for the scrambler and descrambler functions. State
variables for each should be completely distinct.
Measure the number of clock cycles required to scramble a bit.
Measure the number of clock cycles required to descramble a bit.
Task 3: Data analysis (Do this offline)





From the data table you generated in Task 1, 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.
See if the period obtained matches with the theoretical value.
Also, take 2 periods worth of data and perform the scaled autocorrelation as mentioned on slide
7. Please do not forget to convert the sequence from 0’s and 1’s to +1’s and -1’s.
Also perform the autocorrelation on the output from your scrambler function.
Lab report: Present the two autocorrelation graphs for the lab report and assess their accordance
with theoretical values.
Debarati Kundu
Page 2
2/12/2016
Download