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

Subversion Repositories jt51

[/] [jt51/] [trunk/] [jt51/] [jt51_lfo_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
*/
28
 
29
module jt51_lfo_lfsr #(parameter init=220 )(
30
        input   rst,
31
        input   clk,
32
        input   base,
33
        output  out
34
);
35
 
36
reg [18:0] bb;
37
assign out = bb[18];
38
 
39
reg last_base;
40
 
41
always @(posedge clk) begin : base_counter
42
        if( rst ) begin
43
                bb                      <= init[18:0];
44
                last_base       <= 1'b0;
45
        end
46
        else begin
47
                last_base <= base;
48
                if( last_base != base ) begin
49
                        bb[18:1]        <= bb[17:0];
50
                        bb[0]            <= ^{bb[0],bb[1],bb[14],bb[15],bb[17],bb[18]};
51
                end
52
        end
53
end
54
 
55
endmodule

powered by: WebSVN 2.1.0

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