blob: d34cfecd00ea9519c57ee44a2cc7822773b52773 [file] [log] [blame]
shalan0d14e6e2020-08-31 16:50:48 +02001module chip_io(
2 // Package Pins
Tim Edwardsef8312e2020-09-22 17:20:06 -04003 inout vdd3v3,
4 inout vdd1v8,
5 inout vss,
Tim Edwards04ba17f2020-10-02 22:27:50 -04006 inout gpio,
Tim Edwards61bfc1f2020-10-03 11:51:17 -04007 input clock,
8 input resetb,
shalan0d14e6e2020-08-31 16:50:48 +02009 output flash_csb,
10 output flash_clk,
Tim Edwards61bfc1f2020-10-03 11:51:17 -040011 inout flash_io0,
12 inout flash_io1,
shalan0d14e6e2020-08-31 16:50:48 +020013 // Chip Core Interface
Tim Edwardsf51dd082020-10-05 16:30:24 -040014 input porb_h,
15 output resetb_core_h,
Tim Edwardsef8312e2020-09-22 17:20:06 -040016 output clock_core,
Tim Edwards04ba17f2020-10-02 22:27:50 -040017 input gpio_out_core,
18 output gpio_in_core,
19 input gpio_mode0_core,
20 input gpio_mode1_core,
21 input gpio_outenb_core,
22 input gpio_inenb_core,
shalan0d14e6e2020-08-31 16:50:48 +020023 input flash_csb_core,
24 input flash_clk_core,
25 input flash_csb_oeb_core,
26 input flash_clk_oeb_core,
27 input flash_io0_oeb_core,
28 input flash_io1_oeb_core,
shalan0d14e6e2020-08-31 16:50:48 +020029 input flash_csb_ieb_core,
30 input flash_clk_ieb_core,
31 input flash_io0_ieb_core,
32 input flash_io1_ieb_core,
shalan0d14e6e2020-08-31 16:50:48 +020033 input flash_io0_do_core,
34 input flash_io1_do_core,
shalan0d14e6e2020-08-31 16:50:48 +020035 output flash_io0_di_core,
36 output flash_io1_di_core,
Tim Edwards44bab472020-10-04 22:09:54 -040037 // porbh, returned to the I/O level shifted down and inverted
38 input por,
shalan0d14e6e2020-08-31 16:50:48 +020039 // Mega-project IOs
Tim Edwards44bab472020-10-04 22:09:54 -040040 inout [`MPRJ_IO_PADS-1:0] mprj_io,
shalan0d14e6e2020-08-31 16:50:48 +020041 input [`MPRJ_IO_PADS-1:0] mprj_io_out,
Tim Edwards44bab472020-10-04 22:09:54 -040042 input [`MPRJ_IO_PADS-1:0] mprj_io_oeb,
Tim Edwardsef8312e2020-09-22 17:20:06 -040043 input [`MPRJ_IO_PADS-1:0] mprj_io_hldh_n,
shalan0d14e6e2020-08-31 16:50:48 +020044 input [`MPRJ_IO_PADS-1:0] mprj_io_enh,
Tim Edwardsef8312e2020-09-22 17:20:06 -040045 input [`MPRJ_IO_PADS-1:0] mprj_io_inp_dis,
46 input [`MPRJ_IO_PADS-1:0] mprj_io_ib_mode_sel,
Tim Edwards04ba17f2020-10-02 22:27:50 -040047 input [`MPRJ_IO_PADS-1:0] mprj_io_vtrip_sel,
48 input [`MPRJ_IO_PADS-1:0] mprj_io_slow_sel,
49 input [`MPRJ_IO_PADS-1:0] mprj_io_holdover,
Tim Edwardsef8312e2020-09-22 17:20:06 -040050 input [`MPRJ_IO_PADS-1:0] mprj_io_analog_en,
51 input [`MPRJ_IO_PADS-1:0] mprj_io_analog_sel,
52 input [`MPRJ_IO_PADS-1:0] mprj_io_analog_pol,
53 input [`MPRJ_IO_PADS*3-1:0] mprj_io_dm,
shalan0d14e6e2020-08-31 16:50:48 +020054 output [`MPRJ_IO_PADS-1:0] mprj_io_in
55);
Tim Edwardsef8312e2020-09-22 17:20:06 -040056
shalan0d14e6e2020-08-31 16:50:48 +020057 wire analog_a, analog_b;
58 wire vddio_q, vssio_q;
59 // Instantiate power cells for VDD3V3 domain (8 total; 4 high clamps and
Tim Edwardsef8312e2020-09-22 17:20:06 -040060 // 4 low clamps)
61 s8iom0_vdda_hvc_pad vdd3v3hclamp [1:0] (
shalan0d14e6e2020-08-31 16:50:48 +020062 `ABUTMENT_PINS
63 .drn_hvc(),
64 .src_bdy_hvc()
Tim Edwardsef8312e2020-09-22 17:20:06 -040065 );
shalan0d14e6e2020-08-31 16:50:48 +020066
Tim Edwardsef8312e2020-09-22 17:20:06 -040067 s8iom0_vddio_hvc_pad vddiohclamp [1:0] (
shalan0d14e6e2020-08-31 16:50:48 +020068 `ABUTMENT_PINS
69 .drn_hvc(),
70 .src_bdy_hvc()
Tim Edwardsef8312e2020-09-22 17:20:06 -040071 );
shalan0d14e6e2020-08-31 16:50:48 +020072
Tim Edwardsef8312e2020-09-22 17:20:06 -040073 s8iom0_vdda_lvc_pad vdd3v3lclamp [3:0] (
shalan0d14e6e2020-08-31 16:50:48 +020074 `ABUTMENT_PINS
75 .bdy2_b2b(),
76 .drn_lvc1(),
77 .drn_lvc2(),
78 .src_bdy_lvc1(),
79 .src_bdy_lvc2()
Tim Edwardsef8312e2020-09-22 17:20:06 -040080 );
shalan0d14e6e2020-08-31 16:50:48 +020081
Tim Edwardsef8312e2020-09-22 17:20:06 -040082 // Instantiate the core voltage supply (since it is not generated on-chip)
83 // (1.8V) (4 total, 2 high and 2 low clamps)
84 s8iom0_vccd_hvc_pad vdd1v8hclamp [1:0] (
shalan0d14e6e2020-08-31 16:50:48 +020085 `ABUTMENT_PINS
86 .drn_hvc(),
87 .src_bdy_hvc()
Tim Edwardsef8312e2020-09-22 17:20:06 -040088 );
shalan0d14e6e2020-08-31 16:50:48 +020089
Tim Edwardsef8312e2020-09-22 17:20:06 -040090 s8iom0_vccd_lvc_pad vdd1v8lclamp [1:0] (
shalan0d14e6e2020-08-31 16:50:48 +020091 `ABUTMENT_PINS
92 .bdy2_b2b(),
93 .drn_lvc1(),
94 .drn_lvc2(),
95 .src_bdy_lvc1(),
96 .src_bdy_lvc2()
Tim Edwardsef8312e2020-09-22 17:20:06 -040097 );
shalan0d14e6e2020-08-31 16:50:48 +020098
Tim Edwardsef8312e2020-09-22 17:20:06 -040099 // Instantiate ground cells (7 total, 4 high clamps and 3 low clamps)
100 s8iom0_vssa_hvc_pad vsshclamp [3:0] (
shalan0d14e6e2020-08-31 16:50:48 +0200101 `ABUTMENT_PINS
102 .drn_hvc(),
103 .src_bdy_hvc()
Tim Edwardsef8312e2020-09-22 17:20:06 -0400104 );
shalan0d14e6e2020-08-31 16:50:48 +0200105
Tim Edwardsef8312e2020-09-22 17:20:06 -0400106 s8iom0_vssa_lvc_pad vssalclamp (
shalan0d14e6e2020-08-31 16:50:48 +0200107 `ABUTMENT_PINS
108 .bdy2_b2b(),
109 .drn_lvc1(),
110 .drn_lvc2(),
111 .src_bdy_lvc1(),
112 .src_bdy_lvc2()
Tim Edwardsef8312e2020-09-22 17:20:06 -0400113 );
shalan0d14e6e2020-08-31 16:50:48 +0200114
Tim Edwardsef8312e2020-09-22 17:20:06 -0400115 s8iom0_vssd_lvc_pad vssdlclamp (
shalan0d14e6e2020-08-31 16:50:48 +0200116 `ABUTMENT_PINS
117 .bdy2_b2b(),
118 .drn_lvc1(),
119 .drn_lvc2(),
120 .src_bdy_lvc1(),
121 .src_bdy_lvc2()
Tim Edwardsef8312e2020-09-22 17:20:06 -0400122 );
shalan0d14e6e2020-08-31 16:50:48 +0200123
Tim Edwardsef8312e2020-09-22 17:20:06 -0400124 s8iom0_vssio_lvc_pad vssiolclamp (
shalan0d14e6e2020-08-31 16:50:48 +0200125 `ABUTMENT_PINS
126 .bdy2_b2b(),
127 .drn_lvc1(),
128 .drn_lvc2(),
129 .src_bdy_lvc1(),
130 .src_bdy_lvc2()
Tim Edwardsef8312e2020-09-22 17:20:06 -0400131 );
shalan0d14e6e2020-08-31 16:50:48 +0200132
Tim Edwards04ba17f2020-10-02 22:27:50 -0400133 wire [2:0] dm_all =
134 {gpio_mode1_core, gpio_mode1_core, gpio_mode0_core};
shalan0d14e6e2020-08-31 16:50:48 +0200135 wire[2:0] flash_io0_mode =
136 {flash_io0_ieb_core, flash_io0_ieb_core, flash_io0_oeb_core};
137 wire[2:0] flash_io1_mode =
138 {flash_io1_ieb_core, flash_io1_ieb_core, flash_io1_oeb_core};
shalan0d14e6e2020-08-31 16:50:48 +0200139
Tim Edwards04ba17f2020-10-02 22:27:50 -0400140 // GPIO pad
141 `INOUT_PAD(
142 gpio, gpio_in_core, gpio_out_core,
shalan0d14e6e2020-08-31 16:50:48 +0200143 gpio_inenb_core, gpio_outenb_core, dm_all);
144
145 // Flash pads
146 `INOUT_PAD(
147 flash_io0, flash_io0_di_core, flash_io0_do_core,
148 flash_io0_ieb_core, flash_io0_oeb_core, flash_io0_mode);
149 `INOUT_PAD(
150 flash_io1, flash_io1_di_core, flash_io1_do_core,
151 flash_io1_ieb_core, flash_io1_oeb_core, flash_io1_mode);
shalan0d14e6e2020-08-31 16:50:48 +0200152
Tim Edwardsef8312e2020-09-22 17:20:06 -0400153 `INPUT_PAD(clock, clock_core);
shalan0d14e6e2020-08-31 16:50:48 +0200154
155 // Output Pads
shalan0d14e6e2020-08-31 16:50:48 +0200156 `OUTPUT_PAD(flash_csb, flash_csb_core, flash_csb_ieb_core, flash_csb_oeb_core);
157 `OUTPUT_PAD(flash_clk, flash_clk_core, flash_clk_ieb_core, flash_clk_oeb_core);
158
shalan0d14e6e2020-08-31 16:50:48 +0200159
160 // NOTE: The analog_out pad from the raven chip has been replaced by
Tim Edwards04ba17f2020-10-02 22:27:50 -0400161 // the digital reset input resetb on caravel due to the lack of an on-board
Tim Edwardsef8312e2020-09-22 17:20:06 -0400162 // power-on-reset circuit. The XRES pad is used for providing a glitch-
163 // free reset.
Tim Edwards04ba17f2020-10-02 22:27:50 -0400164 s8iom0s8_top_xres4v2 resetb_pad (
shalan0d14e6e2020-08-31 16:50:48 +0200165 `ABUTMENT_PINS
Tim Edwardsef8312e2020-09-22 17:20:06 -0400166 `ifndef TOP_ROUTING
Tim Edwards04ba17f2020-10-02 22:27:50 -0400167 .pad(resetb),
Tim Edwardsef8312e2020-09-22 17:20:06 -0400168 `endif
shalan0d14e6e2020-08-31 16:50:48 +0200169 .tie_weak_hi_h(xresloop), // Loop-back connection to pad through pad_a_esd_h
170 .tie_hi_esd(),
171 .tie_lo_esd(),
172 .pad_a_esd_h(xresloop),
Tim Edwardsf51dd082020-10-05 16:30:24 -0400173 .xres_h_n(resetb_core_h),
shalan0d14e6e2020-08-31 16:50:48 +0200174 .disable_pullup_h(vss), // 0 = enable pull-up on reset pad
Tim Edwardsef8312e2020-09-22 17:20:06 -0400175 .enable_h(vdd3v3), // Power-on-reset to the power-on-reset input??
shalan0d14e6e2020-08-31 16:50:48 +0200176 .en_vddio_sig_h(vss), // No idea.
177 .inp_sel_h(vss), // 1 = use filt_in_h else filter the pad input
178 .filt_in_h(vss), // Alternate input for glitch filter
179 .pullup_h(vss), // Pullup connection for alternate filter input
180 .enable_vddio(vdd1v8)
Tim Edwardsef8312e2020-09-22 17:20:06 -0400181 );
shalan0d14e6e2020-08-31 16:50:48 +0200182
183 // Corner cells (These are overlay cells; it is not clear what is normally
Tim Edwardsef8312e2020-09-22 17:20:06 -0400184 // supposed to go under them.)
185 `ifndef TOP_ROUTING
186 s8iom0_corner_pad corner [3:0] (
shalan0d14e6e2020-08-31 16:50:48 +0200187 .vssio(vss),
Tim Edwardsef8312e2020-09-22 17:20:06 -0400188 .vddio(vdd3v3),
shalan0d14e6e2020-08-31 16:50:48 +0200189 .vddio_q(vddio_q),
190 .vssio_q(vssio_q),
191 .amuxbus_a(analog_a),
192 .amuxbus_b(analog_b),
193 .vssd(vss),
194 .vssa(vss),
Tim Edwardsef8312e2020-09-22 17:20:06 -0400195 .vswitch(vdd3v3),
196 .vdda(vdd3v3),
shalan0d14e6e2020-08-31 16:50:48 +0200197 .vccd(vdd1v8),
198 .vcchib(vdd1v8)
Tim Edwardsef8312e2020-09-22 17:20:06 -0400199 );
200 `endif
shalan0d14e6e2020-08-31 16:50:48 +0200201
202 mprj_io mprj_pads(
Tim Edwards44bab472020-10-04 22:09:54 -0400203 .vdd3v3(vdd3v3),
shalan0d14e6e2020-08-31 16:50:48 +0200204 .vdd1v8(vdd1v8),
205 .vss(vss),
206 .vddio_q(vddio_q),
207 .vssio_q(vssio_q),
208 .analog_a(analog_a),
209 .analog_b(analog_b),
Tim Edwards44bab472020-10-04 22:09:54 -0400210 .porb_h(porb_h),
211 .por(por),
shalan0d14e6e2020-08-31 16:50:48 +0200212 .io(mprj_io),
213 .io_out(mprj_io_out),
Tim Edwards44bab472020-10-04 22:09:54 -0400214 .oeb(mprj_io_oeb),
shalan0d14e6e2020-08-31 16:50:48 +0200215 .hldh_n(mprj_io_hldh_n),
216 .enh(mprj_io_enh),
217 .inp_dis(mprj_io_inp_dis),
218 .ib_mode_sel(mprj_io_ib_mode_sel),
Tim Edwards44bab472020-10-04 22:09:54 -0400219 .vtrip_sel(mprj_io_vtrip_sel),
220 .holdover(mprj_io_holdover),
221 .slow_sel(mprj_io_slow_sel),
shalan0d14e6e2020-08-31 16:50:48 +0200222 .analog_en(mprj_io_analog_en),
223 .analog_sel(mprj_io_analog_sel),
224 .analog_pol(mprj_io_analog_pol),
225 .dm(mprj_io_dm),
226 .io_in(mprj_io_in)
227 );
228
Tim Edwardsef8312e2020-09-22 17:20:06 -0400229endmodule