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

Subversion Repositories ft816float

[/] [ft816float/] [trunk/] [rtl/] [verilog/] [lib/] [vtdl.v] - Blame information for rev 88

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 61 robfinch
// ============================================================================
2
//        __
3
//   \\__/ o\    (C) 2007-2021  Robert Finch, Waterloo
4
//    \  __ /    All rights reserved.
5
//     \/_//     robfinch<remove>@finitron.ca
6
//       ||
7
//
8
//      vtdl - variable tap delay line
9
//              (dynamic shift register)
10
//
11
// BSD 3-Clause License
12
// Redistribution and use in source and binary forms, with or without
13
// modification, are permitted provided that the following conditions are met:
14
//
15
// 1. Redistributions of source code must retain the above copyright notice, this
16
//    list of conditions and the following disclaimer.
17
//
18
// 2. Redistributions in binary form must reproduce the above copyright notice,
19
//    this list of conditions and the following disclaimer in the documentation
20
//    and/or other materials provided with the distribution.
21
//
22
// 3. Neither the name of the copyright holder nor the names of its
23
//    contributors may be used to endorse or promote products derived from
24
//    this software without specific prior written permission.
25
//
26
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
30
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
34
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
//
37
// ============================================================================
38
//
39
//    Notes:
40
//
41
//      This module acts like a clocked delay line with a variable tap.
42
//      Miscellaneous usage in rate control circuitry such as fifo's.
43
//      Capable of delaying a signal bus.
44
//      Signal bus width is specified with the WID parameter.
45
//
46
//      Verilog 1995
47
// =============================================================================
48
//
49
module vtdl(clk, ce, a, d, q);
50
parameter WID = 8;
51
parameter DEP = 16;
52
localparam AMSB = DEP>64?6:DEP>32?5:DEP>16?4:DEP>8?3:DEP>4?2:DEP>2?1:0;
53
input clk;
54
input ce;
55
input [AMSB:0] a;
56
input [WID-1:0] d;
57
output [WID-1:0] q;
58
 
59
reg [WID-1:0] m [DEP-1:0];
60
integer n;
61
 
62
always @(posedge clk)
63
        if (ce) begin
64
                for (n = 1; n < DEP; n = n + 1)
65
                        m[n] <= m[n-1];
66
                m[0] <= d;
67
        end
68
 
69
assign q = m[a];
70
 
71
endmodule
72
 
73
module vtdlx1(clk, ce, a, d, q);
74
parameter DEP = 16;
75
localparam AMSB = DEP>64?6:DEP>32?5:DEP>16?4:DEP>8?3:DEP>4?2:DEP>2?1:0;
76
input clk;
77
input ce;
78
input [AMSB:0] a;
79
input d;
80
output q;
81
 
82
reg [DEP-1:0] m;
83
integer n;
84
 
85
always @(posedge clk)
86
        if (ce) begin
87
                for (n = 1; n < DEP; n = n + 1)
88
                        m[n] <= m[n-1];
89
                m[0] <= d;
90
        end
91
 
92
assign q = m[a];
93
 
94
endmodule

powered by: WebSVN 2.1.0

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