blob: 0c6840d7582960605fc13066c35c43facca26f18 [file] [log] [blame]
Matt Venn08cd6eb2020-11-16 12:01:14 +01001`default_nettype none
Tim Edwards53d92182020-10-11 21:47:40 -04002/*----------------------------------------------------------------------*/
3/* Buffers protecting the management region from the user region. */
4/* This mainly consists of tristate buffers that are enabled by a */
5/* "logic 1" output connected to the user's VCCD domain. This ensures */
6/* that the buffer is disabled and the output high-impedence when the */
7/* user 1.8V supply is absent. */
8/*----------------------------------------------------------------------*/
9/* Because there is no tristate buffer with a non-inverted enable, a */
10/* tristate inverter with non-inverted enable is used in series with */
11/* another (normal) inverter. */
12/*----------------------------------------------------------------------*/
13/* For the sake of placement/routing, one conb (logic 1) cell is used */
14/* for every buffer. */
15/*----------------------------------------------------------------------*/
16
17module mgmt_protect (
Ahmed Ghazyfe9c3bb2020-11-26 15:29:48 +020018`ifdef USE_POWER_PINS
Tim Edwards53d92182020-10-11 21:47:40 -040019 inout vccd,
20 inout vssd,
21 inout vccd1,
22 inout vssd1,
Tim Edwards32d05422020-10-19 19:43:52 -040023 inout vccd2,
24 inout vssd2,
Tim Edwards05ad4fc2020-10-19 22:12:33 -040025 inout vdda1,
26 inout vssa1,
27 inout vdda2,
28 inout vssa2,
Ahmed Ghazyfe9c3bb2020-11-26 15:29:48 +020029`endif
Tim Edwards53d92182020-10-11 21:47:40 -040030
31 input caravel_clk,
Tim Edwards7a8cbb12020-10-12 11:32:11 -040032 input caravel_clk2,
Tim Edwards53d92182020-10-11 21:47:40 -040033 input caravel_rstn,
34 input mprj_cyc_o_core,
35 input mprj_stb_o_core,
36 input mprj_we_o_core,
37 input [3:0] mprj_sel_o_core,
38 input [31:0] mprj_adr_o_core,
39 input [31:0] mprj_dat_o_core,
Tim Edwards43e5c602020-11-19 15:59:50 -050040
41 // All signal in/out directions are the reverse of the signal
42 // names at the buffer intrface.
43
44 output [127:0] la_data_in_mprj,
45 input [127:0] la_data_out_mprj,
46 input [127:0] la_oen_mprj,
47
48 input [127:0] la_data_out_core,
49 output [127:0] la_data_in_core,
50 output [127:0] la_oen_core,
Tim Edwards53d92182020-10-11 21:47:40 -040051
52 output user_clock,
Tim Edwards7a8cbb12020-10-12 11:32:11 -040053 output user_clock2,
Tim Edwards53d92182020-10-11 21:47:40 -040054 output user_resetn,
Ahmed Ghazy69663c72020-11-18 20:15:53 +020055 output user_reset,
Tim Edwards53d92182020-10-11 21:47:40 -040056 output mprj_cyc_o_user,
57 output mprj_stb_o_user,
58 output mprj_we_o_user,
59 output [3:0] mprj_sel_o_user,
60 output [31:0] mprj_adr_o_user,
61 output [31:0] mprj_dat_o_user,
Tim Edwards05ad4fc2020-10-19 22:12:33 -040062 output user1_vcc_powergood,
63 output user2_vcc_powergood,
64 output user1_vdd_powergood,
65 output user2_vdd_powergood
Tim Edwards53d92182020-10-11 21:47:40 -040066);
67
Tim Edwards43e5c602020-11-19 15:59:50 -050068 wire [458:0] mprj_logic1;
69 wire mprj2_logic1;
Tim Edwards05ad4fc2020-10-19 22:12:33 -040070
71 wire mprj_vdd_logic1_h;
72 wire mprj2_vdd_logic1_h;
73 wire mprj_vdd_logic1;
74 wire mprj2_vdd_logic1;
75
76 wire user1_vcc_powergood;
77 wire user2_vcc_powergood;
78 wire user1_vdd_powergood;
79 wire user2_vdd_powergood;
Tim Edwards53d92182020-10-11 21:47:40 -040080
Tim Edwards4518c622020-11-19 17:44:25 -050081 wire [127:0] la_data_in_mprj_bar;
82
Tim Edwards43e5c602020-11-19 15:59:50 -050083 sky130_fd_sc_hd__conb_1 mprj_logic_high [458:0] (
Ahmed Ghazy69663c72020-11-18 20:15:53 +020084`ifdef USE_POWER_PINS
Tim Edwards53d92182020-10-11 21:47:40 -040085 .VPWR(vccd1),
86 .VGND(vssd1),
87 .VPB(vccd1),
88 .VNB(vssd1),
Ahmed Ghazy69663c72020-11-18 20:15:53 +020089`endif
Tim Edwards53d92182020-10-11 21:47:40 -040090 .HI(mprj_logic1),
91 .LO()
92 );
93
Tim Edwards32d05422020-10-19 19:43:52 -040094 sky130_fd_sc_hd__conb_1 mprj2_logic_high (
Ahmed Ghazy69663c72020-11-18 20:15:53 +020095`ifdef USE_POWER_PINS
Tim Edwards32d05422020-10-19 19:43:52 -040096 .VPWR(vccd2),
97 .VGND(vssd2),
98 .VPB(vccd2),
99 .VNB(vssd2),
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200100`endif
Tim Edwards32d05422020-10-19 19:43:52 -0400101 .HI(mprj2_logic1),
102 .LO()
103 );
104
Tim Edwards05ad4fc2020-10-19 22:12:33 -0400105 // Logic high in the VDDA (3.3V) domains
106
Tim Edwardsbc035512020-11-23 11:16:08 -0500107 mgmt_protect_hv powergood_check (
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200108`ifdef USE_POWER_PINS
Tim Edwardsbc035512020-11-23 11:16:08 -0500109 .vccd(vccd),
110 .vssd(vssd),
111 .vdda1(vdda1),
112 .vssa1(vssa1),
113 .vdda2(vdda2),
114 .vssa2(vssa2),
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200115`endif
Tim Edwardsbc035512020-11-23 11:16:08 -0500116 .mprj_vdd_logic1(mprj_vdd_logic1),
117 .mprj2_vdd_logic1(mprj2_vdd_logic1)
Tim Edwards05ad4fc2020-10-19 22:12:33 -0400118 );
119
Tim Edwards32d05422020-10-19 19:43:52 -0400120
Tim Edwards43e5c602020-11-19 15:59:50 -0500121 // Buffering from the user side to the management side.
122 // NOTE: This is intended to be better protected, by a full
123 // chain of an lv-to-hv buffer followed by an hv-to-lv buffer.
124 // This serves as a placeholder until that configuration is
125 // checked and characterized. The function below forces the
126 // data input to the management core to be a solid logic 0 when
127 // the user project is powered down.
128
Tim Edwards4518c622020-11-19 17:44:25 -0500129 sky130_fd_sc_hd__nand2_4 user_to_mprj_in_gates [127:0] (
130`ifdef USE_POWER_PINS
131 .VPWR(vccd),
132 .VGND(vssd),
133 .VPB(vccd),
134 .VNB(vssd),
135`endif
136 .Y(la_data_in_mprj_bar),
137 .A(la_data_out_core),
138 .B(mprj_logic1[457:330])
139 );
140
141 sky130_fd_sc_hd__inv_8 user_to_mprj_in_buffers [127:0] (
Tim Edwards43e5c602020-11-19 15:59:50 -0500142`ifdef USE_POWER_PINS
143 .VPWR(vccd),
144 .VGND(vssd),
145 .VPB(vccd),
146 .VNB(vssd),
147`endif
148 .Y(la_data_in_mprj),
Tim Edwards4518c622020-11-19 17:44:25 -0500149 .A(la_data_in_mprj_bar)
Tim Edwards43e5c602020-11-19 15:59:50 -0500150 );
151
152 // The remaining circuitry guards against the management
153 // SoC dumping current into the user project area when
154 // the user project area is powered down.
155
Tim Edwards53d92182020-10-11 21:47:40 -0400156 sky130_fd_sc_hd__einvp_8 mprj_rstn_buf (
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200157`ifdef USE_POWER_PINS
Tim Edwards53d92182020-10-11 21:47:40 -0400158 .VPWR(vccd),
159 .VGND(vssd),
160 .VPB(vccd),
161 .VNB(vssd),
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200162`endif
Tim Edwards53d92182020-10-11 21:47:40 -0400163 .Z(user_resetn),
164 .A(~caravel_rstn),
165 .TE(mprj_logic1[0])
166 );
167
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200168 assign user_reset = ~user_resetn;
169
Tim Edwards53d92182020-10-11 21:47:40 -0400170 sky130_fd_sc_hd__einvp_8 mprj_clk_buf (
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200171`ifdef USE_POWER_PINS
Tim Edwards53d92182020-10-11 21:47:40 -0400172 .VPWR(vccd),
173 .VGND(vssd),
174 .VPB(vccd),
175 .VNB(vssd),
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200176`endif
Tim Edwards53d92182020-10-11 21:47:40 -0400177 .Z(user_clock),
178 .A(~caravel_clk),
179 .TE(mprj_logic1[1])
180 );
181
Tim Edwards7a8cbb12020-10-12 11:32:11 -0400182 sky130_fd_sc_hd__einvp_8 mprj_clk2_buf (
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200183`ifdef USE_POWER_PINS
Tim Edwards7a8cbb12020-10-12 11:32:11 -0400184 .VPWR(vccd),
185 .VGND(vssd),
186 .VPB(vccd),
187 .VNB(vssd),
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200188`endif
Tim Edwards7a8cbb12020-10-12 11:32:11 -0400189 .Z(user_clock2),
190 .A(~caravel_clk2),
191 .TE(mprj_logic1[2])
192 );
193
Tim Edwards53d92182020-10-11 21:47:40 -0400194 sky130_fd_sc_hd__einvp_8 mprj_cyc_buf (
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200195`ifdef USE_POWER_PINS
Tim Edwards53d92182020-10-11 21:47:40 -0400196 .VPWR(vccd),
197 .VGND(vssd),
198 .VPB(vccd),
199 .VNB(vssd),
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200200`endif
Tim Edwards53d92182020-10-11 21:47:40 -0400201 .Z(mprj_cyc_o_user),
202 .A(~mprj_cyc_o_core),
Tim Edwards7a8cbb12020-10-12 11:32:11 -0400203 .TE(mprj_logic1[3])
Tim Edwards53d92182020-10-11 21:47:40 -0400204 );
205
206 sky130_fd_sc_hd__einvp_8 mprj_stb_buf (
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200207`ifdef USE_POWER_PINS
Tim Edwards53d92182020-10-11 21:47:40 -0400208 .VPWR(vccd),
209 .VGND(vssd),
210 .VPB(vccd),
211 .VNB(vssd),
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200212`endif
Tim Edwards53d92182020-10-11 21:47:40 -0400213 .Z(mprj_stb_o_user),
214 .A(~mprj_stb_o_core),
Tim Edwards7a8cbb12020-10-12 11:32:11 -0400215 .TE(mprj_logic1[4])
Tim Edwards53d92182020-10-11 21:47:40 -0400216 );
217
218 sky130_fd_sc_hd__einvp_8 mprj_we_buf (
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200219`ifdef USE_POWER_PINS
Tim Edwards53d92182020-10-11 21:47:40 -0400220 .VPWR(vccd),
221 .VGND(vssd),
222 .VPB(vccd),
223 .VNB(vssd),
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200224`endif
Tim Edwards53d92182020-10-11 21:47:40 -0400225 .Z(mprj_we_o_user),
226 .A(~mprj_we_o_core),
Tim Edwards7a8cbb12020-10-12 11:32:11 -0400227 .TE(mprj_logic1[5])
Tim Edwards53d92182020-10-11 21:47:40 -0400228 );
229
230 sky130_fd_sc_hd__einvp_8 mprj_sel_buf [3:0] (
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200231`ifdef USE_POWER_PINS
Tim Edwards53d92182020-10-11 21:47:40 -0400232 .VPWR(vccd),
233 .VGND(vssd),
234 .VPB(vccd),
235 .VNB(vssd),
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200236`endif
Tim Edwards53d92182020-10-11 21:47:40 -0400237 .Z(mprj_sel_o_user),
238 .A(~mprj_sel_o_core),
Tim Edwards7a8cbb12020-10-12 11:32:11 -0400239 .TE(mprj_logic1[9:6])
Tim Edwards53d92182020-10-11 21:47:40 -0400240 );
241
242 sky130_fd_sc_hd__einvp_8 mprj_adr_buf [31:0] (
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200243`ifdef USE_POWER_PINS
Tim Edwards53d92182020-10-11 21:47:40 -0400244 .VPWR(vccd),
245 .VGND(vssd),
246 .VPB(vccd),
247 .VNB(vssd),
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200248`endif
Tim Edwards53d92182020-10-11 21:47:40 -0400249 .Z(mprj_adr_o_user),
250 .A(~mprj_adr_o_core),
Tim Edwards7a8cbb12020-10-12 11:32:11 -0400251 .TE(mprj_logic1[41:10])
Tim Edwards53d92182020-10-11 21:47:40 -0400252 );
253
254 sky130_fd_sc_hd__einvp_8 mprj_dat_buf [31:0] (
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200255`ifdef USE_POWER_PINS
Tim Edwards53d92182020-10-11 21:47:40 -0400256 .VPWR(vccd),
257 .VGND(vssd),
258 .VPB(vccd),
259 .VNB(vssd),
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200260`endif
Tim Edwards53d92182020-10-11 21:47:40 -0400261 .Z(mprj_dat_o_user),
262 .A(~mprj_dat_o_core),
Tim Edwards7a8cbb12020-10-12 11:32:11 -0400263 .TE(mprj_logic1[73:42])
Tim Edwards53d92182020-10-11 21:47:40 -0400264 );
265
Tim Edwards43e5c602020-11-19 15:59:50 -0500266 /* Project data out from the managment side to the user project */
267 /* area when the user project is powered down. */
Tim Edwards53d92182020-10-11 21:47:40 -0400268
269 sky130_fd_sc_hd__einvp_8 la_buf [127:0] (
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200270`ifdef USE_POWER_PINS
Tim Edwards53d92182020-10-11 21:47:40 -0400271 .VPWR(vccd),
272 .VGND(vssd),
273 .VPB(vccd),
274 .VNB(vssd),
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200275`endif
Tim Edwards43e5c602020-11-19 15:59:50 -0500276 .Z(la_data_in_core),
277 .A(~la_data_out_mprj),
278 .TE(mprj_logic1[201:74])
Tim Edwards53d92182020-10-11 21:47:40 -0400279 );
280
Tim Edwards43e5c602020-11-19 15:59:50 -0500281 /* Project data out enable (bar) from the managment side to the */
282 /* user project area when the user project is powered down. */
283
284 sky130_fd_sc_hd__einvp_8 user_to_mprj_oen_buffers [127:0] (
285`ifdef USE_POWER_PINS
286 .VPWR(vccd),
287 .VGND(vssd),
288 .VPB(vccd),
289 .VNB(vssd),
290`endif
291 .Z(la_oen_core),
292 .A(~la_oen_mprj),
293 .TE(mprj_logic1[329:202])
294 );
295
Tim Edwards32d05422020-10-19 19:43:52 -0400296 /* The conb cell output is a resistive connection directly to */
297 /* the power supply, so when returning the user1_powergood */
298 /* signal, make sure that it is buffered properly. */
299
300 sky130_fd_sc_hd__buf_8 mprj_pwrgood (
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200301`ifdef USE_POWER_PINS
Tim Edwards32d05422020-10-19 19:43:52 -0400302 .VPWR(vccd),
303 .VGND(vssd),
304 .VPB(vccd),
305 .VNB(vssd),
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200306`endif
Tim Edwards43e5c602020-11-19 15:59:50 -0500307 .A(mprj_logic1[458]),
Tim Edwards05ad4fc2020-10-19 22:12:33 -0400308 .X(user1_vcc_powergood)
Tim Edwards32d05422020-10-19 19:43:52 -0400309 );
310
311 sky130_fd_sc_hd__buf_8 mprj2_pwrgood (
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200312`ifdef USE_POWER_PINS
Tim Edwards32d05422020-10-19 19:43:52 -0400313 .VPWR(vccd),
314 .VGND(vssd),
315 .VPB(vccd),
316 .VNB(vssd),
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200317`endif
Tim Edwards43e5c602020-11-19 15:59:50 -0500318 .A(mprj2_vdd_logic1),
Tim Edwards05ad4fc2020-10-19 22:12:33 -0400319 .X(user2_vcc_powergood)
Tim Edwards32d05422020-10-19 19:43:52 -0400320 );
321
Tim Edwards05ad4fc2020-10-19 22:12:33 -0400322 sky130_fd_sc_hd__buf_8 mprj_vdd_pwrgood (
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200323`ifdef USE_POWER_PINS
Tim Edwards05ad4fc2020-10-19 22:12:33 -0400324 .VPWR(vccd),
325 .VGND(vssd),
326 .VPB(vccd),
327 .VNB(vssd),
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200328`endif
Tim Edwards05ad4fc2020-10-19 22:12:33 -0400329 .A(mprj_vdd_logic1),
Tim Edwards581068f2020-11-19 12:45:25 -0500330 .X(user1_vdd_powergood)
Tim Edwards05ad4fc2020-10-19 22:12:33 -0400331 );
332
333 sky130_fd_sc_hd__buf_8 mprj2_vdd_pwrgood (
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200334`ifdef USE_POWER_PINS
Tim Edwards05ad4fc2020-10-19 22:12:33 -0400335 .VPWR(vccd),
336 .VGND(vssd),
337 .VPB(vccd),
338 .VNB(vssd),
Ahmed Ghazy69663c72020-11-18 20:15:53 +0200339`endif
Tim Edwards05ad4fc2020-10-19 22:12:33 -0400340 .A(mprj2_vdd_logic1),
341 .X(user2_vdd_powergood)
342 );
Tim Edwards53d92182020-10-11 21:47:40 -0400343endmodule
Tim Edwards581068f2020-11-19 12:45:25 -0500344`default_nettype wire