3 // GENERIC PN SEQUENCE GENERATOR
4 // Linear Feedback Shift Register
5 // -------------------------------
6 // This solution implements an LFSR by applying an XOR reduction
7 // function to the 40 bit accumulator, XORing the contents of the
8 // CC bit, shifting by one the accumulator, and inserting the
9 // resulting bit on the open bit slot.
10 // CC --> ----- XOR--------------------------
13 // +------------------------------+ v
14 // | b0 b1 b2 b3 b38 b39 | in <-- by one
15 // +------------------------------+
17 // +------------------------------+
18 // | b1 b2 b3 b38 b39 in |
19 // +------------------------------+
20 // The program shown here is a PN sequence generator, and hence
21 // does not take any input other than the initial state. However,
22 // in order to accept an input, one simply needs to rotate the
23 // input sequence via CC prior to applying the XOR reduction.
25 .include "testutils.inc"
32 // load Polynomial into A1
40 // load InitState into A0
48 LSETUP ( l$0 , l$0end ) LC0 = P4;
49 l$0: // **** START l-LOOP *****
52 LSETUP ( m$1 , m$1 ) LC1 = P4; // **** START m-LOOP *****
54 A0 = BXORSHIFT( A0 , A1, CC );
56 // store 16 bits of outdata RL1
63 R0.L = W [ I2 ++ ]; DBGA ( R0.L , 0x5adf );
64 R0.L = W [ I2 ++ ]; DBGA ( R0.L , 0x2fc9 );
65 R0.L = W [ I2 ++ ]; DBGA ( R0.L , 0xbd91 );
66 R0.L = W [ I2 ++ ]; DBGA ( R0.L , 0x5520 );
67 R0.L = W [ I2 ++ ]; DBGA ( R0.L , 0x80d5 );
68 R0.L = W [ I2 ++ ]; DBGA ( R0.L , 0x7fef );
69 R0.L = W [ I2 ++ ]; DBGA ( R0.L , 0x34d1 );
70 R0.L = W [ I2 ++ ]; DBGA ( R0.L , 0x915c );