blob: dfb5f5e708fac6489af71f240ba03c2ea6f64dad [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 Chen437fd9a2020-08-26 12:48:40 -070040 input rstmgr_pkg::rstmgr_ast_t rstmgr_ast_i,
Timothy Chen1555dce2020-08-11 11:26:50 -070041 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 Chenfb34fe32020-08-26 17:13:19 -070048 output tlul_pkg::tl_h2d_t ast_tl_req_o,
49 input tlul_pkg::tl_d2h_t ast_tl_rsp_i,
Timothy Chen437fd9a2020-08-26 12:48:40 -070050 output clkmgr_pkg::clkmgr_ast_out_t clks_ast_o,
51 output rstmgr_pkg::rstmgr_ast_out_t rsts_ast_o,
Timothy Chenac3a8c92020-06-29 20:17:07 -070052 input scan_rst_ni, // reset used for test mode
53 input scanmode_i // 1 for Scan
lowRISC Contributors802543a2019-08-31 12:12:56 +010054);
55
Philipp Wagner086b7032019-10-25 17:06:15 +010056 // JTAG IDCODE for development versions of this code.
57 // Manufacturers of OpenTitan chips must replace this code with one of their
58 // own IDs.
59 // Field structure as defined in the IEEE 1149.1 (JTAG) specification,
60 // section 12.1.1.
Michael Schaffnerd4d5d2f2020-04-17 15:45:55 -070061 localparam logic [31:0] JTAG_IDCODE = {
Philipp Wagner086b7032019-10-25 17:06:15 +010062 4'h0, // Version
63 16'h4F54, // Part Number: "OT"
Philipp Wagnerf57964e2019-11-04 17:57:06 +000064 11'h426, // Manufacturer Identity: Google
Philipp Wagner086b7032019-10-25 17:06:15 +010065 1'b1 // (fixed)
66 };
67
lowRISC Contributors802543a2019-08-31 12:12:56 +010068 import tlul_pkg::*;
69 import top_pkg::*;
70 import tl_main_pkg::*;
lowRISC Contributors802543a2019-08-31 12:12:56 +010071
Eunchan Kim769065e2019-10-29 17:29:26 -070072 // Signals
Michael Schaffner79eb65f2020-05-01 19:12:47 -070073 logic [31:0] mio_p2d;
74 logic [31:0] mio_d2p;
75 logic [31:0] mio_d2p_en;
Pirmin Vogelfe6863b2020-05-11 17:30:54 +020076 logic [14:0] dio_p2d;
77 logic [14:0] dio_d2p;
78 logic [14:0] dio_d2p_en;
Eunchan Kim769065e2019-10-29 17:29:26 -070079 // uart
80 logic cio_uart_rx_p2d;
81 logic cio_uart_tx_d2p;
82 logic cio_uart_tx_en_d2p;
83 // gpio
84 logic [31:0] cio_gpio_gpio_p2d;
85 logic [31:0] cio_gpio_gpio_d2p;
86 logic [31:0] cio_gpio_gpio_en_d2p;
87 // spi_device
88 logic cio_spi_device_sck_p2d;
89 logic cio_spi_device_csb_p2d;
Scott Johnsonfe79c4b2020-07-08 10:31:08 -070090 logic cio_spi_device_sdi_p2d;
91 logic cio_spi_device_sdo_d2p;
92 logic cio_spi_device_sdo_en_d2p;
Eunchan Kim769065e2019-10-29 17:29:26 -070093 // flash_ctrl
94 // rv_timer
95 // aes
96 // hmac
97 // rv_plic
98 // pinmux
Michael Schaffner79eb65f2020-05-01 19:12:47 -070099 // padctrl
Michael Schaffner666dde12019-10-25 11:57:54 -0700100 // alert_handler
Timothy Chen163050b2020-04-13 23:29:29 -0700101 // pwrmgr
Timothy Chenc59f7012020-04-16 19:11:42 -0700102 // rstmgr
Timothy Chenf56c1b52020-04-28 17:00:43 -0700103 // clkmgr
Michael Schaffner666dde12019-10-25 11:57:54 -0700104 // nmi_gen
Pirmin Vogelea91b302020-01-14 18:53:01 +0000105 // usbdev
106 logic cio_usbdev_sense_p2d;
Pirmin Vogelb054fc02020-03-11 11:23:03 +0100107 logic cio_usbdev_d_p2d;
Pirmin Vogelea91b302020-01-14 18:53:01 +0000108 logic cio_usbdev_dp_p2d;
109 logic cio_usbdev_dn_p2d;
Pirmin Vogelb054fc02020-03-11 11:23:03 +0100110 logic cio_usbdev_se0_d2p;
111 logic cio_usbdev_se0_en_d2p;
Pirmin Vogelfe6863b2020-05-11 17:30:54 +0200112 logic cio_usbdev_dp_pullup_d2p;
113 logic cio_usbdev_dp_pullup_en_d2p;
114 logic cio_usbdev_dn_pullup_d2p;
115 logic cio_usbdev_dn_pullup_en_d2p;
Pirmin Vogelb054fc02020-03-11 11:23:03 +0100116 logic cio_usbdev_tx_mode_se_d2p;
117 logic cio_usbdev_tx_mode_se_en_d2p;
118 logic cio_usbdev_suspend_d2p;
119 logic cio_usbdev_suspend_en_d2p;
120 logic cio_usbdev_d_d2p;
121 logic cio_usbdev_d_en_d2p;
Pirmin Vogelea91b302020-01-14 18:53:01 +0000122 logic cio_usbdev_dp_d2p;
123 logic cio_usbdev_dp_en_d2p;
124 logic cio_usbdev_dn_d2p;
125 logic cio_usbdev_dn_en_d2p;
Timothy Chen1555dce2020-08-11 11:26:50 -0700126 // sensor_ctrl
Philipp Wagnera4a9e402020-06-22 12:06:56 +0100127 // otbn
Eunchan Kim769065e2019-10-29 17:29:26 -0700128
129
Michael Schaffnere2193b32020-08-04 14:02:46 -0700130 logic [81:0] intr_vector;
lowRISC Contributors802543a2019-08-31 12:12:56 +0100131 // Interrupt source list
132 logic intr_uart_tx_watermark;
133 logic intr_uart_rx_watermark;
Timothy Chen087d4f42019-12-27 16:04:46 -0800134 logic intr_uart_tx_empty;
lowRISC Contributors802543a2019-08-31 12:12:56 +0100135 logic intr_uart_rx_overflow;
136 logic intr_uart_rx_frame_err;
137 logic intr_uart_rx_break_err;
138 logic intr_uart_rx_timeout;
139 logic intr_uart_rx_parity_err;
140 logic [31:0] intr_gpio_gpio;
Eunchan Kim8c57fe32019-09-02 21:14:24 -0700141 logic intr_spi_device_rxf;
lowRISC Contributors802543a2019-08-31 12:12:56 +0100142 logic intr_spi_device_rxlvl;
lowRISC Contributors802543a2019-08-31 12:12:56 +0100143 logic intr_spi_device_txlvl;
144 logic intr_spi_device_rxerr;
Eunchan Kim546c0d42019-09-24 15:07:06 -0700145 logic intr_spi_device_rxoverflow;
146 logic intr_spi_device_txunderflow;
lowRISC Contributors802543a2019-08-31 12:12:56 +0100147 logic intr_flash_ctrl_prog_empty;
148 logic intr_flash_ctrl_prog_lvl;
149 logic intr_flash_ctrl_rd_full;
150 logic intr_flash_ctrl_rd_lvl;
151 logic intr_flash_ctrl_op_done;
152 logic intr_flash_ctrl_op_error;
153 logic intr_rv_timer_timer_expired_0_0;
154 logic intr_hmac_hmac_done;
Eunchan Kimd9d69aa2020-03-20 10:21:11 -0700155 logic intr_hmac_fifo_empty;
Eunchan Kim226eab62019-10-18 14:11:29 -0700156 logic intr_hmac_hmac_err;
Michael Schaffner666dde12019-10-25 11:57:54 -0700157 logic intr_alert_handler_classa;
158 logic intr_alert_handler_classb;
159 logic intr_alert_handler_classc;
160 logic intr_alert_handler_classd;
Timothy Chen163050b2020-04-13 23:29:29 -0700161 logic intr_pwrmgr_wakeup;
Michael Schaffner666dde12019-10-25 11:57:54 -0700162 logic intr_nmi_gen_esc0;
163 logic intr_nmi_gen_esc1;
164 logic intr_nmi_gen_esc2;
Pirmin Vogelea91b302020-01-14 18:53:01 +0000165 logic intr_usbdev_pkt_received;
166 logic intr_usbdev_pkt_sent;
167 logic intr_usbdev_disconnected;
168 logic intr_usbdev_host_lost;
169 logic intr_usbdev_link_reset;
170 logic intr_usbdev_link_suspend;
171 logic intr_usbdev_link_resume;
172 logic intr_usbdev_av_empty;
173 logic intr_usbdev_rx_full;
174 logic intr_usbdev_av_overflow;
175 logic intr_usbdev_link_in_err;
176 logic intr_usbdev_rx_crc_err;
177 logic intr_usbdev_rx_pid_err;
178 logic intr_usbdev_rx_bitstuff_err;
179 logic intr_usbdev_frame;
180 logic intr_usbdev_connected;
Philipp Wagnera4a9e402020-06-22 12:06:56 +0100181 logic intr_otbn_done;
182 logic intr_otbn_err;
Michael Schaffner666dde12019-10-25 11:57:54 -0700183
lowRISC Contributors802543a2019-08-31 12:12:56 +0100184
Michael Schaffnerd4d5d2f2020-04-17 15:45:55 -0700185
Michael Schaffner1ba89b82019-11-03 14:25:54 -0800186 logic [0:0] irq_plic;
187 logic [0:0] msip;
Pirmin Vogelea91b302020-01-14 18:53:01 +0000188 logic [6:0] irq_id[1];
189 logic [6:0] unused_irq_id[1];
lowRISC Contributors802543a2019-08-31 12:12:56 +0100190
Michael Schaffner1ba89b82019-11-03 14:25:54 -0800191 // this avoids lint errors
192 assign unused_irq_id = irq_id;
lowRISC Contributors802543a2019-08-31 12:12:56 +0100193
Michael Schaffner666dde12019-10-25 11:57:54 -0700194 // Alert list
Philipp Wagner79725e12020-03-03 23:34:38 +0000195 prim_alert_pkg::alert_tx_t [alert_pkg::NAlerts-1:0] alert_tx;
196 prim_alert_pkg::alert_rx_t [alert_pkg::NAlerts-1:0] alert_rx;
Michael Schaffner666dde12019-10-25 11:57:54 -0700197 // Escalation outputs
Philipp Wagner79725e12020-03-03 23:34:38 +0000198 prim_esc_pkg::esc_tx_t [alert_pkg::N_ESC_SEV-1:0] esc_tx;
199 prim_esc_pkg::esc_rx_t [alert_pkg::N_ESC_SEV-1:0] esc_rx;
Michael Schaffner666dde12019-10-25 11:57:54 -0700200
201
Eunchan Kim40098a92020-04-17 12:22:36 -0700202 // define inter-module signals
203 flash_ctrl_pkg::flash_req_t flash_ctrl_flash_req;
204 flash_ctrl_pkg::flash_rsp_t flash_ctrl_flash_rsp;
Timothy Chenc59f7012020-04-16 19:11:42 -0700205 pwrmgr_pkg::pwr_rst_req_t pwrmgr_pwr_rst_req;
206 pwrmgr_pkg::pwr_rst_rsp_t pwrmgr_pwr_rst_rsp;
Timothy Chenf56c1b52020-04-28 17:00:43 -0700207 pwrmgr_pkg::pwr_clk_req_t pwrmgr_pwr_clk_req;
208 pwrmgr_pkg::pwr_clk_rsp_t pwrmgr_pwr_clk_rsp;
Eunchan Kim5152e882020-08-03 16:26:40 -0700209 logic pwrmgr_wakeups;
Eunchan Kim0f549542020-08-04 10:40:11 -0700210 tlul_pkg::tl_h2d_t rom_tl_req;
211 tlul_pkg::tl_d2h_t rom_tl_rsp;
212 tlul_pkg::tl_h2d_t ram_main_tl_req;
213 tlul_pkg::tl_d2h_t ram_main_tl_rsp;
214 tlul_pkg::tl_h2d_t eflash_tl_req;
215 tlul_pkg::tl_d2h_t eflash_tl_rsp;
216 tlul_pkg::tl_h2d_t main_tl_peri_req;
217 tlul_pkg::tl_d2h_t main_tl_peri_rsp;
218 tlul_pkg::tl_h2d_t flash_ctrl_tl_req;
219 tlul_pkg::tl_d2h_t flash_ctrl_tl_rsp;
220 tlul_pkg::tl_h2d_t hmac_tl_req;
221 tlul_pkg::tl_d2h_t hmac_tl_rsp;
222 tlul_pkg::tl_h2d_t aes_tl_req;
223 tlul_pkg::tl_d2h_t aes_tl_rsp;
224 tlul_pkg::tl_h2d_t rv_plic_tl_req;
225 tlul_pkg::tl_d2h_t rv_plic_tl_rsp;
226 tlul_pkg::tl_h2d_t pinmux_tl_req;
227 tlul_pkg::tl_d2h_t pinmux_tl_rsp;
228 tlul_pkg::tl_h2d_t padctrl_tl_req;
229 tlul_pkg::tl_d2h_t padctrl_tl_rsp;
230 tlul_pkg::tl_h2d_t alert_handler_tl_req;
231 tlul_pkg::tl_d2h_t alert_handler_tl_rsp;
232 tlul_pkg::tl_h2d_t nmi_gen_tl_req;
233 tlul_pkg::tl_d2h_t nmi_gen_tl_rsp;
234 tlul_pkg::tl_h2d_t otbn_tl_req;
235 tlul_pkg::tl_d2h_t otbn_tl_rsp;
236 tlul_pkg::tl_h2d_t uart_tl_req;
237 tlul_pkg::tl_d2h_t uart_tl_rsp;
238 tlul_pkg::tl_h2d_t gpio_tl_req;
239 tlul_pkg::tl_d2h_t gpio_tl_rsp;
240 tlul_pkg::tl_h2d_t spi_device_tl_req;
241 tlul_pkg::tl_d2h_t spi_device_tl_rsp;
242 tlul_pkg::tl_h2d_t rv_timer_tl_req;
243 tlul_pkg::tl_d2h_t rv_timer_tl_rsp;
244 tlul_pkg::tl_h2d_t usbdev_tl_req;
245 tlul_pkg::tl_d2h_t usbdev_tl_rsp;
246 tlul_pkg::tl_h2d_t pwrmgr_tl_req;
247 tlul_pkg::tl_d2h_t pwrmgr_tl_rsp;
248 tlul_pkg::tl_h2d_t rstmgr_tl_req;
249 tlul_pkg::tl_d2h_t rstmgr_tl_rsp;
250 tlul_pkg::tl_h2d_t clkmgr_tl_req;
251 tlul_pkg::tl_d2h_t clkmgr_tl_rsp;
252 tlul_pkg::tl_h2d_t ram_ret_tl_req;
253 tlul_pkg::tl_d2h_t ram_ret_tl_rsp;
Timothy Chen1555dce2020-08-11 11:26:50 -0700254 tlul_pkg::tl_h2d_t sensor_ctrl_tl_req;
255 tlul_pkg::tl_d2h_t sensor_ctrl_tl_rsp;
Timothy Chenc59f7012020-04-16 19:11:42 -0700256 rstmgr_pkg::rstmgr_out_t rstmgr_resets;
257 rstmgr_pkg::rstmgr_cpu_t rstmgr_cpu;
258 pwrmgr_pkg::pwr_cpu_t pwrmgr_pwr_cpu;
Timothy Chenf56c1b52020-04-28 17:00:43 -0700259 clkmgr_pkg::clkmgr_out_t clkmgr_clocks;
Pirmin Vogela2d411d2020-07-13 17:33:42 +0200260 logic aes_idle;
261 clkmgr_pkg::clk_hint_status_t clkmgr_status;
Eunchan Kim0f549542020-08-04 10:40:11 -0700262 tlul_pkg::tl_h2d_t main_tl_corei_req;
263 tlul_pkg::tl_d2h_t main_tl_corei_rsp;
264 tlul_pkg::tl_h2d_t main_tl_cored_req;
265 tlul_pkg::tl_d2h_t main_tl_cored_rsp;
266 tlul_pkg::tl_h2d_t main_tl_dm_sba_req;
267 tlul_pkg::tl_d2h_t main_tl_dm_sba_rsp;
268 tlul_pkg::tl_h2d_t main_tl_debug_mem_req;
269 tlul_pkg::tl_d2h_t main_tl_debug_mem_rsp;
Pirmin Vogela2d411d2020-07-13 17:33:42 +0200270
271 always_comb begin
272 // TODO: So far just aes is connected
273 clkmgr_status.idle = clkmgr_pkg::CLK_HINT_STATUS_DEFAULT;
274 clkmgr_status.idle[0] = aes_idle;
275 end
Timothy Chen80bd8aa2019-10-04 15:57:11 -0700276
Timothy Chen3193b002019-10-04 16:56:05 -0700277 // Non-debug module reset == reset for everything except for the debug module
278 logic ndmreset_req;
279
Timothy Chen3193b002019-10-04 16:56:05 -0700280 // debug request from rv_dm to core
lowRISC Contributors802543a2019-08-31 12:12:56 +0100281 logic debug_req;
282
283 // processor core
284 rv_core_ibex #(
Philipp Wagner25d889222020-04-03 11:52:41 +0100285 .PMPEnable (1),
286 .PMPGranularity (0), // 2^(PMPGranularity+2) == 4 byte granularity
287 .PMPNumRegions (16),
Pirmin Vogel185d1bf2020-08-27 13:30:10 +0200288 .MHPMCounterNum (10),
289 .MHPMCounterWidth (32),
Greg Chadwickdadb1af2020-04-16 17:10:23 +0100290 .RV32E (0),
Pirmin Vogele3814642020-08-27 12:44:23 +0200291 .RV32M (ibex_pkg::RV32MSingleCycle),
292 .RV32B (ibex_pkg::RV32BNone),
293 .RegFile (ibex_pkg::RegFileFF),
Greg Chadwickdadb1af2020-04-16 17:10:23 +0100294 .BranchTargetALU (1),
295 .WritebackStage (1),
Tom Roberts78bb2ae2020-06-03 15:24:22 +0100296 .ICache (0),
297 .ICacheECC (0),
Pirmin Vogele3814642020-08-27 12:44:23 +0200298 .BranchPredictor (0),
Greg Chadwickdadb1af2020-04-16 17:10:23 +0100299 .DbgTriggerEn (1),
Tom Roberts78bb2ae2020-06-03 15:24:22 +0100300 .SecureIbex (0),
Greg Chadwickdadb1af2020-04-16 17:10:23 +0100301 .DmHaltAddr (ADDR_SPACE_DEBUG_MEM + dm::HaltAddress),
302 .DmExceptionAddr (ADDR_SPACE_DEBUG_MEM + dm::ExceptionAddress),
303 .PipeLine (IbexPipeLine)
Michael Schaffnera39557e2020-03-17 18:30:21 -0700304 ) u_rv_core_ibex (
lowRISC Contributors802543a2019-08-31 12:12:56 +0100305 // clock and reset
Timothy Chenf56c1b52020-04-28 17:00:43 -0700306 .clk_i (clkmgr_clocks.clk_proc_main),
Timothy Chenc59f7012020-04-16 19:11:42 -0700307 .rst_ni (rstmgr_resets.rst_sys_n),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100308 .test_en_i (1'b0),
309 // static pinning
Greg Chadwick53ef2ec2019-09-03 14:53:54 +0100310 .hart_id_i (32'b0),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100311 .boot_addr_i (ADDR_SPACE_ROM),
312 // TL-UL buses
Eunchan Kim0f549542020-08-04 10:40:11 -0700313 .tl_i_o (main_tl_corei_req),
314 .tl_i_i (main_tl_corei_rsp),
315 .tl_d_o (main_tl_cored_req),
316 .tl_d_i (main_tl_cored_rsp),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100317 // interrupts
318 .irq_software_i (msip),
319 .irq_timer_i (intr_rv_timer_timer_expired_0_0),
320 .irq_external_i (irq_plic),
Michael Schaffnerbdcbd202020-07-27 12:18:21 -0700321 // escalation input from alert handler (NMI)
322 .esc_tx_i (esc_tx[0]),
323 .esc_rx_o (esc_rx[0]),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100324 // debug interface
325 .debug_req_i (debug_req),
326 // CPU control signals
Pirmin Vogelffc9e832019-09-13 16:16:05 +0100327 .fetch_enable_i (1'b1),
Timothy Chenc59f7012020-04-16 19:11:42 -0700328 .core_sleep_o (pwrmgr_pwr_cpu.core_sleeping)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100329 );
330
331 // Debug Module (RISC-V Debug Spec 0.13)
332 //
333
334 rv_dm #(
Philipp Wagner086b7032019-10-25 17:06:15 +0100335 .NrHarts (1),
336 .IdcodeValue (JTAG_IDCODE)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100337 ) u_dm_top (
Timothy Chenf56c1b52020-04-28 17:00:43 -0700338 .clk_i (clkmgr_clocks.clk_proc_main),
Timothy Chenc59f7012020-04-16 19:11:42 -0700339 .rst_ni (rstmgr_resets.rst_lc_n),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100340 .testmode_i (1'b0),
Timothy Chen3193b002019-10-04 16:56:05 -0700341 .ndmreset_o (ndmreset_req),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100342 .dmactive_o (),
343 .debug_req_o (debug_req),
344 .unavailable_i (1'b0),
345
346 // bus device with debug memory (for execution-based debug)
Eunchan Kim0f549542020-08-04 10:40:11 -0700347 .tl_d_i (main_tl_debug_mem_req),
348 .tl_d_o (main_tl_debug_mem_rsp),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100349
350 // bus host (for system bus accesses, SBA)
Eunchan Kim0f549542020-08-04 10:40:11 -0700351 .tl_h_o (main_tl_dm_sba_req),
352 .tl_h_i (main_tl_dm_sba_rsp),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100353
354 //JTAG
355 .tck_i (jtag_tck_i),
356 .tms_i (jtag_tms_i),
357 .trst_ni (jtag_trst_ni),
Michael Schaffner79eb65f2020-05-01 19:12:47 -0700358 .td_i (jtag_tdi_i),
359 .td_o (jtag_tdo_o),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100360 .tdo_oe_o ( )
361 );
362
Timothy Chenc59f7012020-04-16 19:11:42 -0700363 assign rstmgr_cpu.ndmreset_req = ndmreset_req;
364 assign rstmgr_cpu.rst_cpu_n = rstmgr_resets.rst_sys_n;
365
Timothy Chen44461032019-09-20 15:35:20 -0700366 // ROM device
lowRISC Contributors802543a2019-08-31 12:12:56 +0100367 logic rom_req;
Timothy Chenda2e3442020-02-24 21:37:47 -0800368 logic [11:0] rom_addr;
lowRISC Contributors802543a2019-08-31 12:12:56 +0100369 logic [31:0] rom_rdata;
370 logic rom_rvalid;
371
372 tlul_adapter_sram #(
Timothy Chenda2e3442020-02-24 21:37:47 -0800373 .SramAw(12),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100374 .SramDw(32),
Eunchan Kim6c731a82020-03-04 14:48:52 -0800375 .Outstanding(2),
Timothy Chen44461032019-09-20 15:35:20 -0700376 .ErrOnWrite(1)
Michael Schaffnera39557e2020-03-17 18:30:21 -0700377 ) u_tl_adapter_rom (
Timothy Chenf56c1b52020-04-28 17:00:43 -0700378 .clk_i (clkmgr_clocks.clk_main_infra),
Timothy Chenc59f7012020-04-16 19:11:42 -0700379 .rst_ni (rstmgr_resets.rst_sys_n),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100380
Eunchan Kim0f549542020-08-04 10:40:11 -0700381 .tl_i (rom_tl_req),
382 .tl_o (rom_tl_rsp),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100383
384 .req_o (rom_req),
385 .gnt_i (1'b1), // Always grant as only one requester exists
Timothy Chen44461032019-09-20 15:35:20 -0700386 .we_o (),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100387 .addr_o (rom_addr),
Timothy Chen44461032019-09-20 15:35:20 -0700388 .wdata_o (),
389 .wmask_o (),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100390 .rdata_i (rom_rdata),
391 .rvalid_i (rom_rvalid),
392 .rerror_i (2'b00)
393 );
394
Michael Schaffner0beb8a42020-06-05 23:17:40 -0700395 prim_rom_adv #(
lowRISC Contributors802543a2019-08-31 12:12:56 +0100396 .Width(32),
Philipp Wagnera37bcfa2020-05-19 22:46:41 +0100397 .Depth(4096),
398 .MemInitFile(BootRomInitFile)
Timothy Chen44461032019-09-20 15:35:20 -0700399 ) u_rom_rom (
Timothy Chenf56c1b52020-04-28 17:00:43 -0700400 .clk_i (clkmgr_clocks.clk_main_infra),
Timothy Chenc59f7012020-04-16 19:11:42 -0700401 .rst_ni (rstmgr_resets.rst_sys_n),
Michael Schaffner0beb8a42020-06-05 23:17:40 -0700402 .req_i (rom_req),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100403 .addr_i (rom_addr),
Michael Schaffner0beb8a42020-06-05 23:17:40 -0700404 .rdata_o (rom_rdata),
405 .rvalid_o (rom_rvalid),
406 .cfg_i ('0) // tied off for now
lowRISC Contributors802543a2019-08-31 12:12:56 +0100407 );
Timothy Chen44461032019-09-20 15:35:20 -0700408
lowRISC Contributors802543a2019-08-31 12:12:56 +0100409 // sram device
410 logic ram_main_req;
411 logic ram_main_we;
412 logic [13:0] ram_main_addr;
413 logic [31:0] ram_main_wdata;
414 logic [31:0] ram_main_wmask;
415 logic [31:0] ram_main_rdata;
416 logic ram_main_rvalid;
Philipp Wagnere1efc182020-05-21 18:26:17 +0100417 logic [1:0] ram_main_rerror;
lowRISC Contributors802543a2019-08-31 12:12:56 +0100418
419 tlul_adapter_sram #(
420 .SramAw(14),
421 .SramDw(32),
Eunchan Kim6c731a82020-03-04 14:48:52 -0800422 .Outstanding(2)
Michael Schaffnera39557e2020-03-17 18:30:21 -0700423 ) u_tl_adapter_ram_main (
Timothy Chenf56c1b52020-04-28 17:00:43 -0700424 .clk_i (clkmgr_clocks.clk_main_infra),
Timothy Chenc59f7012020-04-16 19:11:42 -0700425 .rst_ni (rstmgr_resets.rst_sys_n),
Eunchan Kim0f549542020-08-04 10:40:11 -0700426 .tl_i (ram_main_tl_req),
427 .tl_o (ram_main_tl_rsp),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100428
429 .req_o (ram_main_req),
430 .gnt_i (1'b1), // Always grant as only one requester exists
431 .we_o (ram_main_we),
432 .addr_o (ram_main_addr),
433 .wdata_o (ram_main_wdata),
434 .wmask_o (ram_main_wmask),
435 .rdata_i (ram_main_rdata),
436 .rvalid_i (ram_main_rvalid),
Philipp Wagnere1efc182020-05-21 18:26:17 +0100437 .rerror_i (ram_main_rerror)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100438 );
439
Philipp Wagnere1efc182020-05-21 18:26:17 +0100440 prim_ram_1p_adv #(
lowRISC Contributors802543a2019-08-31 12:12:56 +0100441 .Width(32),
442 .Depth(16384),
Philipp Wagnere1efc182020-05-21 18:26:17 +0100443 .DataBitsPerMask(8),
Michael Schaffner25d73cf2020-06-10 22:31:40 -0700444 .CfgW(8),
445 // TODO: enable parity once supported by the simulation infrastructure
446 .EnableParity(0)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100447 ) u_ram1p_ram_main (
Timothy Chenf56c1b52020-04-28 17:00:43 -0700448 .clk_i (clkmgr_clocks.clk_main_infra),
Timothy Chenc59f7012020-04-16 19:11:42 -0700449 .rst_ni (rstmgr_resets.rst_sys_n),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100450
451 .req_i (ram_main_req),
452 .write_i (ram_main_we),
453 .addr_i (ram_main_addr),
454 .wdata_i (ram_main_wdata),
455 .wmask_i (ram_main_wmask),
Philipp Wagnere1efc182020-05-21 18:26:17 +0100456 .rdata_o (ram_main_rdata),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100457 .rvalid_o (ram_main_rvalid),
Philipp Wagnere1efc182020-05-21 18:26:17 +0100458 .rerror_o (ram_main_rerror),
459 .cfg_i ('0)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100460 );
Timothy Chen6e2ba842020-06-29 15:04:13 -0700461 // sram device
462 logic ram_ret_req;
463 logic ram_ret_we;
464 logic [9:0] ram_ret_addr;
465 logic [31:0] ram_ret_wdata;
466 logic [31:0] ram_ret_wmask;
467 logic [31:0] ram_ret_rdata;
468 logic ram_ret_rvalid;
469 logic [1:0] ram_ret_rerror;
470
471 tlul_adapter_sram #(
472 .SramAw(10),
473 .SramDw(32),
474 .Outstanding(2)
475 ) u_tl_adapter_ram_ret (
476 .clk_i (clkmgr_clocks.clk_io_infra),
477 .rst_ni (rstmgr_resets.rst_sys_io_n),
Eunchan Kim0f549542020-08-04 10:40:11 -0700478 .tl_i (ram_ret_tl_req),
479 .tl_o (ram_ret_tl_rsp),
Timothy Chen6e2ba842020-06-29 15:04:13 -0700480
481 .req_o (ram_ret_req),
482 .gnt_i (1'b1), // Always grant as only one requester exists
483 .we_o (ram_ret_we),
484 .addr_o (ram_ret_addr),
485 .wdata_o (ram_ret_wdata),
486 .wmask_o (ram_ret_wmask),
487 .rdata_i (ram_ret_rdata),
488 .rvalid_i (ram_ret_rvalid),
489 .rerror_i (ram_ret_rerror)
490 );
491
492 prim_ram_1p_adv #(
493 .Width(32),
494 .Depth(1024),
495 .DataBitsPerMask(8),
496 .CfgW(8),
497 // TODO: enable parity once supported by the simulation infrastructure
498 .EnableParity(0)
499 ) u_ram1p_ram_ret (
500 .clk_i (clkmgr_clocks.clk_io_infra),
501 .rst_ni (rstmgr_resets.rst_sys_io_n),
502
503 .req_i (ram_ret_req),
504 .write_i (ram_ret_we),
505 .addr_i (ram_ret_addr),
506 .wdata_i (ram_ret_wdata),
507 .wmask_i (ram_ret_wmask),
508 .rdata_o (ram_ret_rdata),
509 .rvalid_o (ram_ret_rvalid),
510 .rerror_o (ram_ret_rerror),
511 .cfg_i ('0)
512 );
lowRISC Contributors802543a2019-08-31 12:12:56 +0100513
lowRISC Contributors802543a2019-08-31 12:12:56 +0100514 // host to flash communication
515 logic flash_host_req;
516 logic flash_host_req_rdy;
517 logic flash_host_req_done;
Timothy Chen14518402020-04-13 15:25:22 -0700518 logic [flash_ctrl_pkg::BusWidth-1:0] flash_host_rdata;
Timothy Chenb35a3402020-06-23 00:14:11 -0700519 logic [flash_ctrl_pkg::BusAddrW-1:0] flash_host_addr;
lowRISC Contributors802543a2019-08-31 12:12:56 +0100520
Timothy Chen5aec5282019-09-10 21:10:56 -0700521 tlul_adapter_sram #(
Timothy Chenb35a3402020-06-23 00:14:11 -0700522 .SramAw(flash_ctrl_pkg::BusAddrW),
Timothy Chen14518402020-04-13 15:25:22 -0700523 .SramDw(flash_ctrl_pkg::BusWidth),
Eunchan Kim6c731a82020-03-04 14:48:52 -0800524 .Outstanding(2),
Timothy Chen5aec5282019-09-10 21:10:56 -0700525 .ByteAccess(0),
526 .ErrOnWrite(1)
Michael Schaffnera39557e2020-03-17 18:30:21 -0700527 ) u_tl_adapter_eflash (
Timothy Chenf56c1b52020-04-28 17:00:43 -0700528 .clk_i (clkmgr_clocks.clk_main_infra),
Timothy Chenc59f7012020-04-16 19:11:42 -0700529 .rst_ni (rstmgr_resets.rst_lc_n),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100530
Eunchan Kim0f549542020-08-04 10:40:11 -0700531 .tl_i (eflash_tl_req),
532 .tl_o (eflash_tl_rsp),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100533
Timothy Chen5aec5282019-09-10 21:10:56 -0700534 .req_o (flash_host_req),
535 .gnt_i (flash_host_req_rdy),
536 .we_o (),
537 .addr_o (flash_host_addr),
538 .wdata_o (),
539 .wmask_o (),
540 .rdata_i (flash_host_rdata),
541 .rvalid_i (flash_host_req_done),
542 .rerror_i (2'b00)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100543 );
544
Timothy Chen14518402020-04-13 15:25:22 -0700545 flash_phy u_flash_eflash (
Timothy Chenf56c1b52020-04-28 17:00:43 -0700546 .clk_i (clkmgr_clocks.clk_main_infra),
Timothy Chenc59f7012020-04-16 19:11:42 -0700547 .rst_ni (rstmgr_resets.rst_lc_n),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100548 .host_req_i (flash_host_req),
549 .host_addr_i (flash_host_addr),
550 .host_req_rdy_o (flash_host_req_rdy),
551 .host_req_done_o (flash_host_req_done),
552 .host_rdata_o (flash_host_rdata),
Eunchan Kim6599ba92020-04-13 15:27:16 -0700553 .flash_ctrl_i (flash_ctrl_flash_req),
554 .flash_ctrl_o (flash_ctrl_flash_rsp)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100555 );
556
557
Michael Schaffner666dde12019-10-25 11:57:54 -0700558
Michael Schaffnera39557e2020-03-17 18:30:21 -0700559 uart u_uart (
Eunchan Kim769065e2019-10-29 17:29:26 -0700560
561 // Input
562 .cio_rx_i (cio_uart_rx_p2d),
563
564 // Output
565 .cio_tx_o (cio_uart_tx_d2p),
566 .cio_tx_en_o (cio_uart_tx_en_d2p),
567
568 // Interrupt
569 .intr_tx_watermark_o (intr_uart_tx_watermark),
570 .intr_rx_watermark_o (intr_uart_rx_watermark),
Timothy Chen087d4f42019-12-27 16:04:46 -0800571 .intr_tx_empty_o (intr_uart_tx_empty),
Eunchan Kim769065e2019-10-29 17:29:26 -0700572 .intr_rx_overflow_o (intr_uart_rx_overflow),
573 .intr_rx_frame_err_o (intr_uart_rx_frame_err),
574 .intr_rx_break_err_o (intr_uart_rx_break_err),
575 .intr_rx_timeout_o (intr_uart_rx_timeout),
lowRISC Contributors802543a2019-08-31 12:12:56 +0100576 .intr_rx_parity_err_o (intr_uart_rx_parity_err),
Eunchan Kim0f549542020-08-04 10:40:11 -0700577
578 // Inter-module signals
579 .tl_i(uart_tl_req),
580 .tl_o(uart_tl_rsp),
Timothy Chen33b3b9d2020-05-08 10:14:17 -0700581 .clk_i (clkmgr_clocks.clk_io_secure),
582 .rst_ni (rstmgr_resets.rst_sys_io_n)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100583 );
584
Michael Schaffnera39557e2020-03-17 18:30:21 -0700585 gpio u_gpio (
Eunchan Kim769065e2019-10-29 17:29:26 -0700586
587 // Input
588 .cio_gpio_i (cio_gpio_gpio_p2d),
589
590 // Output
591 .cio_gpio_o (cio_gpio_gpio_d2p),
592 .cio_gpio_en_o (cio_gpio_gpio_en_d2p),
593
594 // Interrupt
lowRISC Contributors802543a2019-08-31 12:12:56 +0100595 .intr_gpio_o (intr_gpio_gpio),
Eunchan Kim0f549542020-08-04 10:40:11 -0700596
597 // Inter-module signals
598 .tl_i(gpio_tl_req),
599 .tl_o(gpio_tl_rsp),
Timothy Chen33b3b9d2020-05-08 10:14:17 -0700600 .clk_i (clkmgr_clocks.clk_io_peri),
601 .rst_ni (rstmgr_resets.rst_sys_io_n)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100602 );
603
Michael Schaffnera39557e2020-03-17 18:30:21 -0700604 spi_device u_spi_device (
Eunchan Kim769065e2019-10-29 17:29:26 -0700605
606 // Input
Timothy Chenc38f7892020-07-16 18:19:48 -0700607 .cio_sck_i (cio_spi_device_sck_p2d),
608 .cio_csb_i (cio_spi_device_csb_p2d),
609 .cio_sdi_i (cio_spi_device_sdi_p2d),
Eunchan Kim769065e2019-10-29 17:29:26 -0700610
611 // Output
Timothy Chenc38f7892020-07-16 18:19:48 -0700612 .cio_sdo_o (cio_spi_device_sdo_d2p),
613 .cio_sdo_en_o (cio_spi_device_sdo_en_d2p),
Eunchan Kim769065e2019-10-29 17:29:26 -0700614
615 // Interrupt
616 .intr_rxf_o (intr_spi_device_rxf),
617 .intr_rxlvl_o (intr_spi_device_rxlvl),
618 .intr_txlvl_o (intr_spi_device_txlvl),
619 .intr_rxerr_o (intr_spi_device_rxerr),
620 .intr_rxoverflow_o (intr_spi_device_rxoverflow),
Eunchan Kim546c0d42019-09-24 15:07:06 -0700621 .intr_txunderflow_o (intr_spi_device_txunderflow),
Eunchan Kim0f549542020-08-04 10:40:11 -0700622
623 // Inter-module signals
624 .tl_i(spi_device_tl_req),
625 .tl_o(spi_device_tl_rsp),
Eunchan Kim2cfadab2019-10-02 12:41:11 -0700626 .scanmode_i (scanmode_i),
Timothy Chen33b3b9d2020-05-08 10:14:17 -0700627 .clk_i (clkmgr_clocks.clk_io_peri),
Timothy Chenc59f7012020-04-16 19:11:42 -0700628 .rst_ni (rstmgr_resets.rst_spi_device_n)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100629 );
630
Michael Schaffnera39557e2020-03-17 18:30:21 -0700631 flash_ctrl u_flash_ctrl (
Eunchan Kim769065e2019-10-29 17:29:26 -0700632
633 // Interrupt
lowRISC Contributors802543a2019-08-31 12:12:56 +0100634 .intr_prog_empty_o (intr_flash_ctrl_prog_empty),
Eunchan Kim769065e2019-10-29 17:29:26 -0700635 .intr_prog_lvl_o (intr_flash_ctrl_prog_lvl),
636 .intr_rd_full_o (intr_flash_ctrl_rd_full),
637 .intr_rd_lvl_o (intr_flash_ctrl_rd_lvl),
638 .intr_op_done_o (intr_flash_ctrl_op_done),
639 .intr_op_error_o (intr_flash_ctrl_op_error),
640
Eunchan Kime4a85072020-02-05 16:00:00 -0800641 // Inter-module signals
Eunchan Kim6599ba92020-04-13 15:27:16 -0700642 .flash_o(flash_ctrl_flash_req),
643 .flash_i(flash_ctrl_flash_rsp),
Timothy Chenac620652020-06-25 13:48:50 -0700644 .otp_i(flash_ctrl_pkg::OTP_FLASH_DEFAULT),
Eunchan Kim0f549542020-08-04 10:40:11 -0700645 .tl_i(flash_ctrl_tl_req),
646 .tl_o(flash_ctrl_tl_rsp),
Timothy Chenf56c1b52020-04-28 17:00:43 -0700647 .clk_i (clkmgr_clocks.clk_main_infra),
Timothy Chenc59f7012020-04-16 19:11:42 -0700648 .rst_ni (rstmgr_resets.rst_lc_n)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100649 );
650
Michael Schaffnera39557e2020-03-17 18:30:21 -0700651 rv_timer u_rv_timer (
Eunchan Kim769065e2019-10-29 17:29:26 -0700652
653 // Interrupt
lowRISC Contributors802543a2019-08-31 12:12:56 +0100654 .intr_timer_expired_0_0_o (intr_rv_timer_timer_expired_0_0),
Eunchan Kim0f549542020-08-04 10:40:11 -0700655
656 // Inter-module signals
657 .tl_i(rv_timer_tl_req),
658 .tl_o(rv_timer_tl_rsp),
Timothy Chen33b3b9d2020-05-08 10:14:17 -0700659 .clk_i (clkmgr_clocks.clk_io_timers),
660 .rst_ni (rstmgr_resets.rst_sys_io_n)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100661 );
662
Michael Schaffnera39557e2020-03-17 18:30:21 -0700663 aes u_aes (
Pirmin Vogela2d411d2020-07-13 17:33:42 +0200664
Pirmin Vogel3dc24fc2020-07-29 19:51:22 +0200665 // [0]: ctrl_err_update
666 // [1]: ctrl_err_storage
667 .alert_tx_o ( alert_tx[1:0] ),
668 .alert_rx_i ( alert_rx[1:0] ),
Pirmin Vogelbe4bcb72020-04-17 14:43:45 +0200669
Pirmin Vogela2d411d2020-07-13 17:33:42 +0200670 // Inter-module signals
671 .idle_o(aes_idle),
Eunchan Kim0f549542020-08-04 10:40:11 -0700672 .tl_i(aes_tl_req),
673 .tl_o(aes_tl_rsp),
Timothy Chenf56c1b52020-04-28 17:00:43 -0700674 .clk_i (clkmgr_clocks.clk_main_aes),
Timothy Chenc59f7012020-04-16 19:11:42 -0700675 .rst_ni (rstmgr_resets.rst_sys_n)
Pirmin Vogeld4534382019-10-17 13:18:31 +0100676 );
677
Michael Schaffnera39557e2020-03-17 18:30:21 -0700678 hmac u_hmac (
Eunchan Kim769065e2019-10-29 17:29:26 -0700679
680 // Interrupt
Eunchan Kimd9d69aa2020-03-20 10:21:11 -0700681 .intr_hmac_done_o (intr_hmac_hmac_done),
682 .intr_fifo_empty_o (intr_hmac_fifo_empty),
683 .intr_hmac_err_o (intr_hmac_hmac_err),
Michael Schaffnerd4d5d2f2020-04-17 15:45:55 -0700684
Pirmin Vogel3dc24fc2020-07-29 19:51:22 +0200685 // [2]: msg_push_sha_disabled
686 .alert_tx_o ( alert_tx[2:2] ),
687 .alert_rx_i ( alert_rx[2:2] ),
Eunchan Kim0f549542020-08-04 10:40:11 -0700688
689 // Inter-module signals
690 .tl_i(hmac_tl_req),
691 .tl_o(hmac_tl_rsp),
Timothy Chenf56c1b52020-04-28 17:00:43 -0700692 .clk_i (clkmgr_clocks.clk_main_hmac),
Timothy Chenc59f7012020-04-16 19:11:42 -0700693 .rst_ni (rstmgr_resets.rst_sys_n)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100694 );
695
Michael Schaffnera39557e2020-03-17 18:30:21 -0700696 rv_plic u_rv_plic (
Eunchan Kim0f549542020-08-04 10:40:11 -0700697
698 // Inter-module signals
699 .tl_i(rv_plic_tl_req),
700 .tl_o(rv_plic_tl_rsp),
Eunchan Kim769065e2019-10-29 17:29:26 -0700701
lowRISC Contributors802543a2019-08-31 12:12:56 +0100702 .intr_src_i (intr_vector),
703 .irq_o (irq_plic),
704 .irq_id_o (irq_id),
705 .msip_o (msip),
Timothy Chenf56c1b52020-04-28 17:00:43 -0700706 .clk_i (clkmgr_clocks.clk_main_secure),
Timothy Chenc59f7012020-04-16 19:11:42 -0700707 .rst_ni (rstmgr_resets.rst_sys_n)
lowRISC Contributors802543a2019-08-31 12:12:56 +0100708 );
709
Michael Schaffnera39557e2020-03-17 18:30:21 -0700710 pinmux u_pinmux (
Eunchan Kim769065e2019-10-29 17:29:26 -0700711
Michael Schaffner920e4cc2020-04-28 22:58:12 -0700712 // Inter-module signals
Michael Schaffner39ef7f52020-07-10 21:58:48 -0700713 .lc_pinmux_strap_i('0),
Michael Schaffner920e4cc2020-04-28 22:58:12 -0700714 .lc_pinmux_strap_o(),
Michael Schaffner39ef7f52020-07-10 21:58:48 -0700715 .dft_strap_test_o(),
716 .io_pok_i({pinmux_pkg::NIOPokSignals{1'b1}}),
717 .sleep_en_i(1'b0),
Timothy Chen4ba25312020-06-17 13:08:57 -0700718 .aon_wkup_req_o(pwrmgr_wakeups),
Eunchan Kim0f549542020-08-04 10:40:11 -0700719 .tl_i(pinmux_tl_req),
720 .tl_o(pinmux_tl_rsp),
Eunchan Kim769065e2019-10-29 17:29:26 -0700721
Michael Schaffner79eb65f2020-05-01 19:12:47 -0700722 .periph_to_mio_i (mio_d2p ),
723 .periph_to_mio_oe_i (mio_d2p_en ),
724 .mio_to_periph_o (mio_p2d ),
Michael Schaffner920e4cc2020-04-28 22:58:12 -0700725
726 .mio_out_o,
727 .mio_oe_o,
728 .mio_in_i,
729
Michael Schaffner79eb65f2020-05-01 19:12:47 -0700730 .periph_to_dio_i (dio_d2p ),
731 .periph_to_dio_oe_i (dio_d2p_en ),
732 .dio_to_periph_o (dio_p2d ),
Michael Schaffner920e4cc2020-04-28 22:58:12 -0700733
734 .dio_out_o,
735 .dio_oe_o,
736 .dio_in_i,
Timothy Chenf56c1b52020-04-28 17:00:43 -0700737 .clk_i (clkmgr_clocks.clk_main_secure),
Timothy Chen1faeb3c2020-05-11 22:06:32 -0700738 .clk_aon_i (clkmgr_clocks.clk_io_secure),
Michael Schaffner920e4cc2020-04-28 22:58:12 -0700739 .rst_ni (rstmgr_resets.rst_sys_n),
Timothy Chen1faeb3c2020-05-11 22:06:32 -0700740 .rst_aon_ni (rstmgr_resets.rst_sys_io_n)
Eunchan Kim769065e2019-10-29 17:29:26 -0700741 );
742
Michael Schaffner79eb65f2020-05-01 19:12:47 -0700743 padctrl u_padctrl (
Eunchan Kim0f549542020-08-04 10:40:11 -0700744
745 // Inter-module signals
746 .tl_i(padctrl_tl_req),
747 .tl_o(padctrl_tl_rsp),
Michael Schaffner79eb65f2020-05-01 19:12:47 -0700748
749 .mio_attr_o,
750 .dio_attr_o,
Michael Schaffner79eb65f2020-05-01 19:12:47 -0700751 .clk_i (clkmgr_clocks.clk_main_secure),
752 .rst_ni (rstmgr_resets.rst_sys_n)
753 );
754
Michael Schaffnera39557e2020-03-17 18:30:21 -0700755 alert_handler u_alert_handler (
Michael Schaffner666dde12019-10-25 11:57:54 -0700756
757 // Interrupt
758 .intr_classa_o (intr_alert_handler_classa),
759 .intr_classb_o (intr_alert_handler_classb),
760 .intr_classc_o (intr_alert_handler_classc),
761 .intr_classd_o (intr_alert_handler_classd),
Eunchan Kim0f549542020-08-04 10:40:11 -0700762
763 // Inter-module signals
764 .tl_i(alert_handler_tl_req),
765 .tl_o(alert_handler_tl_rsp),
Michael Schaffner666dde12019-10-25 11:57:54 -0700766 // TODO: wire this to hardware debug circuit
767 .crashdump_o ( ),
768 // TODO: wire this to TRNG
769 .entropy_i ( 1'b0 ),
770 // alert signals
771 .alert_rx_o ( alert_rx ),
772 .alert_tx_i ( alert_tx ),
773 // escalation outputs
774 .esc_rx_i ( esc_rx ),
775 .esc_tx_o ( esc_tx ),
Timothy Chenf56c1b52020-04-28 17:00:43 -0700776 .clk_i (clkmgr_clocks.clk_main_secure),
Timothy Chenc59f7012020-04-16 19:11:42 -0700777 .rst_ni (rstmgr_resets.rst_sys_n)
Michael Schaffner666dde12019-10-25 11:57:54 -0700778 );
779
Timothy Chen163050b2020-04-13 23:29:29 -0700780 pwrmgr u_pwrmgr (
Timothy Chen163050b2020-04-13 23:29:29 -0700781
782 // Interrupt
783 .intr_wakeup_o (intr_pwrmgr_wakeup),
784
785 // Inter-module signals
Timothy Chen1555dce2020-08-11 11:26:50 -0700786 .pwr_ast_o(pwrmgr_pwr_ast_req_o),
787 .pwr_ast_i(pwrmgr_pwr_ast_rsp_i),
Timothy Chenc59f7012020-04-16 19:11:42 -0700788 .pwr_rst_o(pwrmgr_pwr_rst_req),
789 .pwr_rst_i(pwrmgr_pwr_rst_rsp),
Timothy Chenf56c1b52020-04-28 17:00:43 -0700790 .pwr_clk_o(pwrmgr_pwr_clk_req),
791 .pwr_clk_i(pwrmgr_pwr_clk_rsp),
Timothy Chen163050b2020-04-13 23:29:29 -0700792 .pwr_otp_o(),
793 .pwr_otp_i(pwrmgr_pkg::PWR_OTP_RSP_DEFAULT),
794 .pwr_lc_o(),
795 .pwr_lc_i(pwrmgr_pkg::PWR_LC_RSP_DEFAULT),
796 .pwr_flash_i(pwrmgr_pkg::PWR_FLASH_DEFAULT),
Timothy Chenc59f7012020-04-16 19:11:42 -0700797 .pwr_cpu_i(pwrmgr_pwr_cpu),
Timothy Chen4ba25312020-06-17 13:08:57 -0700798 .wakeups_i(pwrmgr_wakeups),
799 .rstreqs_i('0),
Eunchan Kim0f549542020-08-04 10:40:11 -0700800 .tl_i(pwrmgr_tl_req),
801 .tl_o(pwrmgr_tl_rsp),
Timothy Chen371c94d2020-06-30 17:18:14 -0700802 .clk_i (clkmgr_clocks.clk_io_powerup),
803 .clk_slow_i (clkmgr_clocks.clk_aon_powerup),
Timothy Chenc59f7012020-04-16 19:11:42 -0700804 .rst_ni (rstmgr_resets.rst_por_n),
Timothy Chena4cc10d2020-05-08 16:06:20 -0700805 .rst_slow_ni (rstmgr_resets.rst_por_aon_n)
Timothy Chenc59f7012020-04-16 19:11:42 -0700806 );
807
808 rstmgr u_rstmgr (
Timothy Chenc59f7012020-04-16 19:11:42 -0700809
810 // Inter-module signals
811 .pwr_i(pwrmgr_pwr_rst_req),
812 .pwr_o(pwrmgr_pwr_rst_rsp),
813 .resets_o(rstmgr_resets),
Timothy Chen1555dce2020-08-11 11:26:50 -0700814 .ast_i(rstmgr_ast_i),
Timothy Chenc59f7012020-04-16 19:11:42 -0700815 .cpu_i(rstmgr_cpu),
816 .peri_i(rstmgr_pkg::RSTMGR_PERI_DEFAULT),
Timothy Chen437fd9a2020-08-26 12:48:40 -0700817 .resets_ast_o(rsts_ast_o),
Eunchan Kim0f549542020-08-04 10:40:11 -0700818 .tl_i(rstmgr_tl_req),
819 .tl_o(rstmgr_tl_rsp),
Timothy Chen371c94d2020-06-30 17:18:14 -0700820 .clk_i (clkmgr_clocks.clk_io_powerup),
821 .clk_aon_i (clkmgr_clocks.clk_aon_powerup),
822 .clk_main_i (clkmgr_clocks.clk_main_powerup),
823 .clk_io_i (clkmgr_clocks.clk_io_powerup),
824 .clk_usb_i (clkmgr_clocks.clk_usb_powerup),
825 .clk_io_div2_i (clkmgr_clocks.clk_io_div2_powerup),
Timothy Chen437fd9a2020-08-26 12:48:40 -0700826 .clk_io_div4_i (clkmgr_clocks.clk_io_div4_powerup),
Timothy Chenc59f7012020-04-16 19:11:42 -0700827 .rst_ni (rst_ni)
Timothy Chen163050b2020-04-13 23:29:29 -0700828 );
829
Timothy Chenf56c1b52020-04-28 17:00:43 -0700830 clkmgr u_clkmgr (
Timothy Chenf56c1b52020-04-28 17:00:43 -0700831
832 // Inter-module signals
833 .clocks_o(clkmgr_clocks),
Eunchan Kim5511bbe2020-08-07 14:04:20 -0700834 .clk_main_i(clk_main_i),
835 .clk_io_i(clk_io_i),
836 .clk_usb_i(clk_usb_i),
837 .clk_aon_i(clk_aon_i),
Timothy Chen437fd9a2020-08-26 12:48:40 -0700838 .clocks_ast_o(clks_ast_o),
Timothy Chenf56c1b52020-04-28 17:00:43 -0700839 .pwr_i(pwrmgr_pwr_clk_req),
840 .pwr_o(pwrmgr_pwr_clk_rsp),
841 .dft_i(clkmgr_pkg::CLK_DFT_DEFAULT),
Pirmin Vogela2d411d2020-07-13 17:33:42 +0200842 .status_i(clkmgr_status),
Eunchan Kim0f549542020-08-04 10:40:11 -0700843 .tl_i(clkmgr_tl_req),
844 .tl_o(clkmgr_tl_rsp),
Timothy Chen371c94d2020-06-30 17:18:14 -0700845 .clk_i (clkmgr_clocks.clk_io_powerup),
Timothy Chena4cc10d2020-05-08 16:06:20 -0700846 .rst_ni (rstmgr_resets.rst_por_io_n),
Timothy Chenf56c1b52020-04-28 17:00:43 -0700847 .rst_main_ni (rstmgr_resets.rst_por_n),
Timothy Chena4cc10d2020-05-08 16:06:20 -0700848 .rst_io_ni (rstmgr_resets.rst_por_io_n),
Timothy Chen371c94d2020-06-30 17:18:14 -0700849 .rst_usb_ni (rstmgr_resets.rst_por_usb_n),
Timothy Chene896d0c2020-08-20 11:11:09 -0700850 .rst_io_div2_ni (rstmgr_resets.rst_por_io_div2_n),
851 .rst_io_div4_ni (rstmgr_resets.rst_por_io_div4_n)
Timothy Chenf56c1b52020-04-28 17:00:43 -0700852 );
853
Michael Schaffnera39557e2020-03-17 18:30:21 -0700854 nmi_gen u_nmi_gen (
Michael Schaffner666dde12019-10-25 11:57:54 -0700855
856 // Interrupt
857 .intr_esc0_o (intr_nmi_gen_esc0),
858 .intr_esc1_o (intr_nmi_gen_esc1),
859 .intr_esc2_o (intr_nmi_gen_esc2),
Eunchan Kim0f549542020-08-04 10:40:11 -0700860
861 // Inter-module signals
862 .tl_i(nmi_gen_tl_req),
863 .tl_o(nmi_gen_tl_rsp),
Michael Schaffner666dde12019-10-25 11:57:54 -0700864 // escalation signal inputs
Michael Schaffnerbdcbd202020-07-27 12:18:21 -0700865 .esc_rx_o ( esc_rx[3:1] ),
866 .esc_tx_i ( esc_tx[3:1] ),
Timothy Chenf56c1b52020-04-28 17:00:43 -0700867 .clk_i (clkmgr_clocks.clk_main_secure),
Timothy Chenc59f7012020-04-16 19:11:42 -0700868 .rst_ni (rstmgr_resets.rst_sys_n)
Michael Schaffner666dde12019-10-25 11:57:54 -0700869 );
870
Michael Schaffnera39557e2020-03-17 18:30:21 -0700871 usbdev u_usbdev (
Pirmin Vogelea91b302020-01-14 18:53:01 +0000872
Pirmin Vogelb054fc02020-03-11 11:23:03 +0100873 // Input
874 .cio_sense_i (cio_usbdev_sense_p2d),
875 .cio_d_i (cio_usbdev_d_p2d),
876 .cio_dp_i (cio_usbdev_dp_p2d),
877 .cio_dn_i (cio_usbdev_dn_p2d),
Pirmin Vogelea91b302020-01-14 18:53:01 +0000878
Pirmin Vogelb054fc02020-03-11 11:23:03 +0100879 // Output
880 .cio_se0_o (cio_usbdev_se0_d2p),
881 .cio_se0_en_o (cio_usbdev_se0_en_d2p),
Pirmin Vogelfe6863b2020-05-11 17:30:54 +0200882 .cio_dp_pullup_o (cio_usbdev_dp_pullup_d2p),
883 .cio_dp_pullup_en_o (cio_usbdev_dp_pullup_en_d2p),
884 .cio_dn_pullup_o (cio_usbdev_dn_pullup_d2p),
885 .cio_dn_pullup_en_o (cio_usbdev_dn_pullup_en_d2p),
Pirmin Vogelb054fc02020-03-11 11:23:03 +0100886 .cio_tx_mode_se_o (cio_usbdev_tx_mode_se_d2p),
887 .cio_tx_mode_se_en_o (cio_usbdev_tx_mode_se_en_d2p),
888 .cio_suspend_o (cio_usbdev_suspend_d2p),
889 .cio_suspend_en_o (cio_usbdev_suspend_en_d2p),
890 .cio_d_o (cio_usbdev_d_d2p),
891 .cio_d_en_o (cio_usbdev_d_en_d2p),
892 .cio_dp_o (cio_usbdev_dp_d2p),
893 .cio_dp_en_o (cio_usbdev_dp_en_d2p),
894 .cio_dn_o (cio_usbdev_dn_d2p),
895 .cio_dn_en_o (cio_usbdev_dn_en_d2p),
Pirmin Vogelea91b302020-01-14 18:53:01 +0000896
897 // Interrupt
898 .intr_pkt_received_o (intr_usbdev_pkt_received),
899 .intr_pkt_sent_o (intr_usbdev_pkt_sent),
900 .intr_disconnected_o (intr_usbdev_disconnected),
901 .intr_host_lost_o (intr_usbdev_host_lost),
902 .intr_link_reset_o (intr_usbdev_link_reset),
903 .intr_link_suspend_o (intr_usbdev_link_suspend),
904 .intr_link_resume_o (intr_usbdev_link_resume),
905 .intr_av_empty_o (intr_usbdev_av_empty),
906 .intr_rx_full_o (intr_usbdev_rx_full),
907 .intr_av_overflow_o (intr_usbdev_av_overflow),
908 .intr_link_in_err_o (intr_usbdev_link_in_err),
909 .intr_rx_crc_err_o (intr_usbdev_rx_crc_err),
910 .intr_rx_pid_err_o (intr_usbdev_rx_pid_err),
911 .intr_rx_bitstuff_err_o (intr_usbdev_rx_bitstuff_err),
912 .intr_frame_o (intr_usbdev_frame),
913 .intr_connected_o (intr_usbdev_connected),
914
Pirmin Vogeldd3a2f02020-05-12 14:59:50 +0200915 // Inter-module signals
Timothy Chen1555dce2020-08-11 11:26:50 -0700916 .usb_ref_val_o(usbdev_usb_ref_val_o),
917 .usb_ref_pulse_o(usbdev_usb_ref_pulse_o),
Eunchan Kim0f549542020-08-04 10:40:11 -0700918 .tl_i(usbdev_tl_req),
919 .tl_o(usbdev_tl_rsp),
Timothy Chen33b3b9d2020-05-08 10:14:17 -0700920 .clk_i (clkmgr_clocks.clk_io_peri),
921 .clk_usb_48mhz_i (clkmgr_clocks.clk_usb_peri),
922 .rst_ni (rstmgr_resets.rst_sys_io_n),
Timothy Chenc59f7012020-04-16 19:11:42 -0700923 .rst_usb_48mhz_ni (rstmgr_resets.rst_usb_n)
Pirmin Vogelea91b302020-01-14 18:53:01 +0000924 );
925
Timothy Chen1555dce2020-08-11 11:26:50 -0700926 sensor_ctrl u_sensor_ctrl (
927
Timothy Chen1555dce2020-08-11 11:26:50 -0700928 // [3]: ast_alerts
929 // [4]: ast_alerts
930 // [5]: ast_alerts
931 // [6]: ast_alerts
932 // [7]: ast_alerts
933 // [8]: ast_alerts
Pirmin Vogel3dc24fc2020-07-29 19:51:22 +0200934 // [9]: ast_alerts
935 .alert_tx_o ( alert_tx[9:3] ),
936 .alert_rx_i ( alert_rx[9:3] ),
Timothy Chen1555dce2020-08-11 11:26:50 -0700937
938 // Inter-module signals
939 .ast_alert_i(sensor_ctrl_ast_alert_req_i),
940 .ast_alert_o(sensor_ctrl_ast_alert_rsp_o),
941 .ast_status_i(sensor_ctrl_ast_status_i),
942 .tl_i(sensor_ctrl_tl_req),
943 .tl_o(sensor_ctrl_tl_rsp),
944 .clk_i (clkmgr_clocks.clk_io_secure),
945 .rst_ni (rstmgr_resets.rst_sys_io_n)
946 );
947
Philipp Wagnera4a9e402020-06-22 12:06:56 +0100948 otbn u_otbn (
Philipp Wagnera4a9e402020-06-22 12:06:56 +0100949
950 // Interrupt
951 .intr_done_o (intr_otbn_done),
952 .intr_err_o (intr_otbn_err),
953
Pirmin Vogel3dc24fc2020-07-29 19:51:22 +0200954 // [10]: imem_uncorrectable
955 // [11]: dmem_uncorrectable
956 // [12]: reg_uncorrectable
957 .alert_tx_o ( alert_tx[12:10] ),
958 .alert_rx_i ( alert_rx[12:10] ),
Philipp Wagnera4a9e402020-06-22 12:06:56 +0100959
960 // Inter-module signals
961 .idle_o(),
Eunchan Kim0f549542020-08-04 10:40:11 -0700962 .tl_i(otbn_tl_req),
963 .tl_o(otbn_tl_rsp),
Philipp Wagnera4a9e402020-06-22 12:06:56 +0100964 .clk_i (clkmgr_clocks.clk_main_otbn),
965 .rst_ni (rstmgr_resets.rst_sys_n)
966 );
967
lowRISC Contributors802543a2019-08-31 12:12:56 +0100968 // interrupt assignments
969 assign intr_vector = {
Philipp Wagnera4a9e402020-06-22 12:06:56 +0100970 intr_otbn_err,
971 intr_otbn_done,
Timothy Chen163050b2020-04-13 23:29:29 -0700972 intr_pwrmgr_wakeup,
Pirmin Vogelea91b302020-01-14 18:53:01 +0000973 intr_usbdev_connected,
974 intr_usbdev_frame,
975 intr_usbdev_rx_bitstuff_err,
976 intr_usbdev_rx_pid_err,
977 intr_usbdev_rx_crc_err,
978 intr_usbdev_link_in_err,
979 intr_usbdev_av_overflow,
980 intr_usbdev_rx_full,
981 intr_usbdev_av_empty,
982 intr_usbdev_link_resume,
983 intr_usbdev_link_suspend,
984 intr_usbdev_link_reset,
985 intr_usbdev_host_lost,
986 intr_usbdev_disconnected,
987 intr_usbdev_pkt_sent,
988 intr_usbdev_pkt_received,
Michael Schaffner666dde12019-10-25 11:57:54 -0700989 intr_nmi_gen_esc2,
990 intr_nmi_gen_esc1,
991 intr_nmi_gen_esc0,
992 intr_alert_handler_classd,
993 intr_alert_handler_classc,
994 intr_alert_handler_classb,
995 intr_alert_handler_classa,
Eunchan Kim226eab62019-10-18 14:11:29 -0700996 intr_hmac_hmac_err,
Eunchan Kimd9d69aa2020-03-20 10:21:11 -0700997 intr_hmac_fifo_empty,
lowRISC Contributors802543a2019-08-31 12:12:56 +0100998 intr_hmac_hmac_done,
999 intr_flash_ctrl_op_error,
1000 intr_flash_ctrl_op_done,
1001 intr_flash_ctrl_rd_lvl,
1002 intr_flash_ctrl_rd_full,
1003 intr_flash_ctrl_prog_lvl,
1004 intr_flash_ctrl_prog_empty,
Eunchan Kim546c0d42019-09-24 15:07:06 -07001005 intr_spi_device_txunderflow,
1006 intr_spi_device_rxoverflow,
lowRISC Contributors802543a2019-08-31 12:12:56 +01001007 intr_spi_device_rxerr,
1008 intr_spi_device_txlvl,
lowRISC Contributors802543a2019-08-31 12:12:56 +01001009 intr_spi_device_rxlvl,
Eunchan Kim8c57fe32019-09-02 21:14:24 -07001010 intr_spi_device_rxf,
lowRISC Contributors802543a2019-08-31 12:12:56 +01001011 intr_uart_rx_parity_err,
1012 intr_uart_rx_timeout,
1013 intr_uart_rx_break_err,
1014 intr_uart_rx_frame_err,
1015 intr_uart_rx_overflow,
Timothy Chen087d4f42019-12-27 16:04:46 -08001016 intr_uart_tx_empty,
lowRISC Contributors802543a2019-08-31 12:12:56 +01001017 intr_uart_rx_watermark,
1018 intr_uart_tx_watermark,
Eunchan Kim88a86152020-04-13 16:12:08 -07001019 intr_gpio_gpio,
1020 1'b 0 // For ID 0.
lowRISC Contributors802543a2019-08-31 12:12:56 +01001021 };
1022
1023 // TL-UL Crossbar
lowRISC Contributors802543a2019-08-31 12:12:56 +01001024 xbar_main u_xbar_main (
Timothy Chenf56c1b52020-04-28 17:00:43 -07001025 .clk_main_i (clkmgr_clocks.clk_main_infra),
Timothy Chen33b3b9d2020-05-08 10:14:17 -07001026 .clk_fixed_i (clkmgr_clocks.clk_io_infra),
Timothy Chenc59f7012020-04-16 19:11:42 -07001027 .rst_main_ni (rstmgr_resets.rst_sys_n),
Timothy Chen33b3b9d2020-05-08 10:14:17 -07001028 .rst_fixed_ni (rstmgr_resets.rst_sys_io_n),
Eunchan Kim0f549542020-08-04 10:40:11 -07001029
1030 // port: tl_corei
1031 .tl_corei_i(main_tl_corei_req),
1032 .tl_corei_o(main_tl_corei_rsp),
1033
1034 // port: tl_cored
1035 .tl_cored_i(main_tl_cored_req),
1036 .tl_cored_o(main_tl_cored_rsp),
1037
1038 // port: tl_dm_sba
1039 .tl_dm_sba_i(main_tl_dm_sba_req),
1040 .tl_dm_sba_o(main_tl_dm_sba_rsp),
1041
1042 // port: tl_rom
1043 .tl_rom_o(rom_tl_req),
1044 .tl_rom_i(rom_tl_rsp),
1045
1046 // port: tl_debug_mem
1047 .tl_debug_mem_o(main_tl_debug_mem_req),
1048 .tl_debug_mem_i(main_tl_debug_mem_rsp),
1049
1050 // port: tl_ram_main
1051 .tl_ram_main_o(ram_main_tl_req),
1052 .tl_ram_main_i(ram_main_tl_rsp),
1053
1054 // port: tl_eflash
1055 .tl_eflash_o(eflash_tl_req),
1056 .tl_eflash_i(eflash_tl_rsp),
1057
1058 // port: tl_peri
1059 .tl_peri_o(main_tl_peri_req),
1060 .tl_peri_i(main_tl_peri_rsp),
1061
1062 // port: tl_flash_ctrl
1063 .tl_flash_ctrl_o(flash_ctrl_tl_req),
1064 .tl_flash_ctrl_i(flash_ctrl_tl_rsp),
1065
1066 // port: tl_hmac
1067 .tl_hmac_o(hmac_tl_req),
1068 .tl_hmac_i(hmac_tl_rsp),
1069
1070 // port: tl_aes
1071 .tl_aes_o(aes_tl_req),
1072 .tl_aes_i(aes_tl_rsp),
1073
1074 // port: tl_rv_plic
1075 .tl_rv_plic_o(rv_plic_tl_req),
1076 .tl_rv_plic_i(rv_plic_tl_rsp),
1077
1078 // port: tl_pinmux
1079 .tl_pinmux_o(pinmux_tl_req),
1080 .tl_pinmux_i(pinmux_tl_rsp),
1081
1082 // port: tl_padctrl
1083 .tl_padctrl_o(padctrl_tl_req),
1084 .tl_padctrl_i(padctrl_tl_rsp),
1085
1086 // port: tl_alert_handler
1087 .tl_alert_handler_o(alert_handler_tl_req),
1088 .tl_alert_handler_i(alert_handler_tl_rsp),
1089
1090 // port: tl_nmi_gen
1091 .tl_nmi_gen_o(nmi_gen_tl_req),
1092 .tl_nmi_gen_i(nmi_gen_tl_rsp),
1093
1094 // port: tl_otbn
1095 .tl_otbn_o(otbn_tl_req),
1096 .tl_otbn_i(otbn_tl_rsp),
1097
lowRISC Contributors802543a2019-08-31 12:12:56 +01001098
1099 .scanmode_i
1100 );
Eunchan Kim55d7ae82019-12-19 17:08:35 -08001101 xbar_peri u_xbar_peri (
Timothy Chen33b3b9d2020-05-08 10:14:17 -07001102 .clk_peri_i (clkmgr_clocks.clk_io_infra),
1103 .rst_peri_ni (rstmgr_resets.rst_sys_io_n),
Eunchan Kim0f549542020-08-04 10:40:11 -07001104
1105 // port: tl_main
1106 .tl_main_i(main_tl_peri_req),
1107 .tl_main_o(main_tl_peri_rsp),
1108
1109 // port: tl_uart
1110 .tl_uart_o(uart_tl_req),
1111 .tl_uart_i(uart_tl_rsp),
1112
1113 // port: tl_gpio
1114 .tl_gpio_o(gpio_tl_req),
1115 .tl_gpio_i(gpio_tl_rsp),
1116
1117 // port: tl_spi_device
1118 .tl_spi_device_o(spi_device_tl_req),
1119 .tl_spi_device_i(spi_device_tl_rsp),
1120
1121 // port: tl_rv_timer
1122 .tl_rv_timer_o(rv_timer_tl_req),
1123 .tl_rv_timer_i(rv_timer_tl_rsp),
1124
1125 // port: tl_usbdev
1126 .tl_usbdev_o(usbdev_tl_req),
1127 .tl_usbdev_i(usbdev_tl_rsp),
1128
1129 // port: tl_pwrmgr
1130 .tl_pwrmgr_o(pwrmgr_tl_req),
1131 .tl_pwrmgr_i(pwrmgr_tl_rsp),
1132
1133 // port: tl_rstmgr
1134 .tl_rstmgr_o(rstmgr_tl_req),
1135 .tl_rstmgr_i(rstmgr_tl_rsp),
1136
1137 // port: tl_clkmgr
1138 .tl_clkmgr_o(clkmgr_tl_req),
1139 .tl_clkmgr_i(clkmgr_tl_rsp),
1140
1141 // port: tl_ram_ret
1142 .tl_ram_ret_o(ram_ret_tl_req),
1143 .tl_ram_ret_i(ram_ret_tl_rsp),
1144
Timothy Chen1555dce2020-08-11 11:26:50 -07001145 // port: tl_sensor_ctrl
1146 .tl_sensor_ctrl_o(sensor_ctrl_tl_req),
1147 .tl_sensor_ctrl_i(sensor_ctrl_tl_rsp),
1148
Timothy Chenfb34fe32020-08-26 17:13:19 -07001149 // port: tl_ast_wrapper
1150 .tl_ast_wrapper_o(ast_tl_req_o),
1151 .tl_ast_wrapper_i(ast_tl_rsp_i),
1152
Eunchan Kim55d7ae82019-12-19 17:08:35 -08001153
1154 .scanmode_i
1155 );
lowRISC Contributors802543a2019-08-31 12:12:56 +01001156
Eunchan Kim769065e2019-10-29 17:29:26 -07001157 // Pinmux connections
Michael Schaffner79eb65f2020-05-01 19:12:47 -07001158 assign mio_d2p = {
Eunchan Kim769065e2019-10-29 17:29:26 -07001159 cio_gpio_gpio_d2p
1160 };
Michael Schaffner79eb65f2020-05-01 19:12:47 -07001161 assign mio_d2p_en = {
Eunchan Kim769065e2019-10-29 17:29:26 -07001162 cio_gpio_gpio_en_d2p
1163 };
1164 assign {
1165 cio_gpio_gpio_p2d
Michael Schaffner79eb65f2020-05-01 19:12:47 -07001166 } = mio_p2d;
Eunchan Kim769065e2019-10-29 17:29:26 -07001167
Michael Schaffner920e4cc2020-04-28 22:58:12 -07001168 // Dedicated IO connections
Michael Schaffner79eb65f2020-05-01 19:12:47 -07001169 // Input-only DIOs have no d2p signals
1170 assign dio_d2p = {
Pirmin Vogelfe6863b2020-05-11 17:30:54 +02001171 1'b0, // DIO14: cio_spi_device_sck
1172 1'b0, // DIO13: cio_spi_device_csb
Scott Johnsonfe79c4b2020-07-08 10:31:08 -07001173 1'b0, // DIO12: cio_spi_device_sdi
1174 cio_spi_device_sdo_d2p, // DIO11
Pirmin Vogelfe6863b2020-05-11 17:30:54 +02001175 1'b0, // DIO10: cio_uart_rx
1176 cio_uart_tx_d2p, // DIO9
1177 1'b0, // DIO8: cio_usbdev_sense
1178 cio_usbdev_se0_d2p, // DIO7
1179 cio_usbdev_dp_pullup_d2p, // DIO6
1180 cio_usbdev_dn_pullup_d2p, // DIO5
Michael Schaffner79eb65f2020-05-01 19:12:47 -07001181 cio_usbdev_tx_mode_se_d2p, // DIO4
1182 cio_usbdev_suspend_d2p, // DIO3
1183 cio_usbdev_d_d2p, // DIO2
1184 cio_usbdev_dp_d2p, // DIO1
1185 cio_usbdev_dn_d2p // DIO0
Michael Schaffner920e4cc2020-04-28 22:58:12 -07001186 };
1187
Michael Schaffner79eb65f2020-05-01 19:12:47 -07001188 assign dio_d2p_en = {
Pirmin Vogelfe6863b2020-05-11 17:30:54 +02001189 1'b0, // DIO14: cio_spi_device_sck
1190 1'b0, // DIO13: cio_spi_device_csb
Scott Johnsonfe79c4b2020-07-08 10:31:08 -07001191 1'b0, // DIO12: cio_spi_device_sdi
1192 cio_spi_device_sdo_en_d2p, // DIO11
Pirmin Vogelfe6863b2020-05-11 17:30:54 +02001193 1'b0, // DIO10: cio_uart_rx
1194 cio_uart_tx_en_d2p, // DIO9
1195 1'b0, // DIO8: cio_usbdev_sense
1196 cio_usbdev_se0_en_d2p, // DIO7
1197 cio_usbdev_dp_pullup_en_d2p, // DIO6
1198 cio_usbdev_dn_pullup_en_d2p, // DIO5
Michael Schaffner79eb65f2020-05-01 19:12:47 -07001199 cio_usbdev_tx_mode_se_en_d2p, // DIO4
1200 cio_usbdev_suspend_en_d2p, // DIO3
1201 cio_usbdev_d_en_d2p, // DIO2
1202 cio_usbdev_dp_en_d2p, // DIO1
1203 cio_usbdev_dn_en_d2p // DIO0
Michael Schaffner920e4cc2020-04-28 22:58:12 -07001204 };
1205
Michael Schaffner79eb65f2020-05-01 19:12:47 -07001206 // Output-only DIOs have no p2d signal
Pirmin Vogelfe6863b2020-05-11 17:30:54 +02001207 assign cio_spi_device_sck_p2d = dio_p2d[14]; // DIO14
1208 assign cio_spi_device_csb_p2d = dio_p2d[13]; // DIO13
Scott Johnsonfe79c4b2020-07-08 10:31:08 -07001209 assign cio_spi_device_sdi_p2d = dio_p2d[12]; // DIO12
1210 // DIO11: cio_spi_device_sdo
Pirmin Vogelfe6863b2020-05-11 17:30:54 +02001211 assign cio_uart_rx_p2d = dio_p2d[10]; // DIO10
1212 // DIO9: cio_uart_tx
1213 assign cio_usbdev_sense_p2d = dio_p2d[8]; // DIO8
1214 // DIO7: cio_usbdev_se0
1215 // DIO6: cio_usbdev_dp_pullup
1216 // DIO5: cio_usbdev_dn_pullup
Michael Schaffner79eb65f2020-05-01 19:12:47 -07001217 // DIO4: cio_usbdev_tx_mode_se
1218 // DIO3: cio_usbdev_suspend
1219 assign cio_usbdev_d_p2d = dio_p2d[2]; // DIO2
1220 assign cio_usbdev_dp_p2d = dio_p2d[1]; // DIO1
1221 assign cio_usbdev_dn_p2d = dio_p2d[0]; // DIO0
Eunchan Kim769065e2019-10-29 17:29:26 -07001222
Nils Graf78607aa2019-09-16 15:47:23 -07001223 // make sure scanmode_i is never X (including during reset)
Eunchan Kim5511bbe2020-08-07 14:04:20 -07001224 `ASSERT_KNOWN(scanmodeKnown, scanmode_i, clk_main_i, 0)
Nils Graf78607aa2019-09-16 15:47:23 -07001225
lowRISC Contributors802543a2019-08-31 12:12:56 +01001226endmodule