40 likes | 51 Views
Create a project in Code Composer Studio to generate PN sequences and implement data scrambling/descrambling using SSRG [5,2]s. Include implementation details, waveforms, state tables, and performance analysis in the lab report.
E N D
Lab 4 Instructions By Yeong Choo and Sam Kanawati The University of Texas at Austin, March 19, 2018
DSK Implementation of PN Sequence Generation • Create a talk-through project in CCS such as in Lab 1 introductory lab. • Inside ISRs.c, please comment out the following lines: • xLeft = CodecDataIn.Channel[ LEFT]; • xRight = CodecDataIn.Channel[ RIGHT]; • yLeft = xLeft; • yRight = xRight; • Also inside ISRs.c, please do the following: • Implement a PN sequence generator with SSRG [5,2]s where 2nd and 5th taps are the feedbacks • Represent the SSRG state as a single integer variable: • Declare intSSRG_state; to represent up to 32-bit state, or declare long longSSRG_state; to represent 64-bit state • Create a function prototype that does the following: • Update SSRG [5,2]s next state and return a newest bit • i.e. y[n] = y[n-2] + y[n-5] mod 2 • Inputs: pointer to state variable • Output: newest bit at time n • Implement intSSRG_update (int * state_ptrn); • Leverage on bitwise operations and logical operations • Set initial condition of the SSRG_state to any value of range • Pass current output bit to Serial Port Codec such as the following: • #define A 32000 • … • CodecDataOut.Channel[ LEFT] = A*((SSRG_state >> 4)&1); • WriteCodecData(CodecDataOut.UINT); • Note that SSRG_state has the oldest bit in the least significant bit, modify your code accordingly • Verify periodic operation of SSRG [5,2]s by observing the following: • Oscilloscope waveform (Include one screenshot in lab report) • Collect an array of first 100 states (Include one table in lab report) • For performance analysis • Profile your implementation of SSRG [5,2]s (Include one screenshot in lab report)
DSK Implementation of Data Scrambler and Data Descrambler • Implement data scrambling and data descrambling using the same SSRG [5,2]s • Represent the Data Scrambler and Data Descrambler states as two separate integer variables: • Declare intDS_state, DD_state; to represent up to 32-bit state • Modify the above implementation to take in input bit “in” such that intSSRG_update (int *state_ptr, int in); • Note that newest bit at time n to the Data Scrambler is function of bits to be sent and newest bit at time n-1 • Pass the scrambled bit from Data Scrambler as an input to Data Descrambler • Run Data Scrambler followed by Data Descrambler once at every ISR execution • Send input vector to one channel of audio codec and data scrambler output to another channel of audio codec such as the following: • #define A 32000 • #define input 1 • … • int output; • … • CodecDataOut.Channel[ LEFT] = A*(input); • CodecDataOut.Channel[ RIGHT] = A*((DS_state >> 4) & 1); • WriteCodecData(CodecDataOut.UINT); • Note that this test uses constant input of 1 into data scrambler, to test your implementation, also use constant input of 0 • Remember to update the DS_state and DD_state separately • A few notes on debugging: • To verify correct operation of data scrambler and descrambler, Input vector of all ones or all zeros. • Please note that the intermediate vector between Data Scrambler and Data Descrambler must be different than the input vector • Please verify that the output vector of data descrambler is exactly similar as the input vector • Collect an array of first 100 states of data scrambler and data descrambler (Include two tables in lab report) • Profile your implementation of data scrambler and data descrambler (Include two screenshots in lab report)
Autocorrelation Graphs • Find out the period of PN sequence from the array of first 100 states of SSRG [5,2]s • Verify that the experimental measurement of period matches the theoretical value • Generate an autocorrelation graph on two periods worth of PN sequence output bit • (Include one graph on lab report and supply all source code) • Generate an autocorrelation graph on two periods worth of data scrambler output bit • (Include one graph on lab report and supply all source code) Don’t use Matlab Function call Please implement the autocorrelation from scratch following the slide below Expected output