55ee613d289334cf1576f4a77d46bb316f8f72f1
[debian/gnuradio] / gr-sounder / src / fpga / lib / lfsr_constants.v
1 // -*- verilog -*-
2 //
3 //  USRP - Universal Software Radio Peripheral
4 //
5 //  Copyright (C) 2007 Corgan Enterprises LLC
6 //
7 //  This program is free software; you can redistribute it and/or modify
8 //  it under the terms of the GNU General Public License as published by
9 //  the Free Software Foundation; either version 2 of the License, or
10 //  (at your option) any later version.
11 //
12 //  This program is distributed in the hope that it will be useful,
13 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 //  GNU General Public License for more details.
16 //
17 //  You should have received a copy of the GNU General Public License
18 //  along with this program; if not, write to the Free Software
19 //  Foundation, Inc., 51 Franklin Street, Boston, MA  02110-1301  USA
20 //
21
22 module lfsr_constants(degree_i,mask_o,len_o);
23    input  wire [4:0]  degree_i;
24    output reg  [15:0] mask_o;
25    output wire [15:0] len_o;
26    
27    assign len_o = (1 << degree_i) - 1;
28    
29    always @*
30      case (degree_i)
31        5'd00: mask_o = 16'h0000;
32        5'd01: mask_o = 16'h0001;
33        5'd02: mask_o = 16'h0003;
34        5'd03: mask_o = 16'h0005;
35        5'd04: mask_o = 16'h0009;
36        5'd05: mask_o = 16'h0012;
37        5'd06: mask_o = 16'h0021;
38        5'd07: mask_o = 16'h0041;
39        5'd08: mask_o = 16'h008E;
40        5'd09: mask_o = 16'h0108;
41        5'd10: mask_o = 16'h0204;
42        5'd11: mask_o = 16'h0402;
43        5'd12: mask_o = 16'h0829;
44        5'd13: mask_o = 16'h100D;
45        5'd14: mask_o = 16'h2015;
46        5'd15: mask_o = 16'h4001;
47        5'd16: mask_o = 16'h8016;
48        default: mask_o = 16'h0000;
49      endcase // case(degree_i)
50
51 endmodule // lfsr_constants