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

Subversion Repositories versatile_library

[/] [versatile_library/] [trunk/] [rtl/] [verilog/] [wb.v] - Blame information for rev 41

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

Line No. Rev Author Line
1 12 unneback
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  Versatile library, wishbone stuff                           ////
4
////                                                              ////
5
////  Description                                                 ////
6
////  Wishbone compliant modules                                  ////
7
////                                                              ////
8
////                                                              ////
9
////  To Do:                                                      ////
10
////   -                                                          ////
11
////                                                              ////
12
////  Author(s):                                                  ////
13
////      - Michael Unneback, unneback@opencores.org              ////
14
////        ORSoC AB                                              ////
15
////                                                              ////
16
//////////////////////////////////////////////////////////////////////
17
////                                                              ////
18
//// Copyright (C) 2010 Authors and OPENCORES.ORG                 ////
19
////                                                              ////
20
//// This source file may be used and distributed without         ////
21
//// restriction provided that this copyright statement is not    ////
22
//// removed from the file and that any derivative work contains  ////
23
//// the original copyright notice and the associated disclaimer. ////
24
////                                                              ////
25
//// This source file is free software; you can redistribute it   ////
26
//// and/or modify it under the terms of the GNU Lesser General   ////
27
//// Public License as published by the Free Software Foundation; ////
28
//// either version 2.1 of the License, or (at your option) any   ////
29
//// later version.                                               ////
30
////                                                              ////
31
//// This source is distributed in the hope that it will be       ////
32
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
33
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
34
//// PURPOSE.  See the GNU Lesser General Public License for more ////
35
//// details.                                                     ////
36
////                                                              ////
37
//// You should have received a copy of the GNU Lesser General    ////
38
//// Public License along with this source; if not, download it   ////
39
//// from http://www.opencores.org/lgpl.shtml                     ////
40
////                                                              ////
41
//////////////////////////////////////////////////////////////////////
42
 
43 40 unneback
`ifdef WB3WB3_BRIDGE
44 12 unneback
// async wb3 - wb3 bridge
45
`timescale 1ns/1ns
46 40 unneback
`define MODULE wb3wb3_bridge
47
module `BASE`MODULE (
48
`undef MODULE
49 12 unneback
        // wishbone slave side
50
        wbs_dat_i, wbs_adr_i, wbs_sel_i, wbs_bte_i, wbs_cti_i, wbs_we_i, wbs_cyc_i, wbs_stb_i, wbs_dat_o, wbs_ack_o, wbs_clk, wbs_rst,
51
        // wishbone master side
52
        wbm_dat_o, wbm_adr_o, wbm_sel_o, wbm_bte_o, wbm_cti_o, wbm_we_o, wbm_cyc_o, wbm_stb_o, wbm_dat_i, wbm_ack_i, wbm_clk, wbm_rst);
53
 
54
input [31:0] wbs_dat_i;
55
input [31:2] wbs_adr_i;
56
input [3:0]  wbs_sel_i;
57
input [1:0]  wbs_bte_i;
58
input [2:0]  wbs_cti_i;
59
input wbs_we_i, wbs_cyc_i, wbs_stb_i;
60
output [31:0] wbs_dat_o;
61 14 unneback
output wbs_ack_o;
62 12 unneback
input wbs_clk, wbs_rst;
63
 
64
output [31:0] wbm_dat_o;
65
output reg [31:2] wbm_adr_o;
66
output [3:0]  wbm_sel_o;
67
output reg [1:0]  wbm_bte_o;
68
output reg [2:0]  wbm_cti_o;
69 14 unneback
output reg wbm_we_o;
70
output wbm_cyc_o;
71 12 unneback
output wbm_stb_o;
72
input [31:0]  wbm_dat_i;
73
input wbm_ack_i;
74
input wbm_clk, wbm_rst;
75
 
76
parameter addr_width = 4;
77
 
78
// bte
79
parameter linear       = 2'b00;
80
parameter wrap4        = 2'b01;
81
parameter wrap8        = 2'b10;
82
parameter wrap16       = 2'b11;
83
// cti
84
parameter classic      = 3'b000;
85
parameter incburst     = 3'b010;
86
parameter endofburst   = 3'b111;
87
 
88
parameter wbs_adr  = 1'b0;
89
parameter wbs_data = 1'b1;
90
 
91 33 unneback
parameter wbm_adr0      = 2'b00;
92
parameter wbm_adr1      = 2'b01;
93
parameter wbm_data      = 2'b10;
94
parameter wbm_data_wait = 2'b11;
95 12 unneback
 
96
reg [1:0] wbs_bte_reg;
97
reg wbs;
98
wire wbs_eoc_alert, wbm_eoc_alert;
99
reg wbs_eoc, wbm_eoc;
100
reg [1:0] wbm;
101
 
102 14 unneback
wire [1:16] wbs_count, wbm_count;
103 12 unneback
 
104
wire [35:0] a_d, a_q, b_d, b_q;
105
wire a_wr, a_rd, a_fifo_full, a_fifo_empty, b_wr, b_rd, b_fifo_full, b_fifo_empty;
106
reg a_rd_reg;
107
wire b_rd_adr, b_rd_data;
108 14 unneback
wire b_rd_data_reg;
109
wire [35:0] temp;
110 12 unneback
 
111
`define WE 5
112
`define BTE 4:3
113
`define CTI 2:0
114
 
115
assign wbs_eoc_alert = (wbs_bte_reg==wrap4 & wbs_count[3]) | (wbs_bte_reg==wrap8 & wbs_count[7]) | (wbs_bte_reg==wrap16 & wbs_count[15]);
116
always @ (posedge wbs_clk or posedge wbs_rst)
117
if (wbs_rst)
118
        wbs_eoc <= 1'b0;
119
else
120
        if (wbs==wbs_adr & wbs_stb_i & !a_fifo_full)
121
                wbs_eoc <= wbs_bte_i==linear;
122
        else if (wbs_eoc_alert & (a_rd | a_wr))
123
                wbs_eoc <= 1'b1;
124
 
125 40 unneback
`define MODULE cnt_shreg_ce_clear
126
`BASE`MODULE # ( .length(16))
127
`undef MODULE
128 12 unneback
    cnt0 (
129
        .cke(wbs_ack_o),
130
        .clear(wbs_eoc),
131
        .q(wbs_count),
132
        .rst(wbs_rst),
133
        .clk(wbs_clk));
134
 
135
always @ (posedge wbs_clk or posedge wbs_rst)
136
if (wbs_rst)
137
        wbs <= wbs_adr;
138
else
139
        if ((wbs==wbs_adr) & wbs_cyc_i & wbs_stb_i & !a_fifo_full)
140
                wbs <= wbs_data;
141
        else if (wbs_eoc & wbs_ack_o)
142
                wbs <= wbs_adr;
143
 
144
// wbs FIFO
145
assign a_d = (wbs==wbs_adr) ? {wbs_adr_i[31:2],wbs_we_i,wbs_bte_i,wbs_cti_i} : {wbs_dat_i,wbs_sel_i};
146
assign a_wr = (wbs==wbs_adr)  ? wbs_cyc_i & wbs_stb_i & !a_fifo_full :
147
              (wbs==wbs_data) ? wbs_we_i  & wbs_stb_i & !a_fifo_full :
148
              1'b0;
149
assign a_rd = !a_fifo_empty;
150
always @ (posedge wbs_clk or posedge wbs_rst)
151
if (wbs_rst)
152
        a_rd_reg <= 1'b0;
153
else
154
        a_rd_reg <= a_rd;
155
assign wbs_ack_o = a_rd_reg | (a_wr & wbs==wbs_data);
156
 
157
assign wbs_dat_o = a_q[35:4];
158
 
159
always @ (posedge wbs_clk or posedge wbs_rst)
160
if (wbs_rst)
161 13 unneback
        wbs_bte_reg <= 2'b00;
162 12 unneback
else
163 13 unneback
        wbs_bte_reg <= wbs_bte_i;
164 12 unneback
 
165
// wbm FIFO
166
assign wbm_eoc_alert = (wbm_bte_o==wrap4 & wbm_count[3]) | (wbm_bte_o==wrap8 & wbm_count[7]) | (wbm_bte_o==wrap16 & wbm_count[15]);
167
always @ (posedge wbm_clk or posedge wbm_rst)
168
if (wbm_rst)
169
        wbm_eoc <= 1'b0;
170
else
171
        if (wbm==wbm_adr0 & !b_fifo_empty)
172
                wbm_eoc <= b_q[`BTE] == linear;
173
        else if (wbm_eoc_alert & wbm_ack_i)
174
                wbm_eoc <= 1'b1;
175
 
176
always @ (posedge wbm_clk or posedge wbm_rst)
177
if (wbm_rst)
178
        wbm <= wbm_adr0;
179
else
180 33 unneback
/*
181 12 unneback
    if ((wbm==wbm_adr0 & !b_fifo_empty) |
182
        (wbm==wbm_adr1 & !b_fifo_empty & wbm_we_o) |
183
        (wbm==wbm_adr1 & !wbm_we_o) |
184
        (wbm==wbm_data & wbm_ack_i & wbm_eoc))
185
        wbm <= {wbm[0],!(wbm[1] ^ wbm[0])};  // count sequence 00,01,10
186 33 unneback
*/
187
    case (wbm)
188
    wbm_adr0:
189
        if (!b_fifo_empty)
190
            wbm <= wbm_adr1;
191
    wbm_adr1:
192
        if (!wbm_we_o | (!b_fifo_empty & wbm_we_o))
193
            wbm <= wbm_data;
194
    wbm_data:
195
        if (wbm_ack_i & wbm_eoc)
196
            wbm <= wbm_adr0;
197
        else if (b_fifo_empty & wbm_we_o & wbm_ack_i)
198
            wbm <= wbm_data_wait;
199
    wbm_data_wait:
200
        if (!b_fifo_empty)
201
            wbm <= wbm_data;
202
    endcase
203 12 unneback
 
204
assign b_d = {wbm_dat_i,4'b1111};
205
assign b_wr = !wbm_we_o & wbm_ack_i;
206
assign b_rd_adr  = (wbm==wbm_adr0 & !b_fifo_empty);
207
assign b_rd_data = (wbm==wbm_adr1 & !b_fifo_empty & wbm_we_o) ? 1'b1 : // b_q[`WE]
208
                   (wbm==wbm_data & !b_fifo_empty & wbm_we_o & wbm_ack_i & !wbm_eoc) ? 1'b1 :
209 33 unneback
                   (wbm==wbm_data_wait & !b_fifo_empty) ? 1'b1 :
210 12 unneback
                   1'b0;
211
assign b_rd = b_rd_adr | b_rd_data;
212
 
213 40 unneback
`define MODULE dff
214
`BASE`MODULE dff1 ( .d(b_rd_data), .q(b_rd_data_reg), .clk(wbm_clk), .rst(wbm_rst));
215
`undef MODULE
216
`define MODULE dff_ce
217
`BASE`MODULE # ( .width(36)) dff2 ( .d(b_q), .ce(b_rd_data_reg), .q(temp), .clk(wbm_clk), .rst(wbm_rst));
218
`undef MODULE
219 12 unneback
 
220
assign {wbm_dat_o,wbm_sel_o} = (b_rd_data_reg) ? b_q : temp;
221
 
222 40 unneback
`define MODULE cnt_shreg_ce_clear
223 18 unneback
vl_cnt_shreg_ce_clear # ( .length(16))
224 40 unneback
`undef MODULE
225 12 unneback
    cnt1 (
226
        .cke(wbm_ack_i),
227
        .clear(wbm_eoc),
228
        .q(wbm_count),
229
        .rst(wbm_rst),
230
        .clk(wbm_clk));
231
 
232 33 unneback
assign wbm_cyc_o = (wbm==wbm_data | wbm==wbm_data_wait);
233
assign wbm_stb_o = (wbm==wbm_data);
234 12 unneback
 
235
always @ (posedge wbm_clk or posedge wbm_rst)
236
if (wbm_rst)
237
        {wbm_adr_o,wbm_we_o,wbm_bte_o,wbm_cti_o} <= {30'h0,1'b0,linear,classic};
238
else begin
239
        if (wbm==wbm_adr0 & !b_fifo_empty)
240
                {wbm_adr_o,wbm_we_o,wbm_bte_o,wbm_cti_o} <= b_q;
241
        else if (wbm_eoc_alert & wbm_ack_i)
242
                wbm_cti_o <= endofburst;
243
end
244
 
245
//async_fifo_dw_simplex_top
246 40 unneback
`define MODULE fifo_2r2w_async_simplex
247
`BASE`MODULE
248
`undef MODULE
249 12 unneback
# ( .data_width(36), .addr_width(addr_width))
250
fifo (
251
    // a side
252
    .a_d(a_d),
253
    .a_wr(a_wr),
254
    .a_fifo_full(a_fifo_full),
255
    .a_q(a_q),
256
    .a_rd(a_rd),
257
    .a_fifo_empty(a_fifo_empty),
258
    .a_clk(wbs_clk),
259
    .a_rst(wbs_rst),
260
    // b side
261
    .b_d(b_d),
262
    .b_wr(b_wr),
263
    .b_fifo_full(b_fifo_full),
264
    .b_q(b_q),
265
    .b_rd(b_rd),
266
    .b_fifo_empty(b_fifo_empty),
267
    .b_clk(wbm_clk),
268
    .b_rst(wbm_rst)
269
    );
270
 
271
endmodule
272 40 unneback
`undef WE
273
`undef BTE
274
`undef CTI
275
`endif
276 17 unneback
 
277 40 unneback
`ifdef WB3_ARBITER_TYPE1
278
`define MODULE wb3_arbiter_type1
279 39 unneback
module vl_wb3_arbiter_type1 (
280 40 unneback
`undef MODULE
281 39 unneback
    wbm_dat_o, wbm_adr_o, wbm_sel_o, wbm_cti_o, wbm_bte_o, wbm_we_o, wbm_stb_o, wbm_cyc_o,
282
    wbm_dat_i, wbm_ack_i, wbm_err_i, wbm_rty_i,
283
    wbs_dat_i, wbs_adr_i, wbs_sel_i, wbs_cti_i, wbs_bte_i, wbs_we_i, wbs_stb_i, wbs_cyc_i,
284
    wbs_dat_o, wbs_ack_o, wbs_err_o, wbs_rty_o,
285
    wb_clk, wb_rst
286
);
287
 
288
parameter nr_of_ports = 3;
289
parameter adr_size = 26;
290
parameter adr_lo   = 2;
291
parameter dat_size = 32;
292
parameter sel_size = dat_size/8;
293
 
294
localparam aw = (adr_size - adr_lo) * nr_of_ports;
295
localparam dw = dat_size * nr_of_ports;
296
localparam sw = sel_size * nr_of_ports;
297
localparam cw = 3 * nr_of_ports;
298
localparam bw = 2 * nr_of_ports;
299
 
300
input  [dw-1:0] wbm_dat_o;
301
input  [aw-1:0] wbm_adr_o;
302
input  [sw-1:0] wbm_sel_o;
303
input  [cw-1:0] wbm_cti_o;
304
input  [bw-1:0] wbm_bte_o;
305
input  [nr_of_ports-1:0] wbm_we_o, wbm_stb_o, wbm_cyc_o;
306
output [dw-1:0] wbm_dat_i;
307
output [nr_of_ports-1:0] wbm_ack_i, wbm_err_i, wbm_rty_i;
308
 
309
output [dat_size-1:0] wbs_dat_i;
310
output [adr_size-1:adr_lo] wbs_adr_i;
311
output [sel_size-1:0] wbs_sel_i;
312
output [2:0] wbs_cti_i;
313
output [1:0] wbs_bte_i;
314
output wbs_we_i, wbs_stb_i, wbs_cyc_i;
315
input  [dat_size-1:0] wbs_dat_o;
316
input  wbs_ack_o, wbs_err_o, wbs_rty_o;
317
 
318
input wb_clk, wb_rst;
319
 
320
wire [nr_of_ports-1:0] select;
321
wire [nr_of_ports-1:0] state;
322
wire [nr_of_ports-1:0] eoc; // end-of-cycle
323
wire [nr_of_ports-1:0] sel;
324
wire idle;
325
 
326
genvar i;
327
 
328
assign idle = !(|state);
329
 
330
generate
331
if (nr_of_ports == 2) begin
332
 
333
    wire [2:0] wbm1_cti_o, wbm0_cti_o;
334
 
335
    assign {wbm1_cti_o,wbm0_cti_o} = wbm_cti_o;
336
 
337
    assign select = (idle) ? {wbm_cyc_o[1],!wbm_cyc_o[1] & wbm_cyc_o[0]} : 2'b00;
338
    assign eoc[1] = (wbm_ack_i[1] & (wbm1_cti_o == 3'b000 | wbm1_cti_o == 3'b111)) | !wbm_cyc_o[1];
339
    assign eoc[0] = (wbm_ack_i[0] & (wbm0_cti_o == 3'b000 | wbm0_cti_o == 3'b111)) | !wbm_cyc_o[0];
340
 
341
end
342
endgenerate
343
 
344
generate
345
if (nr_of_ports == 3) begin
346
 
347
    wire [2:0] wbm2_cti_o, wbm1_cti_o, wbm0_cti_o;
348
 
349
    assign {wbm2_cti_o,wbm1_cti_o,wbm0_cti_o} = wbm_cti_o;
350
 
351
    assign select = (idle) ? {wbm_cyc_o[2],!wbm_cyc_o[2] & wbm_cyc_o[1],wbm_cyc_o[2:1]==2'b00 & wbm_cyc_o[0]} : 3'b000;
352
    assign eoc[2] = (wbm_ack_i[2] & (wbm2_cti_o == 3'b000 | wbm2_cti_o == 3'b111)) | !wbm_cyc_o[2];
353
    assign eoc[1] = (wbm_ack_i[1] & (wbm1_cti_o == 3'b000 | wbm1_cti_o == 3'b111)) | !wbm_cyc_o[1];
354
    assign eoc[0] = (wbm_ack_i[0] & (wbm0_cti_o == 3'b000 | wbm0_cti_o == 3'b111)) | !wbm_cyc_o[0];
355
 
356
end
357
endgenerate
358
 
359
generate
360
for (i=0;i<nr_of_ports;i=i+1) begin
361
    vl_spr sr0( .sp(select[i]), .r(eoc[i]), .q(state[i]), .clk(wb_clk), .rst(wb_rst));
362
end
363
endgenerate
364
 
365
    assign sel = select | state;
366
 
367 40 unneback
`define MODULE mux_andor
368
    `BASE`MODULE # ( .nr_of_ports(nr_of_ports), .width(32)) mux0 ( .a(wbm_dat_o), .sel(sel), .dout(wbs_dat_i));
369
    `BASE`MODULE # ( .nr_of_ports(nr_of_ports), .width(adr_size-adr_lo)) mux1 ( .a(wbm_adr_o), .sel(sel), .dout(wbs_adr_i));
370
    `BASE`MODULE # ( .nr_of_ports(nr_of_ports), .width(sel_size)) mux2 ( .a(wbm_sel_o), .sel(sel), .dout(wbs_sel_i));
371
    `BASE`MODULE # ( .nr_of_ports(nr_of_ports), .width(3)) mux3 ( .a(wbm_cti_o), .sel(sel), .dout(wbs_cti_i));
372
    `BASE`MODULE # ( .nr_of_ports(nr_of_ports), .width(2)) mux4 ( .a(wbm_bte_o), .sel(sel), .dout(wbs_bte_i));
373
    `BASE`MODULE # ( .nr_of_ports(nr_of_ports), .width(1)) mux5 ( .a(wbm_we_o), .sel(sel), .dout(wbs_we_i));
374
    `BASE`MODULE # ( .nr_of_ports(nr_of_ports), .width(1)) mux6 ( .a(wbm_stb_o), .sel(sel), .dout(wbs_stb_i));
375
`undef MODULE
376 39 unneback
    assign wbs_cyc_i = |sel;
377
 
378
    assign wbm_dat_i = {nr_of_ports{wbs_dat_o}};
379
    assign wbm_ack_i = {nr_of_ports{wbs_ack_o}} & sel;
380
    assign wbm_err_i = {nr_of_ports{wbs_err_o}} & sel;
381
    assign wbm_rty_i = {nr_of_ports{wbs_rty_o}} & sel;
382
 
383
endmodule
384 40 unneback
`endif
385 39 unneback
 
386 40 unneback
`ifdef WB_BOOT_ROM
387 17 unneback
// WB ROM
388 40 unneback
`define MODULE wb_boot_rom
389
module `BASE`MODULE (
390
`undef MODULE
391 17 unneback
    wb_adr_i, wb_stb_i, wb_cyc_i,
392 18 unneback
    wb_dat_o, wb_ack_o, hit_o, wb_clk, wb_rst);
393 17 unneback
 
394 18 unneback
    parameter adr_hi = 31;
395
    parameter adr_lo = 28;
396
    parameter adr_sel = 4'hf;
397
    parameter addr_width = 5;
398 33 unneback
/*
399 17 unneback
//E2_ifndef BOOT_ROM
400
//E2_define BOOT_ROM "boot_rom.v"
401
//E2_endif
402 33 unneback
*/
403 18 unneback
    input [adr_hi:2]    wb_adr_i;
404
    input               wb_stb_i;
405
    input               wb_cyc_i;
406
    output [31:0]        wb_dat_o;
407
    output              wb_ack_o;
408
    output              hit_o;
409
    input               wb_clk;
410
    input               wb_rst;
411
 
412
    wire hit;
413
    reg [31:0] wb_dat;
414
    reg wb_ack;
415
 
416
assign hit = wb_adr_i[adr_hi:adr_lo] == adr_sel;
417 17 unneback
 
418
always @ (posedge wb_clk or posedge wb_rst)
419
    if (wb_rst)
420 18 unneback
        wb_dat <= 32'h15000000;
421 17 unneback
    else
422 18 unneback
         case (wb_adr_i[addr_width-1:2])
423 33 unneback
//E2_ifdef BOOT_ROM
424 17 unneback
//E2_include `BOOT_ROM
425 33 unneback
//E2_endif
426 17 unneback
           /*
427
            // Zero r0 and jump to 0x00000100
428 18 unneback
 
429
            1 : wb_dat <= 32'hA8200000;
430
            2 : wb_dat <= 32'hA8C00100;
431
            3 : wb_dat <= 32'h44003000;
432
            4 : wb_dat <= 32'h15000000;
433 17 unneback
            */
434
           default:
435 18 unneback
             wb_dat <= 32'h00000000;
436 17 unneback
 
437
         endcase // case (wb_adr_i)
438
 
439
 
440
always @ (posedge wb_clk or posedge wb_rst)
441
    if (wb_rst)
442 18 unneback
        wb_ack <= 1'b0;
443 17 unneback
    else
444 18 unneback
        wb_ack <= wb_stb_i & wb_cyc_i & hit & !wb_ack;
445 17 unneback
 
446 18 unneback
assign hit_o = hit;
447
assign wb_dat_o = wb_dat & {32{wb_ack}};
448
assign wb_ack_o = wb_ack;
449
 
450 17 unneback
endmodule
451 40 unneback
`endif
452 32 unneback
 
453 40 unneback
`ifdef WB_DPRAM
454
`define MODULE wb_dpram
455
module `BASE`MODULE (
456
`undef MODULE
457 32 unneback
        // wishbone slave side a
458
        wbsa_dat_i, wbsa_adr_i, wbsa_we_i, wbsa_cyc_i, wbsa_stb_i, wbsa_dat_o, wbsa_ack_o,
459
        wbsa_clk, wbsa_rst,
460
        // wishbone slave side a
461
        wbsb_dat_i, wbsb_adr_i, wbsb_we_i, wbsb_cyc_i, wbsb_stb_i, wbsb_dat_o, wbsb_ack_o,
462
        wbsb_clk, wbsb_rst);
463
 
464
parameter data_width = 32;
465
parameter addr_width = 8;
466
 
467
parameter dat_o_mask_a = 1;
468
parameter dat_o_mask_b = 1;
469
 
470
input [31:0] wbsa_dat_i;
471
input [addr_width-1:2] wbsa_adr_i;
472
input wbsa_we_i, wbsa_cyc_i, wbsa_stb_i;
473
output [31:0] wbsa_dat_o;
474
output wbsa_ack_o;
475
input wbsa_clk, wbsa_rst;
476
 
477
input [31:0] wbsb_dat_i;
478
input [addr_width-1:2] wbsb_adr_i;
479
input wbsb_we_i, wbsb_cyc_i, wbsb_stb_i;
480
output [31:0] wbsb_dat_o;
481
output wbsb_ack_o;
482
input wbsb_clk, wbsb_rst;
483
 
484
wire wbsa_dat_tmp, wbsb_dat_tmp;
485
 
486 40 unneback
`define MODULE dpram_2r2w
487
`BASE`MODULE # (
488
`undef MODULE
489 33 unneback
    .data_width(data_width), .addr_width(addr_width) )
490 32 unneback
dpram0(
491
    .d_a(wbsa_dat_i),
492
    .q_a(wbsa_dat_tmp),
493
    .adr_a(wbsa_adr_i),
494
    .we_a(wbsa_we_i),
495
    .clk_a(wbsa_clk),
496
    .d_b(wbsb_dat_i),
497
    .q_b(wbsb_dat_tmp),
498
    .adr_b(wbsb_adr_i),
499
    .we_b(wbsb_we_i),
500
    .clk_b(wbsb_clk) );
501
 
502 33 unneback
generate if (dat_o_mask_a==1)
503 32 unneback
    assign wbsa_dat_o = wbsa_dat_tmp & {data_width{wbsa_ack_o}};
504
endgenerate
505 33 unneback
generate if (dat_o_mask_a==0)
506 32 unneback
    assign wbsa_dat_o = wbsa_dat_tmp;
507
endgenerate
508
 
509 33 unneback
generate if (dat_o_mask_b==1)
510 32 unneback
    assign wbsb_dat_o = wbsb_dat_tmp & {data_width{wbsb_ack_o}};
511
endgenerate
512 33 unneback
generate if (dat_o_mask_b==0)
513 32 unneback
    assign wbsb_dat_o = wbsb_dat_tmp;
514
endgenerate
515
 
516 40 unneback
`define MODULE spr
517
`BASE`MODULE ack_a( .sp(wbsa_cyc_i & wbsa_stb_i & !wbsa_ack_o), .r(1'b1), .q(wbsa_ack_o), .clk(wbsa_clk), .rst(wbsa_rst));
518
`BASE`MODULE ack_b( .sp(wbsb_cyc_i & wbsb_stb_i & !wbsb_ack_o), .r(1'b1), .q(wbsb_ack_o), .clk(wbsb_clk), .rst(wbsb_rst));
519
`undef MODULE
520 32 unneback
 
521
endmodule
522 40 unneback
`endif

powered by: WebSVN 2.1.0

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