blob: f5cbc53fc2eececd9e71a958c05920452ebed62c [file] [log] [blame]
lowRISC Contributors802543a2019-08-31 12:12:56 +01001// Copyright lowRISC contributors.
2// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3// SPDX-License-Identifier: Apache-2.0
4
Timothy Chen7ff53122019-09-19 15:20:43 -07005module top_earlgrey #(
Philipp Wagnera37bcfa2020-05-19 22:46:41 +01006 parameter bit IbexPipeLine = 0,
7 parameter BootRomInitFile = ""
Timothy Chen7ff53122019-09-19 15:20:43 -07008) (
Timothy Chen371c94d2020-06-30 17:18:14 -07009 // Reset, clocks defined as part of intermodule
lowRISC Contributors802543a2019-08-31 12:12:56 +010010 input rst_ni,
11
12 // JTAG interface
13 input jtag_tck_i,
14 input jtag_tms_i,
15 input jtag_trst_ni,
Michael Schaffner79eb65f2020-05-01 19:12:47 -070016 input jtag_tdi_i,
17 output jtag_tdo_o,
lowRISC Contributors802543a2019-08-31 12:12:56 +010018
Eunchan Kim769065e2019-10-29 17:29:26 -070019 // Multiplexed I/O
20 input [31:0] mio_in_i,
21 output logic [31:0] mio_out_o,
22 output logic [31:0] mio_oe_o,
Eunchan Kim769065e2019-10-29 17:29:26 -070023 // Dedicated I/O
Pirmin Vogelfe6863b2020-05-11 17:30:54 +020024 input [14:0] dio_in_i,
25 output logic [14:0] dio_out_o,
26 output logic [14:0] dio_oe_o,
lowRISC Contributors802543a2019-08-31 12:12:56 +010027
Michael Schaffner79eb65f2020-05-01 19:12:47 -070028 // pad attributes to padring
29 output logic[padctrl_reg_pkg::NMioPads-1:0]
30 [padctrl_reg_pkg::AttrDw-1:0] mio_attr_o,
31 output logic[padctrl_reg_pkg::NDioPads-1:0]
32 [padctrl_reg_pkg::AttrDw-1:0] dio_attr_o,
33
Timothy Chen371c94d2020-06-30 17:18:14 -070034
35 // Inter-module Signal External type
Eunchan Kim5511bbe2020-08-07 14:04:20 -070036 input logic clk_main_i,
37 input logic clk_io_i,
38 input logic clk_usb_i,
39 input logic clk_aon_i,
Timothy Chen1555dce2020-08-11 11:26:50 -070040 input ast_wrapper_pkg::ast_rst_t rstmgr_ast_i,
41 output pwrmgr_pkg::pwr_ast_req_t pwrmgr_pwr_ast_req_o,
42 input pwrmgr_pkg::pwr_ast_rsp_t pwrmgr_pwr_ast_rsp_i,
43 input ast_wrapper_pkg::ast_alert_req_t sensor_ctrl_ast_alert_req_i,
44 output ast_wrapper_pkg::ast_alert_rsp_t sensor_ctrl_ast_alert_rsp_o,
45 input ast_wrapper_pkg::ast_status_t sensor_ctrl_ast_status_i,
46 output logic usbdev_usb_ref_val_o,
47 output logic usbdev_usb_ref_pulse_o,
Timothy Chenac3a8c92020-06-29 20:17:07 -070048 input scan_rst_ni, // reset used for test mode
49 input scanmode_i // 1 for Scan
lowRISC Contributors802543a2019-08-31 12:12:56 +010050);
51
Philipp Wagner086b7032019-10-25 17:06:15 +010052 // JTAG IDCODE for development versions of this code.
53 // Manufacturers of OpenTitan chips must replace this code with one of their
54 // own IDs.
55 // Field structure as defined in the IEEE 1149.1 (JTAG) specification,
56 // section 12.1.1.
Michael Schaffnerd4d5d2f2020-04-17 15:45:55 -070057 localparam logic [31:0] JTAG_IDCODE = {
Philipp Wagner086b7032019-10-25 17:06:15 +010058 4'h0, // Version
59 16'h4F54, // Part Number: "OT"
Philipp Wagnerf57964e2019-11-04 17:57:06 +000060 11'h426, // Manufacturer Identity: Google
Philipp Wagner086b7032019-10-25 17:06:15 +010061 1'b1 // (fixed)
62 };
63
lowRISC Contributors802543a2019-08-31 12:12:56 +010064 import tlul_pkg::*;
65 import top_pkg::*;
66 import tl_main_pkg::*;
lowRISC Contributors802543a2019-08-31 12:12:56 +010067
Eunchan Kim769065e2019-10-29 17:29:26 -070068 // Signals
Michael Schaffner79eb65f2020-05-01 19:12:47 -070069 logic [31:0] mio_p2d;
70 logic [31:0] mio_d2p;
71 logic [31:0] mio_d2p_en;
Pirmin Vogelfe6863b2020-05-11 17:30:54 +020072 logic [14:0] dio_p2d;
73 logic [14:0] dio_d2p;
74 logic [14:0] dio_d2p_en;
Eunchan Kim769065e2019-10-29 17:29:26 -070075 // uart
76 logic cio_uart_rx_p2d;
77 logic cio_uart_tx_d2p;
78 logic cio_uart_tx_en_d2p;
79 // gpio
80 logic [31:0] cio_gpio_gpio_p2d;
81 logic [31:0] cio_gpio_gpio_d2p;
82 logic [31:0] cio_gpio_gpio_en_d2p;
83 // spi_device
84 logic cio_spi_device_sck_p2d;
85 logic cio_spi_device_csb_p2d;
Scott Johnsonfe79c4b2020-07-08 10:31:08 -070086 logic cio_spi_device_sdi_p2d;
87 logic cio_spi_device_sdo_d2p;
88 logic cio_spi_device_sdo_en_d2p;
Eunchan Kim769065e2019-10-29 17:29:26 -070089 // flash_ctrl
90 // rv_timer
91 // aes
92 // hmac
93 // rv_plic
94 // pinmux
Michael Schaffner79eb65f2020-05-01 19:12:47 -070095 // padctrl
Michael Schaffner666dde12019-10-25 11:57:54 -070096 // alert_handler
Timothy Chen163050b2020-04-13 23:29:29 -070097 // pwrmgr
Timothy Chenc59f7012020-04-16 19:11:42 -070098 // rstmgr
Timothy Chenf56c1b52020-04-28 17:00:43 -070099 // clkmgr
Michael Schaffner666dde12019-10-25 11:57:54 -0700100 // nmi_gen
Pirmin Vogelea91b302020-01-14 18:53:01 +0000101 // usbdev
102 logic cio_usbdev_sense_p2d;
Pirmin Vogelb054fc02020-03-11 11:23:03 +0100103 logic cio_usbdev_d_p2d;
Pirmin Vogelea91b302020-01-14 18:53:01 +0000104 logic cio_usbdev_dp_p2d;
105 logic cio_usbdev_dn_p2d;
Pirmin Vogelb054fc02020-03-11 11:23:03 +0100106 logic cio_usbdev_se0_d2p;
107 logic cio_usbdev_se0_en_d2p;
Pirmin Vogelfe6863b2020-05-11 17:30:54 +0200108 logic cio_usbdev_dp_pullup_d2p;
109 logic cio_usbdev_dp_pullup_en_d2p;
110 logic cio_usbdev_dn_pullup_d2p;
111 logic cio_usbdev_dn_pullup_en_d2p;
Pirmin Vogelb054fc02020-03-11 11:23:03 +0100112 logic cio_usbdev_tx_mode_se_d2p;
113 logic cio_usbdev_tx_mode_se_en_d2p;
114 logic cio_usbdev_suspend_d2p;
115 logic cio_usbdev_suspend_en_d2p;
116 logic cio_usbdev_d_d2p;
117 logic cio_usbdev_d_en_d2p;
Pirmin Vogelea91b302020-01-14 18:53:01 +0000118 logic cio_usbdev_dp_d2p;
119 logic cio_usbdev_dp_en_d2p;
120 logic cio_usbdev_dn_d2p;
121 logic cio_usbdev_dn_en_d2p;
Timothy Chen1555dce2020-08-11 11:26:50 -0700122 // sensor_ctrl
Philipp Wagnera4a9e402020-06-22 12:06:56 +0100123 // otbn
Eunchan Kim769065e2019-10-29 17:29:26 -0700124
125
Michael Schaffnere2193b32020-08-04 14:02:46 -0700126 logic [81:0] intr_vector;
lowRISC Contributors802543a2019-08-31 12:12:56 +0100127 // Interrupt source list
128 logic intr_uart_tx_watermark;
129 logic intr_uart_rx_watermark;
Timothy Chen087d4f42019-12-27 16:04:46 -0800130 logic intr_uart_tx_empty;
lowRISC Contributors802543a2019-08-31 12:12:56 +0100131 logic intr_uart_rx_overflow;
132 logic intr_uart_rx_frame_err;
133 logic intr_uart_rx_break_err;
134 logic intr_uart_rx_timeout;
135 logic intr_uart_rx_parity_err;
136 logic [31:0] intr_gpio_gpio;
Eunchan Kim8c57fe32019-09-02 21:14:24 -0700137 logic intr_spi_device_rxf;
lowRISC Contributors802543a2019-08-31 12:12:56 +0100138 logic intr_spi_device_rxlvl;
lowRISC Contributors802543a2019-08-31 12:12:56 +0100139 logic intr_spi_device_txlvl;
140 logic intr_spi_device_rxerr;
Eunchan Kim546c0d42019-09-24 15:07:06 -0700141 logic intr_spi_device_rxoverflow;
142 logic intr_spi_device_txunderflow;
lowRISC Contributors802543a2019-08-31 12:12:56 +0100143 logic intr_flash_ctrl_prog_empty;
144 logic intr_flash_ctrl_prog_lvl;
145 logic intr_flash_ctrl_rd_full;
146 logic intr_flash_ctrl_rd_lvl;
147 logic intr_flash_ctrl_op_done;
148 logic intr_flash_ctrl_op_error;
149 logic intr_rv_timer_timer_expired_0_0;
150 logic intr_hmac_hmac_done;
Eunchan Kimd9d69aa2020-03-20 10:21:11 -0700151 logic intr_hmac_fifo_empty;
Eunchan Kim226eab62019-10-18 14:11:29 -0700152 logic intr_hmac_hmac_err;
Michael Schaffner666dde12019-10-25 11:57:54 -0700153 logic intr_alert_handler_classa;
154 logic intr_alert_handler_classb;
155 logic intr_alert_handler_classc;
156 logic intr_alert_handler_classd;
Timothy Chen163050b2020-04-13 23:29:29 -0700157 logic intr_pwrmgr_wakeup;
Michael Schaffner666dde12019-10-25 11:57:54 -0700158 logic intr_nmi_gen_esc0;
159 logic intr_nmi_gen_esc1;
160 logic intr_nmi_gen_esc2;
Pirmin Vogelea91b302020-01-14 18:53:01 +0000161 logic intr_usbdev_pkt_received;
162 logic intr_usbdev_pkt_sent;
163 logic intr_usbdev_disconnected;
164 logic intr_usbdev_host_lost;
165 logic intr_usbdev_link_reset;
166 logic intr_usbdev_link_suspend;
167 logic intr_usbdev_link_resume;
168 logic intr_usbdev_av_empty;
169 logic intr_usbdev_rx_full;
170 logic intr_usbdev_av_overflow;
171 logic intr_usbdev_link_in_err;
172 logic intr_usbdev_rx_crc_err;
173 logic intr_usbdev_rx_pid_err;
174 logic intr_usbdev_rx_bitstuff_err;
175 logic intr_usbdev_frame;
176 logic intr_usbdev_connected;
Philipp Wagnera4a9e402020-06-22 12:06:56 +0100177 logic intr_otbn_done;
178 logic intr_otbn_err;
Michael Schaffner666dde12019-10-25 11:57:54 -0700179
lowRISC Contributors802543a2019-08-31 12:12:56 +0100180
Michael Schaffnerd4d5d2f2020-04-17 15:45:55 -0700181
Michael Schaffner1ba89b82019-11-03 14:25:54 -0800182 logic [0:0] irq_plic;
183 logic [0:0] msip;
Pirmin Vogelea91b302020-01-14 18:53:01 +0000184 logic [6:0] irq_id[1];
185 logic [6:0] unused_irq_id[1];
lowRISC Contributors802543a2019-08-31 12:12:56 +0100186
Michael Schaffner1ba89b82019-11-03 14:25:54 -0800187 // this avoids lint errors
188 assign unused_irq_id = irq_id;
lowRISC Contributors802543a2019-08-31 12:12:56 +0100189
Michael Schaffner666dde12019-10-25 11:57:54 -0700190 // Alert list
Philipp Wagner79725e12020-03-03 23:34:38 +0000191 prim_alert_pkg::alert_tx_t [alert_pkg::NAlerts-1:0] alert_tx;
192 prim_alert_pkg::alert_rx_t [alert_pkg::NAlerts-1:0] alert_rx;
Michael Schaffner666dde12019-10-25 11:57:54 -0700193 // Escalation outputs
Philipp Wagner79725e12020-03-03 23:34:38 +0000194 prim_esc_pkg::esc_tx_t [alert_pkg::N_ESC_SEV-1:0] esc_tx;
195 prim_esc_pkg::esc_rx_t [alert_pkg::N_ESC_SEV-1:0] esc_rx;
Michael Schaffner666dde12019-10-25 11:57:54 -0700196
197
Eunchan Kim40098a92020-04-17 12:22:36 -0700198 // define inter-module signals
199 flash_ctrl_pkg::flash_req_t flash_ctrl_flash_req;
200 flash_ctrl_pkg::flash_rsp_t flash_ctrl_flash_rsp;
Timothy Chenc59f7012020-04-16 19:11:42 -0700201 pwrmgr_pkg::pwr_rst_req_t pwrmgr_pwr_rst_req;
202 pwrmgr_pkg::pwr_rst_rsp_t pwrmgr_pwr_rst_rsp;
Timothy Chenf56c1b52020-04-28 17:00:43 -0700203 pwrmgr_pkg::pwr_clk_req_t pwrmgr_pwr_clk_req;
204 pwrmgr_pkg::pwr_clk_rsp_t pwrmgr_pwr_clk_rsp;
Eunchan Kim5152e882020-08-03 16:26:40 -0700205 logic pwrmgr_wakeups;
Eunchan Kim0f549542020-08-04 10:40:11 -0700206 tlul_pkg::tl_h2d_t rom_tl_req;
207 tlul_pkg::tl_d2h_t rom_tl_rsp;
208 tlul_pkg::tl_h2d_t ram_main_tl_req;
209 tlul_pkg::tl_d2h_t ram_main_tl_rsp;
210 tlul_pkg::tl_h2d_t eflash_tl_req;
211 tlul_pkg::tl_d2h_t eflash_tl_rsp;
212 tlul_pkg::tl_h2d_t main_tl_peri_req;
213 tlul_pkg::tl_d2h_t main_tl_peri_rsp;
214 tlul_pkg::tl_h2d_t flash_ctrl_tl_req;
215 tlul_pkg::tl_d2h_t flash_ctrl_tl_rsp;
216 tlul_pkg::tl_h2d_t hmac_tl_req;
217 tlul_pkg::tl_d2h_t hmac_tl_rsp;
218 tlul_pkg::tl_h2d_t aes_tl_req;
219 tlul_pkg::tl_d2h_t aes_tl_rsp;
220 tlul_pkg::tl_h2d_t rv_plic_tl_req;
221 tlul_pkg::tl_d2h_t rv_plic_tl_rsp;
222 tlul_pkg::tl_h2d_t pinmux_tl_req;
223 tlul_pkg::tl_d2h_t pinmux_tl_rsp;
224 tlul_pkg::tl_h2d_t padctrl_tl_req;
225 tlul_pkg::tl_d2h_t padctrl_tl_rsp;
226 tlul_pkg::tl_h2d_t alert_handler_tl_req;
227 tlul_pkg::tl_d2h_t alert_handler_tl_rsp;
228 tlul_pkg::tl_h2d_t nmi_gen_tl_req;
229 tlul_pkg::tl_d2h_t nmi_gen_tl_rsp;
230 tlul_pkg::tl_h2d_t otbn_tl_req;
231 tlul_pkg::tl_d2h_t otbn_tl_rsp;
232 tlul_pkg::tl_h2d_t uart_tl_req;
233 tlul_pkg::tl_d2h_t uart_tl_rsp;
234 tlul_pkg::tl_h2d_t gpio_tl_req;
235 tlul_pkg::tl_d2h_t gpio_tl_rsp;
236 tlul_pkg::tl_h2d_t spi_device_tl_req;
237 tlul_pkg::tl_d2h_t spi_device_tl_rsp;
238 tlul_pkg::tl_h2d_t rv_timer_tl_req;
239 tlul_pkg::tl_d2h_t rv_timer_tl_rsp;
240 tlul_pkg::tl_h2d_t usbdev_tl_req;
241 tlul_pkg::tl_d2h_t usbdev_tl_rsp;
242 tlul_pkg::tl_h2d_t pwrmgr_tl_req;
243 tlul_pkg::tl_d2h_t pwrmgr_tl_rsp;
244 tlul_pkg::tl_h2d_t rstmgr_tl_req;
245 tlul_pkg::tl_d2h_t rstmgr_tl_rsp;
246 tlul_pkg::tl_h2d_t clkmgr_tl_req;
247 tlul_pkg::tl_d2h_t clkmgr_tl_rsp;
248 tlul_pkg::tl_h2d_t ram_ret_tl_req;
249 tlul_pkg::tl_d2h_t ram_ret_tl_rsp;
Timothy Chen1555dce2020-08-11 11:26:50 -0700250 tlul_pkg::tl_h2d_t sensor_ctrl_tl_req;
251 tlul_pkg::tl_d2h_t sensor_ctrl_tl_rsp;
Timothy Chenc59f7012020-04-16 19:11:42 -0700252 rstmgr_pkg::rstmgr_out_t rstmgr_resets;
253 rstmgr_pkg::rstmgr_cpu_t rstmgr_cpu;
254 pwrmgr_pkg::pwr_cpu_t pwrmgr_pwr_cpu;
Timothy Chenf56c1b52020-04-28 17:00:43 -0700255 clkmgr_pkg::clkmgr_out_t clkmgr_clocks;
Pirmin Vogela2d411d2020-07-13 17:33:42 +0200256 logic aes_idle;
257 clkmgr_pkg::clk_hint_status_t clkmgr_status;
Eunchan Kim0f549542020-08-04 10:40:11 -0700258 tlul_pkg::tl_h2d_t main_tl_corei_req;
259 tlul_pkg::tl_d2h_t main_tl_corei_rsp;
260 tlul_pkg::tl_h2d_t main_tl_cored_req;
261 tlul_pkg::tl_d2h_t main_tl_cored_rsp;
262 tlul_pkg::tl_h2d_t main_tl_dm_sba_req;
263 tlul_pkg::tl_d2h_t main_tl_dm_sba_rsp;
264 tlul_pkg::tl_h2d_t main_tl_debug_mem_req;
265 tlul_pkg::tl_d2h_t main_tl_debug_mem_rsp;
Pirmin Vogela2d411d2020-07-13 17:33:42 +0200266
267 always_comb begin
268 // TODO: So far just aes is connected
269 clkmgr_status.idle = clkmgr_pkg::CLK_HINT_STATUS_DEFAULT;
270 clkmgr_status.idle[0] = aes_idle;
271 end
Timothy Chen80bd8aa2019-10-04 15:57:11 -0700272
Timothy Chen3193b002019-10-04 16:56:05 -0700273 // Non-debug module reset == reset for everything except for the debug module
274 logic ndmreset_req;
275
Timothy Chen3193b002019-10-04 16:56:05 -0700276 // debug request from rv_dm to core
lowRISC Contributors802543a2019-08-31 12:12:56 +0100277 logic debug_req;
278
279 // processor core
280 rv_core_ibex #(
Philipp Wagner25d889222020-04-03 11:52:41 +0100281 .PMPEnable (1),
282 .PMPGranularity (0), // 2^(PMPGranularity+2) == 4 byte granularity
283 .PMPNumRegions (16),
Greg Chadwickdadb1af2020-04-16 17:10:23 +0100284 .MHPMCounterNum (8),
285 .MHPMCounterWidth (40),
286 .RV32E (0),
287 .RV32M (1),
288 .BranchTargetALU (1),
289 .WritebackStage (1),
290 .MultiplierImplementation ("single-cycle"),
Tom Roberts78bb2ae2020-06-03 15:24:22 +0100291 .ICache (0),
292 .ICacheECC (0),
Greg Chadwickdadb1af2020-04-16 17:10:23 +0100293 .DbgTriggerEn (1),
Tom Roberts78bb2ae2020-06-03 15:24:22 +0100294 .SecureIbex (0),
Greg Chadwickdadb1af2020-04-16 17:10:23 +0100295 .DmHaltAddr (ADDR_SPACE_DEBUG_MEM + dm::HaltAddress),
296 .DmExceptionAddr (ADDR_SPACE_DEBUG_MEM + dm::ExceptionAddress),
297 .PipeLine (IbexPipeLine)
Michael Schaffnera39557e2020-03-17 18:30:21 -0700298 ) u_rv_core_ibex (
lowRISC Contributors802543a2019-08-31 12:12:56 +0100299 // clock and reset
Timothy Chenf56c1b52020-04-28 17:00:43 -0700300 .clk_i (clkmgr_clocks.clk_proc_main),
Timothy Chenc59f7012020-04-16 19:11:42 -0700301 .rst_ni (rstmgr_resets.rst_sys_n),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100302 .test_en_i (1'b0),
303 // static pinning
Greg Chadwick53ef2ec2019-09-03 14:53:54 +0100304 .hart_id_i (32'b0),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100305 .boot_addr_i (ADDR_SPACE_ROM),
306 // TL-UL buses
Eunchan Kim0f549542020-08-04 10:40:11 -0700307 .tl_i_o (main_tl_corei_req),
308 .tl_i_i (main_tl_corei_rsp),
309 .tl_d_o (main_tl_cored_req),
310 .tl_d_i (main_tl_cored_rsp),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100311 // interrupts
312 .irq_software_i (msip),
313 .irq_timer_i (intr_rv_timer_timer_expired_0_0),
314 .irq_external_i (irq_plic),
Michael Schaffnerbdcbd202020-07-27 12:18:21 -0700315 // escalation input from alert handler (NMI)
316 .esc_tx_i (esc_tx[0]),
317 .esc_rx_o (esc_rx[0]),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100318 // debug interface
319 .debug_req_i (debug_req),
320 // CPU control signals
Pirmin Vogelffc9e832019-09-13 16:16:05 +0100321 .fetch_enable_i (1'b1),
Timothy Chenc59f7012020-04-16 19:11:42 -0700322 .core_sleep_o (pwrmgr_pwr_cpu.core_sleeping)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100323 );
324
325 // Debug Module (RISC-V Debug Spec 0.13)
326 //
327
328 rv_dm #(
Philipp Wagner086b7032019-10-25 17:06:15 +0100329 .NrHarts (1),
330 .IdcodeValue (JTAG_IDCODE)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100331 ) u_dm_top (
Timothy Chenf56c1b52020-04-28 17:00:43 -0700332 .clk_i (clkmgr_clocks.clk_proc_main),
Timothy Chenc59f7012020-04-16 19:11:42 -0700333 .rst_ni (rstmgr_resets.rst_lc_n),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100334 .testmode_i (1'b0),
Timothy Chen3193b002019-10-04 16:56:05 -0700335 .ndmreset_o (ndmreset_req),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100336 .dmactive_o (),
337 .debug_req_o (debug_req),
338 .unavailable_i (1'b0),
339
340 // bus device with debug memory (for execution-based debug)
Eunchan Kim0f549542020-08-04 10:40:11 -0700341 .tl_d_i (main_tl_debug_mem_req),
342 .tl_d_o (main_tl_debug_mem_rsp),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100343
344 // bus host (for system bus accesses, SBA)
Eunchan Kim0f549542020-08-04 10:40:11 -0700345 .tl_h_o (main_tl_dm_sba_req),
346 .tl_h_i (main_tl_dm_sba_rsp),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100347
348 //JTAG
349 .tck_i (jtag_tck_i),
350 .tms_i (jtag_tms_i),
351 .trst_ni (jtag_trst_ni),
Michael Schaffner79eb65f2020-05-01 19:12:47 -0700352 .td_i (jtag_tdi_i),
353 .td_o (jtag_tdo_o),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100354 .tdo_oe_o ( )
355 );
356
Timothy Chenc59f7012020-04-16 19:11:42 -0700357 assign rstmgr_cpu.ndmreset_req = ndmreset_req;
358 assign rstmgr_cpu.rst_cpu_n = rstmgr_resets.rst_sys_n;
359
Timothy Chen44461032019-09-20 15:35:20 -0700360 // ROM device
lowRISC Contributors802543a2019-08-31 12:12:56 +0100361 logic rom_req;
Timothy Chenda2e3442020-02-24 21:37:47 -0800362 logic [11:0] rom_addr;
lowRISC Contributors802543a2019-08-31 12:12:56 +0100363 logic [31:0] rom_rdata;
364 logic rom_rvalid;
365
366 tlul_adapter_sram #(
Timothy Chenda2e3442020-02-24 21:37:47 -0800367 .SramAw(12),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100368 .SramDw(32),
Eunchan Kim6c731a82020-03-04 14:48:52 -0800369 .Outstanding(2),
Timothy Chen44461032019-09-20 15:35:20 -0700370 .ErrOnWrite(1)
Michael Schaffnera39557e2020-03-17 18:30:21 -0700371 ) u_tl_adapter_rom (
Timothy Chenf56c1b52020-04-28 17:00:43 -0700372 .clk_i (clkmgr_clocks.clk_main_infra),
Timothy Chenc59f7012020-04-16 19:11:42 -0700373 .rst_ni (rstmgr_resets.rst_sys_n),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100374
Eunchan Kim0f549542020-08-04 10:40:11 -0700375 .tl_i (rom_tl_req),
376 .tl_o (rom_tl_rsp),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100377
378 .req_o (rom_req),
379 .gnt_i (1'b1), // Always grant as only one requester exists
Timothy Chen44461032019-09-20 15:35:20 -0700380 .we_o (),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100381 .addr_o (rom_addr),
Timothy Chen44461032019-09-20 15:35:20 -0700382 .wdata_o (),
383 .wmask_o (),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100384 .rdata_i (rom_rdata),
385 .rvalid_i (rom_rvalid),
386 .rerror_i (2'b00)
387 );
388
Michael Schaffner0beb8a42020-06-05 23:17:40 -0700389 prim_rom_adv #(
lowRISC Contributors802543a2019-08-31 12:12:56 +0100390 .Width(32),
Philipp Wagnera37bcfa2020-05-19 22:46:41 +0100391 .Depth(4096),
392 .MemInitFile(BootRomInitFile)
Timothy Chen44461032019-09-20 15:35:20 -0700393 ) u_rom_rom (
Timothy Chenf56c1b52020-04-28 17:00:43 -0700394 .clk_i (clkmgr_clocks.clk_main_infra),
Timothy Chenc59f7012020-04-16 19:11:42 -0700395 .rst_ni (rstmgr_resets.rst_sys_n),
Michael Schaffner0beb8a42020-06-05 23:17:40 -0700396 .req_i (rom_req),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100397 .addr_i (rom_addr),
Michael Schaffner0beb8a42020-06-05 23:17:40 -0700398 .rdata_o (rom_rdata),
399 .rvalid_o (rom_rvalid),
400 .cfg_i ('0) // tied off for now
lowRISC Contributors802543a2019-08-31 12:12:56 +0100401 );
Timothy Chen44461032019-09-20 15:35:20 -0700402
lowRISC Contributors802543a2019-08-31 12:12:56 +0100403 // sram device
404 logic ram_main_req;
405 logic ram_main_we;
406 logic [13:0] ram_main_addr;
407 logic [31:0] ram_main_wdata;
408 logic [31:0] ram_main_wmask;
409 logic [31:0] ram_main_rdata;
410 logic ram_main_rvalid;
Philipp Wagnere1efc182020-05-21 18:26:17 +0100411 logic [1:0] ram_main_rerror;
lowRISC Contributors802543a2019-08-31 12:12:56 +0100412
413 tlul_adapter_sram #(
414 .SramAw(14),
415 .SramDw(32),
Eunchan Kim6c731a82020-03-04 14:48:52 -0800416 .Outstanding(2)
Michael Schaffnera39557e2020-03-17 18:30:21 -0700417 ) u_tl_adapter_ram_main (
Timothy Chenf56c1b52020-04-28 17:00:43 -0700418 .clk_i (clkmgr_clocks.clk_main_infra),
Timothy Chenc59f7012020-04-16 19:11:42 -0700419 .rst_ni (rstmgr_resets.rst_sys_n),
Eunchan Kim0f549542020-08-04 10:40:11 -0700420 .tl_i (ram_main_tl_req),
421 .tl_o (ram_main_tl_rsp),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100422
423 .req_o (ram_main_req),
424 .gnt_i (1'b1), // Always grant as only one requester exists
425 .we_o (ram_main_we),
426 .addr_o (ram_main_addr),
427 .wdata_o (ram_main_wdata),
428 .wmask_o (ram_main_wmask),
429 .rdata_i (ram_main_rdata),
430 .rvalid_i (ram_main_rvalid),
Philipp Wagnere1efc182020-05-21 18:26:17 +0100431 .rerror_i (ram_main_rerror)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100432 );
433
Philipp Wagnere1efc182020-05-21 18:26:17 +0100434 prim_ram_1p_adv #(
lowRISC Contributors802543a2019-08-31 12:12:56 +0100435 .Width(32),
436 .Depth(16384),
Philipp Wagnere1efc182020-05-21 18:26:17 +0100437 .DataBitsPerMask(8),
Michael Schaffner25d73cf2020-06-10 22:31:40 -0700438 .CfgW(8),
439 // TODO: enable parity once supported by the simulation infrastructure
440 .EnableParity(0)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100441 ) u_ram1p_ram_main (
Timothy Chenf56c1b52020-04-28 17:00:43 -0700442 .clk_i (clkmgr_clocks.clk_main_infra),
Timothy Chenc59f7012020-04-16 19:11:42 -0700443 .rst_ni (rstmgr_resets.rst_sys_n),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100444
445 .req_i (ram_main_req),
446 .write_i (ram_main_we),
447 .addr_i (ram_main_addr),
448 .wdata_i (ram_main_wdata),
449 .wmask_i (ram_main_wmask),
Philipp Wagnere1efc182020-05-21 18:26:17 +0100450 .rdata_o (ram_main_rdata),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100451 .rvalid_o (ram_main_rvalid),
Philipp Wagnere1efc182020-05-21 18:26:17 +0100452 .rerror_o (ram_main_rerror),
453 .cfg_i ('0)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100454 );
Timothy Chen6e2ba842020-06-29 15:04:13 -0700455 // sram device
456 logic ram_ret_req;
457 logic ram_ret_we;
458 logic [9:0] ram_ret_addr;
459 logic [31:0] ram_ret_wdata;
460 logic [31:0] ram_ret_wmask;
461 logic [31:0] ram_ret_rdata;
462 logic ram_ret_rvalid;
463 logic [1:0] ram_ret_rerror;
464
465 tlul_adapter_sram #(
466 .SramAw(10),
467 .SramDw(32),
468 .Outstanding(2)
469 ) u_tl_adapter_ram_ret (
470 .clk_i (clkmgr_clocks.clk_io_infra),
471 .rst_ni (rstmgr_resets.rst_sys_io_n),
Eunchan Kim0f549542020-08-04 10:40:11 -0700472 .tl_i (ram_ret_tl_req),
473 .tl_o (ram_ret_tl_rsp),
Timothy Chen6e2ba842020-06-29 15:04:13 -0700474
475 .req_o (ram_ret_req),
476 .gnt_i (1'b1), // Always grant as only one requester exists
477 .we_o (ram_ret_we),
478 .addr_o (ram_ret_addr),
479 .wdata_o (ram_ret_wdata),
480 .wmask_o (ram_ret_wmask),
481 .rdata_i (ram_ret_rdata),
482 .rvalid_i (ram_ret_rvalid),
483 .rerror_i (ram_ret_rerror)
484 );
485
486 prim_ram_1p_adv #(
487 .Width(32),
488 .Depth(1024),
489 .DataBitsPerMask(8),
490 .CfgW(8),
491 // TODO: enable parity once supported by the simulation infrastructure
492 .EnableParity(0)
493 ) u_ram1p_ram_ret (
494 .clk_i (clkmgr_clocks.clk_io_infra),
495 .rst_ni (rstmgr_resets.rst_sys_io_n),
496
497 .req_i (ram_ret_req),
498 .write_i (ram_ret_we),
499 .addr_i (ram_ret_addr),
500 .wdata_i (ram_ret_wdata),
501 .wmask_i (ram_ret_wmask),
502 .rdata_o (ram_ret_rdata),
503 .rvalid_o (ram_ret_rvalid),
504 .rerror_o (ram_ret_rerror),
505 .cfg_i ('0)
506 );
lowRISC Contributors802543a2019-08-31 12:12:56 +0100507
lowRISC Contributors802543a2019-08-31 12:12:56 +0100508 // host to flash communication
509 logic flash_host_req;
510 logic flash_host_req_rdy;
511 logic flash_host_req_done;
Timothy Chen14518402020-04-13 15:25:22 -0700512 logic [flash_ctrl_pkg::BusWidth-1:0] flash_host_rdata;
Timothy Chenb35a3402020-06-23 00:14:11 -0700513 logic [flash_ctrl_pkg::BusAddrW-1:0] flash_host_addr;
lowRISC Contributors802543a2019-08-31 12:12:56 +0100514
Timothy Chen5aec5282019-09-10 21:10:56 -0700515 tlul_adapter_sram #(
Timothy Chenb35a3402020-06-23 00:14:11 -0700516 .SramAw(flash_ctrl_pkg::BusAddrW),
Timothy Chen14518402020-04-13 15:25:22 -0700517 .SramDw(flash_ctrl_pkg::BusWidth),
Eunchan Kim6c731a82020-03-04 14:48:52 -0800518 .Outstanding(2),
Timothy Chen5aec5282019-09-10 21:10:56 -0700519 .ByteAccess(0),
520 .ErrOnWrite(1)
Michael Schaffnera39557e2020-03-17 18:30:21 -0700521 ) u_tl_adapter_eflash (
Timothy Chenf56c1b52020-04-28 17:00:43 -0700522 .clk_i (clkmgr_clocks.clk_main_infra),
Timothy Chenc59f7012020-04-16 19:11:42 -0700523 .rst_ni (rstmgr_resets.rst_lc_n),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100524
Eunchan Kim0f549542020-08-04 10:40:11 -0700525 .tl_i (eflash_tl_req),
526 .tl_o (eflash_tl_rsp),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100527
Timothy Chen5aec5282019-09-10 21:10:56 -0700528 .req_o (flash_host_req),
529 .gnt_i (flash_host_req_rdy),
530 .we_o (),
531 .addr_o (flash_host_addr),
532 .wdata_o (),
533 .wmask_o (),
534 .rdata_i (flash_host_rdata),
535 .rvalid_i (flash_host_req_done),
536 .rerror_i (2'b00)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100537 );
538
Timothy Chen14518402020-04-13 15:25:22 -0700539 flash_phy u_flash_eflash (
Timothy Chenf56c1b52020-04-28 17:00:43 -0700540 .clk_i (clkmgr_clocks.clk_main_infra),
Timothy Chenc59f7012020-04-16 19:11:42 -0700541 .rst_ni (rstmgr_resets.rst_lc_n),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100542 .host_req_i (flash_host_req),
543 .host_addr_i (flash_host_addr),
544 .host_req_rdy_o (flash_host_req_rdy),
545 .host_req_done_o (flash_host_req_done),
546 .host_rdata_o (flash_host_rdata),
Eunchan Kim6599ba92020-04-13 15:27:16 -0700547 .flash_ctrl_i (flash_ctrl_flash_req),
548 .flash_ctrl_o (flash_ctrl_flash_rsp)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100549 );
550
551
Michael Schaffner666dde12019-10-25 11:57:54 -0700552
Michael Schaffnera39557e2020-03-17 18:30:21 -0700553 uart u_uart (
Eunchan Kim769065e2019-10-29 17:29:26 -0700554
555 // Input
556 .cio_rx_i (cio_uart_rx_p2d),
557
558 // Output
559 .cio_tx_o (cio_uart_tx_d2p),
560 .cio_tx_en_o (cio_uart_tx_en_d2p),
561
562 // Interrupt
563 .intr_tx_watermark_o (intr_uart_tx_watermark),
564 .intr_rx_watermark_o (intr_uart_rx_watermark),
Timothy Chen087d4f42019-12-27 16:04:46 -0800565 .intr_tx_empty_o (intr_uart_tx_empty),
Eunchan Kim769065e2019-10-29 17:29:26 -0700566 .intr_rx_overflow_o (intr_uart_rx_overflow),
567 .intr_rx_frame_err_o (intr_uart_rx_frame_err),
568 .intr_rx_break_err_o (intr_uart_rx_break_err),
569 .intr_rx_timeout_o (intr_uart_rx_timeout),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100570 .intr_rx_parity_err_o (intr_uart_rx_parity_err),
Eunchan Kim0f549542020-08-04 10:40:11 -0700571
572 // Inter-module signals
573 .tl_i(uart_tl_req),
574 .tl_o(uart_tl_rsp),
Timothy Chen33b3b9d2020-05-08 10:14:17 -0700575 .clk_i (clkmgr_clocks.clk_io_secure),
576 .rst_ni (rstmgr_resets.rst_sys_io_n)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100577 );
578
Michael Schaffnera39557e2020-03-17 18:30:21 -0700579 gpio u_gpio (
Eunchan Kim769065e2019-10-29 17:29:26 -0700580
581 // Input
582 .cio_gpio_i (cio_gpio_gpio_p2d),
583
584 // Output
585 .cio_gpio_o (cio_gpio_gpio_d2p),
586 .cio_gpio_en_o (cio_gpio_gpio_en_d2p),
587
588 // Interrupt
lowRISC Contributors802543a2019-08-31 12:12:56 +0100589 .intr_gpio_o (intr_gpio_gpio),
Eunchan Kim0f549542020-08-04 10:40:11 -0700590
591 // Inter-module signals
592 .tl_i(gpio_tl_req),
593 .tl_o(gpio_tl_rsp),
Timothy Chen33b3b9d2020-05-08 10:14:17 -0700594 .clk_i (clkmgr_clocks.clk_io_peri),
595 .rst_ni (rstmgr_resets.rst_sys_io_n)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100596 );
597
Michael Schaffnera39557e2020-03-17 18:30:21 -0700598 spi_device u_spi_device (
Eunchan Kim769065e2019-10-29 17:29:26 -0700599
600 // Input
Timothy Chenc38f7892020-07-16 18:19:48 -0700601 .cio_sck_i (cio_spi_device_sck_p2d),
602 .cio_csb_i (cio_spi_device_csb_p2d),
603 .cio_sdi_i (cio_spi_device_sdi_p2d),
Eunchan Kim769065e2019-10-29 17:29:26 -0700604
605 // Output
Timothy Chenc38f7892020-07-16 18:19:48 -0700606 .cio_sdo_o (cio_spi_device_sdo_d2p),
607 .cio_sdo_en_o (cio_spi_device_sdo_en_d2p),
Eunchan Kim769065e2019-10-29 17:29:26 -0700608
609 // Interrupt
610 .intr_rxf_o (intr_spi_device_rxf),
611 .intr_rxlvl_o (intr_spi_device_rxlvl),
612 .intr_txlvl_o (intr_spi_device_txlvl),
613 .intr_rxerr_o (intr_spi_device_rxerr),
614 .intr_rxoverflow_o (intr_spi_device_rxoverflow),
Eunchan Kim546c0d42019-09-24 15:07:06 -0700615 .intr_txunderflow_o (intr_spi_device_txunderflow),
Eunchan Kim0f549542020-08-04 10:40:11 -0700616
617 // Inter-module signals
618 .tl_i(spi_device_tl_req),
619 .tl_o(spi_device_tl_rsp),
Eunchan Kim2cfadab2019-10-02 12:41:11 -0700620 .scanmode_i (scanmode_i),
Timothy Chen33b3b9d2020-05-08 10:14:17 -0700621 .clk_i (clkmgr_clocks.clk_io_peri),
Timothy Chenc59f7012020-04-16 19:11:42 -0700622 .rst_ni (rstmgr_resets.rst_spi_device_n)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100623 );
624
Michael Schaffnera39557e2020-03-17 18:30:21 -0700625 flash_ctrl u_flash_ctrl (
Eunchan Kim769065e2019-10-29 17:29:26 -0700626
627 // Interrupt
lowRISC Contributors802543a2019-08-31 12:12:56 +0100628 .intr_prog_empty_o (intr_flash_ctrl_prog_empty),
Eunchan Kim769065e2019-10-29 17:29:26 -0700629 .intr_prog_lvl_o (intr_flash_ctrl_prog_lvl),
630 .intr_rd_full_o (intr_flash_ctrl_rd_full),
631 .intr_rd_lvl_o (intr_flash_ctrl_rd_lvl),
632 .intr_op_done_o (intr_flash_ctrl_op_done),
633 .intr_op_error_o (intr_flash_ctrl_op_error),
634
Eunchan Kime4a85072020-02-05 16:00:00 -0800635 // Inter-module signals
Eunchan Kim6599ba92020-04-13 15:27:16 -0700636 .flash_o(flash_ctrl_flash_req),
637 .flash_i(flash_ctrl_flash_rsp),
Timothy Chenac620652020-06-25 13:48:50 -0700638 .otp_i(flash_ctrl_pkg::OTP_FLASH_DEFAULT),
Eunchan Kim0f549542020-08-04 10:40:11 -0700639 .tl_i(flash_ctrl_tl_req),
640 .tl_o(flash_ctrl_tl_rsp),
Timothy Chenf56c1b52020-04-28 17:00:43 -0700641 .clk_i (clkmgr_clocks.clk_main_infra),
Timothy Chenc59f7012020-04-16 19:11:42 -0700642 .rst_ni (rstmgr_resets.rst_lc_n)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100643 );
644
Michael Schaffnera39557e2020-03-17 18:30:21 -0700645 rv_timer u_rv_timer (
Eunchan Kim769065e2019-10-29 17:29:26 -0700646
647 // Interrupt
lowRISC Contributors802543a2019-08-31 12:12:56 +0100648 .intr_timer_expired_0_0_o (intr_rv_timer_timer_expired_0_0),
Eunchan Kim0f549542020-08-04 10:40:11 -0700649
650 // Inter-module signals
651 .tl_i(rv_timer_tl_req),
652 .tl_o(rv_timer_tl_rsp),
Timothy Chen33b3b9d2020-05-08 10:14:17 -0700653 .clk_i (clkmgr_clocks.clk_io_timers),
654 .rst_ni (rstmgr_resets.rst_sys_io_n)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100655 );
656
Michael Schaffnera39557e2020-03-17 18:30:21 -0700657 aes u_aes (
Pirmin Vogela2d411d2020-07-13 17:33:42 +0200658
Pirmin Vogelbe4bcb72020-04-17 14:43:45 +0200659 // [0]: ctrl_err
660 .alert_tx_o ( alert_tx[0:0] ),
661 .alert_rx_i ( alert_rx[0:0] ),
662
Pirmin Vogela2d411d2020-07-13 17:33:42 +0200663 // Inter-module signals
664 .idle_o(aes_idle),
Eunchan Kim0f549542020-08-04 10:40:11 -0700665 .tl_i(aes_tl_req),
666 .tl_o(aes_tl_rsp),
Timothy Chenf56c1b52020-04-28 17:00:43 -0700667 .clk_i (clkmgr_clocks.clk_main_aes),
Timothy Chenc59f7012020-04-16 19:11:42 -0700668 .rst_ni (rstmgr_resets.rst_sys_n)
Pirmin Vogeld4534382019-10-17 13:18:31 +0100669 );
670
Michael Schaffnera39557e2020-03-17 18:30:21 -0700671 hmac u_hmac (
Eunchan Kim769065e2019-10-29 17:29:26 -0700672
673 // Interrupt
Eunchan Kimd9d69aa2020-03-20 10:21:11 -0700674 .intr_hmac_done_o (intr_hmac_hmac_done),
675 .intr_fifo_empty_o (intr_hmac_fifo_empty),
676 .intr_hmac_err_o (intr_hmac_hmac_err),
Michael Schaffnerd4d5d2f2020-04-17 15:45:55 -0700677
Pirmin Vogelbe4bcb72020-04-17 14:43:45 +0200678 // [1]: msg_push_sha_disabled
679 .alert_tx_o ( alert_tx[1:1] ),
680 .alert_rx_i ( alert_rx[1:1] ),
Eunchan Kim0f549542020-08-04 10:40:11 -0700681
682 // Inter-module signals
683 .tl_i(hmac_tl_req),
684 .tl_o(hmac_tl_rsp),
Timothy Chenf56c1b52020-04-28 17:00:43 -0700685 .clk_i (clkmgr_clocks.clk_main_hmac),
Timothy Chenc59f7012020-04-16 19:11:42 -0700686 .rst_ni (rstmgr_resets.rst_sys_n)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100687 );
688
Michael Schaffnera39557e2020-03-17 18:30:21 -0700689 rv_plic u_rv_plic (
Eunchan Kim0f549542020-08-04 10:40:11 -0700690
691 // Inter-module signals
692 .tl_i(rv_plic_tl_req),
693 .tl_o(rv_plic_tl_rsp),
Eunchan Kim769065e2019-10-29 17:29:26 -0700694
lowRISC Contributors802543a2019-08-31 12:12:56 +0100695 .intr_src_i (intr_vector),
696 .irq_o (irq_plic),
697 .irq_id_o (irq_id),
698 .msip_o (msip),
Timothy Chenf56c1b52020-04-28 17:00:43 -0700699 .clk_i (clkmgr_clocks.clk_main_secure),
Timothy Chenc59f7012020-04-16 19:11:42 -0700700 .rst_ni (rstmgr_resets.rst_sys_n)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100701 );
702
Michael Schaffnera39557e2020-03-17 18:30:21 -0700703 pinmux u_pinmux (
Eunchan Kim769065e2019-10-29 17:29:26 -0700704
Michael Schaffner920e4cc2020-04-28 22:58:12 -0700705 // Inter-module signals
Michael Schaffner39ef7f52020-07-10 21:58:48 -0700706 .lc_pinmux_strap_i('0),
Michael Schaffner920e4cc2020-04-28 22:58:12 -0700707 .lc_pinmux_strap_o(),
Michael Schaffner39ef7f52020-07-10 21:58:48 -0700708 .dft_strap_test_o(),
709 .io_pok_i({pinmux_pkg::NIOPokSignals{1'b1}}),
710 .sleep_en_i(1'b0),
Timothy Chen4ba25312020-06-17 13:08:57 -0700711 .aon_wkup_req_o(pwrmgr_wakeups),
Eunchan Kim0f549542020-08-04 10:40:11 -0700712 .tl_i(pinmux_tl_req),
713 .tl_o(pinmux_tl_rsp),
Eunchan Kim769065e2019-10-29 17:29:26 -0700714
Michael Schaffner79eb65f2020-05-01 19:12:47 -0700715 .periph_to_mio_i (mio_d2p ),
716 .periph_to_mio_oe_i (mio_d2p_en ),
717 .mio_to_periph_o (mio_p2d ),
Michael Schaffner920e4cc2020-04-28 22:58:12 -0700718
719 .mio_out_o,
720 .mio_oe_o,
721 .mio_in_i,
722
Michael Schaffner79eb65f2020-05-01 19:12:47 -0700723 .periph_to_dio_i (dio_d2p ),
724 .periph_to_dio_oe_i (dio_d2p_en ),
725 .dio_to_periph_o (dio_p2d ),
Michael Schaffner920e4cc2020-04-28 22:58:12 -0700726
727 .dio_out_o,
728 .dio_oe_o,
729 .dio_in_i,
Timothy Chenf56c1b52020-04-28 17:00:43 -0700730 .clk_i (clkmgr_clocks.clk_main_secure),
Timothy Chen1faeb3c2020-05-11 22:06:32 -0700731 .clk_aon_i (clkmgr_clocks.clk_io_secure),
Michael Schaffner920e4cc2020-04-28 22:58:12 -0700732 .rst_ni (rstmgr_resets.rst_sys_n),
Timothy Chen1faeb3c2020-05-11 22:06:32 -0700733 .rst_aon_ni (rstmgr_resets.rst_sys_io_n)
Eunchan Kim769065e2019-10-29 17:29:26 -0700734 );
735
Michael Schaffner79eb65f2020-05-01 19:12:47 -0700736 padctrl u_padctrl (
Eunchan Kim0f549542020-08-04 10:40:11 -0700737
738 // Inter-module signals
739 .tl_i(padctrl_tl_req),
740 .tl_o(padctrl_tl_rsp),
Michael Schaffner79eb65f2020-05-01 19:12:47 -0700741
742 .mio_attr_o,
743 .dio_attr_o,
Michael Schaffner79eb65f2020-05-01 19:12:47 -0700744 .clk_i (clkmgr_clocks.clk_main_secure),
745 .rst_ni (rstmgr_resets.rst_sys_n)
746 );
747
Michael Schaffnera39557e2020-03-17 18:30:21 -0700748 alert_handler u_alert_handler (
Michael Schaffner666dde12019-10-25 11:57:54 -0700749
750 // Interrupt
751 .intr_classa_o (intr_alert_handler_classa),
752 .intr_classb_o (intr_alert_handler_classb),
753 .intr_classc_o (intr_alert_handler_classc),
754 .intr_classd_o (intr_alert_handler_classd),
Eunchan Kim0f549542020-08-04 10:40:11 -0700755
756 // Inter-module signals
757 .tl_i(alert_handler_tl_req),
758 .tl_o(alert_handler_tl_rsp),
Michael Schaffner666dde12019-10-25 11:57:54 -0700759 // TODO: wire this to hardware debug circuit
760 .crashdump_o ( ),
761 // TODO: wire this to TRNG
762 .entropy_i ( 1'b0 ),
763 // alert signals
764 .alert_rx_o ( alert_rx ),
765 .alert_tx_i ( alert_tx ),
766 // escalation outputs
767 .esc_rx_i ( esc_rx ),
768 .esc_tx_o ( esc_tx ),
Timothy Chenf56c1b52020-04-28 17:00:43 -0700769 .clk_i (clkmgr_clocks.clk_main_secure),
Timothy Chenc59f7012020-04-16 19:11:42 -0700770 .rst_ni (rstmgr_resets.rst_sys_n)
Michael Schaffner666dde12019-10-25 11:57:54 -0700771 );
772
Timothy Chen163050b2020-04-13 23:29:29 -0700773 pwrmgr u_pwrmgr (
Timothy Chen163050b2020-04-13 23:29:29 -0700774
775 // Interrupt
776 .intr_wakeup_o (intr_pwrmgr_wakeup),
777
778 // Inter-module signals
Timothy Chen1555dce2020-08-11 11:26:50 -0700779 .pwr_ast_o(pwrmgr_pwr_ast_req_o),
780 .pwr_ast_i(pwrmgr_pwr_ast_rsp_i),
Timothy Chenc59f7012020-04-16 19:11:42 -0700781 .pwr_rst_o(pwrmgr_pwr_rst_req),
782 .pwr_rst_i(pwrmgr_pwr_rst_rsp),
Timothy Chenf56c1b52020-04-28 17:00:43 -0700783 .pwr_clk_o(pwrmgr_pwr_clk_req),
784 .pwr_clk_i(pwrmgr_pwr_clk_rsp),
Timothy Chen163050b2020-04-13 23:29:29 -0700785 .pwr_otp_o(),
786 .pwr_otp_i(pwrmgr_pkg::PWR_OTP_RSP_DEFAULT),
787 .pwr_lc_o(),
788 .pwr_lc_i(pwrmgr_pkg::PWR_LC_RSP_DEFAULT),
789 .pwr_flash_i(pwrmgr_pkg::PWR_FLASH_DEFAULT),
Timothy Chenc59f7012020-04-16 19:11:42 -0700790 .pwr_cpu_i(pwrmgr_pwr_cpu),
Timothy Chen4ba25312020-06-17 13:08:57 -0700791 .wakeups_i(pwrmgr_wakeups),
792 .rstreqs_i('0),
Eunchan Kim0f549542020-08-04 10:40:11 -0700793 .tl_i(pwrmgr_tl_req),
794 .tl_o(pwrmgr_tl_rsp),
Timothy Chen371c94d2020-06-30 17:18:14 -0700795 .clk_i (clkmgr_clocks.clk_io_powerup),
796 .clk_slow_i (clkmgr_clocks.clk_aon_powerup),
Timothy Chenc59f7012020-04-16 19:11:42 -0700797 .rst_ni (rstmgr_resets.rst_por_n),
Timothy Chena4cc10d2020-05-08 16:06:20 -0700798 .rst_slow_ni (rstmgr_resets.rst_por_aon_n)
Timothy Chenc59f7012020-04-16 19:11:42 -0700799 );
800
801 rstmgr u_rstmgr (
Timothy Chenc59f7012020-04-16 19:11:42 -0700802
803 // Inter-module signals
804 .pwr_i(pwrmgr_pwr_rst_req),
805 .pwr_o(pwrmgr_pwr_rst_rsp),
806 .resets_o(rstmgr_resets),
Timothy Chen1555dce2020-08-11 11:26:50 -0700807 .ast_i(rstmgr_ast_i),
Timothy Chenc59f7012020-04-16 19:11:42 -0700808 .cpu_i(rstmgr_cpu),
809 .peri_i(rstmgr_pkg::RSTMGR_PERI_DEFAULT),
Eunchan Kim0f549542020-08-04 10:40:11 -0700810 .tl_i(rstmgr_tl_req),
811 .tl_o(rstmgr_tl_rsp),
Timothy Chenac3a8c92020-06-29 20:17:07 -0700812 .scanmode_i (scanmode_i),
813 .scan_rst_ni (scan_rst_ni),
Timothy Chen371c94d2020-06-30 17:18:14 -0700814 .clk_i (clkmgr_clocks.clk_io_powerup),
815 .clk_aon_i (clkmgr_clocks.clk_aon_powerup),
816 .clk_main_i (clkmgr_clocks.clk_main_powerup),
817 .clk_io_i (clkmgr_clocks.clk_io_powerup),
818 .clk_usb_i (clkmgr_clocks.clk_usb_powerup),
819 .clk_io_div2_i (clkmgr_clocks.clk_io_div2_powerup),
Timothy Chenc59f7012020-04-16 19:11:42 -0700820 .rst_ni (rst_ni)
Timothy Chen163050b2020-04-13 23:29:29 -0700821 );
822
Timothy Chenf56c1b52020-04-28 17:00:43 -0700823 clkmgr u_clkmgr (
Timothy Chenf56c1b52020-04-28 17:00:43 -0700824
825 // Inter-module signals
826 .clocks_o(clkmgr_clocks),
Eunchan Kim5511bbe2020-08-07 14:04:20 -0700827 .clk_main_i(clk_main_i),
828 .clk_io_i(clk_io_i),
829 .clk_usb_i(clk_usb_i),
830 .clk_aon_i(clk_aon_i),
Timothy Chenf56c1b52020-04-28 17:00:43 -0700831 .pwr_i(pwrmgr_pwr_clk_req),
832 .pwr_o(pwrmgr_pwr_clk_rsp),
833 .dft_i(clkmgr_pkg::CLK_DFT_DEFAULT),
Pirmin Vogela2d411d2020-07-13 17:33:42 +0200834 .status_i(clkmgr_status),
Eunchan Kim0f549542020-08-04 10:40:11 -0700835 .tl_i(clkmgr_tl_req),
836 .tl_o(clkmgr_tl_rsp),
Timothy Chen371c94d2020-06-30 17:18:14 -0700837 .clk_i (clkmgr_clocks.clk_io_powerup),
Timothy Chena4cc10d2020-05-08 16:06:20 -0700838 .rst_ni (rstmgr_resets.rst_por_io_n),
Timothy Chenf56c1b52020-04-28 17:00:43 -0700839 .rst_main_ni (rstmgr_resets.rst_por_n),
Timothy Chena4cc10d2020-05-08 16:06:20 -0700840 .rst_io_ni (rstmgr_resets.rst_por_io_n),
Timothy Chen371c94d2020-06-30 17:18:14 -0700841 .rst_usb_ni (rstmgr_resets.rst_por_usb_n),
842 .rst_io_div2_ni (rstmgr_resets.rst_por_io_div2_n)
Timothy Chenf56c1b52020-04-28 17:00:43 -0700843 );
844
Michael Schaffnera39557e2020-03-17 18:30:21 -0700845 nmi_gen u_nmi_gen (
Michael Schaffner666dde12019-10-25 11:57:54 -0700846
847 // Interrupt
848 .intr_esc0_o (intr_nmi_gen_esc0),
849 .intr_esc1_o (intr_nmi_gen_esc1),
850 .intr_esc2_o (intr_nmi_gen_esc2),
Eunchan Kim0f549542020-08-04 10:40:11 -0700851
852 // Inter-module signals
853 .tl_i(nmi_gen_tl_req),
854 .tl_o(nmi_gen_tl_rsp),
Michael Schaffner666dde12019-10-25 11:57:54 -0700855 // escalation signal inputs
Michael Schaffnerbdcbd202020-07-27 12:18:21 -0700856 .esc_rx_o ( esc_rx[3:1] ),
857 .esc_tx_i ( esc_tx[3:1] ),
Timothy Chenf56c1b52020-04-28 17:00:43 -0700858 .clk_i (clkmgr_clocks.clk_main_secure),
Timothy Chenc59f7012020-04-16 19:11:42 -0700859 .rst_ni (rstmgr_resets.rst_sys_n)
Michael Schaffner666dde12019-10-25 11:57:54 -0700860 );
861
Michael Schaffnera39557e2020-03-17 18:30:21 -0700862 usbdev u_usbdev (
Pirmin Vogelea91b302020-01-14 18:53:01 +0000863
Pirmin Vogelb054fc02020-03-11 11:23:03 +0100864 // Input
865 .cio_sense_i (cio_usbdev_sense_p2d),
866 .cio_d_i (cio_usbdev_d_p2d),
867 .cio_dp_i (cio_usbdev_dp_p2d),
868 .cio_dn_i (cio_usbdev_dn_p2d),
Pirmin Vogelea91b302020-01-14 18:53:01 +0000869
Pirmin Vogelb054fc02020-03-11 11:23:03 +0100870 // Output
871 .cio_se0_o (cio_usbdev_se0_d2p),
872 .cio_se0_en_o (cio_usbdev_se0_en_d2p),
Pirmin Vogelfe6863b2020-05-11 17:30:54 +0200873 .cio_dp_pullup_o (cio_usbdev_dp_pullup_d2p),
874 .cio_dp_pullup_en_o (cio_usbdev_dp_pullup_en_d2p),
875 .cio_dn_pullup_o (cio_usbdev_dn_pullup_d2p),
876 .cio_dn_pullup_en_o (cio_usbdev_dn_pullup_en_d2p),
Pirmin Vogelb054fc02020-03-11 11:23:03 +0100877 .cio_tx_mode_se_o (cio_usbdev_tx_mode_se_d2p),
878 .cio_tx_mode_se_en_o (cio_usbdev_tx_mode_se_en_d2p),
879 .cio_suspend_o (cio_usbdev_suspend_d2p),
880 .cio_suspend_en_o (cio_usbdev_suspend_en_d2p),
881 .cio_d_o (cio_usbdev_d_d2p),
882 .cio_d_en_o (cio_usbdev_d_en_d2p),
883 .cio_dp_o (cio_usbdev_dp_d2p),
884 .cio_dp_en_o (cio_usbdev_dp_en_d2p),
885 .cio_dn_o (cio_usbdev_dn_d2p),
886 .cio_dn_en_o (cio_usbdev_dn_en_d2p),
Pirmin Vogelea91b302020-01-14 18:53:01 +0000887
888 // Interrupt
889 .intr_pkt_received_o (intr_usbdev_pkt_received),
890 .intr_pkt_sent_o (intr_usbdev_pkt_sent),
891 .intr_disconnected_o (intr_usbdev_disconnected),
892 .intr_host_lost_o (intr_usbdev_host_lost),
893 .intr_link_reset_o (intr_usbdev_link_reset),
894 .intr_link_suspend_o (intr_usbdev_link_suspend),
895 .intr_link_resume_o (intr_usbdev_link_resume),
896 .intr_av_empty_o (intr_usbdev_av_empty),
897 .intr_rx_full_o (intr_usbdev_rx_full),
898 .intr_av_overflow_o (intr_usbdev_av_overflow),
899 .intr_link_in_err_o (intr_usbdev_link_in_err),
900 .intr_rx_crc_err_o (intr_usbdev_rx_crc_err),
901 .intr_rx_pid_err_o (intr_usbdev_rx_pid_err),
902 .intr_rx_bitstuff_err_o (intr_usbdev_rx_bitstuff_err),
903 .intr_frame_o (intr_usbdev_frame),
904 .intr_connected_o (intr_usbdev_connected),
905
Pirmin Vogeldd3a2f02020-05-12 14:59:50 +0200906 // Inter-module signals
Timothy Chen1555dce2020-08-11 11:26:50 -0700907 .usb_ref_val_o(usbdev_usb_ref_val_o),
908 .usb_ref_pulse_o(usbdev_usb_ref_pulse_o),
Eunchan Kim0f549542020-08-04 10:40:11 -0700909 .tl_i(usbdev_tl_req),
910 .tl_o(usbdev_tl_rsp),
Timothy Chen33b3b9d2020-05-08 10:14:17 -0700911 .clk_i (clkmgr_clocks.clk_io_peri),
912 .clk_usb_48mhz_i (clkmgr_clocks.clk_usb_peri),
913 .rst_ni (rstmgr_resets.rst_sys_io_n),
Timothy Chenc59f7012020-04-16 19:11:42 -0700914 .rst_usb_48mhz_ni (rstmgr_resets.rst_usb_n)
Pirmin Vogelea91b302020-01-14 18:53:01 +0000915 );
916
Timothy Chen1555dce2020-08-11 11:26:50 -0700917 sensor_ctrl u_sensor_ctrl (
918
919 // [2]: ast_alerts
920 // [3]: ast_alerts
921 // [4]: ast_alerts
922 // [5]: ast_alerts
923 // [6]: ast_alerts
924 // [7]: ast_alerts
925 // [8]: ast_alerts
926 .alert_tx_o ( alert_tx[8:2] ),
927 .alert_rx_i ( alert_rx[8:2] ),
928
929 // Inter-module signals
930 .ast_alert_i(sensor_ctrl_ast_alert_req_i),
931 .ast_alert_o(sensor_ctrl_ast_alert_rsp_o),
932 .ast_status_i(sensor_ctrl_ast_status_i),
933 .tl_i(sensor_ctrl_tl_req),
934 .tl_o(sensor_ctrl_tl_rsp),
935 .clk_i (clkmgr_clocks.clk_io_secure),
936 .rst_ni (rstmgr_resets.rst_sys_io_n)
937 );
938
Philipp Wagnera4a9e402020-06-22 12:06:56 +0100939 otbn u_otbn (
Philipp Wagnera4a9e402020-06-22 12:06:56 +0100940
941 // Interrupt
942 .intr_done_o (intr_otbn_done),
943 .intr_err_o (intr_otbn_err),
944
Timothy Chen1555dce2020-08-11 11:26:50 -0700945 // [9]: imem_uncorrectable
946 // [10]: dmem_uncorrectable
947 // [11]: reg_uncorrectable
948 .alert_tx_o ( alert_tx[11:9] ),
949 .alert_rx_i ( alert_rx[11:9] ),
Philipp Wagnera4a9e402020-06-22 12:06:56 +0100950
951 // Inter-module signals
952 .idle_o(),
Eunchan Kim0f549542020-08-04 10:40:11 -0700953 .tl_i(otbn_tl_req),
954 .tl_o(otbn_tl_rsp),
Philipp Wagnera4a9e402020-06-22 12:06:56 +0100955 .clk_i (clkmgr_clocks.clk_main_otbn),
956 .rst_ni (rstmgr_resets.rst_sys_n)
957 );
958
lowRISC Contributors802543a2019-08-31 12:12:56 +0100959 // interrupt assignments
960 assign intr_vector = {
Philipp Wagnera4a9e402020-06-22 12:06:56 +0100961 intr_otbn_err,
962 intr_otbn_done,
Timothy Chen163050b2020-04-13 23:29:29 -0700963 intr_pwrmgr_wakeup,
Pirmin Vogelea91b302020-01-14 18:53:01 +0000964 intr_usbdev_connected,
965 intr_usbdev_frame,
966 intr_usbdev_rx_bitstuff_err,
967 intr_usbdev_rx_pid_err,
968 intr_usbdev_rx_crc_err,
969 intr_usbdev_link_in_err,
970 intr_usbdev_av_overflow,
971 intr_usbdev_rx_full,
972 intr_usbdev_av_empty,
973 intr_usbdev_link_resume,
974 intr_usbdev_link_suspend,
975 intr_usbdev_link_reset,
976 intr_usbdev_host_lost,
977 intr_usbdev_disconnected,
978 intr_usbdev_pkt_sent,
979 intr_usbdev_pkt_received,
Michael Schaffner666dde12019-10-25 11:57:54 -0700980 intr_nmi_gen_esc2,
981 intr_nmi_gen_esc1,
982 intr_nmi_gen_esc0,
983 intr_alert_handler_classd,
984 intr_alert_handler_classc,
985 intr_alert_handler_classb,
986 intr_alert_handler_classa,
Eunchan Kim226eab62019-10-18 14:11:29 -0700987 intr_hmac_hmac_err,
Eunchan Kimd9d69aa2020-03-20 10:21:11 -0700988 intr_hmac_fifo_empty,
lowRISC Contributors802543a2019-08-31 12:12:56 +0100989 intr_hmac_hmac_done,
990 intr_flash_ctrl_op_error,
991 intr_flash_ctrl_op_done,
992 intr_flash_ctrl_rd_lvl,
993 intr_flash_ctrl_rd_full,
994 intr_flash_ctrl_prog_lvl,
995 intr_flash_ctrl_prog_empty,
Eunchan Kim546c0d42019-09-24 15:07:06 -0700996 intr_spi_device_txunderflow,
997 intr_spi_device_rxoverflow,
lowRISC Contributors802543a2019-08-31 12:12:56 +0100998 intr_spi_device_rxerr,
999 intr_spi_device_txlvl,
lowRISC Contributors802543a2019-08-31 12:12:56 +01001000 intr_spi_device_rxlvl,
Eunchan Kim8c57fe32019-09-02 21:14:24 -07001001 intr_spi_device_rxf,
lowRISC Contributors802543a2019-08-31 12:12:56 +01001002 intr_uart_rx_parity_err,
1003 intr_uart_rx_timeout,
1004 intr_uart_rx_break_err,
1005 intr_uart_rx_frame_err,
1006 intr_uart_rx_overflow,
Timothy Chen087d4f42019-12-27 16:04:46 -08001007 intr_uart_tx_empty,
lowRISC Contributors802543a2019-08-31 12:12:56 +01001008 intr_uart_rx_watermark,
1009 intr_uart_tx_watermark,
Eunchan Kim88a86152020-04-13 16:12:08 -07001010 intr_gpio_gpio,
1011 1'b 0 // For ID 0.
lowRISC Contributors802543a2019-08-31 12:12:56 +01001012 };
1013
1014 // TL-UL Crossbar
lowRISC Contributors802543a2019-08-31 12:12:56 +01001015 xbar_main u_xbar_main (
Timothy Chenf56c1b52020-04-28 17:00:43 -07001016 .clk_main_i (clkmgr_clocks.clk_main_infra),
Timothy Chen33b3b9d2020-05-08 10:14:17 -07001017 .clk_fixed_i (clkmgr_clocks.clk_io_infra),
Timothy Chenc59f7012020-04-16 19:11:42 -07001018 .rst_main_ni (rstmgr_resets.rst_sys_n),
Timothy Chen33b3b9d2020-05-08 10:14:17 -07001019 .rst_fixed_ni (rstmgr_resets.rst_sys_io_n),
Eunchan Kim0f549542020-08-04 10:40:11 -07001020
1021 // port: tl_corei
1022 .tl_corei_i(main_tl_corei_req),
1023 .tl_corei_o(main_tl_corei_rsp),
1024
1025 // port: tl_cored
1026 .tl_cored_i(main_tl_cored_req),
1027 .tl_cored_o(main_tl_cored_rsp),
1028
1029 // port: tl_dm_sba
1030 .tl_dm_sba_i(main_tl_dm_sba_req),
1031 .tl_dm_sba_o(main_tl_dm_sba_rsp),
1032
1033 // port: tl_rom
1034 .tl_rom_o(rom_tl_req),
1035 .tl_rom_i(rom_tl_rsp),
1036
1037 // port: tl_debug_mem
1038 .tl_debug_mem_o(main_tl_debug_mem_req),
1039 .tl_debug_mem_i(main_tl_debug_mem_rsp),
1040
1041 // port: tl_ram_main
1042 .tl_ram_main_o(ram_main_tl_req),
1043 .tl_ram_main_i(ram_main_tl_rsp),
1044
1045 // port: tl_eflash
1046 .tl_eflash_o(eflash_tl_req),
1047 .tl_eflash_i(eflash_tl_rsp),
1048
1049 // port: tl_peri
1050 .tl_peri_o(main_tl_peri_req),
1051 .tl_peri_i(main_tl_peri_rsp),
1052
1053 // port: tl_flash_ctrl
1054 .tl_flash_ctrl_o(flash_ctrl_tl_req),
1055 .tl_flash_ctrl_i(flash_ctrl_tl_rsp),
1056
1057 // port: tl_hmac
1058 .tl_hmac_o(hmac_tl_req),
1059 .tl_hmac_i(hmac_tl_rsp),
1060
1061 // port: tl_aes
1062 .tl_aes_o(aes_tl_req),
1063 .tl_aes_i(aes_tl_rsp),
1064
1065 // port: tl_rv_plic
1066 .tl_rv_plic_o(rv_plic_tl_req),
1067 .tl_rv_plic_i(rv_plic_tl_rsp),
1068
1069 // port: tl_pinmux
1070 .tl_pinmux_o(pinmux_tl_req),
1071 .tl_pinmux_i(pinmux_tl_rsp),
1072
1073 // port: tl_padctrl
1074 .tl_padctrl_o(padctrl_tl_req),
1075 .tl_padctrl_i(padctrl_tl_rsp),
1076
1077 // port: tl_alert_handler
1078 .tl_alert_handler_o(alert_handler_tl_req),
1079 .tl_alert_handler_i(alert_handler_tl_rsp),
1080
1081 // port: tl_nmi_gen
1082 .tl_nmi_gen_o(nmi_gen_tl_req),
1083 .tl_nmi_gen_i(nmi_gen_tl_rsp),
1084
1085 // port: tl_otbn
1086 .tl_otbn_o(otbn_tl_req),
1087 .tl_otbn_i(otbn_tl_rsp),
1088
lowRISC Contributors802543a2019-08-31 12:12:56 +01001089
1090 .scanmode_i
1091 );
Eunchan Kim55d7ae82019-12-19 17:08:35 -08001092 xbar_peri u_xbar_peri (
Timothy Chen33b3b9d2020-05-08 10:14:17 -07001093 .clk_peri_i (clkmgr_clocks.clk_io_infra),
1094 .rst_peri_ni (rstmgr_resets.rst_sys_io_n),
Eunchan Kim0f549542020-08-04 10:40:11 -07001095
1096 // port: tl_main
1097 .tl_main_i(main_tl_peri_req),
1098 .tl_main_o(main_tl_peri_rsp),
1099
1100 // port: tl_uart
1101 .tl_uart_o(uart_tl_req),
1102 .tl_uart_i(uart_tl_rsp),
1103
1104 // port: tl_gpio
1105 .tl_gpio_o(gpio_tl_req),
1106 .tl_gpio_i(gpio_tl_rsp),
1107
1108 // port: tl_spi_device
1109 .tl_spi_device_o(spi_device_tl_req),
1110 .tl_spi_device_i(spi_device_tl_rsp),
1111
1112 // port: tl_rv_timer
1113 .tl_rv_timer_o(rv_timer_tl_req),
1114 .tl_rv_timer_i(rv_timer_tl_rsp),
1115
1116 // port: tl_usbdev
1117 .tl_usbdev_o(usbdev_tl_req),
1118 .tl_usbdev_i(usbdev_tl_rsp),
1119
1120 // port: tl_pwrmgr
1121 .tl_pwrmgr_o(pwrmgr_tl_req),
1122 .tl_pwrmgr_i(pwrmgr_tl_rsp),
1123
1124 // port: tl_rstmgr
1125 .tl_rstmgr_o(rstmgr_tl_req),
1126 .tl_rstmgr_i(rstmgr_tl_rsp),
1127
1128 // port: tl_clkmgr
1129 .tl_clkmgr_o(clkmgr_tl_req),
1130 .tl_clkmgr_i(clkmgr_tl_rsp),
1131
1132 // port: tl_ram_ret
1133 .tl_ram_ret_o(ram_ret_tl_req),
1134 .tl_ram_ret_i(ram_ret_tl_rsp),
1135
Timothy Chen1555dce2020-08-11 11:26:50 -07001136 // port: tl_sensor_ctrl
1137 .tl_sensor_ctrl_o(sensor_ctrl_tl_req),
1138 .tl_sensor_ctrl_i(sensor_ctrl_tl_rsp),
1139
Eunchan Kim55d7ae82019-12-19 17:08:35 -08001140
1141 .scanmode_i
1142 );
lowRISC Contributors802543a2019-08-31 12:12:56 +01001143
Eunchan Kim769065e2019-10-29 17:29:26 -07001144 // Pinmux connections
Michael Schaffner79eb65f2020-05-01 19:12:47 -07001145 assign mio_d2p = {
Eunchan Kim769065e2019-10-29 17:29:26 -07001146 cio_gpio_gpio_d2p
1147 };
Michael Schaffner79eb65f2020-05-01 19:12:47 -07001148 assign mio_d2p_en = {
Eunchan Kim769065e2019-10-29 17:29:26 -07001149 cio_gpio_gpio_en_d2p
1150 };
1151 assign {
1152 cio_gpio_gpio_p2d
Michael Schaffner79eb65f2020-05-01 19:12:47 -07001153 } = mio_p2d;
Eunchan Kim769065e2019-10-29 17:29:26 -07001154
Michael Schaffner920e4cc2020-04-28 22:58:12 -07001155 // Dedicated IO connections
Michael Schaffner79eb65f2020-05-01 19:12:47 -07001156 // Input-only DIOs have no d2p signals
1157 assign dio_d2p = {
Pirmin Vogelfe6863b2020-05-11 17:30:54 +02001158 1'b0, // DIO14: cio_spi_device_sck
1159 1'b0, // DIO13: cio_spi_device_csb
Scott Johnsonfe79c4b2020-07-08 10:31:08 -07001160 1'b0, // DIO12: cio_spi_device_sdi
1161 cio_spi_device_sdo_d2p, // DIO11
Pirmin Vogelfe6863b2020-05-11 17:30:54 +02001162 1'b0, // DIO10: cio_uart_rx
1163 cio_uart_tx_d2p, // DIO9
1164 1'b0, // DIO8: cio_usbdev_sense
1165 cio_usbdev_se0_d2p, // DIO7
1166 cio_usbdev_dp_pullup_d2p, // DIO6
1167 cio_usbdev_dn_pullup_d2p, // DIO5
Michael Schaffner79eb65f2020-05-01 19:12:47 -07001168 cio_usbdev_tx_mode_se_d2p, // DIO4
1169 cio_usbdev_suspend_d2p, // DIO3
1170 cio_usbdev_d_d2p, // DIO2
1171 cio_usbdev_dp_d2p, // DIO1
1172 cio_usbdev_dn_d2p // DIO0
Michael Schaffner920e4cc2020-04-28 22:58:12 -07001173 };
1174
Michael Schaffner79eb65f2020-05-01 19:12:47 -07001175 assign dio_d2p_en = {
Pirmin Vogelfe6863b2020-05-11 17:30:54 +02001176 1'b0, // DIO14: cio_spi_device_sck
1177 1'b0, // DIO13: cio_spi_device_csb
Scott Johnsonfe79c4b2020-07-08 10:31:08 -07001178 1'b0, // DIO12: cio_spi_device_sdi
1179 cio_spi_device_sdo_en_d2p, // DIO11
Pirmin Vogelfe6863b2020-05-11 17:30:54 +02001180 1'b0, // DIO10: cio_uart_rx
1181 cio_uart_tx_en_d2p, // DIO9
1182 1'b0, // DIO8: cio_usbdev_sense
1183 cio_usbdev_se0_en_d2p, // DIO7
1184 cio_usbdev_dp_pullup_en_d2p, // DIO6
1185 cio_usbdev_dn_pullup_en_d2p, // DIO5
Michael Schaffner79eb65f2020-05-01 19:12:47 -07001186 cio_usbdev_tx_mode_se_en_d2p, // DIO4
1187 cio_usbdev_suspend_en_d2p, // DIO3
1188 cio_usbdev_d_en_d2p, // DIO2
1189 cio_usbdev_dp_en_d2p, // DIO1
1190 cio_usbdev_dn_en_d2p // DIO0
Michael Schaffner920e4cc2020-04-28 22:58:12 -07001191 };
1192
Michael Schaffner79eb65f2020-05-01 19:12:47 -07001193 // Output-only DIOs have no p2d signal
Pirmin Vogelfe6863b2020-05-11 17:30:54 +02001194 assign cio_spi_device_sck_p2d = dio_p2d[14]; // DIO14
1195 assign cio_spi_device_csb_p2d = dio_p2d[13]; // DIO13
Scott Johnsonfe79c4b2020-07-08 10:31:08 -07001196 assign cio_spi_device_sdi_p2d = dio_p2d[12]; // DIO12
1197 // DIO11: cio_spi_device_sdo
Pirmin Vogelfe6863b2020-05-11 17:30:54 +02001198 assign cio_uart_rx_p2d = dio_p2d[10]; // DIO10
1199 // DIO9: cio_uart_tx
1200 assign cio_usbdev_sense_p2d = dio_p2d[8]; // DIO8
1201 // DIO7: cio_usbdev_se0
1202 // DIO6: cio_usbdev_dp_pullup
1203 // DIO5: cio_usbdev_dn_pullup
Michael Schaffner79eb65f2020-05-01 19:12:47 -07001204 // DIO4: cio_usbdev_tx_mode_se
1205 // DIO3: cio_usbdev_suspend
1206 assign cio_usbdev_d_p2d = dio_p2d[2]; // DIO2
1207 assign cio_usbdev_dp_p2d = dio_p2d[1]; // DIO1
1208 assign cio_usbdev_dn_p2d = dio_p2d[0]; // DIO0
Eunchan Kim769065e2019-10-29 17:29:26 -07001209
Nils Graf78607aa2019-09-16 15:47:23 -07001210 // make sure scanmode_i is never X (including during reset)
Eunchan Kim5511bbe2020-08-07 14:04:20 -07001211 `ASSERT_KNOWN(scanmodeKnown, scanmode_i, clk_main_i, 0)
Nils Graf78607aa2019-09-16 15:47:23 -07001212
lowRISC Contributors802543a2019-08-31 12:12:56 +01001213endmodule