blob: dc46ebf1577ecac9358f7172161d78b9c7820145 [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
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,
Tim Edwards44bab472020-10-04 22:09:54 -040036 // porbh, returned to the I/O level shifted down and inverted
37 input por,
shalan0d14e6e2020-08-31 16:50:48 +020038 // Mega-project IOs
Tim Edwards44bab472020-10-04 22:09:54 -040039 inout [`MPRJ_IO_PADS-1:0] mprj_io,
shalan0d14e6e2020-08-31 16:50:48 +020040 input [`MPRJ_IO_PADS-1:0] mprj_io_out,
Tim Edwards44bab472020-10-04 22:09:54 -040041 input [`MPRJ_IO_PADS-1:0] mprj_io_oeb,
Tim Edwardsef8312e2020-09-22 17:20:06 -040042 input [`MPRJ_IO_PADS-1:0] mprj_io_hldh_n,
shalan0d14e6e2020-08-31 16:50:48 +020043 input [`MPRJ_IO_PADS-1:0] mprj_io_enh,
Tim Edwardsef8312e2020-09-22 17:20:06 -040044 input [`MPRJ_IO_PADS-1:0] mprj_io_inp_dis,
45 input [`MPRJ_IO_PADS-1:0] mprj_io_ib_mode_sel,
Tim Edwards04ba17f2020-10-02 22:27:50 -040046 input [`MPRJ_IO_PADS-1:0] mprj_io_vtrip_sel,
47 input [`MPRJ_IO_PADS-1:0] mprj_io_slow_sel,
48 input [`MPRJ_IO_PADS-1:0] mprj_io_holdover,
Tim Edwardsef8312e2020-09-22 17:20:06 -040049 input [`MPRJ_IO_PADS-1:0] mprj_io_analog_en,
50 input [`MPRJ_IO_PADS-1:0] mprj_io_analog_sel,
51 input [`MPRJ_IO_PADS-1:0] mprj_io_analog_pol,
52 input [`MPRJ_IO_PADS*3-1:0] mprj_io_dm,
shalan0d14e6e2020-08-31 16:50:48 +020053 output [`MPRJ_IO_PADS-1:0] mprj_io_in
54);
Tim Edwardsef8312e2020-09-22 17:20:06 -040055
shalan0d14e6e2020-08-31 16:50:48 +020056 wire analog_a, analog_b;
57 wire vddio_q, vssio_q;
58 // Instantiate power cells for VDD3V3 domain (8 total; 4 high clamps and
Tim Edwardsef8312e2020-09-22 17:20:06 -040059 // 4 low clamps)
60 s8iom0_vdda_hvc_pad vdd3v3hclamp [1:0] (
shalan0d14e6e2020-08-31 16:50:48 +020061 `ABUTMENT_PINS
62 .drn_hvc(),
63 .src_bdy_hvc()
Tim Edwardsef8312e2020-09-22 17:20:06 -040064 );
shalan0d14e6e2020-08-31 16:50:48 +020065
Tim Edwardsef8312e2020-09-22 17:20:06 -040066 s8iom0_vddio_hvc_pad vddiohclamp [1:0] (
shalan0d14e6e2020-08-31 16:50:48 +020067 `ABUTMENT_PINS
68 .drn_hvc(),
69 .src_bdy_hvc()
Tim Edwardsef8312e2020-09-22 17:20:06 -040070 );
shalan0d14e6e2020-08-31 16:50:48 +020071
Tim Edwardsef8312e2020-09-22 17:20:06 -040072 s8iom0_vdda_lvc_pad vdd3v3lclamp [3:0] (
shalan0d14e6e2020-08-31 16:50:48 +020073 `ABUTMENT_PINS
74 .bdy2_b2b(),
75 .drn_lvc1(),
76 .drn_lvc2(),
77 .src_bdy_lvc1(),
78 .src_bdy_lvc2()
Tim Edwardsef8312e2020-09-22 17:20:06 -040079 );
shalan0d14e6e2020-08-31 16:50:48 +020080
Tim Edwardsef8312e2020-09-22 17:20:06 -040081 // Instantiate the core voltage supply (since it is not generated on-chip)
82 // (1.8V) (4 total, 2 high and 2 low clamps)
83 s8iom0_vccd_hvc_pad vdd1v8hclamp [1:0] (
shalan0d14e6e2020-08-31 16:50:48 +020084 `ABUTMENT_PINS
85 .drn_hvc(),
86 .src_bdy_hvc()
Tim Edwardsef8312e2020-09-22 17:20:06 -040087 );
shalan0d14e6e2020-08-31 16:50:48 +020088
Tim Edwardsef8312e2020-09-22 17:20:06 -040089 s8iom0_vccd_lvc_pad vdd1v8lclamp [1:0] (
shalan0d14e6e2020-08-31 16:50:48 +020090 `ABUTMENT_PINS
91 .bdy2_b2b(),
92 .drn_lvc1(),
93 .drn_lvc2(),
94 .src_bdy_lvc1(),
95 .src_bdy_lvc2()
Tim Edwardsef8312e2020-09-22 17:20:06 -040096 );
shalan0d14e6e2020-08-31 16:50:48 +020097
Tim Edwardsef8312e2020-09-22 17:20:06 -040098 // Instantiate ground cells (7 total, 4 high clamps and 3 low clamps)
99 s8iom0_vssa_hvc_pad vsshclamp [3:0] (
shalan0d14e6e2020-08-31 16:50:48 +0200100 `ABUTMENT_PINS
101 .drn_hvc(),
102 .src_bdy_hvc()
Tim Edwardsef8312e2020-09-22 17:20:06 -0400103 );
shalan0d14e6e2020-08-31 16:50:48 +0200104
Tim Edwardsef8312e2020-09-22 17:20:06 -0400105 s8iom0_vssa_lvc_pad vssalclamp (
shalan0d14e6e2020-08-31 16:50:48 +0200106 `ABUTMENT_PINS
107 .bdy2_b2b(),
108 .drn_lvc1(),
109 .drn_lvc2(),
110 .src_bdy_lvc1(),
111 .src_bdy_lvc2()
Tim Edwardsef8312e2020-09-22 17:20:06 -0400112 );
shalan0d14e6e2020-08-31 16:50:48 +0200113
Tim Edwardsef8312e2020-09-22 17:20:06 -0400114 s8iom0_vssd_lvc_pad vssdlclamp (
shalan0d14e6e2020-08-31 16:50:48 +0200115 `ABUTMENT_PINS
116 .bdy2_b2b(),
117 .drn_lvc1(),
118 .drn_lvc2(),
119 .src_bdy_lvc1(),
120 .src_bdy_lvc2()
Tim Edwardsef8312e2020-09-22 17:20:06 -0400121 );
shalan0d14e6e2020-08-31 16:50:48 +0200122
Tim Edwardsef8312e2020-09-22 17:20:06 -0400123 s8iom0_vssio_lvc_pad vssiolclamp (
shalan0d14e6e2020-08-31 16:50:48 +0200124 `ABUTMENT_PINS
125 .bdy2_b2b(),
126 .drn_lvc1(),
127 .drn_lvc2(),
128 .src_bdy_lvc1(),
129 .src_bdy_lvc2()
Tim Edwardsef8312e2020-09-22 17:20:06 -0400130 );
shalan0d14e6e2020-08-31 16:50:48 +0200131
Tim Edwards04ba17f2020-10-02 22:27:50 -0400132 wire [2:0] dm_all =
133 {gpio_mode1_core, gpio_mode1_core, gpio_mode0_core};
shalan0d14e6e2020-08-31 16:50:48 +0200134 wire[2:0] flash_io0_mode =
135 {flash_io0_ieb_core, flash_io0_ieb_core, flash_io0_oeb_core};
136 wire[2:0] flash_io1_mode =
137 {flash_io1_ieb_core, flash_io1_ieb_core, flash_io1_oeb_core};
shalan0d14e6e2020-08-31 16:50:48 +0200138
Tim Edwards04ba17f2020-10-02 22:27:50 -0400139 // GPIO pad
140 `INOUT_PAD(
141 gpio, gpio_in_core, gpio_out_core,
shalan0d14e6e2020-08-31 16:50:48 +0200142 gpio_inenb_core, gpio_outenb_core, dm_all);
143
144 // Flash pads
145 `INOUT_PAD(
146 flash_io0, flash_io0_di_core, flash_io0_do_core,
147 flash_io0_ieb_core, flash_io0_oeb_core, flash_io0_mode);
148 `INOUT_PAD(
149 flash_io1, flash_io1_di_core, flash_io1_do_core,
150 flash_io1_ieb_core, flash_io1_oeb_core, flash_io1_mode);
shalan0d14e6e2020-08-31 16:50:48 +0200151
Tim Edwardsef8312e2020-09-22 17:20:06 -0400152 `INPUT_PAD(clock, clock_core);
shalan0d14e6e2020-08-31 16:50:48 +0200153
154 // Output Pads
shalan0d14e6e2020-08-31 16:50:48 +0200155 `OUTPUT_PAD(flash_csb, flash_csb_core, flash_csb_ieb_core, flash_csb_oeb_core);
156 `OUTPUT_PAD(flash_clk, flash_clk_core, flash_clk_ieb_core, flash_clk_oeb_core);
157
shalan0d14e6e2020-08-31 16:50:48 +0200158
159 // NOTE: The analog_out pad from the raven chip has been replaced by
Tim Edwards04ba17f2020-10-02 22:27:50 -0400160 // the digital reset input resetb on caravel due to the lack of an on-board
Tim Edwardsef8312e2020-09-22 17:20:06 -0400161 // power-on-reset circuit. The XRES pad is used for providing a glitch-
162 // free reset.
Tim Edwards04ba17f2020-10-02 22:27:50 -0400163 s8iom0s8_top_xres4v2 resetb_pad (
shalan0d14e6e2020-08-31 16:50:48 +0200164 `ABUTMENT_PINS
Tim Edwardsef8312e2020-09-22 17:20:06 -0400165 `ifndef TOP_ROUTING
Tim Edwards04ba17f2020-10-02 22:27:50 -0400166 .pad(resetb),
Tim Edwardsef8312e2020-09-22 17:20:06 -0400167 `endif
shalan0d14e6e2020-08-31 16:50:48 +0200168 .tie_weak_hi_h(xresloop), // Loop-back connection to pad through pad_a_esd_h
169 .tie_hi_esd(),
170 .tie_lo_esd(),
171 .pad_a_esd_h(xresloop),
172 .xres_h_n(porb_h),
173 .disable_pullup_h(vss), // 0 = enable pull-up on reset pad
Tim Edwardsef8312e2020-09-22 17:20:06 -0400174 .enable_h(vdd3v3), // Power-on-reset to the power-on-reset input??
shalan0d14e6e2020-08-31 16:50:48 +0200175 .en_vddio_sig_h(vss), // No idea.
176 .inp_sel_h(vss), // 1 = use filt_in_h else filter the pad input
177 .filt_in_h(vss), // Alternate input for glitch filter
178 .pullup_h(vss), // Pullup connection for alternate filter input
179 .enable_vddio(vdd1v8)
Tim Edwardsef8312e2020-09-22 17:20:06 -0400180 );
shalan0d14e6e2020-08-31 16:50:48 +0200181
182 // Corner cells (These are overlay cells; it is not clear what is normally
Tim Edwardsef8312e2020-09-22 17:20:06 -0400183 // supposed to go under them.)
184 `ifndef TOP_ROUTING
185 s8iom0_corner_pad corner [3:0] (
shalan0d14e6e2020-08-31 16:50:48 +0200186 .vssio(vss),
Tim Edwardsef8312e2020-09-22 17:20:06 -0400187 .vddio(vdd3v3),
shalan0d14e6e2020-08-31 16:50:48 +0200188 .vddio_q(vddio_q),
189 .vssio_q(vssio_q),
190 .amuxbus_a(analog_a),
191 .amuxbus_b(analog_b),
192 .vssd(vss),
193 .vssa(vss),
Tim Edwardsef8312e2020-09-22 17:20:06 -0400194 .vswitch(vdd3v3),
195 .vdda(vdd3v3),
shalan0d14e6e2020-08-31 16:50:48 +0200196 .vccd(vdd1v8),
197 .vcchib(vdd1v8)
Tim Edwardsef8312e2020-09-22 17:20:06 -0400198 );
199 `endif
shalan0d14e6e2020-08-31 16:50:48 +0200200
201 mprj_io mprj_pads(
Tim Edwards44bab472020-10-04 22:09:54 -0400202 .vdd3v3(vdd3v3),
shalan0d14e6e2020-08-31 16:50:48 +0200203 .vdd1v8(vdd1v8),
204 .vss(vss),
205 .vddio_q(vddio_q),
206 .vssio_q(vssio_q),
207 .analog_a(analog_a),
208 .analog_b(analog_b),
Tim Edwards44bab472020-10-04 22:09:54 -0400209 .porb_h(porb_h),
210 .por(por),
shalan0d14e6e2020-08-31 16:50:48 +0200211 .io(mprj_io),
212 .io_out(mprj_io_out),
Tim Edwards44bab472020-10-04 22:09:54 -0400213 .oeb(mprj_io_oeb),
shalan0d14e6e2020-08-31 16:50:48 +0200214 .hldh_n(mprj_io_hldh_n),
215 .enh(mprj_io_enh),
216 .inp_dis(mprj_io_inp_dis),
217 .ib_mode_sel(mprj_io_ib_mode_sel),
Tim Edwards44bab472020-10-04 22:09:54 -0400218 .vtrip_sel(mprj_io_vtrip_sel),
219 .holdover(mprj_io_holdover),
220 .slow_sel(mprj_io_slow_sel),
shalan0d14e6e2020-08-31 16:50:48 +0200221 .analog_en(mprj_io_analog_en),
222 .analog_sel(mprj_io_analog_sel),
223 .analog_pol(mprj_io_analog_pol),
224 .dm(mprj_io_dm),
225 .io_in(mprj_io_in)
226 );
227
Tim Edwardsef8312e2020-09-22 17:20:06 -0400228endmodule