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

Subversion Repositories Aquarius

[/] [Aquarius/] [trunk/] [verilog/] [sasc_fifo4.v] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 thorn_aitc
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  FIFO 4 entries deep                                        ////
4
////                                                             ////
5
////                                                             ////
6
////  Author: Rudolf Usselmann                                   ////
7
////          rudi@asics.ws                                      ////
8
////                                                             ////
9
////                                                             ////
10
////  Downloaded from: http://www.opencores.org/cores/sasc/      ////
11
////                                                             ////
12
/////////////////////////////////////////////////////////////////////
13
////                                                             ////
14
//// Copyright (C) 2000-2002 Rudolf Usselmann                    ////
15
////                         www.asics.ws                        ////
16
////                         rudi@asics.ws                       ////
17
////                                                             ////
18
//// This source file may be used and distributed without        ////
19
//// restriction provided that this copyright statement is not   ////
20
//// removed from the file and that any derivative work contains ////
21
//// the original copyright notice and the associated disclaimer.////
22
////                                                             ////
23
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     ////
24
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   ////
25
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   ////
26
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      ////
27
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         ////
28
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    ////
29
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   ////
30
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        ////
31
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  ////
32
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  ////
33
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  ////
34
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         ////
35
//// POSSIBILITY OF SUCH DAMAGE.                                 ////
36
////                                                             ////
37
/////////////////////////////////////////////////////////////////////
38
 
39
//  CVS Log
40
//
41
//  $Id: sasc_fifo4.v,v 1.1.1.1 2003-07-12 13:19:55 thorn_aitch Exp $
42
//
43
//  $Date: 2003-07-12 13:19:55 $
44
//  $Revision: 1.1.1.1 $
45
//  $Author: thorn_aitch $
46
//  $Locker:  $
47
//  $State: Exp $
48
//
49
// Change History:
50
//               $Log: not supported by cvs2svn $
51
//               Revision 1.1.1.1  2002/09/16 16:16:41  rudi
52
//               Initial Checkin
53
//
54
//
55
//
56
//
57
//
58
//
59
 
60
`include "timescale.v"
61
 
62
// 4 entry deep fast fifo
63
module sasc_fifo4(clk, rst, clr,  din, we, dout, re, full, empty);
64
 
65
input           clk, rst;
66
input           clr;
67
input   [7:0]    din;
68
input           we;
69
output  [7:0]    dout;
70
input           re;
71
output          full, empty;
72
 
73
 
74
////////////////////////////////////////////////////////////////////
75
//
76
// Local Wires
77
//
78
 
79
reg     [7:0]    mem[0:3];
80
reg     [1:0]   wp;
81
reg     [1:0]   rp;
82
wire    [1:0]   wp_p1;
83
wire    [1:0]   wp_p2;
84
wire    [1:0]   rp_p1;
85
wire    full, empty;
86
reg             gb;
87
 
88
////////////////////////////////////////////////////////////////////
89
//
90
// Misc Logic
91
//
92
 
93
  always @(posedge clk or negedge rst)
94
        if(!rst)        wp <= #1 2'h0;
95
        else
96
        if(clr)         wp <= #1 2'h0;
97
        else
98
        if(we)          wp <= #1 wp_p1;
99
 
100
assign wp_p1 = wp + 2'h1;
101
assign wp_p2 = wp + 2'h2;
102
 
103
  always @(posedge clk or negedge rst)
104
        if(!rst)        rp <= #1 2'h0;
105
        else
106
        if(clr)         rp <= #1 2'h0;
107
        else
108
        if(re)          rp <= #1 rp_p1;
109
 
110
assign rp_p1 = rp + 2'h1;
111
 
112
// Fifo Output
113
assign  dout = mem[ rp ];
114
 
115
// Fifo Input 
116
always @(posedge clk)
117
        if(we)     mem[ wp ] <= #1 din;
118
 
119
// Status
120
assign empty = (wp == rp) & !gb;
121
assign full  = (wp == rp) &  gb;
122
 
123
// Guard Bit ...
124
always @(posedge clk)
125
        if(!rst)                        gb <= #1 1'b0;
126
        else
127
        if(clr)                         gb <= #1 1'b0;
128
        else
129
        if((wp_p1 == rp) & we)          gb <= #1 1'b1;
130
        else
131
        if(re)                          gb <= #1 1'b0;
132
 
133
endmodule
134
 
135
 

powered by: WebSVN 2.1.0

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