blob: 1b88ef74f579976dfdcf5ea4ef093fa1d3387f59 [file] [log] [blame]
Manar68e03632020-11-09 13:25:13 +02001/*
Manar8f131792020-11-11 16:38:32 +02002 Building blocks for DFF based RAM compiler for SKY130A
3 BYTE : 8 memory cells used as a building block for WORD module
Manar68e03632020-11-09 13:25:13 +02004 WORD : 32-bit memory word with select and byte-level WE
Manar8f131792020-11-11 16:38:32 +02005 DEC6x64 : 2x4 Binary Decoder
Manar68e03632020-11-09 13:25:13 +02006 DEC6x64 : 6x64 Binary decoder
Manar8f131792020-11-11 16:38:32 +02007 MUX4x1_32 : 32-bit 4x1 MUX
8 MUX2x1_32 : 32-bit 2x1 MUX
9 SRAM64x32 : Tri-state buffers based 64x32 DFF RAM
10 DFFRAM_COL4 : A single column of 4 SRAM64x32 blocks using 4x1 multiplexors
11*/
12/*
13 Author: Mohamed Shalan (mshalan@aucegypt.edu)
Manar68e03632020-11-09 13:25:13 +020014*/
15
16module BYTE (
Manar61dce922020-11-10 19:26:28 +020017`ifdef USE_POWER_PINS
18 input VPWR,
19 input VGND,
20`endif
Manar68e03632020-11-09 13:25:13 +020021 input CLK,
22 input WE,
23 input SEL,
24 input [7:0] Di,
Manar61dce922020-11-10 19:26:28 +020025 output [7:0] Do
Manar68e03632020-11-09 13:25:13 +020026);
27
28 wire [7:0] q_wire;
29 wire we_wire;
30 wire SEL_B;
31 wire GCLK;
32
Manar8f131792020-11-11 16:38:32 +020033 sky130_fd_sc_hd__inv_1 INV(
34 `ifdef USE_POWER_PINS
Manar61dce922020-11-10 19:26:28 +020035 .VPWR(VPWR),
36 .VGND(VGND),
37 .VPB(VPWR),
38 .VNB(VGND),
39 `endif
40 .Y(SEL_B),
41 .A(SEL)
42 );
Manar8f131792020-11-11 16:38:32 +020043
Manar61dce922020-11-10 19:26:28 +020044 sky130_fd_sc_hd__and2_1 CGAND(
45 `ifdef USE_POWER_PINS
46 .VPWR(VPWR),
47 .VGND(VGND),
48 .VPB(VPWR),
49 .VNB(VGND),
50 `endif
51 .A(SEL),
52 .B(WE),
53 .X(we_wire)
54 );
55
56 sky130_fd_sc_hd__dlclkp_1 CG(
57 `ifdef USE_POWER_PINS
58 .VPWR(VPWR),
59 .VGND(VGND),
60 .VPB(VPWR),
61 .VNB(VGND),
62 `endif
63 .CLK(CLK),
64 .GCLK(GCLK),
Manar8f131792020-11-11 16:38:32 +020065 .GATE(we_wire)
Manar61dce922020-11-10 19:26:28 +020066 );
Manar68e03632020-11-09 13:25:13 +020067
68 generate
69 genvar i;
70 for(i=0; i<8; i=i+1) begin : BIT
Manar8f131792020-11-11 16:38:32 +020071 sky130_fd_sc_hd__dfxtp_1 FF (
Manar61dce922020-11-10 19:26:28 +020072 `ifdef USE_POWER_PINS
73 .VPWR(VPWR),
74 .VGND(VGND),
75 .VPB(VPWR),
76 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +020077 `endif
Manar61dce922020-11-10 19:26:28 +020078 .D(Di[i]),
79 .Q(q_wire[i]),
80 .CLK(GCLK)
81 );
Manar8f131792020-11-11 16:38:32 +020082
Manar61dce922020-11-10 19:26:28 +020083 sky130_fd_sc_hd__ebufn_2 OBUF (
84 `ifdef USE_POWER_PINS
85 .VPWR(VPWR),
86 .VGND(VGND),
87 .VPB(VPWR),
88 .VNB(VGND),
89 `endif
90 .A(q_wire[i]),
91 .Z(Do[i]),
92 .TE_B(SEL_B)
93 );
Manar8f131792020-11-11 16:38:32 +020094
Manar68e03632020-11-09 13:25:13 +020095 end
96 endgenerate
97
98endmodule
99
100
101module WORD32 (
Manar61dce922020-11-10 19:26:28 +0200102`ifdef USE_POWER_PINS
103 input VPWR,
104 input VGND,
105`endif
Manar68e03632020-11-09 13:25:13 +0200106 input CLK,
107 input [3:0] WE,
108 input SEL,
109 input [31:0] Di,
Manar61dce922020-11-10 19:26:28 +0200110 output [31:0] Do
Manar68e03632020-11-09 13:25:13 +0200111);
112
Manar8f131792020-11-11 16:38:32 +0200113 BYTE B0 (
Manar61dce922020-11-10 19:26:28 +0200114 `ifdef USE_POWER_PINS
115 .VPWR(VPWR),
116 .VGND(VGND),
Manar8f131792020-11-11 16:38:32 +0200117 `endif
118 .CLK(CLK), .WE(WE[0]), .SEL(SEL), .Di(Di[7:0]), .Do(Do[7:0]) );
119
Manar61dce922020-11-10 19:26:28 +0200120 BYTE B1 (
121 `ifdef USE_POWER_PINS
Manar8f131792020-11-11 16:38:32 +0200122 .VPWR(VPWR),
Manar61dce922020-11-10 19:26:28 +0200123 .VGND(VGND),
124 `endif
Manar8f131792020-11-11 16:38:32 +0200125 .CLK(CLK), .WE(WE[1]), .SEL(SEL), .Di(Di[15:8]), .Do(Do[15:8]) );
126
Manar61dce922020-11-10 19:26:28 +0200127 BYTE B2 (
128 `ifdef USE_POWER_PINS
129 .VPWR(VPWR),
130 .VGND(VGND),
131 `endif
Manar8f131792020-11-11 16:38:32 +0200132 .CLK(CLK), .WE(WE[2]), .SEL(SEL), .Di(Di[23:16]), .Do(Do[23:16]) );
133
Manar61dce922020-11-10 19:26:28 +0200134 BYTE B3 (
135 `ifdef USE_POWER_PINS
136 .VPWR(VPWR),
137 .VGND(VGND),
138 `endif
Manar8f131792020-11-11 16:38:32 +0200139 .CLK(CLK), .WE(WE[3]), .SEL(SEL), .Di(Di[31:24]), .Do(Do[31:24]) );
Manar68e03632020-11-09 13:25:13 +0200140
141endmodule
142
Manar8f131792020-11-11 16:38:32 +0200143module DEC1x2 (
144`ifdef USE_POWER_PINS
145 input VPWR,
146 input VGND,
147`endif
148 input EN,
149 input [0:0] A,
150 output [1:0] SEL
151);
152 sky130_fd_sc_hd__and2b_2 AND1 (
153 `ifdef USE_POWER_PINS
154 .VPWR(VPWR),
155 .VGND(VGND),
156 .VPB(VPWR),
157 .VNB(VGND),
158 `endif
159 .X(SEL[0]),
160 .A_N(A),
161 .B(EN)
162 );
163
164 sky130_fd_sc_hd__and2_2 AND3 (
165 `ifdef USE_POWER_PINS
166 .VPWR(VPWR),
167 .VGND(VGND),
168 .VPB(VPWR),
169 .VNB(VGND),
170 `endif
171 .X(SEL[1]),
172 .A(A),
173 .B(A[0])
174 );
175
176endmodule
177
Manar68e03632020-11-09 13:25:13 +0200178module DEC2x4 (
Manar61dce922020-11-10 19:26:28 +0200179`ifdef USE_POWER_PINS
180 input VPWR,
181 input VGND,
182`endif
Manar68e03632020-11-09 13:25:13 +0200183 input EN,
184 input [1:0] A,
Manar61dce922020-11-10 19:26:28 +0200185 output [3:0] SEL
Manar68e03632020-11-09 13:25:13 +0200186);
Manar8f131792020-11-11 16:38:32 +0200187 sky130_fd_sc_hd__nor3b_4 AND0 (
188 `ifdef USE_POWER_PINS
Manar61dce922020-11-10 19:26:28 +0200189 .VPWR(VPWR),
190 .VGND(VGND),
191 .VPB(VPWR),
192 .VNB(VGND),
193 `endif
194 .Y(SEL[0]),
195 .A(A[0]),
196 .B(A[1]),
197 .C_N(EN)
198 );
Manar8f131792020-11-11 16:38:32 +0200199
200 sky130_fd_sc_hd__and3b_4 AND1 (
201 `ifdef USE_POWER_PINS
Manar61dce922020-11-10 19:26:28 +0200202 .VPWR(VPWR),
203 .VGND(VGND),
204 .VPB(VPWR),
205 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +0200206 `endif
Manar61dce922020-11-10 19:26:28 +0200207 .X(SEL[1]),
208 .A_N(A[1]),
209 .B(A[0]),
210 .C(EN)
211 );
Manar8f131792020-11-11 16:38:32 +0200212
213 sky130_fd_sc_hd__and3b_4 AND2 (
214 `ifdef USE_POWER_PINS
Manar61dce922020-11-10 19:26:28 +0200215 .VPWR(VPWR),
216 .VGND(VGND),
217 .VPB(VPWR),
218 .VNB(VGND),
219 `endif
220 .X(SEL[2]),
221 .A_N(A[0]),
222 .B(A[1]),
Manar8f131792020-11-11 16:38:32 +0200223 .C(EN)
Manar61dce922020-11-10 19:26:28 +0200224 );
Manar8f131792020-11-11 16:38:32 +0200225
226 sky130_fd_sc_hd__and3_4 AND3 (
227 `ifdef USE_POWER_PINS
Manar61dce922020-11-10 19:26:28 +0200228 .VPWR(VPWR),
229 .VGND(VGND),
230 .VPB(VPWR),
231 .VNB(VGND),
232 `endif
233 .X(SEL[3]),
Manar8f131792020-11-11 16:38:32 +0200234 .A(A[1]),
Manar61dce922020-11-10 19:26:28 +0200235 .B(A[0]),
236 .C(EN)
237 );
Manar68e03632020-11-09 13:25:13 +0200238
239endmodule
240
241module DEC3x8 (
Manar61dce922020-11-10 19:26:28 +0200242`ifdef USE_POWER_PINS
243 input VPWR,
244 input VGND,
245`endif
Manar68e03632020-11-09 13:25:13 +0200246 input EN,
247 input [2:0] A,
Manar61dce922020-11-10 19:26:28 +0200248 output [7:0] SEL
Manar68e03632020-11-09 13:25:13 +0200249);
Manar8f131792020-11-11 16:38:32 +0200250 sky130_fd_sc_hd__nor4b_2 AND0 (
Manar61dce922020-11-10 19:26:28 +0200251 `ifdef USE_POWER_PINS
252 .VPWR(VPWR),
253 .VGND(VGND),
254 .VPB(VPWR),
255 .VNB(VGND),
256 `endif
257 .Y(SEL[0]),
258 .A(A[0]),
259 .B(A[1]),
Manar8f131792020-11-11 16:38:32 +0200260 .C(A[2]),
Manar61dce922020-11-10 19:26:28 +0200261 .D_N(EN)
262 ); // 000
263
264 sky130_fd_sc_hd__and4bb_2 AND1 (
265 `ifdef USE_POWER_PINS
266 .VPWR(VPWR),
267 .VGND(VGND),
268 .VPB(VPWR),
269 .VNB(VGND),
270 `endif
271 .X(SEL[1]),
272 .A_N(A[2]),
273 .B_N(A[1]),
274 .C(A[0]),
Manar8f131792020-11-11 16:38:32 +0200275 .D(EN)
Manar61dce922020-11-10 19:26:28 +0200276 ); // 001
277
278 sky130_fd_sc_hd__and4bb_2 AND2 (
279 `ifdef USE_POWER_PINS
280 .VPWR(VPWR),
281 .VGND(VGND),
282 .VPB(VPWR),
283 .VNB(VGND),
284 `endif
285 .X(SEL[2]),
286 .A_N(A[2]),
287 .B_N(A[0]),
288 .C(A[1]),
289 .D(EN)
290 ); // 010
291
Manar8f131792020-11-11 16:38:32 +0200292 sky130_fd_sc_hd__and4b_2 AND3 (
Manar61dce922020-11-10 19:26:28 +0200293 `ifdef USE_POWER_PINS
294 .VPWR(VPWR),
295 .VGND(VGND),
296 .VPB(VPWR),
297 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +0200298 `endif
Manar61dce922020-11-10 19:26:28 +0200299 .X(SEL[3]),
300 .A_N(A[2]),
301 .B(A[1]),
302 .C(A[0]),
303 .D(EN)
304 ); // 011
Manar8f131792020-11-11 16:38:32 +0200305
306 sky130_fd_sc_hd__and4bb_2 AND4 (
Manar61dce922020-11-10 19:26:28 +0200307 `ifdef USE_POWER_PINS
308 .VPWR(VPWR),
309 .VGND(VGND),
310 .VPB(VPWR),
311 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +0200312 `endif
Manar61dce922020-11-10 19:26:28 +0200313 .X(SEL[4]),
314 .A_N(A[0]),
315 .B_N(A[1]),
316 .C(A[2]),
317 .D(EN)
318 ); // 100
Manar8f131792020-11-11 16:38:32 +0200319
320 sky130_fd_sc_hd__and4b_2 AND5 (
321 `ifdef USE_POWER_PINS
Manar61dce922020-11-10 19:26:28 +0200322 .VPWR(VPWR),
323 .VGND(VGND),
324 .VPB(VPWR),
325 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +0200326 `endif
Manar61dce922020-11-10 19:26:28 +0200327 .X(SEL[5]),
328 .A_N(A[1]),
329 .B(A[0]),
330 .C(A[2]),
Manar8f131792020-11-11 16:38:32 +0200331 .D(EN)
Manar61dce922020-11-10 19:26:28 +0200332 ); // 101
Manar8f131792020-11-11 16:38:32 +0200333
334 sky130_fd_sc_hd__and4b_2 AND6 (
335 `ifdef USE_POWER_PINS
Manar61dce922020-11-10 19:26:28 +0200336 .VPWR(VPWR),
337 .VGND(VGND),
338 .VPB(VPWR),
339 .VNB(VGND),
340 `endif
341 .X(SEL[6]),
342 .A_N(A[0]),
Manar8f131792020-11-11 16:38:32 +0200343 .B(A[1]),
Manar61dce922020-11-10 19:26:28 +0200344 .C(A[2]),
Manar8f131792020-11-11 16:38:32 +0200345 .D(EN)
Manar61dce922020-11-10 19:26:28 +0200346 ); // 110
Manar8f131792020-11-11 16:38:32 +0200347
348 sky130_fd_sc_hd__and4_2 AND7 (
Manar61dce922020-11-10 19:26:28 +0200349 `ifdef USE_POWER_PINS
350 .VPWR(VPWR),
351 .VGND(VGND),
352 .VPB(VPWR),
353 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +0200354 `endif
Manar61dce922020-11-10 19:26:28 +0200355 .X(SEL[7]),
356 .A(A[0]),
357 .B(A[1]),
Manar8f131792020-11-11 16:38:32 +0200358 .C(A[2]),
Manar61dce922020-11-10 19:26:28 +0200359 .D(EN)
360 ); // 111
Manar68e03632020-11-09 13:25:13 +0200361endmodule
362
363
364module DEC6x64 (
Manar61dce922020-11-10 19:26:28 +0200365`ifdef USE_POWER_PINS
366 input VPWR,
367 input VGND,
368`endif
Manar68e03632020-11-09 13:25:13 +0200369 input EN,
370 input [5:0] A,
Manar61dce922020-11-10 19:26:28 +0200371 output [63:0] SEL
Manar68e03632020-11-09 13:25:13 +0200372);
373 wire [7:0] SEL0_w ;
Manar8f131792020-11-11 16:38:32 +0200374 wire [2:0] A_buf;
375
Manar61dce922020-11-10 19:26:28 +0200376 DEC3x8 DEC_L0 (
377 `ifdef USE_POWER_PINS
378 .VPWR(VPWR),
379 .VGND(VGND),
380 `endif
Manar8f131792020-11-11 16:38:32 +0200381 .EN(EN),
382 .A(A[5:3]),
383 .SEL(SEL0_w)
384 );
385
386 sky130_fd_sc_hd__clkbuf_16 ABUF[2:0] (
387 `ifdef USE_POWER_PINS
388 .VPWR(VPWR),
389 .VGND(VGND),
390 .VPB(VPWR),
391 .VNB(VGND),
392 `endif
393 .X(A_buf),
394 .A(A[2:0])
395 );
Manar68e03632020-11-09 13:25:13 +0200396
397 generate
398 genvar i;
399 for(i=0; i<8; i=i+1) begin : DEC_L1
Manar61dce922020-11-10 19:26:28 +0200400 DEC3x8 U (
401 `ifdef USE_POWER_PINS
402 .VPWR(VPWR),
403 .VGND(VGND),
404 `endif
Manar8f131792020-11-11 16:38:32 +0200405 .EN(SEL0_w[i]),
406 .A(A_buf),
407 .SEL(SEL[7+8*i: 8*i])
408 );
Manar68e03632020-11-09 13:25:13 +0200409 end
410 endgenerate
411endmodule
412
Manar8f131792020-11-11 16:38:32 +0200413module MUX2x1_32(
414`ifdef USE_POWER_PINS
415 input VPWR,
416 input VGND,
417`endif
418 input [31:0] A0, A1,
419 input [0:0] S,
420 output [31:0] X
421);
422 sky130_fd_sc_hd__mux2_1 MUX[31:0] (
423 `ifdef USE_POWER_PINS
424 .VPWR(VPWR),
425 .VGND(VGND),
426 .VPB(VPWR),
427 .VNB(VGND),
428 `endif
429 .A0(A0),
430 .A1(A1),
431 .S(S[0]),
432 .X(X)
433 );
434
435endmodule
436
Manar68e03632020-11-09 13:25:13 +0200437module MUX4x1_32(
Manar61dce922020-11-10 19:26:28 +0200438`ifdef USE_POWER_PINS
439 input VPWR,
440 input VGND,
441`endif
Manar68e03632020-11-09 13:25:13 +0200442 input [31:0] A0, A1, A2, A3,
443 input [1:0] S,
Manar61dce922020-11-10 19:26:28 +0200444 output [31:0] X
Manar68e03632020-11-09 13:25:13 +0200445);
Manar8f131792020-11-11 16:38:32 +0200446 sky130_fd_sc_hd__mux4_1 MUX[31:0] (
Manar61dce922020-11-10 19:26:28 +0200447 `ifdef USE_POWER_PINS
448 .VPWR(VPWR),
449 .VGND(VGND),
450 .VPB(VPWR),
451 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +0200452 `endif
453 .A0(A0),
454 .A1(A1),
455 .A2(A2),
456 .A3(A3),
457 .S0(S[0]),
458 .S1(S[1]),
459 .X(X)
460 );
461endmodule
462
463module PASS (
464`ifdef USE_POWER_PINS
465 input VPWR,
466 input VGND,
467`endif
468 input [31:0] A,
469 output [31:0] X
470);
471 assign X = A;
Manar68e03632020-11-09 13:25:13 +0200472endmodule
473
474module SRAM64x32(
Manar61dce922020-11-10 19:26:28 +0200475`ifdef USE_POWER_PINS
476 input VPWR,
477 input VGND,
478`endif
Manar68e03632020-11-09 13:25:13 +0200479 input CLK,
480 input [3:0] WE,
481 input EN,
482 input [31:0] Di,
483 output [31:0] Do,
Manar61dce922020-11-10 19:26:28 +0200484 input [5:0] A
Manar68e03632020-11-09 13:25:13 +0200485);
486
487 wire [63:0] SEL;
488 wire [31:0] Do_pre;
489 wire [31:0] Di_buf;
490 wire CLK_buf;
491 wire [3:0] WE_buf;
492
Manar8f131792020-11-11 16:38:32 +0200493 sky130_fd_sc_hd__clkbuf_16 CLKBUF (
Manar61dce922020-11-10 19:26:28 +0200494 `ifdef USE_POWER_PINS
495 .VPWR(VPWR),
496 .VGND(VGND),
497 .VPB(VPWR),
498 .VNB(VGND),
499 `endif
500 .X(CLK_buf),
501 .A(CLK)
502 );
Manar8f131792020-11-11 16:38:32 +0200503
504 sky130_fd_sc_hd__clkbuf_16 WEBUF[3:0] (
Manar61dce922020-11-10 19:26:28 +0200505 `ifdef USE_POWER_PINS
506 .VPWR(VPWR),
507 .VGND(VGND),
508 .VPB(VPWR),
509 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +0200510 `endif
Manar61dce922020-11-10 19:26:28 +0200511 .X(WE_buf),
512 .A(WE)
513 );
514
Manar8f131792020-11-11 16:38:32 +0200515 sky130_fd_sc_hd__clkbuf_16 DIBUF[31:0] (
Manar61dce922020-11-10 19:26:28 +0200516 `ifdef USE_POWER_PINS
517 .VPWR(VPWR),
518 .VGND(VGND),
519 .VPB(VPWR),
520 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +0200521 `endif
Manar61dce922020-11-10 19:26:28 +0200522 .X(Di_buf),
523 .A(Di)
524 );
525
526 DEC6x64 DEC (
527 `ifdef USE_POWER_PINS
528 .VPWR(VPWR),
529 .VGND(VGND),
530 `endif
531 .EN(EN),
532 .A(A),
533 .SEL(SEL)
534 );
Manar68e03632020-11-09 13:25:13 +0200535
536 generate
537 genvar i;
538 for (i=0; i< 64; i=i+1) begin : WORD
Manar61dce922020-11-10 19:26:28 +0200539 WORD32 W (
540 `ifdef USE_POWER_PINS
541 .VPWR(VPWR),
542 .VGND(VGND),
543 `endif
544 .CLK(CLK_buf),
545 .WE(WE_buf),
546 .SEL(SEL[i]),
547 .Di(Di_buf),
548 .Do(Do_pre)
549 );
Manar68e03632020-11-09 13:25:13 +0200550 end
551 endgenerate
552
553 // Ensure that the Do_pre lines are not floating when EN = 0
Manar8f131792020-11-11 16:38:32 +0200554 wire lo;
555 wire float_buf_en;
556 sky130_fd_sc_hd__clkbuf_4 FBUFENBUF(
Manar61dce922020-11-10 19:26:28 +0200557 `ifdef USE_POWER_PINS
558 .VPWR(VPWR),
559 .VGND(VGND),
560 .VPB(VPWR),
561 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +0200562 `endif
563 .X(float_buf_en),
564 .A(EN)
565 );
566
567 sky130_fd_sc_hd__conb_1 TIE (
568 `ifdef USE_POWER_PINS
569 .VPWR(VPWR),
570 .VGND(VGND),
571 .VPB(VPWR),
572 .VNB(VGND),
573 `endif
574 .LO(lo),
575 .HI()
576 );
577
578 sky130_fd_sc_hd__ebufn_4 FLOATBUF[31:0] (
579 `ifdef USE_POWER_PINS
580 .VPWR(VPWR),
581 .VGND(VGND),
582 .VPB(VPWR),
583 .VNB(VGND),
584 `endif
585 .A( lo ),
Manar61dce922020-11-10 19:26:28 +0200586 .Z(Do_pre),
Manar8f131792020-11-11 16:38:32 +0200587 .TE_B(float_buf_en)
Manar61dce922020-11-10 19:26:28 +0200588 );
Manar68e03632020-11-09 13:25:13 +0200589
590 generate
591 //genvar i;
592 for(i=0; i<32; i=i+1) begin : OUT
Manar61dce922020-11-10 19:26:28 +0200593 sky130_fd_sc_hd__dfxtp_1 FF (
Manar8f131792020-11-11 16:38:32 +0200594 `ifdef USE_POWER_PINS
Manar61dce922020-11-10 19:26:28 +0200595 .VPWR(VPWR),
596 .VGND(VGND),
597 .VPB(VPWR),
598 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +0200599 `endif
Manar61dce922020-11-10 19:26:28 +0200600 .D(Do_pre[i]),
601 .Q(Do[i]),
602 .CLK(CLK)
603 );
Manar68e03632020-11-09 13:25:13 +0200604 end
605 endgenerate
606
607endmodule
608
Manar8f131792020-11-11 16:38:32 +0200609module DFFRAM_COL4
610(
611`ifdef USE_POWER_PINS
612 VPWR,
613 VGND,
614`endif
615 CLK,
616 WE,
617 EN,
618 Di,
619 Do,
620 A
621);
622
623 input CLK;
624 input [3:0] WE;
625 input EN;
626 input [31:0] Di;
627 output [31:0] Do;
628 input [7:0] A;
629
630`ifdef USE_POWER_PINS
631 input VPWR;
632 input VGND;
633`endif
634
635 wire [31:0] Di_buf;
636 wire [31:0] Do_pre;
637 wire CLK_buf;
638 wire [3:0] WE_buf;
639 wire [5:3] A_buf;
640
641 wire [31:0] Do_B_0_0;
642 wire [31:0] Do_B_0_1;
643 wire [31:0] Do_B_0_2;
644 wire [31:0] Do_B_0_3;
645
646 wire [3:0] row_sel;
647
648 sky130_fd_sc_hd__clkbuf_8 CLKBUF (
649 `ifdef USE_POWER_PINS
650 .VPWR(VPWR),
651 .VGND(VGND),
652 .VPB(VPWR),
653 .VNB(VGND),
654 `endif
655 .X(CLK_buf),
656 .A(CLK)
657 );
658
659 sky130_fd_sc_hd__clkbuf_8 WEBUF[3:0] (
660 `ifdef USE_POWER_PINS
661 .VPWR(VPWR),
662 .VGND(VGND),
663 .VPB(VPWR),
664 .VNB(VGND),
665 `endif
666 .X(WE_buf),
667 .A(WE)
668 );
669
670 sky130_fd_sc_hd__clkbuf_8 DIBUF[31:0] (
671 `ifdef USE_POWER_PINS
672 .VPWR(VPWR),
673 .VGND(VGND),
674 .VPB(VPWR),
675 .VNB(VGND),
676 `endif
677 .X(Di_buf),
678 .A(Di)
679 );
680
681 sky130_fd_sc_hd__clkbuf_16 ABUF[2:0] (
682 `ifdef USE_POWER_PINS
683 .VPWR(VPWR),
684 .VGND(VGND),
685 .VPB(VPWR),
686 .VNB(VGND),
687 `endif
688 .X(A_buf),
689 .A(A[5:3])
690 );
691
692 DEC2x4 DEC (
693 `ifdef USE_POWER_PINS
694 .VPWR(VPWR),
695 .VGND(VGND),
696 `endif
697 .EN(EN),
698 .A(A[7:6]),
699 .SEL(row_sel)
700 );
701
702 SRAM64x32 B_0_0 (
703 `ifdef USE_POWER_PINS
704 .VPWR(VPWR),
705 .VGND(VGND),
706 `endif
707 .CLK(CLK_buf),
708 .WE(WE_buf),
709 .EN(row_sel[0]),
710 .Di(Di_buf),
711 .Do(Do_B_0_0),
712 .A({A_buf,A[2:0]})
713 );
714
715 SRAM64x32 B_0_1 (
716 `ifdef USE_POWER_PINS
717 .VPWR(VPWR),
718 .VGND(VGND),
719 `endif
720 .CLK(CLK_buf),
721 .WE(WE_buf),
722 .EN(row_sel[1]),
723 .Di(Di_buf),
724 .Do(Do_B_0_1),
725 .A({A_buf,A[2:0]})
726 );
727
728 SRAM64x32 B_0_2 (
729 `ifdef USE_POWER_PINS
730 .VPWR(VPWR),
731 .VGND(VGND),
732 `endif
733 .CLK(CLK_buf),
734 .WE(WE_buf),
735 .EN(row_sel[2]),
736 .Di(Di_buf),
737 .Do(Do_B_0_2),
738 .A({A_buf,A[2:0]})
739 );
740
741 SRAM64x32 B_0_3 (
742 `ifdef USE_POWER_PINS
743 .VPWR(VPWR),
744 .VGND(VGND),
745 `endif
746 .CLK(CLK_buf),
747 .WE(WE_buf),
748 .EN(row_sel[3]),
749 .Di(Di_buf),
750 .Do(Do_B_0_3),
751 .A({A_buf,A[2:0]})
752 );
753
754 MUX4x1_32 MUX (
755 `ifdef USE_POWER_PINS
756 .VPWR(VPWR),
757 .VGND(VGND),
758 `endif
759 .A0(Do_B_0_0),
760 .A1(Do_B_0_1),
761 .A2(Do_B_0_2),
762 .A3(Do_B_0_3),
763 .S(A[7:6]),
764 .X(Do)
765 );
766
767endmodule
768