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

Subversion Repositories or1k

[/] [or1k/] [branches/] [mp3_stable/] [mp3/] [lib/] [xilinx/] [unisims/] [RAMB4_S2_S4.v] - Blame information for rev 266

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

Line No. Rev Author Line
1 266 lampret
// $Header: /home/marcus/revision_ctrl_test/oc_cvs/cvs/or1k/mp3/lib/xilinx/unisims/RAMB4_S2_S4.v,v 1.1.1.1 2001-11-04 18:59:59 lampret Exp $
2
 
3
/*
4
 
5
FUNCTION        : 4x2x4 Block RAM with synchronous write capability
6
 
7
*/
8
 
9
`timescale  100 ps / 10 ps
10
 
11
`celldefine
12
 
13
module RAMB4_S2_S4 (DOA, DOB, ADDRA, CLKA, DIA, ENA, RSTA, WEA, ADDRB, CLKB, DIB, ENB, RSTB, WEB);
14
 
15
    parameter cds_action = "ignore";
16
 
17
    parameter INIT_00 = 256'h0000000000000000000000000000000000000000000000000000000000000000;
18
    parameter INIT_01 = 256'h0000000000000000000000000000000000000000000000000000000000000000;
19
    parameter INIT_02 = 256'h0000000000000000000000000000000000000000000000000000000000000000;
20
    parameter INIT_03 = 256'h0000000000000000000000000000000000000000000000000000000000000000;
21
    parameter INIT_04 = 256'h0000000000000000000000000000000000000000000000000000000000000000;
22
    parameter INIT_05 = 256'h0000000000000000000000000000000000000000000000000000000000000000;
23
    parameter INIT_06 = 256'h0000000000000000000000000000000000000000000000000000000000000000;
24
    parameter INIT_07 = 256'h0000000000000000000000000000000000000000000000000000000000000000;
25
    parameter INIT_08 = 256'h0000000000000000000000000000000000000000000000000000000000000000;
26
    parameter INIT_09 = 256'h0000000000000000000000000000000000000000000000000000000000000000;
27
    parameter INIT_0A = 256'h0000000000000000000000000000000000000000000000000000000000000000;
28
    parameter INIT_0B = 256'h0000000000000000000000000000000000000000000000000000000000000000;
29
    parameter INIT_0C = 256'h0000000000000000000000000000000000000000000000000000000000000000;
30
    parameter INIT_0D = 256'h0000000000000000000000000000000000000000000000000000000000000000;
31
    parameter INIT_0E = 256'h0000000000000000000000000000000000000000000000000000000000000000;
32
    parameter INIT_0F = 256'h0000000000000000000000000000000000000000000000000000000000000000;
33
 
34
    output [1:0] DOA;
35
    reg [1:0] doa_out;
36
    wire doa_out0, doa_out1;
37
 
38
    input [10:0] ADDRA;
39
    input [1:0] DIA;
40
    input ENA, CLKA, WEA, RSTA;
41
 
42
    output [3:0] DOB;
43
    reg [3:0] dob_out;
44
    wire dob_out0, dob_out1, dob_out2, dob_out3;
45
 
46
    input [9:0] ADDRB;
47
    input [3:0] DIB;
48
    input ENB, CLKB, WEB, RSTB;
49
 
50
    reg [4095:0] mem;
51
    reg [8:0] count;
52
 
53
    reg [5:0] mi, mj, ai, aj, bi, bj, ci, cj;
54
 
55
    wire [10:0] addra_int;
56
    wire [1:0] dia_int;
57
    wire ena_int, clka_int, wea_int, rsta_int;
58
    wire [9:0] addrb_int;
59
    wire [3:0] dib_int;
60
    wire enb_int, clkb_int, web_int, rstb_int;
61
 
62
    reg recovery_a, recovery_b;
63
    reg address_collision;
64
 
65
    wire clka_enable = ena_int && wea_int && enb_int && address_collision;
66
    wire clkb_enable = enb_int && web_int && ena_int && address_collision;
67
    wire collision = clka_enable || clkb_enable;
68
 
69
    tri0 GSR = glbl.GSR;
70
 
71
    always @(GSR)
72
        if (GSR) begin
73
            assign doa_out = 0;
74
        end
75
        else begin
76
            deassign doa_out;
77
        end
78
 
79
    always @(GSR)
80
        if (GSR) begin
81
            assign dob_out = 0;
82
        end
83
        else begin
84
            deassign dob_out;
85
        end
86
 
87
    buf b_doa_out0 (doa_out0, doa_out[0]);
88
    buf b_doa_out1 (doa_out1, doa_out[1]);
89
    buf b_dob_out0 (dob_out0, dob_out[0]);
90
    buf b_dob_out1 (dob_out1, dob_out[1]);
91
    buf b_dob_out2 (dob_out2, dob_out[2]);
92
    buf b_dob_out3 (dob_out3, dob_out[3]);
93
    buf b_doa0 (DOA[0], doa_out0);
94
    buf b_doa1 (DOA[1], doa_out1);
95
    buf b_dob0 (DOB[0], dob_out0);
96
    buf b_dob1 (DOB[1], dob_out1);
97
    buf b_dob2 (DOB[2], dob_out2);
98
    buf b_dob3 (DOB[3], dob_out3);
99
    buf b_addra_0 (addra_int[0], ADDRA[0]);
100
    buf b_addra_1 (addra_int[1], ADDRA[1]);
101
    buf b_addra_2 (addra_int[2], ADDRA[2]);
102
    buf b_addra_3 (addra_int[3], ADDRA[3]);
103
    buf b_addra_4 (addra_int[4], ADDRA[4]);
104
    buf b_addra_5 (addra_int[5], ADDRA[5]);
105
    buf b_addra_6 (addra_int[6], ADDRA[6]);
106
    buf b_addra_7 (addra_int[7], ADDRA[7]);
107
    buf b_addra_8 (addra_int[8], ADDRA[8]);
108
    buf b_addra_9 (addra_int[9], ADDRA[9]);
109
    buf b_addra_10 (addra_int[10], ADDRA[10]);
110
    buf b_dia_0 (dia_int[0], DIA[0]);
111
    buf b_dia_1 (dia_int[1], DIA[1]);
112
    buf b_clka (clka_int, CLKA);
113
    buf b_ena (ena_int, ENA);
114
    buf b_rsta (rsta_int, RSTA);
115
    buf b_wea (wea_int, WEA);
116
    buf b_addrb_0 (addrb_int[0], ADDRB[0]);
117
    buf b_addrb_1 (addrb_int[1], ADDRB[1]);
118
    buf b_addrb_2 (addrb_int[2], ADDRB[2]);
119
    buf b_addrb_3 (addrb_int[3], ADDRB[3]);
120
    buf b_addrb_4 (addrb_int[4], ADDRB[4]);
121
    buf b_addrb_5 (addrb_int[5], ADDRB[5]);
122
    buf b_addrb_6 (addrb_int[6], ADDRB[6]);
123
    buf b_addrb_7 (addrb_int[7], ADDRB[7]);
124
    buf b_addrb_8 (addrb_int[8], ADDRB[8]);
125
    buf b_addrb_9 (addrb_int[9], ADDRB[9]);
126
    buf b_dib_0 (dib_int[0], DIB[0]);
127
    buf b_dib_1 (dib_int[1], DIB[1]);
128
    buf b_dib_2 (dib_int[2], DIB[2]);
129
    buf b_dib_3 (dib_int[3], DIB[3]);
130
    buf b_clkb (clkb_int, CLKB);
131
    buf b_enb (enb_int, ENB);
132
    buf b_rstb (rstb_int, RSTB);
133
    buf b_web (web_int, WEB);
134
 
135
    initial begin
136
        for (count = 0; count < 256; count = count + 1) begin
137
            mem[count]            <= INIT_00[count];
138
            mem[256 * 1 + count]  <= INIT_01[count];
139
            mem[256 * 2 + count]  <= INIT_02[count];
140
            mem[256 * 3 + count]  <= INIT_03[count];
141
            mem[256 * 4 + count]  <= INIT_04[count];
142
            mem[256 * 5 + count]  <= INIT_05[count];
143
            mem[256 * 6 + count]  <= INIT_06[count];
144
            mem[256 * 7 + count]  <= INIT_07[count];
145
            mem[256 * 8 + count]  <= INIT_08[count];
146
            mem[256 * 9 + count]  <= INIT_09[count];
147
            mem[256 * 10 + count] <= INIT_0A[count];
148
            mem[256 * 11 + count] <= INIT_0B[count];
149
            mem[256 * 12 + count] <= INIT_0C[count];
150
            mem[256 * 13 + count] <= INIT_0D[count];
151
            mem[256 * 14 + count] <= INIT_0E[count];
152
            mem[256 * 15 + count] <= INIT_0F[count];
153
        end
154
        recovery_a <= 0;
155
        recovery_b <= 0;
156
    end
157
 
158
    always @(addra_int or addrb_int) begin
159
        address_collision <= 1'b0;
160
        for (ci = 0; ci < 2; ci = ci + 1) begin
161
            for (cj = 0; cj < 4; cj = cj + 1) begin
162
                if ((addra_int * 2 + ci) == (addrb_int * 4 + cj)) begin
163
                    address_collision <= 1'b1;
164
                end
165
            end
166
        end
167
    end
168
 
169
    always @(posedge recovery_a or posedge recovery_b) begin
170
        if (wea_int == 1 && web_int == 1) begin
171
            for (mi = 0; mi < 2; mi = mi + 1) begin
172
                for (mj = 0; mj < 4; mj = mj + 1) begin
173
                    if ((addra_int * 2 + mi) == (addrb_int * 4 + mj)) begin
174
                        mem[addra_int * 2 + mi] <= 1'bX;
175
                    end
176
                end
177
            end
178
        end
179
        recovery_a <= 0;
180
        recovery_b <= 0;
181
    end
182
 
183
    always @(posedge recovery_a or posedge recovery_b) begin
184
        if (web_int == 1 && rsta_int == 0) begin
185
            for (ai = 0; ai < 2; ai = ai + 1) begin
186
                for (aj = 0; aj < 4; aj = aj + 1) begin
187
                    if ((addra_int * 2 + ai) == (addrb_int * 4 + aj)) begin
188
                        doa_out[ai] <= 1'bX;
189
                    end
190
                end
191
            end
192
        end
193
    end
194
 
195
    always @(posedge recovery_a or posedge recovery_b) begin
196
        if (wea_int == 1 && rstb_int == 0) begin
197
            for (bi = 0; bi < 2; bi = bi + 1) begin
198
                for (bj = 0; bj < 4; bj = bj + 1) begin
199
                    if ((addra_int * 2 + bi) == (addrb_int * 4 + bj)) begin
200
                        dob_out[bj] <= 1'bX;
201
                    end
202
                end
203
            end
204
        end
205
    end
206
 
207
    always @(posedge clka_int) begin
208
        if (ena_int == 1'b1) begin
209
            if (rsta_int == 1'b1) begin
210
                doa_out[0] <= 0;
211
                doa_out[1] <= 0;
212
            end
213
            else if (wea_int == 0) begin
214
                doa_out[0] <= mem[addra_int * 2 + 0];
215
                doa_out[1] <= mem[addra_int * 2 + 1];
216
            end
217
            else begin
218
                doa_out[0] <= dia_int[0];
219
                doa_out[1] <= dia_int[1];
220
            end
221
        end
222
    end
223
 
224
    always @(posedge clka_int) begin
225
        if (ena_int == 1'b1 && wea_int == 1'b1) begin
226
            mem[addra_int * 2 + 0] <= dia_int[0];
227
            mem[addra_int * 2 + 1] <= dia_int[1];
228
        end
229
    end
230
 
231
    always @(posedge clkb_int) begin
232
        if (enb_int == 1'b1) begin
233
            if (rstb_int == 1'b1) begin
234
                dob_out[0] <= 0;
235
                dob_out[1] <= 0;
236
                dob_out[2] <= 0;
237
                dob_out[3] <= 0;
238
            end
239
            else if (web_int == 0) begin
240
                dob_out[0] <= mem[addrb_int * 4 + 0];
241
                dob_out[1] <= mem[addrb_int * 4 + 1];
242
                dob_out[2] <= mem[addrb_int * 4 + 2];
243
                dob_out[3] <= mem[addrb_int * 4 + 3];
244
            end
245
            else begin
246
                dob_out[0] <= dib_int[0];
247
                dob_out[1] <= dib_int[1];
248
                dob_out[2] <= dib_int[2];
249
                dob_out[3] <= dib_int[3];
250
            end
251
        end
252
    end
253
 
254
    always @(posedge clkb_int) begin
255
        if (enb_int == 1'b1 && web_int == 1'b1) begin
256
            mem[addrb_int * 4 + 0] <= dib_int[0];
257
            mem[addrb_int * 4 + 1] <= dib_int[1];
258
            mem[addrb_int * 4 + 2] <= dib_int[2];
259
            mem[addrb_int * 4 + 3] <= dib_int[3];
260
        end
261
    end
262
 
263
    specify
264
        (CLKA *> DOA) = (1, 1);
265
        (CLKB *> DOB) = (1, 1);
266
        $recovery (posedge CLKB, posedge CLKA &&& collision, 1, recovery_b);
267
        $recovery (posedge CLKA, posedge CLKB &&& collision, 1, recovery_a);
268
    endspecify
269
 
270
endmodule
271
 
272
`endcelldefine

powered by: WebSVN 2.1.0

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