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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [common/] [opencores.org/] [cde/] [ip/] [fifo/] [rtl/] [verilog/] [fifo_def] - Blame information for rev 134

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 134 jt_eaton
reg                             r;
2
reg                             w;
3
reg [SIZE:0]                  push_1;
4
reg [SIZE:0]                  pop_1;
5
 
6
   always@(*)  push_1 =  (push_pointer + 1'b1);
7
   always@(*)  pop_1  =  (pop_pointer  + 1'b1);
8
 
9
 
10
   always@(*)  r =  (pop_pointer == push_1[SIZE-1:0]);
11
   always@(*)  w =  (push_pointer == pop_1[SIZE-1:0]);
12
 
13
 
14
 
15
 
16
always@(posedge clk)
17
  if(reset)
18
                                begin
19
                                full         <=  1'b0;
20
                                empty        <=  1'b1;
21
                                over_run     <=  1'b0;
22
                                under_run    <=  1'b0;
23
                                push_pointer <= {SIZE{1'b0}};
24
                                pop_pointer  <= {SIZE{1'b0}};
25
                                end
26
  else
27
  if(empty && !full)
28
       if( push && ~pop)
29
                                begin
30
                                full         <=  1'b0;
31
                                empty        <=  1'b0;
32
                                over_run     <=  1'b0;
33
                                under_run    <=  1'b0;
34
                                push_pointer <= push_pointer+1;
35
                                pop_pointer  <= pop_pointer;
36
                                end
37
       else
38
       if(~push &&  pop)
39
                                begin
40
                                full         <=  1'b0;
41
                                empty        <=  1'b1;
42
                                over_run     <=  1'b0;
43
                                under_run    <=  1'b1;
44
                                push_pointer <= push_pointer;
45
                                pop_pointer  <= pop_pointer;
46
                                end
47
       else
48
       if( push &&  pop)
49
                                begin
50
                                full         <=  1'b0;
51
                                empty        <=  1'b1;
52
                                over_run     <=  1'b0;
53
                                under_run    <=  1'b0;
54
                                push_pointer <= push_pointer +  1;
55
                                pop_pointer  <= pop_pointer + 1;
56
                                end
57
       else
58
                                begin
59
                                full         <=  1'b0;
60
                                empty        <=  1'b1;
61
                                over_run     <=  1'b0;
62
                                under_run    <=  1'b0;
63
                                push_pointer <= push_pointer;
64
                                pop_pointer  <= pop_pointer;
65
                                end
66
   else
67
   if(!empty && !full)
68
       if( push &&  pop)
69
                                begin
70
                                full         <=  1'b0;
71
                                empty        <=  1'b0;
72
                                over_run     <=  1'b0;
73
                                under_run    <=  1'b0;
74
                                push_pointer <= push_pointer +  1;
75
                                pop_pointer  <= pop_pointer + 1;
76
                                end
77
       else
78
       if( push && !pop && r)
79
                                begin
80
                                full         <=  1'b1;
81
                                empty        <=  1'b0;
82
                                over_run     <=  1'b0;
83
                                under_run    <=  1'b0;
84
                                push_pointer <= push_pointer+1;
85
                                pop_pointer  <= pop_pointer;
86
                                end
87
       else
88
       if( push && !pop && !r)
89
                                begin
90
                                full         <=  1'b0;
91
                                empty        <=  1'b0;
92
                                over_run     <=  1'b0;
93
                                under_run    <=  1'b0;
94
                                push_pointer <= push_pointer+1;
95
                                pop_pointer  <= pop_pointer;
96
                                end
97
       else
98
       if(~push &&  pop && w)
99
                                begin
100
                                full         <=  1'b0;
101
                                empty        <=  1'b1;
102
                                over_run     <=  1'b0;
103
                                under_run    <=  1'b0;
104
                                push_pointer <= push_pointer;
105
                                pop_pointer  <= pop_pointer+1;
106
                                end
107
       else
108
       if(~push &&  pop && !w)
109
                                begin
110
                                full         <=  1'b0;
111
                                empty        <=  1'b0;
112
                                over_run     <=  1'b0;
113
                                under_run    <=  1'b0;
114
                                push_pointer <= push_pointer;
115
                                pop_pointer  <= pop_pointer+1;
116
                                end
117
       else
118
                                begin
119
                                full         <=  1'b0;
120
                                empty        <=  1'b0;
121
                                over_run     <=  1'b0;
122
                                under_run    <=  1'b0;
123
                                push_pointer <= push_pointer;
124
                                pop_pointer  <= pop_pointer;
125
                                end
126
  else
127
  if(!empty && full)
128
      if( push && ~pop)
129
                                begin
130
                                full         <=  1'b1;
131
                                empty        <=  1'b0;
132
                                over_run     <=  1'b1;
133
                                under_run    <=  1'b0;
134
                                push_pointer <= push_pointer;
135
                                pop_pointer  <= pop_pointer;
136
                                end
137
       else
138
       if(~push &&  pop)
139
                                begin
140
                                full         <=  1'b0;
141
                                empty        <=  1'b0;
142
                                over_run     <=  1'b0;
143
                                under_run    <=  1'b0;
144
                                push_pointer <= push_pointer;
145
                                pop_pointer  <= pop_pointer+1;
146
                                end
147
       else
148
       if( push &&  pop)
149
                                begin
150
                                full         <=  1'b1;
151
                                empty        <=  1'b0;
152
                                over_run     <=  1'b0;
153
                                under_run    <=  1'b0;
154
                                push_pointer <= push_pointer +  1;
155
                                pop_pointer  <= pop_pointer + 1;
156
                                end
157
       else
158
                                begin
159
                                full         <=  1'b1;
160
                                empty        <=  1'b0;
161
                                over_run     <=  1'b0;
162
                                under_run    <=  1'b0;
163
                                push_pointer <= push_pointer;
164
                                pop_pointer  <= pop_pointer;
165
                                end
166
//  full and empty at the same time should never occur
167
 
168
 
169
    else
170
                                begin
171
                                full         <=  1'b0;
172
                                empty        <=  1'b1;
173
                                over_run     <=  1'b0;
174
                                under_run    <=  1'b0;
175
                                push_pointer <= {SIZE{1'b0}};
176
                                pop_pointer  <= {SIZE{1'b0}};
177
                                end
178
 
179
 
180
 
181
 
182
 

powered by: WebSVN 2.1.0

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