OpenCores
URL https://opencores.org/ocsvn/jt51/jt51/trunk

Subversion Repositories jt51

[/] [jt51/] [trunk/] [jt51/] [jt51_noise_lfsr.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 gryzor
/*  This file is part of JT51.
2
 
3
    JT51 is free software: you can redistribute it and/or modify
4
    it under the terms of the GNU General Public License as published by
5
    the Free Software Foundation, either version 3 of the License, or
6
    (at your option) any later version.
7
 
8
    JT51 is distributed in the hope that it will be useful,
9
    but WITHOUT ANY WARRANTY; without even the implied warranty of
10
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
    GNU General Public License for more details.
12
 
13
    You should have received a copy of the GNU General Public License
14
    along with JT51.  If not, see <http://www.gnu.org/licenses/>.
15
 
16
        Author: Jose Tejada Gomez. Twitter: @topapate
17
        Version: 1.0
18
        Date: 27-10-2016
19
        */
20
 
21
`timescale 1ns / 1ps
22
 
23
/*
24
 
25
        tab size 4
26
 
27
        See xapp052.pdf from Xilinx
28
 
29
*/
30
 
31
module jt51_noise_lfsr #(parameter init=14220 )(
32
        input   rst,
33
        input   clk,
34
        input   base,
35
        output  out
36
);
37
 
38
reg [16:0] bb;
39
assign out = bb[16];
40
 
41
reg last_base;
42
 
43
always @(posedge clk) begin : base_counter
44
        if( rst ) begin
45
                bb                      <= init[16:0];
46
                last_base       <= 1'b0;
47
        end
48
        else begin
49
                last_base <= base;
50
                if( last_base != base ) begin
51
                        bb[16:1]        <= bb[15:0];
52
                        bb[0]            <= ~(bb[16]^bb[13]);
53
                end
54
        end
55
end
56
 
57
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.