blob: ebe02345b378f50abbda6290677e1e4f1461a4e9 [file] [log] [blame]
shalan0d14e6e2020-08-31 16:50:48 +02001module chip_io(
2 // Package Pins
Tim Edwards9eda80d2020-10-08 21:36:44 -04003 inout vddio, // Common padframe/ESD supply
4 inout vssio, // Common padframe/ESD ground
5 inout vccd, // Common 1.8V supply
6 inout vssd, // Common digital ground
7 inout vdda, // Management analog 3.3V supply
8 inout vssa, // Management analog ground
9 inout vdda1, // User area 1 3.3V supply
10 inout vdda2, // User area 2 3.3V supply
11 inout vssa1, // User area 1 analog ground
12 inout vssa2, // User area 2 analog ground
13 inout vccd1, // User area 1 1.8V supply
14 inout vccd2, // User area 2 1.8V supply
15 inout vssd1, // User area 1 digital ground
16 inout vssd2, // User area 2 digital ground
17
Tim Edwards04ba17f2020-10-02 22:27:50 -040018 inout gpio,
Tim Edwards61bfc1f2020-10-03 11:51:17 -040019 input clock,
20 input resetb,
shalan0d14e6e2020-08-31 16:50:48 +020021 output flash_csb,
22 output flash_clk,
Tim Edwards61bfc1f2020-10-03 11:51:17 -040023 inout flash_io0,
24 inout flash_io1,
shalan0d14e6e2020-08-31 16:50:48 +020025 // Chip Core Interface
Tim Edwardsf51dd082020-10-05 16:30:24 -040026 input porb_h,
27 output resetb_core_h,
Tim Edwardsef8312e2020-09-22 17:20:06 -040028 output clock_core,
Tim Edwards04ba17f2020-10-02 22:27:50 -040029 input gpio_out_core,
30 output gpio_in_core,
31 input gpio_mode0_core,
32 input gpio_mode1_core,
33 input gpio_outenb_core,
34 input gpio_inenb_core,
shalan0d14e6e2020-08-31 16:50:48 +020035 input flash_csb_core,
36 input flash_clk_core,
37 input flash_csb_oeb_core,
38 input flash_clk_oeb_core,
39 input flash_io0_oeb_core,
40 input flash_io1_oeb_core,
shalan0d14e6e2020-08-31 16:50:48 +020041 input flash_csb_ieb_core,
42 input flash_clk_ieb_core,
43 input flash_io0_ieb_core,
44 input flash_io1_ieb_core,
shalan0d14e6e2020-08-31 16:50:48 +020045 input flash_io0_do_core,
46 input flash_io1_do_core,
shalan0d14e6e2020-08-31 16:50:48 +020047 output flash_io0_di_core,
48 output flash_io1_di_core,
Tim Edwards44bab472020-10-04 22:09:54 -040049 // porbh, returned to the I/O level shifted down and inverted
50 input por,
shalan0d14e6e2020-08-31 16:50:48 +020051 // Mega-project IOs
Tim Edwards44bab472020-10-04 22:09:54 -040052 inout [`MPRJ_IO_PADS-1:0] mprj_io,
shalan0d14e6e2020-08-31 16:50:48 +020053 input [`MPRJ_IO_PADS-1:0] mprj_io_out,
Tim Edwards44bab472020-10-04 22:09:54 -040054 input [`MPRJ_IO_PADS-1:0] mprj_io_oeb,
Tim Edwardsef8312e2020-09-22 17:20:06 -040055 input [`MPRJ_IO_PADS-1:0] mprj_io_hldh_n,
shalan0d14e6e2020-08-31 16:50:48 +020056 input [`MPRJ_IO_PADS-1:0] mprj_io_enh,
Tim Edwardsef8312e2020-09-22 17:20:06 -040057 input [`MPRJ_IO_PADS-1:0] mprj_io_inp_dis,
58 input [`MPRJ_IO_PADS-1:0] mprj_io_ib_mode_sel,
Tim Edwards04ba17f2020-10-02 22:27:50 -040059 input [`MPRJ_IO_PADS-1:0] mprj_io_vtrip_sel,
60 input [`MPRJ_IO_PADS-1:0] mprj_io_slow_sel,
61 input [`MPRJ_IO_PADS-1:0] mprj_io_holdover,
Tim Edwardsef8312e2020-09-22 17:20:06 -040062 input [`MPRJ_IO_PADS-1:0] mprj_io_analog_en,
63 input [`MPRJ_IO_PADS-1:0] mprj_io_analog_sel,
64 input [`MPRJ_IO_PADS-1:0] mprj_io_analog_pol,
65 input [`MPRJ_IO_PADS*3-1:0] mprj_io_dm,
shalan0d14e6e2020-08-31 16:50:48 +020066 output [`MPRJ_IO_PADS-1:0] mprj_io_in
67);
Tim Edwardsef8312e2020-09-22 17:20:06 -040068
shalan0d14e6e2020-08-31 16:50:48 +020069 wire analog_a, analog_b;
70 wire vddio_q, vssio_q;
Tim Edwards9eda80d2020-10-08 21:36:44 -040071
72 // Instantiate power and ground pads for management domain
73 // 12 pads: vddio, vssio, vdda, vssa, vccd, vssd
74 // One each HV and LV clamp.
75
76 s8iom0_vddio_hvc_pad mgmt_vddio_hvclamp_pad (
77 `MGMT_ABUTMENT_PINS
78 `HVCLAMP_PINS
79 );
80 s8iom0_vddio_lvc_pad mgmt_vddio_lvclamp_pad (
81 `MGMT_ABUTMENT_PINS
82 `LVCLAMP_PINS
Tim Edwardsef8312e2020-09-22 17:20:06 -040083 );
shalan0d14e6e2020-08-31 16:50:48 +020084
Tim Edwards9eda80d2020-10-08 21:36:44 -040085 s8iom0_vdda_hvc_pad mgmt_vdda_hvclamp_pad (
86 `MGMT_ABUTMENT_PINS
87 `HVCLAMP_PINS
Tim Edwardsef8312e2020-09-22 17:20:06 -040088 );
Tim Edwards9eda80d2020-10-08 21:36:44 -040089 s8iom0_vdda_lvc_pad mgmt_vdda_lvclamp_pad (
90 `MGMT_ABUTMENT_PINS
91 `LVCLAMP_PINS
Tim Edwardsef8312e2020-09-22 17:20:06 -040092 );
shalan0d14e6e2020-08-31 16:50:48 +020093
Tim Edwards9eda80d2020-10-08 21:36:44 -040094 s8iom0_vccd_hvc_pad mgmt_vccd_hvclamp_pad (
95 `MGMT_ABUTMENT_PINS
96 `HVCLAMP_PINS
97 );
98 s8iom0_vccd_lvc_pad mgmt_vccd_lvclamp_pad (
99 `MGMT_ABUTMENT_PINS
100 `LVCLAMP_PINS
Tim Edwardsef8312e2020-09-22 17:20:06 -0400101 );
shalan0d14e6e2020-08-31 16:50:48 +0200102
Tim Edwards9eda80d2020-10-08 21:36:44 -0400103 s8iom0_vssio_hvc_pad mgmt_vssio_hvclamp_pad (
104 `MGMT_ABUTMENT_PINS
105 `HVCLAMP_PINS
106 );
107 s8iom0_vssio_lvc_pad mgmt_vssio_lvclamp_pad (
108 `MGMT_ABUTMENT_PINS
109 `LVCLAMP_PINS
Tim Edwardsef8312e2020-09-22 17:20:06 -0400110 );
shalan0d14e6e2020-08-31 16:50:48 +0200111
Tim Edwards9eda80d2020-10-08 21:36:44 -0400112 s8iom0_vssa_hvc_pad mgmt_vssa_hvclamp_pad (
113 `MGMT_ABUTMENT_PINS
114 `HVCLAMP_PINS
115 );
116 s8iom0_vssa_lvc_pad mgmt_vssa_lvclamp_pad (
117 `MGMT_ABUTMENT_PINS
118 `LVCLAMP_PINS
Tim Edwardsef8312e2020-09-22 17:20:06 -0400119 );
shalan0d14e6e2020-08-31 16:50:48 +0200120
Tim Edwards9eda80d2020-10-08 21:36:44 -0400121 s8iom0_vssd_hvc_pad mgmt_vssd_hvclamp_pad (
122 `MGMT_ABUTMENT_PINS
123 `HVCLAMP_PINS
124 );
125 s8iom0_vssd_lvc_pad mgmt_vssd_lvclmap_pad (
126 `MGMT_ABUTMENT_PINS
127 `LVCLAMP_PINS
Tim Edwardsef8312e2020-09-22 17:20:06 -0400128 );
shalan0d14e6e2020-08-31 16:50:48 +0200129
Tim Edwards9eda80d2020-10-08 21:36:44 -0400130 // Instantiate power and ground pads for user 1 domain
131 // 8 pads: vdda, vssa, vccd, vssd; One each HV and LV clamp.
132
133 s8iom0_vdda_hvc_pad user1_vdda_hvclamp_pad (
134 `USER1_ABUTMENT_PINS
135 `HVCLAMP_PINS
136 );
137 s8iom0_vdda_lvc_pad user1_vdda_lvclamp_pad (
138 `USER1_ABUTMENT_PINS
139 `LVCLAMP_PINS
Tim Edwardsef8312e2020-09-22 17:20:06 -0400140 );
shalan0d14e6e2020-08-31 16:50:48 +0200141
Tim Edwards9eda80d2020-10-08 21:36:44 -0400142 s8iom0_vccd_hvc_pad user1_vccd_hvclamp_pad (
143 `USER1_ABUTMENT_PINS
144 `HVCLAMP_PINS
145 );
146 s8iom0_vccd_lvc_pad user1_vccd_lvclamp_pad (
147 `USER1_ABUTMENT_PINS
148 `LVCLAMP_PINS
149 );
150
151 s8iom0_vssa_hvc_pad user1_vssa_hvclamp_pad (
152 `USER1_ABUTMENT_PINS
153 `HVCLAMP_PINS
154 );
155 s8iom0_vssa_lvc_pad user1_vssa_lvclamp_pad (
156 `USER1_ABUTMENT_PINS
157 `LVCLAMP_PINS
158 );
159
160 s8iom0_vssd_hvc_pad user1_vssd_hvclamp_pad (
161 `USER1_ABUTMENT_PINS
162 `HVCLAMP_PINS
163 );
164 s8iom0_vssd_lvc_pad user1_vssd_lvclmap_pad (
165 `USER1_ABUTMENT_PINS
166 `LVCLAMP_PINS
167 );
168
169 // Instantiate power and ground pads for user 2 domain
170 // 8 pads: vdda, vssa, vccd, vssd; One each HV and LV clamp.
171
172 s8iom0_vdda_hvc_pad user2_vdda_hvclamp_pad (
173 `USER2_ABUTMENT_PINS
174 `HVCLAMP_PINS
175 );
176 s8iom0_vdda_lvc_pad user2_vdda_lvclamp_pad (
177 `USER2_ABUTMENT_PINS
178 `LVCLAMP_PINS
179 );
180
181 s8iom0_vccd_hvc_pad user2_vccd_hvclamp_pad (
182 `USER2_ABUTMENT_PINS
183 `HVCLAMP_PINS
184 );
185 s8iom0_vccd_lvc_pad user2_vccd_lvclamp_pad (
186 `USER2_ABUTMENT_PINS
187 `LVCLAMP_PINS
188 );
189
190 s8iom0_vssa_hvc_pad user2_vssa_hvclamp_pad (
191 `USER2_ABUTMENT_PINS
192 `HVCLAMP_PINS
193 );
194 s8iom0_vssa_lvc_pad user2_vssa_lvclamp_pad (
195 `USER2_ABUTMENT_PINS
196 `LVCLAMP_PINS
197 );
198
199 s8iom0_vssd_hvc_pad user2_vssd_hvclamp_pad (
200 `USER2_ABUTMENT_PINS
201 `HVCLAMP_PINS
202 );
203 s8iom0_vssd_lvc_pad user2_vssd_lvclmap_pad (
204 `USER2_ABUTMENT_PINS
205 `LVCLAMP_PINS
Tim Edwardsef8312e2020-09-22 17:20:06 -0400206 );
shalan0d14e6e2020-08-31 16:50:48 +0200207
Tim Edwards04ba17f2020-10-02 22:27:50 -0400208 wire [2:0] dm_all =
209 {gpio_mode1_core, gpio_mode1_core, gpio_mode0_core};
shalan0d14e6e2020-08-31 16:50:48 +0200210 wire[2:0] flash_io0_mode =
211 {flash_io0_ieb_core, flash_io0_ieb_core, flash_io0_oeb_core};
212 wire[2:0] flash_io1_mode =
213 {flash_io1_ieb_core, flash_io1_ieb_core, flash_io1_oeb_core};
shalan0d14e6e2020-08-31 16:50:48 +0200214
Tim Edwards9eda80d2020-10-08 21:36:44 -0400215 // Management clock input pad
216 `INPUT_PAD(clock, clock_core);
217
218 // Management GPIO pad
Tim Edwards04ba17f2020-10-02 22:27:50 -0400219 `INOUT_PAD(
220 gpio, gpio_in_core, gpio_out_core,
shalan0d14e6e2020-08-31 16:50:48 +0200221 gpio_inenb_core, gpio_outenb_core, dm_all);
222
Tim Edwards9eda80d2020-10-08 21:36:44 -0400223 // Management Flash SPI pads
shalan0d14e6e2020-08-31 16:50:48 +0200224 `INOUT_PAD(
225 flash_io0, flash_io0_di_core, flash_io0_do_core,
226 flash_io0_ieb_core, flash_io0_oeb_core, flash_io0_mode);
227 `INOUT_PAD(
228 flash_io1, flash_io1_di_core, flash_io1_do_core,
229 flash_io1_ieb_core, flash_io1_oeb_core, flash_io1_mode);
shalan0d14e6e2020-08-31 16:50:48 +0200230
shalan0d14e6e2020-08-31 16:50:48 +0200231 `OUTPUT_PAD(flash_csb, flash_csb_core, flash_csb_ieb_core, flash_csb_oeb_core);
232 `OUTPUT_PAD(flash_clk, flash_clk_core, flash_clk_ieb_core, flash_clk_oeb_core);
233
shalan0d14e6e2020-08-31 16:50:48 +0200234 // NOTE: The analog_out pad from the raven chip has been replaced by
Tim Edwards04ba17f2020-10-02 22:27:50 -0400235 // the digital reset input resetb on caravel due to the lack of an on-board
Tim Edwardsef8312e2020-09-22 17:20:06 -0400236 // power-on-reset circuit. The XRES pad is used for providing a glitch-
237 // free reset.
Tim Edwards9eda80d2020-10-08 21:36:44 -0400238
Tim Edwards04ba17f2020-10-02 22:27:50 -0400239 s8iom0s8_top_xres4v2 resetb_pad (
Tim Edwards9eda80d2020-10-08 21:36:44 -0400240 `MGMT_ABUTMENT_PINS
Tim Edwardsef8312e2020-09-22 17:20:06 -0400241 `ifndef TOP_ROUTING
Tim Edwards04ba17f2020-10-02 22:27:50 -0400242 .pad(resetb),
Tim Edwardsef8312e2020-09-22 17:20:06 -0400243 `endif
shalan0d14e6e2020-08-31 16:50:48 +0200244 .tie_weak_hi_h(xresloop), // Loop-back connection to pad through pad_a_esd_h
245 .tie_hi_esd(),
246 .tie_lo_esd(),
247 .pad_a_esd_h(xresloop),
Tim Edwardsf51dd082020-10-05 16:30:24 -0400248 .xres_h_n(resetb_core_h),
Tim Edwards9eda80d2020-10-08 21:36:44 -0400249 .disable_pullup_h(vssio), // 0 = enable pull-up on reset pad
250 .enable_h(porb_h), // Power-on-reset
251 .en_vddio_sig_h(vssio), // No idea.
252 .inp_sel_h(vssio), // 1 = use filt_in_h else filter the pad input
253 .filt_in_h(vssio), // Alternate input for glitch filter
254 .pullup_h(vssio), // Pullup connection for alternate filter input
255 .enable_vddio(vccd)
Tim Edwardsef8312e2020-09-22 17:20:06 -0400256 );
shalan0d14e6e2020-08-31 16:50:48 +0200257
258 // Corner cells (These are overlay cells; it is not clear what is normally
Tim Edwards9eda80d2020-10-08 21:36:44 -0400259 // supposed to go under them.)
260
Tim Edwardsef8312e2020-09-22 17:20:06 -0400261 `ifndef TOP_ROUTING
Tim Edwards9eda80d2020-10-08 21:36:44 -0400262 s8iom0_corner_pad mgmt_corner [1:0] (
263 .vssio(vssio),
264 .vddio(vddio),
shalan0d14e6e2020-08-31 16:50:48 +0200265 .vddio_q(vddio_q),
266 .vssio_q(vssio_q),
267 .amuxbus_a(analog_a),
268 .amuxbus_b(analog_b),
Tim Edwards9eda80d2020-10-08 21:36:44 -0400269 .vssd(vssio),
270 .vssa(vssio),
271 .vswitch(vddio),
272 .vdda(vdda),
273 .vccd(vccd),
274 .vcchib(vccd)
275 );
276 s8iom0_corner_pad user1_corner (
277 .vssio(vssio),
278 .vddio(vddio),
279 .vddio_q(vddio_q),
280 .vssio_q(vssio_q),
281 .amuxbus_a(analog_a),
282 .amuxbus_b(analog_b),
283 .vssd(vssd1),
284 .vssa(vssa1),
285 .vswitch(vddio),
286 .vdda(vdda1),
287 .vccd(vccd1),
288 .vcchib(vccd)
289 );
290 s8iom0_corner_pad user2_corner (
291 .vssio(vssio),
292 .vddio(vddio),
293 .vddio_q(vddio_q),
294 .vssio_q(vssio_q),
295 .amuxbus_a(analog_a),
296 .amuxbus_b(analog_b),
297 .vssd(vssd2),
298 .vssa(vssa2),
299 .vswitch(vddio),
300 .vdda(vdda2),
301 .vccd(vccd2),
302 .vcchib(vccd)
Tim Edwardsef8312e2020-09-22 17:20:06 -0400303 );
304 `endif
shalan0d14e6e2020-08-31 16:50:48 +0200305
306 mprj_io mprj_pads(
Tim Edwards9eda80d2020-10-08 21:36:44 -0400307 .vddio(vddio),
308 .vssio(vssio),
309 .vccd(vccd),
310 .vssd(vssd),
311 .vdda1(vdda1),
312 .vdda2(vdda2),
313 .vssa1(vssa1),
314 .vssa2(vssa2),
315 .vccd1(vccd1),
316 .vccd2(vccd2),
317 .vssd1(vssd1),
318 .vssd2(vssd2),
shalan0d14e6e2020-08-31 16:50:48 +0200319 .vddio_q(vddio_q),
320 .vssio_q(vssio_q),
321 .analog_a(analog_a),
322 .analog_b(analog_b),
Tim Edwards44bab472020-10-04 22:09:54 -0400323 .porb_h(porb_h),
324 .por(por),
shalan0d14e6e2020-08-31 16:50:48 +0200325 .io(mprj_io),
326 .io_out(mprj_io_out),
Tim Edwards44bab472020-10-04 22:09:54 -0400327 .oeb(mprj_io_oeb),
shalan0d14e6e2020-08-31 16:50:48 +0200328 .hldh_n(mprj_io_hldh_n),
329 .enh(mprj_io_enh),
330 .inp_dis(mprj_io_inp_dis),
331 .ib_mode_sel(mprj_io_ib_mode_sel),
Tim Edwards44bab472020-10-04 22:09:54 -0400332 .vtrip_sel(mprj_io_vtrip_sel),
333 .holdover(mprj_io_holdover),
334 .slow_sel(mprj_io_slow_sel),
shalan0d14e6e2020-08-31 16:50:48 +0200335 .analog_en(mprj_io_analog_en),
336 .analog_sel(mprj_io_analog_sel),
337 .analog_pol(mprj_io_analog_pol),
338 .dm(mprj_io_dm),
339 .io_in(mprj_io_in)
340 );
341
Tim Edwardsef8312e2020-09-22 17:20:06 -0400342endmodule