@@ -19,11 +19,29 @@ module scan_wrapper_USER_MODULE_ID (
1919 output wire scan_select_out,
2020 output wire latch_enable_out
2121 );
22-
23- assign scan_select_out = scan_select_in;
24- assign latch_enable_out = latch_enable_in;
25- assign clk_out = clk_in;
26- wire clk = clk_in;
22+
23+ // input buffers
24+ // Looking at results from multiple projects the bufferring is a bit
25+ // inconsistent. So instead, we ensure at least clk buf
26+ wire clk;
27+
28+ sky130_fd_sc_hd__clkbuf_2 input_buf_clk (
29+ .A (clk_in),
30+ .X (clk),
31+ .VPWR (1'b1 ),
32+ .VGND (1'b0 )
33+ );
34+
35+ // output buffers
36+ // Same as for input, to try and be more consistent, we make our own
37+ wire data_out_i;
38+
39+ sky130_fd_sc_hd__buf_4 output_buffers[3 :0 ] (
40+ .A ({clk, data_out_i, scan_select_in, latch_enable_in }),
41+ .X ({clk_out, data_out, scan_select_out, latch_enable_out }),
42+ .VPWR (1'b1 ),
43+ .VGND (1'b0 )
44+ );
2745
2846 /*
2947 `ifdef COCOTB
@@ -45,9 +63,16 @@ module scan_wrapper_USER_MODULE_ID (
4563
4664 // scan chain - link all the flops, with data coming from data_in
4765 assign scan_data_in = {scan_data_out[NUM_IOS- 2 :0 ], data_in};
48-
49- // end of the chain is the last scan flop's out
50- assign data_out = scan_data_out[NUM_IOS- 1 ];
66+
67+ // end of the chain is a negedge FF to increase hold margin between blocks
68+ sky130_fd_sc_hd__dfrtn_1 out_flop (
69+ .RESET_B (1'b1 ),
70+ .CLK_N (clk),
71+ .D (scan_data_out[NUM_IOS-1 ]),
72+ .Q (data_out_i),
73+ .VPWR (1'b1 ),
74+ .VGND (1'b0 )
75+ );
5176
5277 // scan flops have a mux on their inputs to choose either data from the user module or the previous flop's output
5378 // https://antmicro-skywater-pdk-docs.readthedocs.io/en/test-submodules-in-rtd/contents/libraries/sky130_fd_sc_ls/cells/sdfxtp/README.html
0 commit comments