blob: 0203ede7e387f962110298b5e3b942ce68d3b4ee [file] [log] [blame]
shalan0d14e6e2020-08-31 16:50:48 +02001module chip_io(
2 // Package Pins
3 inout vdd,
4 inout vdd1v8,
5 inout vss,
6 input [15:0] gpio,
7 inout xi,
8 output xo,
9 inout adc0_in,
10 inout adc1_in,
11 inout adc_high,
12 inout adc_low,
13 inout comp_inn,
14 inout comp_inp,
15 inout RSTB,
16 inout ser_rx,
17 output ser_tx,
18 inout irq,
19 output SDO,
20 inout SDI,
21 inout CSB,
22 inout SCK,
23 inout xclk,
24 output flash_csb,
25 output flash_clk,
26 output flash_io0,
27 output flash_io1,
28 output flash_io2,
29 output flash_io3,
30 // Chip Core Interface
31 input por,
32 output porb_h,
33 output ext_clk_core,
34 output xi_core,
35 input [15:0] gpio_out_core,
36 output [15:0] gpio_in_core,
37 input [15:0] gpio_mode0_core,
38 input [15:0] gpio_mode1_core,
39 input [15:0] gpio_outenb_core,
40 input [15:0] gpio_inenb_core,
41 output SCK_core,
42 output ser_rx_core,
43 inout ser_tx_core,
44 output irq_pin_core,
45 input flash_csb_core,
46 input flash_clk_core,
47 input flash_csb_oeb_core,
48 input flash_clk_oeb_core,
49 input flash_io0_oeb_core,
50 input flash_io1_oeb_core,
51 input flash_io2_oeb_core,
52 input flash_io3_oeb_core,
53 input flash_csb_ieb_core,
54 input flash_clk_ieb_core,
55 input flash_io0_ieb_core,
56 input flash_io1_ieb_core,
57 input flash_io2_ieb_core,
58 input flash_io3_ieb_core,
59 input flash_io0_do_core,
60 input flash_io1_do_core,
61 input flash_io2_do_core,
62 input flash_io3_do_core,
63 output flash_io0_di_core,
64 output flash_io1_di_core,
65 output flash_io2_di_core,
66 output flash_io3_di_core,
67 output SDI_core,
68 output CSB_core,
69 input pll_clk16,
70 input SDO_core,
71 // Mega-project IOs
72 input [`MPRJ_IO_PADS-1:0] mprj_io,
73 input [`MPRJ_IO_PADS-1:0] mprj_io_out,
74 input [`MPRJ_IO_PADS-1:0] mprj_io_oeb_n,
75 input [`MPRJ_IO_PADS-1:0] mprj_io_hldh_n,
76 input [`MPRJ_IO_PADS-1:0] mprj_io_enh,
77 input [`MPRJ_IO_PADS-1:0] mprj_io_inp_dis,
78 input [`MPRJ_IO_PADS-1:0] mprj_io_ib_mode_sel,
79 input [`MPRJ_IO_PADS-1:0] mprj_io_analog_en,
80 input [`MPRJ_IO_PADS-1:0] mprj_io_analog_sel,
81 input [`MPRJ_IO_PADS-1:0] mprj_io_analog_pol,
82 input [`MPRJ_IO_PADS*3-1:0] mprj_io_dm,
83 output [`MPRJ_IO_PADS-1:0] mprj_io_in
84);
85 wire analog_a, analog_b;
86 wire vddio_q, vssio_q;
87 // Instantiate power cells for VDD3V3 domain (8 total; 4 high clamps and
88 // 4 low clamps)
89 s8iom0_vdda_hvc_pad vdd3v3hclamp [1:0] (
90 `ABUTMENT_PINS
91 .drn_hvc(),
92 .src_bdy_hvc()
93 );
94
95 s8iom0_vddio_hvc_pad vddiohclamp [1:0] (
96 `ABUTMENT_PINS
97 .drn_hvc(),
98 .src_bdy_hvc()
99 );
100
101 s8iom0_vdda_lvc_pad vdd3v3lclamp [3:0] (
102 `ABUTMENT_PINS
103 .bdy2_b2b(),
104 .drn_lvc1(),
105 .drn_lvc2(),
106 .src_bdy_lvc1(),
107 .src_bdy_lvc2()
108 );
109
110 // Instantiate the core voltage supply (since it is not generated on-chip)
111 // (1.8V) (4 total, 2 high and 2 low clamps)
112 s8iom0_vccd_hvc_pad vdd1v8hclamp [1:0] (
113 `ABUTMENT_PINS
114 .drn_hvc(),
115 .src_bdy_hvc()
116 );
117
118 s8iom0_vccd_lvc_pad vdd1v8lclamp [1:0] (
119 `ABUTMENT_PINS
120 .bdy2_b2b(),
121 .drn_lvc1(),
122 .drn_lvc2(),
123 .src_bdy_lvc1(),
124 .src_bdy_lvc2()
125 );
126
127 // Instantiate ground cells (7 total, 4 high clamps and 3 low clamps)
128 s8iom0_vssa_hvc_pad vsshclamp [3:0] (
129 `ABUTMENT_PINS
130 .drn_hvc(),
131 .src_bdy_hvc()
132 );
133
134 s8iom0_vssa_lvc_pad vssalclamp (
135 `ABUTMENT_PINS
136 .bdy2_b2b(),
137 .drn_lvc1(),
138 .drn_lvc2(),
139 .src_bdy_lvc1(),
140 .src_bdy_lvc2()
141 );
142
143 s8iom0_vssd_lvc_pad vssdlclamp (
144 `ABUTMENT_PINS
145 .bdy2_b2b(),
146 .drn_lvc1(),
147 .drn_lvc2(),
148 .src_bdy_lvc1(),
149 .src_bdy_lvc2()
150 );
151
152 s8iom0_vssio_lvc_pad vssiolclamp (
153 `ABUTMENT_PINS
154 .bdy2_b2b(),
155 .drn_lvc1(),
156 .drn_lvc2(),
157 .src_bdy_lvc1(),
158 .src_bdy_lvc2()
159 );
160
161 wire [47:0] dm_all;
162 assign dm_all = {gpio_mode1_core[15], gpio_mode1_core[15], gpio_mode0_core[15],
163 gpio_mode1_core[14], gpio_mode1_core[14], gpio_mode0_core[14],
164 gpio_mode1_core[13], gpio_mode1_core[13], gpio_mode0_core[13],
165 gpio_mode1_core[12], gpio_mode1_core[12], gpio_mode0_core[12],
166 gpio_mode1_core[11], gpio_mode1_core[11], gpio_mode0_core[11],
167 gpio_mode1_core[10], gpio_mode1_core[10], gpio_mode0_core[10],
168 gpio_mode1_core[9], gpio_mode1_core[9], gpio_mode0_core[9],
169 gpio_mode1_core[8], gpio_mode1_core[8], gpio_mode0_core[8],
170 gpio_mode1_core[7], gpio_mode1_core[7], gpio_mode0_core[7],
171 gpio_mode1_core[6], gpio_mode1_core[6], gpio_mode0_core[6],
172 gpio_mode1_core[5], gpio_mode1_core[5], gpio_mode0_core[5],
173 gpio_mode1_core[4], gpio_mode1_core[4], gpio_mode0_core[4],
174 gpio_mode1_core[3], gpio_mode1_core[3], gpio_mode0_core[3],
175 gpio_mode1_core[2], gpio_mode1_core[2], gpio_mode0_core[2],
176 gpio_mode1_core[1], gpio_mode1_core[1], gpio_mode0_core[1],
177 gpio_mode1_core[0], gpio_mode1_core[0], gpio_mode0_core[0]};
178
179 wire[2:0] flash_io0_mode =
180 {flash_io0_ieb_core, flash_io0_ieb_core, flash_io0_oeb_core};
181 wire[2:0] flash_io1_mode =
182 {flash_io1_ieb_core, flash_io1_ieb_core, flash_io1_oeb_core};
183 wire[2:0] flash_io2_mode =
184 {flash_io2_ieb_core, flash_io2_ieb_core, flash_io2_oeb_core};
185 wire[2:0] flash_io3_mode =
186 {flash_io3_ieb_core, flash_io3_ieb_core, flash_io3_oeb_core};
187
188 // GPIO pads
189 `INOUT_PAD_V(
190 gpio, gpio_in_core, gpio_out_core, 16,
191 gpio_inenb_core, gpio_outenb_core, dm_all);
192
193 // Flash pads
194 `INOUT_PAD(
195 flash_io0, flash_io0_di_core, flash_io0_do_core,
196 flash_io0_ieb_core, flash_io0_oeb_core, flash_io0_mode);
197 `INOUT_PAD(
198 flash_io1, flash_io1_di_core, flash_io1_do_core,
199 flash_io1_ieb_core, flash_io1_oeb_core, flash_io1_mode);
200 `INOUT_PAD(
201 flash_io2, flash_io2_di_core, flash_io2_do_core,
202 flash_io2_ieb_core, flash_io2_oeb_core, flash_io2_mode);
203 `INOUT_PAD(
204 flash_io3, flash_io3_di_core, flash_io3_do_core,
205 flash_io3_ieb_core, flash_io3_oeb_core, flash_io3_mode);
206
207 `INPUT_PAD(xi, xi_core);
208 `INPUT_PAD(irq, irq_pin_core);
209 `INPUT_PAD(xclk,ext_clk_core);
210 `INPUT_PAD(SDI, SDI_core);
211 `INPUT_PAD(CSB, CSB_core);
212 `INPUT_PAD(SCK, SCK_core);
213
214 // Analog Pads
215 `INPUT_PAD_ANALOG(adc0_in,vss,vss);
216 `INPUT_PAD_ANALOG(adc1_in,vss,vss);
217 `INPUT_PAD_ANALOG(adc_high,vdd1v8,vdd1v8);
218 `INPUT_PAD_ANALOG(adc_low,vss,vss);
219 `INPUT_PAD_ANALOG(comp_inn,vss,vss);
220 `INPUT_PAD_ANALOG(comp_inp,vdd1v8,vss);
221
222 // Output Pads
223 `OUTPUT_PAD(xo,pll_clk16,vdd1v8,vss);
224 `OUTPUT_PAD(SDO,SDO_core,vdd1v8,SDO_enb);
225
226 `OUTPUT_PAD(flash_csb, flash_csb_core, flash_csb_ieb_core, flash_csb_oeb_core);
227 `OUTPUT_PAD(flash_clk, flash_clk_core, flash_clk_ieb_core, flash_clk_oeb_core);
228
229 // Instantiate GPIO overvoltage (I2C) compliant cell
230 // (Use this for ser_rx and ser_tx; no reason other than testing
231 // the use of the cell.) (Might be worth adding in the I2C IP from
232 // ravenna just to test on a proper I2C channel.)
233 `I2C_RX(ser_rx, ser_rx_core);
234 `I2C_TX(ser_tx, ser_tx_core);
235
236 // NOTE: The analog_out pad from the raven chip has been replaced by
237 // the digital reset input RSTB on striVe due to the lack of an on-board
238 // power-on-reset circuit. The XRES pad is used for providing a glitch-
239 // free reset.
240 s8iom0s8_top_xres4v2 RSTB_pad (
241 `ABUTMENT_PINS
242`ifndef TOP_ROUTING
243 .pad(RSTB),
244`endif
245 .tie_weak_hi_h(xresloop), // Loop-back connection to pad through pad_a_esd_h
246 .tie_hi_esd(),
247 .tie_lo_esd(),
248 .pad_a_esd_h(xresloop),
249 .xres_h_n(porb_h),
250 .disable_pullup_h(vss), // 0 = enable pull-up on reset pad
251 .enable_h(vdd), // Power-on-reset to the power-on-reset input??
252 .en_vddio_sig_h(vss), // No idea.
253 .inp_sel_h(vss), // 1 = use filt_in_h else filter the pad input
254 .filt_in_h(vss), // Alternate input for glitch filter
255 .pullup_h(vss), // Pullup connection for alternate filter input
256 .enable_vddio(vdd1v8)
257 );
258
259 // Corner cells (These are overlay cells; it is not clear what is normally
260 // supposed to go under them.)
261 `ifndef TOP_ROUTING
262 s8iom0_corner_pad corner [3:0] (
263 .vssio(vss),
264 .vddio(vdd),
265 .vddio_q(vddio_q),
266 .vssio_q(vssio_q),
267 .amuxbus_a(analog_a),
268 .amuxbus_b(analog_b),
269 .vssd(vss),
270 .vssa(vss),
271 .vswitch(vdd),
272 .vdda(vdd),
273 .vccd(vdd1v8),
274 .vcchib(vdd1v8)
275 );
276`endif
277
278 mprj_io mprj_pads(
279 .vdd(vdd),
280 .vdd1v8(vdd1v8),
281 .vss(vss),
282 .vddio_q(vddio_q),
283 .vssio_q(vssio_q),
284 .analog_a(analog_a),
285 .analog_b(analog_b),
286 .io(mprj_io),
287 .io_out(mprj_io_out),
288 .oeb_n(mprj_io_oeb_n),
289 .hldh_n(mprj_io_hldh_n),
290 .enh(mprj_io_enh),
291 .inp_dis(mprj_io_inp_dis),
292 .ib_mode_sel(mprj_io_ib_mode_sel),
293 .analog_en(mprj_io_analog_en),
294 .analog_sel(mprj_io_analog_sel),
295 .analog_pol(mprj_io_analog_pol),
296 .dm(mprj_io_dm),
297 .io_in(mprj_io_in)
298 );
299
300endmodule