blob: 712a2531af81507d6cc53514ee01326af6b3a294 [file] [log] [blame]
Matt Venn08cd6eb2020-11-16 12:01:14 +01001`default_nettype none
Manar68e03632020-11-09 13:25:13 +02002/*
Manar8f131792020-11-11 16:38:32 +02003 Building blocks for DFF based RAM compiler for SKY130A
4 BYTE : 8 memory cells used as a building block for WORD module
Manar68e03632020-11-09 13:25:13 +02005 WORD : 32-bit memory word with select and byte-level WE
Manar8f131792020-11-11 16:38:32 +02006 DEC6x64 : 2x4 Binary Decoder
Manar68e03632020-11-09 13:25:13 +02007 DEC6x64 : 6x64 Binary decoder
Manar8f131792020-11-11 16:38:32 +02008 MUX4x1_32 : 32-bit 4x1 MUX
9 MUX2x1_32 : 32-bit 2x1 MUX
10 SRAM64x32 : Tri-state buffers based 64x32 DFF RAM
11 DFFRAM_COL4 : A single column of 4 SRAM64x32 blocks using 4x1 multiplexors
12*/
13/*
14 Author: Mohamed Shalan (mshalan@aucegypt.edu)
Manar68e03632020-11-09 13:25:13 +020015*/
16
17module BYTE (
Manar61dce922020-11-10 19:26:28 +020018`ifdef USE_POWER_PINS
19 input VPWR,
20 input VGND,
21`endif
Manar68e03632020-11-09 13:25:13 +020022 input CLK,
23 input WE,
24 input SEL,
25 input [7:0] Di,
Manar61dce922020-11-10 19:26:28 +020026 output [7:0] Do
Manar68e03632020-11-09 13:25:13 +020027);
28
29 wire [7:0] q_wire;
30 wire we_wire;
31 wire SEL_B;
32 wire GCLK;
33
Manar8f131792020-11-11 16:38:32 +020034 sky130_fd_sc_hd__inv_1 INV(
35 `ifdef USE_POWER_PINS
Manar61dce922020-11-10 19:26:28 +020036 .VPWR(VPWR),
37 .VGND(VGND),
38 .VPB(VPWR),
39 .VNB(VGND),
40 `endif
41 .Y(SEL_B),
42 .A(SEL)
43 );
Manar8f131792020-11-11 16:38:32 +020044
Manar61dce922020-11-10 19:26:28 +020045 sky130_fd_sc_hd__and2_1 CGAND(
46 `ifdef USE_POWER_PINS
47 .VPWR(VPWR),
48 .VGND(VGND),
49 .VPB(VPWR),
50 .VNB(VGND),
51 `endif
52 .A(SEL),
53 .B(WE),
54 .X(we_wire)
55 );
56
57 sky130_fd_sc_hd__dlclkp_1 CG(
58 `ifdef USE_POWER_PINS
59 .VPWR(VPWR),
60 .VGND(VGND),
61 .VPB(VPWR),
62 .VNB(VGND),
63 `endif
64 .CLK(CLK),
65 .GCLK(GCLK),
Manar8f131792020-11-11 16:38:32 +020066 .GATE(we_wire)
Manar61dce922020-11-10 19:26:28 +020067 );
Manar68e03632020-11-09 13:25:13 +020068
69 generate
70 genvar i;
71 for(i=0; i<8; i=i+1) begin : BIT
Manar8f131792020-11-11 16:38:32 +020072 sky130_fd_sc_hd__dfxtp_1 FF (
Manar61dce922020-11-10 19:26:28 +020073 `ifdef USE_POWER_PINS
74 .VPWR(VPWR),
75 .VGND(VGND),
76 .VPB(VPWR),
77 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +020078 `endif
Manar61dce922020-11-10 19:26:28 +020079 .D(Di[i]),
80 .Q(q_wire[i]),
81 .CLK(GCLK)
82 );
Manar8f131792020-11-11 16:38:32 +020083
Manar61dce922020-11-10 19:26:28 +020084 sky130_fd_sc_hd__ebufn_2 OBUF (
85 `ifdef USE_POWER_PINS
86 .VPWR(VPWR),
87 .VGND(VGND),
88 .VPB(VPWR),
89 .VNB(VGND),
90 `endif
91 .A(q_wire[i]),
92 .Z(Do[i]),
93 .TE_B(SEL_B)
94 );
Manar8f131792020-11-11 16:38:32 +020095
Manar68e03632020-11-09 13:25:13 +020096 end
97 endgenerate
98
99endmodule
100
101
102module WORD32 (
Manar61dce922020-11-10 19:26:28 +0200103`ifdef USE_POWER_PINS
104 input VPWR,
105 input VGND,
106`endif
Manar68e03632020-11-09 13:25:13 +0200107 input CLK,
108 input [3:0] WE,
109 input SEL,
110 input [31:0] Di,
Manar61dce922020-11-10 19:26:28 +0200111 output [31:0] Do
Manar68e03632020-11-09 13:25:13 +0200112);
113
Manar8f131792020-11-11 16:38:32 +0200114 BYTE B0 (
Manar61dce922020-11-10 19:26:28 +0200115 `ifdef USE_POWER_PINS
116 .VPWR(VPWR),
117 .VGND(VGND),
Manar8f131792020-11-11 16:38:32 +0200118 `endif
119 .CLK(CLK), .WE(WE[0]), .SEL(SEL), .Di(Di[7:0]), .Do(Do[7:0]) );
120
Manar61dce922020-11-10 19:26:28 +0200121 BYTE B1 (
122 `ifdef USE_POWER_PINS
Manar8f131792020-11-11 16:38:32 +0200123 .VPWR(VPWR),
Manar61dce922020-11-10 19:26:28 +0200124 .VGND(VGND),
125 `endif
Manar8f131792020-11-11 16:38:32 +0200126 .CLK(CLK), .WE(WE[1]), .SEL(SEL), .Di(Di[15:8]), .Do(Do[15:8]) );
127
Manar61dce922020-11-10 19:26:28 +0200128 BYTE B2 (
129 `ifdef USE_POWER_PINS
130 .VPWR(VPWR),
131 .VGND(VGND),
132 `endif
Manar8f131792020-11-11 16:38:32 +0200133 .CLK(CLK), .WE(WE[2]), .SEL(SEL), .Di(Di[23:16]), .Do(Do[23:16]) );
134
Manar61dce922020-11-10 19:26:28 +0200135 BYTE B3 (
136 `ifdef USE_POWER_PINS
137 .VPWR(VPWR),
138 .VGND(VGND),
139 `endif
Manar8f131792020-11-11 16:38:32 +0200140 .CLK(CLK), .WE(WE[3]), .SEL(SEL), .Di(Di[31:24]), .Do(Do[31:24]) );
Manar68e03632020-11-09 13:25:13 +0200141
142endmodule
143
Manar8f131792020-11-11 16:38:32 +0200144module DEC1x2 (
145`ifdef USE_POWER_PINS
146 input VPWR,
147 input VGND,
148`endif
149 input EN,
150 input [0:0] A,
151 output [1:0] SEL
152);
153 sky130_fd_sc_hd__and2b_2 AND1 (
154 `ifdef USE_POWER_PINS
155 .VPWR(VPWR),
156 .VGND(VGND),
157 .VPB(VPWR),
158 .VNB(VGND),
159 `endif
160 .X(SEL[0]),
161 .A_N(A),
162 .B(EN)
163 );
164
165 sky130_fd_sc_hd__and2_2 AND3 (
166 `ifdef USE_POWER_PINS
167 .VPWR(VPWR),
168 .VGND(VGND),
169 .VPB(VPWR),
170 .VNB(VGND),
171 `endif
172 .X(SEL[1]),
173 .A(A),
174 .B(A[0])
175 );
176
177endmodule
178
Manar68e03632020-11-09 13:25:13 +0200179module DEC2x4 (
Manar61dce922020-11-10 19:26:28 +0200180`ifdef USE_POWER_PINS
181 input VPWR,
182 input VGND,
183`endif
Manar68e03632020-11-09 13:25:13 +0200184 input EN,
185 input [1:0] A,
Manar61dce922020-11-10 19:26:28 +0200186 output [3:0] SEL
Manar68e03632020-11-09 13:25:13 +0200187);
Manar8f131792020-11-11 16:38:32 +0200188 sky130_fd_sc_hd__nor3b_4 AND0 (
189 `ifdef USE_POWER_PINS
Manar61dce922020-11-10 19:26:28 +0200190 .VPWR(VPWR),
191 .VGND(VGND),
192 .VPB(VPWR),
193 .VNB(VGND),
194 `endif
195 .Y(SEL[0]),
196 .A(A[0]),
197 .B(A[1]),
198 .C_N(EN)
199 );
Manar8f131792020-11-11 16:38:32 +0200200
201 sky130_fd_sc_hd__and3b_4 AND1 (
202 `ifdef USE_POWER_PINS
Manar61dce922020-11-10 19:26:28 +0200203 .VPWR(VPWR),
204 .VGND(VGND),
205 .VPB(VPWR),
206 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +0200207 `endif
Manar61dce922020-11-10 19:26:28 +0200208 .X(SEL[1]),
209 .A_N(A[1]),
210 .B(A[0]),
211 .C(EN)
212 );
Manar8f131792020-11-11 16:38:32 +0200213
214 sky130_fd_sc_hd__and3b_4 AND2 (
215 `ifdef USE_POWER_PINS
Manar61dce922020-11-10 19:26:28 +0200216 .VPWR(VPWR),
217 .VGND(VGND),
218 .VPB(VPWR),
219 .VNB(VGND),
220 `endif
221 .X(SEL[2]),
222 .A_N(A[0]),
223 .B(A[1]),
Manar8f131792020-11-11 16:38:32 +0200224 .C(EN)
Manar61dce922020-11-10 19:26:28 +0200225 );
Manar8f131792020-11-11 16:38:32 +0200226
227 sky130_fd_sc_hd__and3_4 AND3 (
228 `ifdef USE_POWER_PINS
Manar61dce922020-11-10 19:26:28 +0200229 .VPWR(VPWR),
230 .VGND(VGND),
231 .VPB(VPWR),
232 .VNB(VGND),
233 `endif
234 .X(SEL[3]),
Manar8f131792020-11-11 16:38:32 +0200235 .A(A[1]),
Manar61dce922020-11-10 19:26:28 +0200236 .B(A[0]),
237 .C(EN)
238 );
Manar68e03632020-11-09 13:25:13 +0200239
240endmodule
241
242module DEC3x8 (
Manar61dce922020-11-10 19:26:28 +0200243`ifdef USE_POWER_PINS
244 input VPWR,
245 input VGND,
246`endif
Manar68e03632020-11-09 13:25:13 +0200247 input EN,
248 input [2:0] A,
Manar61dce922020-11-10 19:26:28 +0200249 output [7:0] SEL
Manar68e03632020-11-09 13:25:13 +0200250);
Manar8f131792020-11-11 16:38:32 +0200251 sky130_fd_sc_hd__nor4b_2 AND0 (
Manar61dce922020-11-10 19:26:28 +0200252 `ifdef USE_POWER_PINS
253 .VPWR(VPWR),
254 .VGND(VGND),
255 .VPB(VPWR),
256 .VNB(VGND),
257 `endif
258 .Y(SEL[0]),
259 .A(A[0]),
260 .B(A[1]),
Manar8f131792020-11-11 16:38:32 +0200261 .C(A[2]),
Manar61dce922020-11-10 19:26:28 +0200262 .D_N(EN)
263 ); // 000
264
265 sky130_fd_sc_hd__and4bb_2 AND1 (
266 `ifdef USE_POWER_PINS
267 .VPWR(VPWR),
268 .VGND(VGND),
269 .VPB(VPWR),
270 .VNB(VGND),
271 `endif
272 .X(SEL[1]),
273 .A_N(A[2]),
274 .B_N(A[1]),
275 .C(A[0]),
Manar8f131792020-11-11 16:38:32 +0200276 .D(EN)
Manar61dce922020-11-10 19:26:28 +0200277 ); // 001
278
279 sky130_fd_sc_hd__and4bb_2 AND2 (
280 `ifdef USE_POWER_PINS
281 .VPWR(VPWR),
282 .VGND(VGND),
283 .VPB(VPWR),
284 .VNB(VGND),
285 `endif
286 .X(SEL[2]),
287 .A_N(A[2]),
288 .B_N(A[0]),
289 .C(A[1]),
290 .D(EN)
291 ); // 010
292
Manar8f131792020-11-11 16:38:32 +0200293 sky130_fd_sc_hd__and4b_2 AND3 (
Manar61dce922020-11-10 19:26:28 +0200294 `ifdef USE_POWER_PINS
295 .VPWR(VPWR),
296 .VGND(VGND),
297 .VPB(VPWR),
298 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +0200299 `endif
Manar61dce922020-11-10 19:26:28 +0200300 .X(SEL[3]),
301 .A_N(A[2]),
302 .B(A[1]),
303 .C(A[0]),
304 .D(EN)
305 ); // 011
Manar8f131792020-11-11 16:38:32 +0200306
307 sky130_fd_sc_hd__and4bb_2 AND4 (
Manar61dce922020-11-10 19:26:28 +0200308 `ifdef USE_POWER_PINS
309 .VPWR(VPWR),
310 .VGND(VGND),
311 .VPB(VPWR),
312 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +0200313 `endif
Manar61dce922020-11-10 19:26:28 +0200314 .X(SEL[4]),
315 .A_N(A[0]),
316 .B_N(A[1]),
317 .C(A[2]),
318 .D(EN)
319 ); // 100
Manar8f131792020-11-11 16:38:32 +0200320
321 sky130_fd_sc_hd__and4b_2 AND5 (
322 `ifdef USE_POWER_PINS
Manar61dce922020-11-10 19:26:28 +0200323 .VPWR(VPWR),
324 .VGND(VGND),
325 .VPB(VPWR),
326 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +0200327 `endif
Manar61dce922020-11-10 19:26:28 +0200328 .X(SEL[5]),
329 .A_N(A[1]),
330 .B(A[0]),
331 .C(A[2]),
Manar8f131792020-11-11 16:38:32 +0200332 .D(EN)
Manar61dce922020-11-10 19:26:28 +0200333 ); // 101
Manar8f131792020-11-11 16:38:32 +0200334
335 sky130_fd_sc_hd__and4b_2 AND6 (
336 `ifdef USE_POWER_PINS
Manar61dce922020-11-10 19:26:28 +0200337 .VPWR(VPWR),
338 .VGND(VGND),
339 .VPB(VPWR),
340 .VNB(VGND),
341 `endif
342 .X(SEL[6]),
343 .A_N(A[0]),
Manar8f131792020-11-11 16:38:32 +0200344 .B(A[1]),
Manar61dce922020-11-10 19:26:28 +0200345 .C(A[2]),
Manar8f131792020-11-11 16:38:32 +0200346 .D(EN)
Manar61dce922020-11-10 19:26:28 +0200347 ); // 110
Manar8f131792020-11-11 16:38:32 +0200348
349 sky130_fd_sc_hd__and4_2 AND7 (
Manar61dce922020-11-10 19:26:28 +0200350 `ifdef USE_POWER_PINS
351 .VPWR(VPWR),
352 .VGND(VGND),
353 .VPB(VPWR),
354 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +0200355 `endif
Manar61dce922020-11-10 19:26:28 +0200356 .X(SEL[7]),
357 .A(A[0]),
358 .B(A[1]),
Manar8f131792020-11-11 16:38:32 +0200359 .C(A[2]),
Manar61dce922020-11-10 19:26:28 +0200360 .D(EN)
361 ); // 111
Manar68e03632020-11-09 13:25:13 +0200362endmodule
363
364
365module DEC6x64 (
Manar61dce922020-11-10 19:26:28 +0200366`ifdef USE_POWER_PINS
367 input VPWR,
368 input VGND,
369`endif
Manar68e03632020-11-09 13:25:13 +0200370 input EN,
371 input [5:0] A,
Manar61dce922020-11-10 19:26:28 +0200372 output [63:0] SEL
Manar68e03632020-11-09 13:25:13 +0200373);
374 wire [7:0] SEL0_w ;
Manar8f131792020-11-11 16:38:32 +0200375 wire [2:0] A_buf;
376
Manar61dce922020-11-10 19:26:28 +0200377 DEC3x8 DEC_L0 (
378 `ifdef USE_POWER_PINS
379 .VPWR(VPWR),
380 .VGND(VGND),
381 `endif
Manar8f131792020-11-11 16:38:32 +0200382 .EN(EN),
383 .A(A[5:3]),
384 .SEL(SEL0_w)
385 );
386
387 sky130_fd_sc_hd__clkbuf_16 ABUF[2:0] (
388 `ifdef USE_POWER_PINS
389 .VPWR(VPWR),
390 .VGND(VGND),
391 .VPB(VPWR),
392 .VNB(VGND),
393 `endif
394 .X(A_buf),
395 .A(A[2:0])
396 );
Manar68e03632020-11-09 13:25:13 +0200397
398 generate
399 genvar i;
400 for(i=0; i<8; i=i+1) begin : DEC_L1
Manar61dce922020-11-10 19:26:28 +0200401 DEC3x8 U (
402 `ifdef USE_POWER_PINS
403 .VPWR(VPWR),
404 .VGND(VGND),
405 `endif
Manar8f131792020-11-11 16:38:32 +0200406 .EN(SEL0_w[i]),
407 .A(A_buf),
408 .SEL(SEL[7+8*i: 8*i])
409 );
Manar68e03632020-11-09 13:25:13 +0200410 end
411 endgenerate
412endmodule
413
Manar8f131792020-11-11 16:38:32 +0200414module MUX2x1_32(
415`ifdef USE_POWER_PINS
416 input VPWR,
417 input VGND,
418`endif
419 input [31:0] A0, A1,
420 input [0:0] S,
421 output [31:0] X
422);
423 sky130_fd_sc_hd__mux2_1 MUX[31:0] (
424 `ifdef USE_POWER_PINS
425 .VPWR(VPWR),
426 .VGND(VGND),
427 .VPB(VPWR),
428 .VNB(VGND),
429 `endif
430 .A0(A0),
431 .A1(A1),
432 .S(S[0]),
433 .X(X)
434 );
435
436endmodule
437
Manar68e03632020-11-09 13:25:13 +0200438module MUX4x1_32(
Manar61dce922020-11-10 19:26:28 +0200439`ifdef USE_POWER_PINS
440 input VPWR,
441 input VGND,
442`endif
Manar68e03632020-11-09 13:25:13 +0200443 input [31:0] A0, A1, A2, A3,
444 input [1:0] S,
Manar61dce922020-11-10 19:26:28 +0200445 output [31:0] X
Manar68e03632020-11-09 13:25:13 +0200446);
Manar8f131792020-11-11 16:38:32 +0200447 sky130_fd_sc_hd__mux4_1 MUX[31:0] (
Manar61dce922020-11-10 19:26:28 +0200448 `ifdef USE_POWER_PINS
449 .VPWR(VPWR),
450 .VGND(VGND),
451 .VPB(VPWR),
452 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +0200453 `endif
454 .A0(A0),
455 .A1(A1),
456 .A2(A2),
457 .A3(A3),
458 .S0(S[0]),
459 .S1(S[1]),
460 .X(X)
461 );
462endmodule
463
464module PASS (
465`ifdef USE_POWER_PINS
466 input VPWR,
467 input VGND,
468`endif
469 input [31:0] A,
470 output [31:0] X
471);
472 assign X = A;
Manar68e03632020-11-09 13:25:13 +0200473endmodule
474
475module SRAM64x32(
Manar61dce922020-11-10 19:26:28 +0200476`ifdef USE_POWER_PINS
477 input VPWR,
478 input VGND,
479`endif
Manar68e03632020-11-09 13:25:13 +0200480 input CLK,
481 input [3:0] WE,
482 input EN,
483 input [31:0] Di,
484 output [31:0] Do,
Manar61dce922020-11-10 19:26:28 +0200485 input [5:0] A
Manar68e03632020-11-09 13:25:13 +0200486);
487
488 wire [63:0] SEL;
489 wire [31:0] Do_pre;
490 wire [31:0] Di_buf;
491 wire CLK_buf;
492 wire [3:0] WE_buf;
493
Manar8f131792020-11-11 16:38:32 +0200494 sky130_fd_sc_hd__clkbuf_16 CLKBUF (
Manar61dce922020-11-10 19:26:28 +0200495 `ifdef USE_POWER_PINS
496 .VPWR(VPWR),
497 .VGND(VGND),
498 .VPB(VPWR),
499 .VNB(VGND),
500 `endif
501 .X(CLK_buf),
502 .A(CLK)
503 );
Manar8f131792020-11-11 16:38:32 +0200504
505 sky130_fd_sc_hd__clkbuf_16 WEBUF[3:0] (
Manar61dce922020-11-10 19:26:28 +0200506 `ifdef USE_POWER_PINS
507 .VPWR(VPWR),
508 .VGND(VGND),
509 .VPB(VPWR),
510 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +0200511 `endif
Manar61dce922020-11-10 19:26:28 +0200512 .X(WE_buf),
513 .A(WE)
514 );
515
Manar8f131792020-11-11 16:38:32 +0200516 sky130_fd_sc_hd__clkbuf_16 DIBUF[31:0] (
Manar61dce922020-11-10 19:26:28 +0200517 `ifdef USE_POWER_PINS
518 .VPWR(VPWR),
519 .VGND(VGND),
520 .VPB(VPWR),
521 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +0200522 `endif
Manar61dce922020-11-10 19:26:28 +0200523 .X(Di_buf),
524 .A(Di)
525 );
526
527 DEC6x64 DEC (
528 `ifdef USE_POWER_PINS
529 .VPWR(VPWR),
530 .VGND(VGND),
531 `endif
532 .EN(EN),
533 .A(A),
534 .SEL(SEL)
535 );
Manar68e03632020-11-09 13:25:13 +0200536
537 generate
538 genvar i;
539 for (i=0; i< 64; i=i+1) begin : WORD
Manar61dce922020-11-10 19:26:28 +0200540 WORD32 W (
541 `ifdef USE_POWER_PINS
542 .VPWR(VPWR),
543 .VGND(VGND),
544 `endif
545 .CLK(CLK_buf),
546 .WE(WE_buf),
547 .SEL(SEL[i]),
548 .Di(Di_buf),
549 .Do(Do_pre)
550 );
Manar68e03632020-11-09 13:25:13 +0200551 end
552 endgenerate
553
554 // Ensure that the Do_pre lines are not floating when EN = 0
Manar8f131792020-11-11 16:38:32 +0200555 wire lo;
556 wire float_buf_en;
557 sky130_fd_sc_hd__clkbuf_4 FBUFENBUF(
Manar61dce922020-11-10 19:26:28 +0200558 `ifdef USE_POWER_PINS
559 .VPWR(VPWR),
560 .VGND(VGND),
561 .VPB(VPWR),
562 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +0200563 `endif
564 .X(float_buf_en),
565 .A(EN)
566 );
567
568 sky130_fd_sc_hd__conb_1 TIE (
569 `ifdef USE_POWER_PINS
570 .VPWR(VPWR),
571 .VGND(VGND),
572 .VPB(VPWR),
573 .VNB(VGND),
574 `endif
575 .LO(lo),
576 .HI()
577 );
578
579 sky130_fd_sc_hd__ebufn_4 FLOATBUF[31:0] (
580 `ifdef USE_POWER_PINS
581 .VPWR(VPWR),
582 .VGND(VGND),
583 .VPB(VPWR),
584 .VNB(VGND),
585 `endif
586 .A( lo ),
Manar61dce922020-11-10 19:26:28 +0200587 .Z(Do_pre),
Manar8f131792020-11-11 16:38:32 +0200588 .TE_B(float_buf_en)
Manar61dce922020-11-10 19:26:28 +0200589 );
Manar68e03632020-11-09 13:25:13 +0200590
591 generate
592 //genvar i;
593 for(i=0; i<32; i=i+1) begin : OUT
Manar61dce922020-11-10 19:26:28 +0200594 sky130_fd_sc_hd__dfxtp_1 FF (
Manar8f131792020-11-11 16:38:32 +0200595 `ifdef USE_POWER_PINS
Manar61dce922020-11-10 19:26:28 +0200596 .VPWR(VPWR),
597 .VGND(VGND),
598 .VPB(VPWR),
599 .VNB(VGND),
Manar8f131792020-11-11 16:38:32 +0200600 `endif
Manar61dce922020-11-10 19:26:28 +0200601 .D(Do_pre[i]),
602 .Q(Do[i]),
603 .CLK(CLK)
604 );
Manar68e03632020-11-09 13:25:13 +0200605 end
606 endgenerate
607
608endmodule
609
Manar8f131792020-11-11 16:38:32 +0200610module DFFRAM_COL4
611(
612`ifdef USE_POWER_PINS
613 VPWR,
614 VGND,
615`endif
616 CLK,
617 WE,
618 EN,
619 Di,
620 Do,
621 A
622);
623
624 input CLK;
625 input [3:0] WE;
626 input EN;
627 input [31:0] Di;
628 output [31:0] Do;
629 input [7:0] A;
630
631`ifdef USE_POWER_PINS
632 input VPWR;
633 input VGND;
634`endif
635
636 wire [31:0] Di_buf;
637 wire [31:0] Do_pre;
638 wire CLK_buf;
639 wire [3:0] WE_buf;
640 wire [5:3] A_buf;
641
642 wire [31:0] Do_B_0_0;
643 wire [31:0] Do_B_0_1;
644 wire [31:0] Do_B_0_2;
645 wire [31:0] Do_B_0_3;
646
647 wire [3:0] row_sel;
648
649 sky130_fd_sc_hd__clkbuf_8 CLKBUF (
650 `ifdef USE_POWER_PINS
651 .VPWR(VPWR),
652 .VGND(VGND),
653 .VPB(VPWR),
654 .VNB(VGND),
655 `endif
656 .X(CLK_buf),
657 .A(CLK)
658 );
659
660 sky130_fd_sc_hd__clkbuf_8 WEBUF[3:0] (
661 `ifdef USE_POWER_PINS
662 .VPWR(VPWR),
663 .VGND(VGND),
664 .VPB(VPWR),
665 .VNB(VGND),
666 `endif
667 .X(WE_buf),
668 .A(WE)
669 );
670
671 sky130_fd_sc_hd__clkbuf_8 DIBUF[31:0] (
672 `ifdef USE_POWER_PINS
673 .VPWR(VPWR),
674 .VGND(VGND),
675 .VPB(VPWR),
676 .VNB(VGND),
677 `endif
678 .X(Di_buf),
679 .A(Di)
680 );
681
682 sky130_fd_sc_hd__clkbuf_16 ABUF[2:0] (
683 `ifdef USE_POWER_PINS
684 .VPWR(VPWR),
685 .VGND(VGND),
686 .VPB(VPWR),
687 .VNB(VGND),
688 `endif
689 .X(A_buf),
690 .A(A[5:3])
691 );
692
693 DEC2x4 DEC (
694 `ifdef USE_POWER_PINS
695 .VPWR(VPWR),
696 .VGND(VGND),
697 `endif
698 .EN(EN),
699 .A(A[7:6]),
700 .SEL(row_sel)
701 );
702
703 SRAM64x32 B_0_0 (
704 `ifdef USE_POWER_PINS
705 .VPWR(VPWR),
706 .VGND(VGND),
707 `endif
708 .CLK(CLK_buf),
709 .WE(WE_buf),
710 .EN(row_sel[0]),
711 .Di(Di_buf),
712 .Do(Do_B_0_0),
713 .A({A_buf,A[2:0]})
714 );
715
716 SRAM64x32 B_0_1 (
717 `ifdef USE_POWER_PINS
718 .VPWR(VPWR),
719 .VGND(VGND),
720 `endif
721 .CLK(CLK_buf),
722 .WE(WE_buf),
723 .EN(row_sel[1]),
724 .Di(Di_buf),
725 .Do(Do_B_0_1),
726 .A({A_buf,A[2:0]})
727 );
728
729 SRAM64x32 B_0_2 (
730 `ifdef USE_POWER_PINS
731 .VPWR(VPWR),
732 .VGND(VGND),
733 `endif
734 .CLK(CLK_buf),
735 .WE(WE_buf),
736 .EN(row_sel[2]),
737 .Di(Di_buf),
738 .Do(Do_B_0_2),
739 .A({A_buf,A[2:0]})
740 );
741
742 SRAM64x32 B_0_3 (
743 `ifdef USE_POWER_PINS
744 .VPWR(VPWR),
745 .VGND(VGND),
746 `endif
747 .CLK(CLK_buf),
748 .WE(WE_buf),
749 .EN(row_sel[3]),
750 .Di(Di_buf),
751 .Do(Do_B_0_3),
752 .A({A_buf,A[2:0]})
753 );
754
755 MUX4x1_32 MUX (
756 `ifdef USE_POWER_PINS
757 .VPWR(VPWR),
758 .VGND(VGND),
759 `endif
760 .A0(Do_B_0_0),
761 .A1(Do_B_0_1),
762 .A2(Do_B_0_2),
763 .A3(Do_B_0_3),
764 .S(A[7:6]),
765 .X(Do)
766 );
767
768endmodule
769