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

Subversion Repositories jt51

[/] [jt51/] [trunk/] [jt51/] [jt51_sh2.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
module jt51_sh2 #(parameter width=5, stages=32 )
24
(
25
        input                                                   clk,
26
        input                                                   en,
27
        input                                                   ld,
28
        input           [width-1:0]                      din,
29
        output          [width-1:0]                      drop
30
);
31
 
32
genvar i;
33
generate
34
        for( i=0; i<width; i=i+1) begin: shifter
35
                jt51_sh1 #(.stages(stages)) u_sh1(
36
                        .clk    ( clk    ),
37
                        .en             ( en     ),
38
                        .ld             ( ld     ),
39
                        .din    ( din[i] ),
40
                        .drop   ( drop[i])
41
                );
42
        end
43
endgenerate
44
 
45
endmodule
46
 
47
module jt51_sh1 #(parameter stages=32)
48
(
49
        input   clk,
50
        input   en,
51
        input   ld,
52
        input   din,
53
        output  drop
54
);
55
 
56
reg     [stages-1:0] shift;
57
assign drop = shift[0];
58
wire next = ld ? din : drop;
59
 
60
always @(posedge clk )
61
        if( en )
62
                shift <= {next, shift[stages-1:1]};
63
 
64
endmodule

powered by: WebSVN 2.1.0

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