blob: bd359b91c4cf6b35e30ce26311737e7a57614da2 [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 Edwardsef8312e2020-09-22 17:20:06 -04007 inout clock,
Tim Edwards04ba17f2020-10-02 22:27:50 -04008 inout resetb,
shalan0d14e6e2020-08-31 16:50:48 +02009 output flash_csb,
10 output flash_clk,
11 output flash_io0,
12 output flash_io1,
shalan0d14e6e2020-08-31 16:50:48 +020013 // Chip Core Interface
shalan0d14e6e2020-08-31 16:50:48 +020014 output porb_h,
Tim Edwardsef8312e2020-09-22 17:20:06 -040015 output clock_core,
Tim Edwards04ba17f2020-10-02 22:27:50 -040016 input gpio_out_core,
17 output gpio_in_core,
18 input gpio_mode0_core,
19 input gpio_mode1_core,
20 input gpio_outenb_core,
21 input gpio_inenb_core,
shalan0d14e6e2020-08-31 16:50:48 +020022 input flash_csb_core,
23 input flash_clk_core,
24 input flash_csb_oeb_core,
25 input flash_clk_oeb_core,
26 input flash_io0_oeb_core,
27 input flash_io1_oeb_core,
shalan0d14e6e2020-08-31 16:50:48 +020028 input flash_csb_ieb_core,
29 input flash_clk_ieb_core,
30 input flash_io0_ieb_core,
31 input flash_io1_ieb_core,
shalan0d14e6e2020-08-31 16:50:48 +020032 input flash_io0_do_core,
33 input flash_io1_do_core,
shalan0d14e6e2020-08-31 16:50:48 +020034 output flash_io0_di_core,
35 output flash_io1_di_core,
shalan0d14e6e2020-08-31 16:50:48 +020036 input pll_clk16,
shalan0d14e6e2020-08-31 16:50:48 +020037 // Mega-project IOs
38 input [`MPRJ_IO_PADS-1:0] mprj_io,
39 input [`MPRJ_IO_PADS-1:0] mprj_io_out,
40 input [`MPRJ_IO_PADS-1:0] mprj_io_oeb_n,
Tim Edwardsef8312e2020-09-22 17:20:06 -040041 input [`MPRJ_IO_PADS-1:0] mprj_io_hldh_n,
shalan0d14e6e2020-08-31 16:50:48 +020042 input [`MPRJ_IO_PADS-1:0] mprj_io_enh,
Tim Edwardsef8312e2020-09-22 17:20:06 -040043 input [`MPRJ_IO_PADS-1:0] mprj_io_inp_dis,
44 input [`MPRJ_IO_PADS-1:0] mprj_io_ib_mode_sel,
Tim Edwards04ba17f2020-10-02 22:27:50 -040045 input [`MPRJ_IO_PADS-1:0] mprj_io_vtrip_sel,
46 input [`MPRJ_IO_PADS-1:0] mprj_io_slow_sel,
47 input [`MPRJ_IO_PADS-1:0] mprj_io_holdover,
Tim Edwardsef8312e2020-09-22 17:20:06 -040048 input [`MPRJ_IO_PADS-1:0] mprj_io_analog_en,
49 input [`MPRJ_IO_PADS-1:0] mprj_io_analog_sel,
50 input [`MPRJ_IO_PADS-1:0] mprj_io_analog_pol,
51 input [`MPRJ_IO_PADS*3-1:0] mprj_io_dm,
shalan0d14e6e2020-08-31 16:50:48 +020052 output [`MPRJ_IO_PADS-1:0] mprj_io_in
53);
Tim Edwardsef8312e2020-09-22 17:20:06 -040054
shalan0d14e6e2020-08-31 16:50:48 +020055 wire analog_a, analog_b;
56 wire vddio_q, vssio_q;
57 // Instantiate power cells for VDD3V3 domain (8 total; 4 high clamps and
Tim Edwardsef8312e2020-09-22 17:20:06 -040058 // 4 low clamps)
59 s8iom0_vdda_hvc_pad vdd3v3hclamp [1:0] (
shalan0d14e6e2020-08-31 16:50:48 +020060 `ABUTMENT_PINS
61 .drn_hvc(),
62 .src_bdy_hvc()
Tim Edwardsef8312e2020-09-22 17:20:06 -040063 );
shalan0d14e6e2020-08-31 16:50:48 +020064
Tim Edwardsef8312e2020-09-22 17:20:06 -040065 s8iom0_vddio_hvc_pad vddiohclamp [1:0] (
shalan0d14e6e2020-08-31 16:50:48 +020066 `ABUTMENT_PINS
67 .drn_hvc(),
68 .src_bdy_hvc()
Tim Edwardsef8312e2020-09-22 17:20:06 -040069 );
shalan0d14e6e2020-08-31 16:50:48 +020070
Tim Edwardsef8312e2020-09-22 17:20:06 -040071 s8iom0_vdda_lvc_pad vdd3v3lclamp [3:0] (
shalan0d14e6e2020-08-31 16:50:48 +020072 `ABUTMENT_PINS
73 .bdy2_b2b(),
74 .drn_lvc1(),
75 .drn_lvc2(),
76 .src_bdy_lvc1(),
77 .src_bdy_lvc2()
Tim Edwardsef8312e2020-09-22 17:20:06 -040078 );
shalan0d14e6e2020-08-31 16:50:48 +020079
Tim Edwardsef8312e2020-09-22 17:20:06 -040080 // Instantiate the core voltage supply (since it is not generated on-chip)
81 // (1.8V) (4 total, 2 high and 2 low clamps)
82 s8iom0_vccd_hvc_pad vdd1v8hclamp [1:0] (
shalan0d14e6e2020-08-31 16:50:48 +020083 `ABUTMENT_PINS
84 .drn_hvc(),
85 .src_bdy_hvc()
Tim Edwardsef8312e2020-09-22 17:20:06 -040086 );
shalan0d14e6e2020-08-31 16:50:48 +020087
Tim Edwardsef8312e2020-09-22 17:20:06 -040088 s8iom0_vccd_lvc_pad vdd1v8lclamp [1:0] (
shalan0d14e6e2020-08-31 16:50:48 +020089 `ABUTMENT_PINS
90 .bdy2_b2b(),
91 .drn_lvc1(),
92 .drn_lvc2(),
93 .src_bdy_lvc1(),
94 .src_bdy_lvc2()
Tim Edwardsef8312e2020-09-22 17:20:06 -040095 );
shalan0d14e6e2020-08-31 16:50:48 +020096
Tim Edwardsef8312e2020-09-22 17:20:06 -040097 // Instantiate ground cells (7 total, 4 high clamps and 3 low clamps)
98 s8iom0_vssa_hvc_pad vsshclamp [3:0] (
shalan0d14e6e2020-08-31 16:50:48 +020099 `ABUTMENT_PINS
100 .drn_hvc(),
101 .src_bdy_hvc()
Tim Edwardsef8312e2020-09-22 17:20:06 -0400102 );
shalan0d14e6e2020-08-31 16:50:48 +0200103
Tim Edwardsef8312e2020-09-22 17:20:06 -0400104 s8iom0_vssa_lvc_pad vssalclamp (
shalan0d14e6e2020-08-31 16:50:48 +0200105 `ABUTMENT_PINS
106 .bdy2_b2b(),
107 .drn_lvc1(),
108 .drn_lvc2(),
109 .src_bdy_lvc1(),
110 .src_bdy_lvc2()
Tim Edwardsef8312e2020-09-22 17:20:06 -0400111 );
shalan0d14e6e2020-08-31 16:50:48 +0200112
Tim Edwardsef8312e2020-09-22 17:20:06 -0400113 s8iom0_vssd_lvc_pad vssdlclamp (
shalan0d14e6e2020-08-31 16:50:48 +0200114 `ABUTMENT_PINS
115 .bdy2_b2b(),
116 .drn_lvc1(),
117 .drn_lvc2(),
118 .src_bdy_lvc1(),
119 .src_bdy_lvc2()
Tim Edwardsef8312e2020-09-22 17:20:06 -0400120 );
shalan0d14e6e2020-08-31 16:50:48 +0200121
Tim Edwardsef8312e2020-09-22 17:20:06 -0400122 s8iom0_vssio_lvc_pad vssiolclamp (
shalan0d14e6e2020-08-31 16:50:48 +0200123 `ABUTMENT_PINS
124 .bdy2_b2b(),
125 .drn_lvc1(),
126 .drn_lvc2(),
127 .src_bdy_lvc1(),
128 .src_bdy_lvc2()
Tim Edwardsef8312e2020-09-22 17:20:06 -0400129 );
shalan0d14e6e2020-08-31 16:50:48 +0200130
Tim Edwards04ba17f2020-10-02 22:27:50 -0400131 wire [2:0] dm_all =
132 {gpio_mode1_core, gpio_mode1_core, gpio_mode0_core};
shalan0d14e6e2020-08-31 16:50:48 +0200133 wire[2:0] flash_io0_mode =
134 {flash_io0_ieb_core, flash_io0_ieb_core, flash_io0_oeb_core};
135 wire[2:0] flash_io1_mode =
136 {flash_io1_ieb_core, flash_io1_ieb_core, flash_io1_oeb_core};
shalan0d14e6e2020-08-31 16:50:48 +0200137
Tim Edwards04ba17f2020-10-02 22:27:50 -0400138 // GPIO pad
139 `INOUT_PAD(
140 gpio, gpio_in_core, gpio_out_core,
shalan0d14e6e2020-08-31 16:50:48 +0200141 gpio_inenb_core, gpio_outenb_core, dm_all);
142
143 // Flash pads
144 `INOUT_PAD(
145 flash_io0, flash_io0_di_core, flash_io0_do_core,
146 flash_io0_ieb_core, flash_io0_oeb_core, flash_io0_mode);
147 `INOUT_PAD(
148 flash_io1, flash_io1_di_core, flash_io1_do_core,
149 flash_io1_ieb_core, flash_io1_oeb_core, flash_io1_mode);
shalan0d14e6e2020-08-31 16:50:48 +0200150
Tim Edwardsef8312e2020-09-22 17:20:06 -0400151 `INPUT_PAD(clock, clock_core);
shalan0d14e6e2020-08-31 16:50:48 +0200152
153 // Output Pads
shalan0d14e6e2020-08-31 16:50:48 +0200154 `OUTPUT_PAD(flash_csb, flash_csb_core, flash_csb_ieb_core, flash_csb_oeb_core);
155 `OUTPUT_PAD(flash_clk, flash_clk_core, flash_clk_ieb_core, flash_clk_oeb_core);
156
shalan0d14e6e2020-08-31 16:50:48 +0200157
158 // NOTE: The analog_out pad from the raven chip has been replaced by
Tim Edwards04ba17f2020-10-02 22:27:50 -0400159 // the digital reset input resetb on caravel due to the lack of an on-board
Tim Edwardsef8312e2020-09-22 17:20:06 -0400160 // power-on-reset circuit. The XRES pad is used for providing a glitch-
161 // free reset.
Tim Edwards04ba17f2020-10-02 22:27:50 -0400162 s8iom0s8_top_xres4v2 resetb_pad (
shalan0d14e6e2020-08-31 16:50:48 +0200163 `ABUTMENT_PINS
Tim Edwardsef8312e2020-09-22 17:20:06 -0400164 `ifndef TOP_ROUTING
Tim Edwards04ba17f2020-10-02 22:27:50 -0400165 .pad(resetb),
Tim Edwardsef8312e2020-09-22 17:20:06 -0400166 `endif
shalan0d14e6e2020-08-31 16:50:48 +0200167 .tie_weak_hi_h(xresloop), // Loop-back connection to pad through pad_a_esd_h
168 .tie_hi_esd(),
169 .tie_lo_esd(),
170 .pad_a_esd_h(xresloop),
171 .xres_h_n(porb_h),
172 .disable_pullup_h(vss), // 0 = enable pull-up on reset pad
Tim Edwardsef8312e2020-09-22 17:20:06 -0400173 .enable_h(vdd3v3), // Power-on-reset to the power-on-reset input??
shalan0d14e6e2020-08-31 16:50:48 +0200174 .en_vddio_sig_h(vss), // No idea.
175 .inp_sel_h(vss), // 1 = use filt_in_h else filter the pad input
176 .filt_in_h(vss), // Alternate input for glitch filter
177 .pullup_h(vss), // Pullup connection for alternate filter input
178 .enable_vddio(vdd1v8)
Tim Edwardsef8312e2020-09-22 17:20:06 -0400179 );
shalan0d14e6e2020-08-31 16:50:48 +0200180
181 // Corner cells (These are overlay cells; it is not clear what is normally
Tim Edwardsef8312e2020-09-22 17:20:06 -0400182 // supposed to go under them.)
183 `ifndef TOP_ROUTING
184 s8iom0_corner_pad corner [3:0] (
shalan0d14e6e2020-08-31 16:50:48 +0200185 .vssio(vss),
Tim Edwardsef8312e2020-09-22 17:20:06 -0400186 .vddio(vdd3v3),
shalan0d14e6e2020-08-31 16:50:48 +0200187 .vddio_q(vddio_q),
188 .vssio_q(vssio_q),
189 .amuxbus_a(analog_a),
190 .amuxbus_b(analog_b),
191 .vssd(vss),
192 .vssa(vss),
Tim Edwardsef8312e2020-09-22 17:20:06 -0400193 .vswitch(vdd3v3),
194 .vdda(vdd3v3),
shalan0d14e6e2020-08-31 16:50:48 +0200195 .vccd(vdd1v8),
196 .vcchib(vdd1v8)
Tim Edwardsef8312e2020-09-22 17:20:06 -0400197 );
198 `endif
shalan0d14e6e2020-08-31 16:50:48 +0200199
200 mprj_io mprj_pads(
Tim Edwardsef8312e2020-09-22 17:20:06 -0400201 .vdd(vdd3v3),
shalan0d14e6e2020-08-31 16:50:48 +0200202 .vdd1v8(vdd1v8),
203 .vss(vss),
204 .vddio_q(vddio_q),
205 .vssio_q(vssio_q),
206 .analog_a(analog_a),
207 .analog_b(analog_b),
208 .io(mprj_io),
209 .io_out(mprj_io_out),
210 .oeb_n(mprj_io_oeb_n),
211 .hldh_n(mprj_io_hldh_n),
212 .enh(mprj_io_enh),
213 .inp_dis(mprj_io_inp_dis),
214 .ib_mode_sel(mprj_io_ib_mode_sel),
215 .analog_en(mprj_io_analog_en),
216 .analog_sel(mprj_io_analog_sel),
217 .analog_pol(mprj_io_analog_pol),
218 .dm(mprj_io_dm),
219 .io_in(mprj_io_in)
220 );
221
Tim Edwardsef8312e2020-09-22 17:20:06 -0400222endmodule