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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [mp3/] [lib/] [xilinx/] [unisims/] [RAMB4_S1_S2.v] - Blame information for rev 1765

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_S1_S2.v,v 1.1.1.1 2001-11-04 18:59:59 lampret Exp $
2
 
3
/*
4
 
5
FUNCTION        : 4x1x2 Block RAM with synchronous write capability
6
 
7
*/
8
 
9
`timescale  100 ps / 10 ps
10
 
11
`celldefine
12
 
13
module RAMB4_S1_S2 (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 [0:0] DOA;
35
    reg [0:0] doa_out;
36
    wire doa_out0;
37
 
38
    input [11:0] ADDRA;
39
    input [0:0] DIA;
40
    input ENA, CLKA, WEA, RSTA;
41
 
42
    output [1:0] DOB;
43
    reg [1:0] dob_out;
44
    wire dob_out0, dob_out1;
45
 
46
    input [10:0] ADDRB;
47
    input [1: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 [11:0] addra_int;
56
    wire [0:0] dia_int;
57
    wire ena_int, clka_int, wea_int, rsta_int;
58
    wire [10:0] addrb_int;
59
    wire [1: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_dob_out0 (dob_out0, dob_out[0]);
89
    buf b_dob_out1 (dob_out1, dob_out[1]);
90
    buf b_doa0 (DOA[0], doa_out0);
91
    buf b_dob0 (DOB[0], dob_out0);
92
    buf b_dob1 (DOB[1], dob_out1);
93
    buf b_addra_0 (addra_int[0], ADDRA[0]);
94
    buf b_addra_1 (addra_int[1], ADDRA[1]);
95
    buf b_addra_2 (addra_int[2], ADDRA[2]);
96
    buf b_addra_3 (addra_int[3], ADDRA[3]);
97
    buf b_addra_4 (addra_int[4], ADDRA[4]);
98
    buf b_addra_5 (addra_int[5], ADDRA[5]);
99
    buf b_addra_6 (addra_int[6], ADDRA[6]);
100
    buf b_addra_7 (addra_int[7], ADDRA[7]);
101
    buf b_addra_8 (addra_int[8], ADDRA[8]);
102
    buf b_addra_9 (addra_int[9], ADDRA[9]);
103
    buf b_addra_10 (addra_int[10], ADDRA[10]);
104
    buf b_addra_11 (addra_int[11], ADDRA[11]);
105
    buf b_dia_0 (dia_int[0], DIA[0]);
106
    buf b_clka (clka_int, CLKA);
107
    buf b_ena (ena_int, ENA);
108
    buf b_rsta (rsta_int, RSTA);
109
    buf b_wea (wea_int, WEA);
110
    buf b_addrb_0 (addrb_int[0], ADDRB[0]);
111
    buf b_addrb_1 (addrb_int[1], ADDRB[1]);
112
    buf b_addrb_2 (addrb_int[2], ADDRB[2]);
113
    buf b_addrb_3 (addrb_int[3], ADDRB[3]);
114
    buf b_addrb_4 (addrb_int[4], ADDRB[4]);
115
    buf b_addrb_5 (addrb_int[5], ADDRB[5]);
116
    buf b_addrb_6 (addrb_int[6], ADDRB[6]);
117
    buf b_addrb_7 (addrb_int[7], ADDRB[7]);
118
    buf b_addrb_8 (addrb_int[8], ADDRB[8]);
119
    buf b_addrb_9 (addrb_int[9], ADDRB[9]);
120
    buf b_addrb_10 (addrb_int[10], ADDRB[10]);
121
    buf b_dib_0 (dib_int[0], DIB[0]);
122
    buf b_dib_1 (dib_int[1], DIB[1]);
123
    buf b_clkb (clkb_int, CLKB);
124
    buf b_enb (enb_int, ENB);
125
    buf b_rstb (rstb_int, RSTB);
126
    buf b_web (web_int, WEB);
127
 
128
    initial begin
129
        for (count = 0; count < 256; count = count + 1) begin
130
            mem[count]            <= INIT_00[count];
131
            mem[256 * 1 + count]  <= INIT_01[count];
132
            mem[256 * 2 + count]  <= INIT_02[count];
133
            mem[256 * 3 + count]  <= INIT_03[count];
134
            mem[256 * 4 + count]  <= INIT_04[count];
135
            mem[256 * 5 + count]  <= INIT_05[count];
136
            mem[256 * 6 + count]  <= INIT_06[count];
137
            mem[256 * 7 + count]  <= INIT_07[count];
138
            mem[256 * 8 + count]  <= INIT_08[count];
139
            mem[256 * 9 + count]  <= INIT_09[count];
140
            mem[256 * 10 + count] <= INIT_0A[count];
141
            mem[256 * 11 + count] <= INIT_0B[count];
142
            mem[256 * 12 + count] <= INIT_0C[count];
143
            mem[256 * 13 + count] <= INIT_0D[count];
144
            mem[256 * 14 + count] <= INIT_0E[count];
145
            mem[256 * 15 + count] <= INIT_0F[count];
146
        end
147
        recovery_a <= 0;
148
        recovery_b <= 0;
149
    end
150
 
151
    always @(addra_int or addrb_int) begin
152
        address_collision <= 1'b0;
153
        for (ci = 0; ci < 1; ci = ci + 1) begin
154
            for (cj = 0; cj < 2; cj = cj + 1) begin
155
                if ((addra_int * 1 + ci) == (addrb_int * 2 + cj)) begin
156
                    address_collision <= 1'b1;
157
                end
158
            end
159
        end
160
    end
161
 
162
    always @(posedge recovery_a or posedge recovery_b) begin
163
        if (wea_int == 1 && web_int == 1) begin
164
            for (mi = 0; mi < 1; mi = mi + 1) begin
165
                for (mj = 0; mj < 2; mj = mj + 1) begin
166
                    if ((addra_int * 1 + mi) == (addrb_int * 2 + mj)) begin
167
                        mem[addra_int * 1 + mi] <= 1'bX;
168
                    end
169
                end
170
            end
171
        end
172
        recovery_a <= 0;
173
        recovery_b <= 0;
174
    end
175
 
176
    always @(posedge recovery_a or posedge recovery_b) begin
177
        if (web_int == 1 && rsta_int == 0) begin
178
            for (ai = 0; ai < 1; ai = ai + 1) begin
179
                for (aj = 0; aj < 2; aj = aj + 1) begin
180
                    if ((addra_int * 1 + ai) == (addrb_int * 2 + aj)) begin
181
                        doa_out[ai] <= 1'bX;
182
                    end
183
                end
184
            end
185
        end
186
    end
187
 
188
    always @(posedge recovery_a or posedge recovery_b) begin
189
        if (wea_int == 1 && rstb_int == 0) begin
190
            for (bi = 0; bi < 1; bi = bi + 1) begin
191
                for (bj = 0; bj < 2; bj = bj + 1) begin
192
                    if ((addra_int * 1 + bi) == (addrb_int * 2 + bj)) begin
193
                        dob_out[bj] <= 1'bX;
194
                    end
195
                end
196
            end
197
        end
198
    end
199
 
200
    always @(posedge clka_int) begin
201
        if (ena_int == 1'b1) begin
202
            if (rsta_int == 1'b1) begin
203
                doa_out[0] <= 0;
204
            end
205
            else if (wea_int == 0) begin
206
                doa_out[0] <= mem[addra_int * 1 + 0];
207
            end
208
            else begin
209
                doa_out[0] <= dia_int[0];
210
            end
211
        end
212
    end
213
 
214
    always @(posedge clka_int) begin
215
        if (ena_int == 1'b1 && wea_int == 1'b1) begin
216
            mem[addra_int * 1 + 0] <= dia_int[0];
217
        end
218
    end
219
 
220
    always @(posedge clkb_int) begin
221
        if (enb_int == 1'b1) begin
222
            if (rstb_int == 1'b1) begin
223
                dob_out[0] <= 0;
224
                dob_out[1] <= 0;
225
            end
226
            else if (web_int == 0) begin
227
                dob_out[0] <= mem[addrb_int * 2 + 0];
228
                dob_out[1] <= mem[addrb_int * 2 + 1];
229
            end
230
            else begin
231
                dob_out[0] <= dib_int[0];
232
                dob_out[1] <= dib_int[1];
233
            end
234
        end
235
    end
236
 
237
    always @(posedge clkb_int) begin
238
        if (enb_int == 1'b1 && web_int == 1'b1) begin
239
            mem[addrb_int * 2 + 0] <= dib_int[0];
240
            mem[addrb_int * 2 + 1] <= dib_int[1];
241
        end
242
    end
243
 
244
    specify
245
        (CLKA *> DOA) = (1, 1);
246
        (CLKB *> DOB) = (1, 1);
247
        $recovery (posedge CLKB, posedge CLKA &&& collision, 1, recovery_b);
248
        $recovery (posedge CLKA, posedge CLKB &&& collision, 1, recovery_a);
249
    endspecify
250
 
251
endmodule
252
 
253
`endcelldefine

powered by: WebSVN 2.1.0

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