You are on page 1of 4

Experiment-3

Pseudo-Noise Sequence Generator

Madhukar kumar Deshant R. Fusate Agni swaroop


2014EE10451 2014EE10436 2014EE10439
Aim:
The aim of the experiment is to design a PN sequence generator of length ‘n’. The value of
‘n’ can be very large also, and the program should work for n<=32. We also have to find out
the number of cycles the program takes to generate one bit of the output.
Theory:
Pseudo-Noise (PN) sequences are commonly used to generate noise that is approximately
"white". It has applications in scrambling, cryptography, and spread-spectrum
communications. It is also commonly referred to as the Pseudo-Random Binary Sequence
(PRBS). These are very widely used in communication standards these days. The qualifier
"pseudo" implies that the sequence is not truly random. Actually, it is periodic with a
(possibly large) period, and exhibits some characteristics of a random white sequence within
that period. PN sequences are generated by Linear Feedback Shift Registers (LFSR), as
shown in the following figure:

In the figure, the output xk is binary (0 or 1), and so are the constants hj, j=0, 1, … n, and ⊕
denotes the XOR operation. This means that xk is given by:
xk = h1xk-1⊕……⊕ hnxk-n
Since xk⊕xk=0, it follows from the above that:
xk ⊕ h1xk-1⊕……⊕hnxk-n =0
or
h(D)x(D) = 0
where h(D) = 1 ⊕ h1D⊕……⊕ hnDn and D denotes a unit delay (xkDj=xk-j for any j). Note that
the “1” in the polynomial does not correspond to a tap.
Procedure:
1) Let say that we have the initial state(xk-n …. xk-1) and h values(hn …. h0) of the PN sequence
generator.
2) First move the data of initial state and h values into two accumulators, say AC0 and AC1
respectively.
3) The last bit in (hn …. h0) i.e., h0 does not correspond to a tap. So, we have to eliminate it first
before generating any output. So, first we have to shift the data in the accumulator in which we have
stored the 0025 i.e., AC1 to the right by 1 bit so that the last bit is discarded. This can be done by
using SFTL operation.
4) Move zero into another accumulator, say AC3. In this register, we are going to store the output
that we are generating from this state of the PN sequence generator.
5) We know that,
xk = h1xk-1⊕……⊕ hnxk-n.
So, we have to multiply the bits of AC0 with the corresponding bits of AC1 and we have to take a
XOR to generate xk. This can be done by using the BCNT operation.
6) Now, we have to update the state of PN sequence generator. This can be done by rotating the
data in AC0 once i.e., ROL operation. We have to make sure that the InBit we give is the output bit
that is just generated. We also have to update the accumulator AC3.
7) Repeat the steps 5 and 6 depending on the depending on the number of bits we need to
generate.

The length of the PN sequence generator I chose is 15 i.e., it has 15 tap points. The initial state(xk-n ….
xk-1) of the PN sequence generator I chose is 0008(in Hexa Decimal) and the h values(hn …. h0) I chose
is 0025(in Hexa Decimal).

CCS code to generate 16 bits of Pseudo-Noise output is:


.mmregs
.def x,h
x .int 0006h
h .int 0035h
.text
.def start
start
BCLR C54CM
;BSET BRAF
BCLR AR4LC
BCLR AR6LC
BCLR SXM
AMOV #x, XAR0
AMOV #h, XAR1
MOV *AR0, AC0
MOV *AR1, AC1
mov #0000H, ac3
SFTL AC1, #-1, AC1
MOV #15, BRC0
RPTB LOOP
BCNT AC0, AC1, TC2, T1
ROL CARRY, AC3, TC2, AC3
ROL CARRY, AC0, TC2, AC0
LOOP
IDLE
Observations:
Screenshot after generating 1 bit of output:

We can see the output we have generated in the register AC3 i.e., 0001(In Hexa decimal). In AC0, we
can see the updated state of the PN sequence generator i.e., 001A(In Hexa decimal). The number of
cycles it took to generate 1 bit of output is 24 cycles.

Screenshot after generating 16 bits of output:

We can see the output we have generated in the register AC3 i.e., E14D(In Hexa decimal). In AC0, we
can see the updated state of the PN sequence generator i.e., 6E14D(In Hexa decimal). The number of
cycles it took to generate 16 bits of output is 174 cycles.
Discussion:
The PN sequence generator took 24 clock cycles to generate 1 bit of output and 174 clock cycles to
generate 16 bits of output. We can see the updated state in AC0 and the output bits generated in
AC3. After generating 1 bit of output, the previous MSB of ‘x’ no longer decides the output any
further as only the current state decides the output and previous MSB of ‘x’ will be thrown out after
generating 1 bit of output. We can generate any number of output bits with the use of the above
code just by changing the number of times the loop runs. We can do this by changing the data we
move into BRC0 in the code.

You might also like