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

Subversion Repositories versatile_fifo

[/] [versatile_fifo/] [trunk/] [rtl/] [verilog/] [sd_fifo.v] - Blame information for rev 23

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

Line No. Rev Author Line
1 9 unneback
module sd_fifo
2
  (
3
    input  [1:0] wb_adr_i,
4
    input [7:0]  wb_dat_i,
5
    output [7:0] wb_dat_o,
6
    input        wb_we_i,
7
    input        wb_re_i,
8
    input        wb_clk,
9
    input [1:0]  sd_adr_i,
10
    input [7:0]  sd_dat_i,
11
    output [7:0] sd_dat_o,
12
    input        sd_we_i,
13
    input        sd_re_i,
14
    input        sd_clk,
15
    output [1:4] fifo_full,
16
    output [1:4] fifo_empty,
17
    input        rst
18
   );
19
 
20
   wire [8:0]     wptr1, rptr1, wptr2, rptr2, wptr3, rptr3, wptr4, rptr4;
21
   wire [8:0]     wadr1, radr1, wadr2, radr2, wadr3, radr3, wadr4, radr4;
22
 
23
   wire          dpram_we_a, dpram_we_b;
24
   wire [10:0]    dpram_a_a, dpram_a_b;
25
 
26 11 unneback
   sd_counter wptr1_cnt
27 9 unneback
     (
28
      .q(wptr1),
29
      .q_bin(wadr1),
30
      .cke((wb_adr_i==2'd0) & wb_we_i & !fifo_full[1]),
31
      .clk(wb_clk),
32
      .rst(rst)
33
      );
34
 
35 11 unneback
   sd_counter rptr1_cnt
36 9 unneback
     (
37
      .q(rptr1),
38
      .q_bin(radr1),
39
      .cke((sd_adr_i==2'd0) & sd_re_i & !fifo_empty[1]),
40
      .clk(sd_clk),
41
      .rst(rst)
42
      );
43
 
44
  versatile_fifo_async_cmp
45
    #
46
    (
47
     .ADDR_WIDTH(9)
48
     )
49
    cmp1
50
    (
51
      .wptr(wptr1),
52
      .rptr(rptr1),
53
      .fifo_empty(fifo_empty[1]),
54
      .fifo_full(fifo_full[1]),
55
      .wclk(wb_clk),
56
      .rclk(sd_clk),
57
      .rst(rst)
58
      );
59
 
60 11 unneback
   sd_counter wptr2_cnt
61 9 unneback
     (
62
      .q(wptr2),
63
      .q_bin(wadr2),
64
      .cke((sd_adr_i==2'd1) & sd_we_i & !fifo_full[2]),
65
      .clk(sd_clk),
66
      .rst(rst)
67
      );
68
 
69 11 unneback
   sd_counter rptr2_cnt
70 9 unneback
     (
71
      .q(rptr2),
72
      .q_bin(radr2),
73 10 unneback
      .cke((wb_adr_i==2'd1) & wb_re_i & !fifo_empty[2]),
74 9 unneback
      .clk(wb_clk),
75
      .rst(rst)
76
      );
77
 
78
  versatile_fifo_async_cmp
79
    #
80
    (
81
     .ADDR_WIDTH(9)
82
     )
83
    cmp2
84
    (
85
      .wptr(wptr2),
86
      .rptr(rptr2),
87
      .fifo_empty(fifo_empty[2]),
88
      .fifo_full(fifo_full[2]),
89
      .wclk(sd_clk),
90
      .rclk(wb_clk),
91
      .rst(rst)
92
      );
93
 
94 11 unneback
   sd_counter wptr3_cnt
95 9 unneback
     (
96
      .q(wptr3),
97
      .q_bin(wadr3),
98
      .cke((wb_adr_i==2'd2) & wb_we_i & !fifo_full[3]),
99
      .clk(wb_clk),
100
      .rst(rst)
101
      );
102
 
103 11 unneback
   sd_counter rptr3_cnt
104 9 unneback
     (
105
      .q(rptr3),
106
      .q_bin(radr3),
107
      .cke((sd_adr_i==2'd2) & sd_re_i & !fifo_empty[3]),
108
      .clk(sd_clk),
109
      .rst(rst)
110
      );
111
 
112
  versatile_fifo_async_cmp
113
    #
114
    (
115
     .ADDR_WIDTH(9)
116
     )
117
    cmp3
118
    (
119
      .wptr(wptr3),
120
      .rptr(rptr3),
121
      .fifo_empty(fifo_empty[3]),
122
      .fifo_full(fifo_full[3]),
123
      .wclk(wb_clk),
124
      .rclk(sd_clk),
125
      .rst(rst)
126
      );
127
 
128 11 unneback
   sd_counter wptr4_cnt
129 9 unneback
     (
130
      .q(wptr4),
131
      .q_bin(wadr4),
132
      .cke((sd_adr_i==2'd3) & sd_we_i & !fifo_full[4]),
133
      .clk(sd_clk),
134
      .rst(rst)
135
      );
136
 
137 11 unneback
   sd_counter rptr4_cnt
138 9 unneback
     (
139
      .q(rptr4),
140
      .q_bin(radr4),
141
      .cke((wb_adr_i==2'd3) & wb_re_i & !fifo_empty[4]),
142
      .clk(wb_clk),
143
      .rst(rst)
144
      );
145
 
146
  versatile_fifo_async_cmp
147
    #
148
    (
149
     .ADDR_WIDTH(9)
150
     )
151
    cmp4
152
    (
153
      .wptr(wptr4),
154
      .rptr(rptr4),
155
      .fifo_empty(fifo_empty[4]),
156
      .fifo_full(fifo_full[4]),
157
      .wclk(sd_clk),
158
      .rclk(wb_clk),
159
      .rst(rst)
160
      );
161
 
162
   assign dpram_we_a = ((wb_adr_i==2'd0) & !fifo_full[1]) ? wb_we_i :
163
                       ((wb_adr_i==2'd2) & !fifo_full[3]) ? wb_we_i :
164
                       1'b0;
165
   assign dpram_we_b = ((sd_adr_i==2'd1) & !fifo_full[2]) ? sd_we_i :
166
                       ((sd_adr_i==2'd3) & !fifo_full[4]) ? sd_we_i :
167
                       1'b0;
168
   assign dpram_a_a = (wb_adr_i==2'd0) ? {wb_adr_i,wadr1} :
169
                      (wb_adr_i==2'd1) ? {wb_adr_i,radr2} :
170
                      (wb_adr_i==2'd2) ? {wb_adr_i,wadr3} :
171
                      {wb_adr_i,radr4};
172
   assign dpram_a_b = (sd_adr_i==2'd0) ? {sd_adr_i,radr1} :
173
                      (sd_adr_i==2'd1) ? {sd_adr_i,wadr2} :
174 13 unneback
                      (sd_adr_i==2'd2) ? {sd_adr_i,radr3} :
175 9 unneback
                      {sd_adr_i,wadr4};
176
 
177
 
178 12 unneback
   vfifo_dual_port_ram_dc_dw
179
/*     #
180 9 unneback
     (
181
      .ADDR_WIDTH(11),
182
      .DATA_WIDTH(8)
183 12 unneback
      )*/
184 9 unneback
     dpram
185
     (
186
      .d_a(wb_dat_i),
187
      .q_a(wb_dat_o),
188
      .adr_a(dpram_a_a),
189
      .we_a(dpram_we_a),
190
      .clk_a(wb_clk),
191
      .q_b(sd_dat_o),
192
      .adr_b(dpram_a_b),
193
      .d_b(sd_dat_i),
194
      .we_b(dpram_we_b),
195
      .clk_b(sd_clk)
196
      );
197
 
198
endmodule // sd_fifo

powered by: WebSVN 2.1.0

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