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