X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=gr-sounder%2Fsrc%2Ffpga%2Flib%2Flfsr.v;fp=gr-sounder%2Fsrc%2Ffpga%2Flib%2Flfsr.v;h=bd0743e9cd72ca2f11bae1f9ed557346280b2b48;hb=8a9ddbb0675f9bfcc6e03b457fba6c79474a3693;hp=0000000000000000000000000000000000000000;hpb=82d471b9b4a8b389b5da44b19c69c36420828382;p=debian%2Fgnuradio diff --git a/gr-sounder/src/fpga/lib/lfsr.v b/gr-sounder/src/fpga/lib/lfsr.v new file mode 100644 index 00000000..bd0743e9 --- /dev/null +++ b/gr-sounder/src/fpga/lib/lfsr.v @@ -0,0 +1,46 @@ +// -*- verilog -*- +// +// USRP - Universal Software Radio Peripheral +// +// Copyright (C) 2007 Corgan Enterprises LLC +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301 USA +// + +module lfsr(clk_i,rst_i,ena_i,strobe_i,mask_i,pn_o); + parameter width = 16; + + input clk_i; + input rst_i; + input ena_i; + input strobe_i; + input [width-1:0] mask_i; + + output pn_o; + + reg [width-1:0] shifter; + + wire parity = ^(shifter & mask_i); + + always @(posedge clk_i) + if (rst_i | ~ena_i) + shifter <= #5 1; + else + if (strobe_i) + shifter <= #5 {shifter[width-2:0],parity}; + + assign pn_o = shifter[0]; + +endmodule // lfsr