lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1 | // 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 Chen | 7ff5312 | 2019-09-19 15:20:43 -0700 | [diff] [blame] | 5 | module top_earlgrey #( |
Philipp Wagner | a37bcfa | 2020-05-19 22:46:41 +0100 | [diff] [blame] | 6 | parameter bit IbexPipeLine = 0, |
| 7 | parameter BootRomInitFile = "" |
Timothy Chen | 7ff5312 | 2019-09-19 15:20:43 -0700 | [diff] [blame] | 8 | ) ( |
Timothy Chen | 371c94d | 2020-06-30 17:18:14 -0700 | [diff] [blame] | 9 | // Reset, clocks defined as part of intermodule |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 10 | input rst_ni, |
| 11 | |
| 12 | // JTAG interface |
| 13 | input jtag_tck_i, |
| 14 | input jtag_tms_i, |
| 15 | input jtag_trst_ni, |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 16 | input jtag_tdi_i, |
| 17 | output jtag_tdo_o, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 18 | |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 19 | // 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 Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 23 | // Dedicated I/O |
Pirmin Vogel | fe6863b | 2020-05-11 17:30:54 +0200 | [diff] [blame] | 24 | input [14:0] dio_in_i, |
| 25 | output logic [14:0] dio_out_o, |
| 26 | output logic [14:0] dio_oe_o, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 27 | |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 28 | // 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 Chen | 371c94d | 2020-06-30 17:18:14 -0700 | [diff] [blame] | 34 | |
| 35 | // Inter-module Signal External type |
Eunchan Kim | 5511bbe | 2020-08-07 14:04:20 -0700 | [diff] [blame] | 36 | input logic clk_main_i, |
| 37 | input logic clk_io_i, |
| 38 | input logic clk_usb_i, |
| 39 | input logic clk_aon_i, |
Timothy Chen | 437fd9a | 2020-08-26 12:48:40 -0700 | [diff] [blame] | 40 | input rstmgr_pkg::rstmgr_ast_t rstmgr_ast_i, |
Timothy Chen | 1555dce | 2020-08-11 11:26:50 -0700 | [diff] [blame] | 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 Chen | fb34fe3 | 2020-08-26 17:13:19 -0700 | [diff] [blame] | 48 | output tlul_pkg::tl_h2d_t ast_tl_req_o, |
| 49 | input tlul_pkg::tl_d2h_t ast_tl_rsp_i, |
Timothy Chen | 437fd9a | 2020-08-26 12:48:40 -0700 | [diff] [blame] | 50 | output clkmgr_pkg::clkmgr_ast_out_t clks_ast_o, |
| 51 | output rstmgr_pkg::rstmgr_ast_out_t rsts_ast_o, |
Timothy Chen | ac3a8c9 | 2020-06-29 20:17:07 -0700 | [diff] [blame] | 52 | input scan_rst_ni, // reset used for test mode |
| 53 | input scanmode_i // 1 for Scan |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 54 | ); |
| 55 | |
Philipp Wagner | 086b703 | 2019-10-25 17:06:15 +0100 | [diff] [blame] | 56 | // 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 Schaffner | d4d5d2f | 2020-04-17 15:45:55 -0700 | [diff] [blame] | 61 | localparam logic [31:0] JTAG_IDCODE = { |
Philipp Wagner | 086b703 | 2019-10-25 17:06:15 +0100 | [diff] [blame] | 62 | 4'h0, // Version |
| 63 | 16'h4F54, // Part Number: "OT" |
Philipp Wagner | f57964e | 2019-11-04 17:57:06 +0000 | [diff] [blame] | 64 | 11'h426, // Manufacturer Identity: Google |
Philipp Wagner | 086b703 | 2019-10-25 17:06:15 +0100 | [diff] [blame] | 65 | 1'b1 // (fixed) |
| 66 | }; |
| 67 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 68 | import tlul_pkg::*; |
| 69 | import top_pkg::*; |
| 70 | import tl_main_pkg::*; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 71 | |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 72 | // Signals |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 73 | logic [31:0] mio_p2d; |
| 74 | logic [31:0] mio_d2p; |
| 75 | logic [31:0] mio_d2p_en; |
Pirmin Vogel | fe6863b | 2020-05-11 17:30:54 +0200 | [diff] [blame] | 76 | logic [14:0] dio_p2d; |
| 77 | logic [14:0] dio_d2p; |
| 78 | logic [14:0] dio_d2p_en; |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 79 | // 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 Johnson | fe79c4b | 2020-07-08 10:31:08 -0700 | [diff] [blame] | 90 | logic cio_spi_device_sdi_p2d; |
| 91 | logic cio_spi_device_sdo_d2p; |
| 92 | logic cio_spi_device_sdo_en_d2p; |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 93 | // flash_ctrl |
| 94 | // rv_timer |
| 95 | // aes |
| 96 | // hmac |
| 97 | // rv_plic |
| 98 | // pinmux |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 99 | // padctrl |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 100 | // alert_handler |
Timothy Chen | 163050b | 2020-04-13 23:29:29 -0700 | [diff] [blame] | 101 | // pwrmgr |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 102 | // rstmgr |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 103 | // clkmgr |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 104 | // nmi_gen |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 105 | // usbdev |
| 106 | logic cio_usbdev_sense_p2d; |
Pirmin Vogel | b054fc0 | 2020-03-11 11:23:03 +0100 | [diff] [blame] | 107 | logic cio_usbdev_d_p2d; |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 108 | logic cio_usbdev_dp_p2d; |
| 109 | logic cio_usbdev_dn_p2d; |
Pirmin Vogel | b054fc0 | 2020-03-11 11:23:03 +0100 | [diff] [blame] | 110 | logic cio_usbdev_se0_d2p; |
| 111 | logic cio_usbdev_se0_en_d2p; |
Pirmin Vogel | fe6863b | 2020-05-11 17:30:54 +0200 | [diff] [blame] | 112 | 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 Vogel | b054fc0 | 2020-03-11 11:23:03 +0100 | [diff] [blame] | 116 | 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 Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 122 | 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 Chen | 1555dce | 2020-08-11 11:26:50 -0700 | [diff] [blame] | 126 | // sensor_ctrl |
Philipp Wagner | a4a9e40 | 2020-06-22 12:06:56 +0100 | [diff] [blame] | 127 | // otbn |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 128 | |
| 129 | |
Michael Schaffner | e2193b3 | 2020-08-04 14:02:46 -0700 | [diff] [blame] | 130 | logic [81:0] intr_vector; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 131 | // Interrupt source list |
| 132 | logic intr_uart_tx_watermark; |
| 133 | logic intr_uart_rx_watermark; |
Timothy Chen | 087d4f4 | 2019-12-27 16:04:46 -0800 | [diff] [blame] | 134 | logic intr_uart_tx_empty; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 135 | 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 Kim | 8c57fe3 | 2019-09-02 21:14:24 -0700 | [diff] [blame] | 141 | logic intr_spi_device_rxf; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 142 | logic intr_spi_device_rxlvl; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 143 | logic intr_spi_device_txlvl; |
| 144 | logic intr_spi_device_rxerr; |
Eunchan Kim | 546c0d4 | 2019-09-24 15:07:06 -0700 | [diff] [blame] | 145 | logic intr_spi_device_rxoverflow; |
| 146 | logic intr_spi_device_txunderflow; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 147 | 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 Kim | d9d69aa | 2020-03-20 10:21:11 -0700 | [diff] [blame] | 155 | logic intr_hmac_fifo_empty; |
Eunchan Kim | 226eab6 | 2019-10-18 14:11:29 -0700 | [diff] [blame] | 156 | logic intr_hmac_hmac_err; |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 157 | logic intr_alert_handler_classa; |
| 158 | logic intr_alert_handler_classb; |
| 159 | logic intr_alert_handler_classc; |
| 160 | logic intr_alert_handler_classd; |
Timothy Chen | 163050b | 2020-04-13 23:29:29 -0700 | [diff] [blame] | 161 | logic intr_pwrmgr_wakeup; |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 162 | logic intr_nmi_gen_esc0; |
| 163 | logic intr_nmi_gen_esc1; |
| 164 | logic intr_nmi_gen_esc2; |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 165 | 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 Wagner | a4a9e40 | 2020-06-22 12:06:56 +0100 | [diff] [blame] | 181 | logic intr_otbn_done; |
| 182 | logic intr_otbn_err; |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 183 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 184 | |
Michael Schaffner | d4d5d2f | 2020-04-17 15:45:55 -0700 | [diff] [blame] | 185 | |
Michael Schaffner | 1ba89b8 | 2019-11-03 14:25:54 -0800 | [diff] [blame] | 186 | logic [0:0] irq_plic; |
| 187 | logic [0:0] msip; |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 188 | logic [6:0] irq_id[1]; |
| 189 | logic [6:0] unused_irq_id[1]; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 190 | |
Michael Schaffner | 1ba89b8 | 2019-11-03 14:25:54 -0800 | [diff] [blame] | 191 | // this avoids lint errors |
| 192 | assign unused_irq_id = irq_id; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 193 | |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 194 | // Alert list |
Philipp Wagner | 79725e1 | 2020-03-03 23:34:38 +0000 | [diff] [blame] | 195 | 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 Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 197 | // Escalation outputs |
Philipp Wagner | 79725e1 | 2020-03-03 23:34:38 +0000 | [diff] [blame] | 198 | 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 Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 200 | |
| 201 | |
Eunchan Kim | 40098a9 | 2020-04-17 12:22:36 -0700 | [diff] [blame] | 202 | // 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 Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 205 | pwrmgr_pkg::pwr_rst_req_t pwrmgr_pwr_rst_req; |
| 206 | pwrmgr_pkg::pwr_rst_rsp_t pwrmgr_pwr_rst_rsp; |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 207 | pwrmgr_pkg::pwr_clk_req_t pwrmgr_pwr_clk_req; |
| 208 | pwrmgr_pkg::pwr_clk_rsp_t pwrmgr_pwr_clk_rsp; |
Eunchan Kim | 5152e88 | 2020-08-03 16:26:40 -0700 | [diff] [blame] | 209 | logic pwrmgr_wakeups; |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 210 | 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 Chen | 1555dce | 2020-08-11 11:26:50 -0700 | [diff] [blame] | 254 | tlul_pkg::tl_h2d_t sensor_ctrl_tl_req; |
| 255 | tlul_pkg::tl_d2h_t sensor_ctrl_tl_rsp; |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 256 | 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 Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 259 | clkmgr_pkg::clkmgr_out_t clkmgr_clocks; |
Pirmin Vogel | a2d411d | 2020-07-13 17:33:42 +0200 | [diff] [blame] | 260 | logic aes_idle; |
| 261 | clkmgr_pkg::clk_hint_status_t clkmgr_status; |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 262 | 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 Vogel | a2d411d | 2020-07-13 17:33:42 +0200 | [diff] [blame] | 270 | |
| 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 Chen | 80bd8aa | 2019-10-04 15:57:11 -0700 | [diff] [blame] | 276 | |
Timothy Chen | 3193b00 | 2019-10-04 16:56:05 -0700 | [diff] [blame] | 277 | // Non-debug module reset == reset for everything except for the debug module |
| 278 | logic ndmreset_req; |
| 279 | |
Timothy Chen | 3193b00 | 2019-10-04 16:56:05 -0700 | [diff] [blame] | 280 | // debug request from rv_dm to core |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 281 | logic debug_req; |
| 282 | |
| 283 | // processor core |
| 284 | rv_core_ibex #( |
Philipp Wagner | 25d88922 | 2020-04-03 11:52:41 +0100 | [diff] [blame] | 285 | .PMPEnable (1), |
| 286 | .PMPGranularity (0), // 2^(PMPGranularity+2) == 4 byte granularity |
| 287 | .PMPNumRegions (16), |
Pirmin Vogel | 185d1bf | 2020-08-27 13:30:10 +0200 | [diff] [blame^] | 288 | .MHPMCounterNum (10), |
| 289 | .MHPMCounterWidth (32), |
Greg Chadwick | dadb1af | 2020-04-16 17:10:23 +0100 | [diff] [blame] | 290 | .RV32E (0), |
Pirmin Vogel | e381464 | 2020-08-27 12:44:23 +0200 | [diff] [blame] | 291 | .RV32M (ibex_pkg::RV32MSingleCycle), |
| 292 | .RV32B (ibex_pkg::RV32BNone), |
| 293 | .RegFile (ibex_pkg::RegFileFF), |
Greg Chadwick | dadb1af | 2020-04-16 17:10:23 +0100 | [diff] [blame] | 294 | .BranchTargetALU (1), |
| 295 | .WritebackStage (1), |
Tom Roberts | 78bb2ae | 2020-06-03 15:24:22 +0100 | [diff] [blame] | 296 | .ICache (0), |
| 297 | .ICacheECC (0), |
Pirmin Vogel | e381464 | 2020-08-27 12:44:23 +0200 | [diff] [blame] | 298 | .BranchPredictor (0), |
Greg Chadwick | dadb1af | 2020-04-16 17:10:23 +0100 | [diff] [blame] | 299 | .DbgTriggerEn (1), |
Tom Roberts | 78bb2ae | 2020-06-03 15:24:22 +0100 | [diff] [blame] | 300 | .SecureIbex (0), |
Greg Chadwick | dadb1af | 2020-04-16 17:10:23 +0100 | [diff] [blame] | 301 | .DmHaltAddr (ADDR_SPACE_DEBUG_MEM + dm::HaltAddress), |
| 302 | .DmExceptionAddr (ADDR_SPACE_DEBUG_MEM + dm::ExceptionAddress), |
| 303 | .PipeLine (IbexPipeLine) |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 304 | ) u_rv_core_ibex ( |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 305 | // clock and reset |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 306 | .clk_i (clkmgr_clocks.clk_proc_main), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 307 | .rst_ni (rstmgr_resets.rst_sys_n), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 308 | .test_en_i (1'b0), |
| 309 | // static pinning |
Greg Chadwick | 53ef2ec | 2019-09-03 14:53:54 +0100 | [diff] [blame] | 310 | .hart_id_i (32'b0), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 311 | .boot_addr_i (ADDR_SPACE_ROM), |
| 312 | // TL-UL buses |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 313 | .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 Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 317 | // interrupts |
| 318 | .irq_software_i (msip), |
| 319 | .irq_timer_i (intr_rv_timer_timer_expired_0_0), |
| 320 | .irq_external_i (irq_plic), |
Michael Schaffner | bdcbd20 | 2020-07-27 12:18:21 -0700 | [diff] [blame] | 321 | // escalation input from alert handler (NMI) |
| 322 | .esc_tx_i (esc_tx[0]), |
| 323 | .esc_rx_o (esc_rx[0]), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 324 | // debug interface |
| 325 | .debug_req_i (debug_req), |
| 326 | // CPU control signals |
Pirmin Vogel | ffc9e83 | 2019-09-13 16:16:05 +0100 | [diff] [blame] | 327 | .fetch_enable_i (1'b1), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 328 | .core_sleep_o (pwrmgr_pwr_cpu.core_sleeping) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 329 | ); |
| 330 | |
| 331 | // Debug Module (RISC-V Debug Spec 0.13) |
| 332 | // |
| 333 | |
| 334 | rv_dm #( |
Philipp Wagner | 086b703 | 2019-10-25 17:06:15 +0100 | [diff] [blame] | 335 | .NrHarts (1), |
| 336 | .IdcodeValue (JTAG_IDCODE) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 337 | ) u_dm_top ( |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 338 | .clk_i (clkmgr_clocks.clk_proc_main), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 339 | .rst_ni (rstmgr_resets.rst_lc_n), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 340 | .testmode_i (1'b0), |
Timothy Chen | 3193b00 | 2019-10-04 16:56:05 -0700 | [diff] [blame] | 341 | .ndmreset_o (ndmreset_req), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 342 | .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 Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 347 | .tl_d_i (main_tl_debug_mem_req), |
| 348 | .tl_d_o (main_tl_debug_mem_rsp), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 349 | |
| 350 | // bus host (for system bus accesses, SBA) |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 351 | .tl_h_o (main_tl_dm_sba_req), |
| 352 | .tl_h_i (main_tl_dm_sba_rsp), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 353 | |
| 354 | //JTAG |
| 355 | .tck_i (jtag_tck_i), |
| 356 | .tms_i (jtag_tms_i), |
| 357 | .trst_ni (jtag_trst_ni), |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 358 | .td_i (jtag_tdi_i), |
| 359 | .td_o (jtag_tdo_o), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 360 | .tdo_oe_o ( ) |
| 361 | ); |
| 362 | |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 363 | assign rstmgr_cpu.ndmreset_req = ndmreset_req; |
| 364 | assign rstmgr_cpu.rst_cpu_n = rstmgr_resets.rst_sys_n; |
| 365 | |
Timothy Chen | 4446103 | 2019-09-20 15:35:20 -0700 | [diff] [blame] | 366 | // ROM device |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 367 | logic rom_req; |
Timothy Chen | da2e344 | 2020-02-24 21:37:47 -0800 | [diff] [blame] | 368 | logic [11:0] rom_addr; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 369 | logic [31:0] rom_rdata; |
| 370 | logic rom_rvalid; |
| 371 | |
| 372 | tlul_adapter_sram #( |
Timothy Chen | da2e344 | 2020-02-24 21:37:47 -0800 | [diff] [blame] | 373 | .SramAw(12), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 374 | .SramDw(32), |
Eunchan Kim | 6c731a8 | 2020-03-04 14:48:52 -0800 | [diff] [blame] | 375 | .Outstanding(2), |
Timothy Chen | 4446103 | 2019-09-20 15:35:20 -0700 | [diff] [blame] | 376 | .ErrOnWrite(1) |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 377 | ) u_tl_adapter_rom ( |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 378 | .clk_i (clkmgr_clocks.clk_main_infra), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 379 | .rst_ni (rstmgr_resets.rst_sys_n), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 380 | |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 381 | .tl_i (rom_tl_req), |
| 382 | .tl_o (rom_tl_rsp), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 383 | |
| 384 | .req_o (rom_req), |
| 385 | .gnt_i (1'b1), // Always grant as only one requester exists |
Timothy Chen | 4446103 | 2019-09-20 15:35:20 -0700 | [diff] [blame] | 386 | .we_o (), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 387 | .addr_o (rom_addr), |
Timothy Chen | 4446103 | 2019-09-20 15:35:20 -0700 | [diff] [blame] | 388 | .wdata_o (), |
| 389 | .wmask_o (), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 390 | .rdata_i (rom_rdata), |
| 391 | .rvalid_i (rom_rvalid), |
| 392 | .rerror_i (2'b00) |
| 393 | ); |
| 394 | |
Michael Schaffner | 0beb8a4 | 2020-06-05 23:17:40 -0700 | [diff] [blame] | 395 | prim_rom_adv #( |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 396 | .Width(32), |
Philipp Wagner | a37bcfa | 2020-05-19 22:46:41 +0100 | [diff] [blame] | 397 | .Depth(4096), |
| 398 | .MemInitFile(BootRomInitFile) |
Timothy Chen | 4446103 | 2019-09-20 15:35:20 -0700 | [diff] [blame] | 399 | ) u_rom_rom ( |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 400 | .clk_i (clkmgr_clocks.clk_main_infra), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 401 | .rst_ni (rstmgr_resets.rst_sys_n), |
Michael Schaffner | 0beb8a4 | 2020-06-05 23:17:40 -0700 | [diff] [blame] | 402 | .req_i (rom_req), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 403 | .addr_i (rom_addr), |
Michael Schaffner | 0beb8a4 | 2020-06-05 23:17:40 -0700 | [diff] [blame] | 404 | .rdata_o (rom_rdata), |
| 405 | .rvalid_o (rom_rvalid), |
| 406 | .cfg_i ('0) // tied off for now |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 407 | ); |
Timothy Chen | 4446103 | 2019-09-20 15:35:20 -0700 | [diff] [blame] | 408 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 409 | // 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 Wagner | e1efc18 | 2020-05-21 18:26:17 +0100 | [diff] [blame] | 417 | logic [1:0] ram_main_rerror; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 418 | |
| 419 | tlul_adapter_sram #( |
| 420 | .SramAw(14), |
| 421 | .SramDw(32), |
Eunchan Kim | 6c731a8 | 2020-03-04 14:48:52 -0800 | [diff] [blame] | 422 | .Outstanding(2) |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 423 | ) u_tl_adapter_ram_main ( |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 424 | .clk_i (clkmgr_clocks.clk_main_infra), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 425 | .rst_ni (rstmgr_resets.rst_sys_n), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 426 | .tl_i (ram_main_tl_req), |
| 427 | .tl_o (ram_main_tl_rsp), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 428 | |
| 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 Wagner | e1efc18 | 2020-05-21 18:26:17 +0100 | [diff] [blame] | 437 | .rerror_i (ram_main_rerror) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 438 | ); |
| 439 | |
Philipp Wagner | e1efc18 | 2020-05-21 18:26:17 +0100 | [diff] [blame] | 440 | prim_ram_1p_adv #( |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 441 | .Width(32), |
| 442 | .Depth(16384), |
Philipp Wagner | e1efc18 | 2020-05-21 18:26:17 +0100 | [diff] [blame] | 443 | .DataBitsPerMask(8), |
Michael Schaffner | 25d73cf | 2020-06-10 22:31:40 -0700 | [diff] [blame] | 444 | .CfgW(8), |
| 445 | // TODO: enable parity once supported by the simulation infrastructure |
| 446 | .EnableParity(0) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 447 | ) u_ram1p_ram_main ( |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 448 | .clk_i (clkmgr_clocks.clk_main_infra), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 449 | .rst_ni (rstmgr_resets.rst_sys_n), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 450 | |
| 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 Wagner | e1efc18 | 2020-05-21 18:26:17 +0100 | [diff] [blame] | 456 | .rdata_o (ram_main_rdata), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 457 | .rvalid_o (ram_main_rvalid), |
Philipp Wagner | e1efc18 | 2020-05-21 18:26:17 +0100 | [diff] [blame] | 458 | .rerror_o (ram_main_rerror), |
| 459 | .cfg_i ('0) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 460 | ); |
Timothy Chen | 6e2ba84 | 2020-06-29 15:04:13 -0700 | [diff] [blame] | 461 | // 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 Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 478 | .tl_i (ram_ret_tl_req), |
| 479 | .tl_o (ram_ret_tl_rsp), |
Timothy Chen | 6e2ba84 | 2020-06-29 15:04:13 -0700 | [diff] [blame] | 480 | |
| 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 Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 513 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 514 | // host to flash communication |
| 515 | logic flash_host_req; |
| 516 | logic flash_host_req_rdy; |
| 517 | logic flash_host_req_done; |
Timothy Chen | 1451840 | 2020-04-13 15:25:22 -0700 | [diff] [blame] | 518 | logic [flash_ctrl_pkg::BusWidth-1:0] flash_host_rdata; |
Timothy Chen | b35a340 | 2020-06-23 00:14:11 -0700 | [diff] [blame] | 519 | logic [flash_ctrl_pkg::BusAddrW-1:0] flash_host_addr; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 520 | |
Timothy Chen | 5aec528 | 2019-09-10 21:10:56 -0700 | [diff] [blame] | 521 | tlul_adapter_sram #( |
Timothy Chen | b35a340 | 2020-06-23 00:14:11 -0700 | [diff] [blame] | 522 | .SramAw(flash_ctrl_pkg::BusAddrW), |
Timothy Chen | 1451840 | 2020-04-13 15:25:22 -0700 | [diff] [blame] | 523 | .SramDw(flash_ctrl_pkg::BusWidth), |
Eunchan Kim | 6c731a8 | 2020-03-04 14:48:52 -0800 | [diff] [blame] | 524 | .Outstanding(2), |
Timothy Chen | 5aec528 | 2019-09-10 21:10:56 -0700 | [diff] [blame] | 525 | .ByteAccess(0), |
| 526 | .ErrOnWrite(1) |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 527 | ) u_tl_adapter_eflash ( |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 528 | .clk_i (clkmgr_clocks.clk_main_infra), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 529 | .rst_ni (rstmgr_resets.rst_lc_n), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 530 | |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 531 | .tl_i (eflash_tl_req), |
| 532 | .tl_o (eflash_tl_rsp), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 533 | |
Timothy Chen | 5aec528 | 2019-09-10 21:10:56 -0700 | [diff] [blame] | 534 | .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 Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 543 | ); |
| 544 | |
Timothy Chen | 1451840 | 2020-04-13 15:25:22 -0700 | [diff] [blame] | 545 | flash_phy u_flash_eflash ( |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 546 | .clk_i (clkmgr_clocks.clk_main_infra), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 547 | .rst_ni (rstmgr_resets.rst_lc_n), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 548 | .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 Kim | 6599ba9 | 2020-04-13 15:27:16 -0700 | [diff] [blame] | 553 | .flash_ctrl_i (flash_ctrl_flash_req), |
| 554 | .flash_ctrl_o (flash_ctrl_flash_rsp) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 555 | ); |
| 556 | |
| 557 | |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 558 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 559 | uart u_uart ( |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 560 | |
| 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 Chen | 087d4f4 | 2019-12-27 16:04:46 -0800 | [diff] [blame] | 571 | .intr_tx_empty_o (intr_uart_tx_empty), |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 572 | .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 Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 576 | .intr_rx_parity_err_o (intr_uart_rx_parity_err), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 577 | |
| 578 | // Inter-module signals |
| 579 | .tl_i(uart_tl_req), |
| 580 | .tl_o(uart_tl_rsp), |
Timothy Chen | 33b3b9d | 2020-05-08 10:14:17 -0700 | [diff] [blame] | 581 | .clk_i (clkmgr_clocks.clk_io_secure), |
| 582 | .rst_ni (rstmgr_resets.rst_sys_io_n) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 583 | ); |
| 584 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 585 | gpio u_gpio ( |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 586 | |
| 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 Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 595 | .intr_gpio_o (intr_gpio_gpio), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 596 | |
| 597 | // Inter-module signals |
| 598 | .tl_i(gpio_tl_req), |
| 599 | .tl_o(gpio_tl_rsp), |
Timothy Chen | 33b3b9d | 2020-05-08 10:14:17 -0700 | [diff] [blame] | 600 | .clk_i (clkmgr_clocks.clk_io_peri), |
| 601 | .rst_ni (rstmgr_resets.rst_sys_io_n) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 602 | ); |
| 603 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 604 | spi_device u_spi_device ( |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 605 | |
| 606 | // Input |
Timothy Chen | c38f789 | 2020-07-16 18:19:48 -0700 | [diff] [blame] | 607 | .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 Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 610 | |
| 611 | // Output |
Timothy Chen | c38f789 | 2020-07-16 18:19:48 -0700 | [diff] [blame] | 612 | .cio_sdo_o (cio_spi_device_sdo_d2p), |
| 613 | .cio_sdo_en_o (cio_spi_device_sdo_en_d2p), |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 614 | |
| 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 Kim | 546c0d4 | 2019-09-24 15:07:06 -0700 | [diff] [blame] | 621 | .intr_txunderflow_o (intr_spi_device_txunderflow), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 622 | |
| 623 | // Inter-module signals |
| 624 | .tl_i(spi_device_tl_req), |
| 625 | .tl_o(spi_device_tl_rsp), |
Eunchan Kim | 2cfadab | 2019-10-02 12:41:11 -0700 | [diff] [blame] | 626 | .scanmode_i (scanmode_i), |
Timothy Chen | 33b3b9d | 2020-05-08 10:14:17 -0700 | [diff] [blame] | 627 | .clk_i (clkmgr_clocks.clk_io_peri), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 628 | .rst_ni (rstmgr_resets.rst_spi_device_n) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 629 | ); |
| 630 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 631 | flash_ctrl u_flash_ctrl ( |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 632 | |
| 633 | // Interrupt |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 634 | .intr_prog_empty_o (intr_flash_ctrl_prog_empty), |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 635 | .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 Kim | e4a8507 | 2020-02-05 16:00:00 -0800 | [diff] [blame] | 641 | // Inter-module signals |
Eunchan Kim | 6599ba9 | 2020-04-13 15:27:16 -0700 | [diff] [blame] | 642 | .flash_o(flash_ctrl_flash_req), |
| 643 | .flash_i(flash_ctrl_flash_rsp), |
Timothy Chen | ac62065 | 2020-06-25 13:48:50 -0700 | [diff] [blame] | 644 | .otp_i(flash_ctrl_pkg::OTP_FLASH_DEFAULT), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 645 | .tl_i(flash_ctrl_tl_req), |
| 646 | .tl_o(flash_ctrl_tl_rsp), |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 647 | .clk_i (clkmgr_clocks.clk_main_infra), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 648 | .rst_ni (rstmgr_resets.rst_lc_n) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 649 | ); |
| 650 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 651 | rv_timer u_rv_timer ( |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 652 | |
| 653 | // Interrupt |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 654 | .intr_timer_expired_0_0_o (intr_rv_timer_timer_expired_0_0), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 655 | |
| 656 | // Inter-module signals |
| 657 | .tl_i(rv_timer_tl_req), |
| 658 | .tl_o(rv_timer_tl_rsp), |
Timothy Chen | 33b3b9d | 2020-05-08 10:14:17 -0700 | [diff] [blame] | 659 | .clk_i (clkmgr_clocks.clk_io_timers), |
| 660 | .rst_ni (rstmgr_resets.rst_sys_io_n) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 661 | ); |
| 662 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 663 | aes u_aes ( |
Pirmin Vogel | a2d411d | 2020-07-13 17:33:42 +0200 | [diff] [blame] | 664 | |
Pirmin Vogel | 3dc24fc | 2020-07-29 19:51:22 +0200 | [diff] [blame] | 665 | // [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 Vogel | be4bcb7 | 2020-04-17 14:43:45 +0200 | [diff] [blame] | 669 | |
Pirmin Vogel | a2d411d | 2020-07-13 17:33:42 +0200 | [diff] [blame] | 670 | // Inter-module signals |
| 671 | .idle_o(aes_idle), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 672 | .tl_i(aes_tl_req), |
| 673 | .tl_o(aes_tl_rsp), |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 674 | .clk_i (clkmgr_clocks.clk_main_aes), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 675 | .rst_ni (rstmgr_resets.rst_sys_n) |
Pirmin Vogel | d453438 | 2019-10-17 13:18:31 +0100 | [diff] [blame] | 676 | ); |
| 677 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 678 | hmac u_hmac ( |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 679 | |
| 680 | // Interrupt |
Eunchan Kim | d9d69aa | 2020-03-20 10:21:11 -0700 | [diff] [blame] | 681 | .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 Schaffner | d4d5d2f | 2020-04-17 15:45:55 -0700 | [diff] [blame] | 684 | |
Pirmin Vogel | 3dc24fc | 2020-07-29 19:51:22 +0200 | [diff] [blame] | 685 | // [2]: msg_push_sha_disabled |
| 686 | .alert_tx_o ( alert_tx[2:2] ), |
| 687 | .alert_rx_i ( alert_rx[2:2] ), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 688 | |
| 689 | // Inter-module signals |
| 690 | .tl_i(hmac_tl_req), |
| 691 | .tl_o(hmac_tl_rsp), |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 692 | .clk_i (clkmgr_clocks.clk_main_hmac), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 693 | .rst_ni (rstmgr_resets.rst_sys_n) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 694 | ); |
| 695 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 696 | rv_plic u_rv_plic ( |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 697 | |
| 698 | // Inter-module signals |
| 699 | .tl_i(rv_plic_tl_req), |
| 700 | .tl_o(rv_plic_tl_rsp), |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 701 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 702 | .intr_src_i (intr_vector), |
| 703 | .irq_o (irq_plic), |
| 704 | .irq_id_o (irq_id), |
| 705 | .msip_o (msip), |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 706 | .clk_i (clkmgr_clocks.clk_main_secure), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 707 | .rst_ni (rstmgr_resets.rst_sys_n) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 708 | ); |
| 709 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 710 | pinmux u_pinmux ( |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 711 | |
Michael Schaffner | 920e4cc | 2020-04-28 22:58:12 -0700 | [diff] [blame] | 712 | // Inter-module signals |
Michael Schaffner | 39ef7f5 | 2020-07-10 21:58:48 -0700 | [diff] [blame] | 713 | .lc_pinmux_strap_i('0), |
Michael Schaffner | 920e4cc | 2020-04-28 22:58:12 -0700 | [diff] [blame] | 714 | .lc_pinmux_strap_o(), |
Michael Schaffner | 39ef7f5 | 2020-07-10 21:58:48 -0700 | [diff] [blame] | 715 | .dft_strap_test_o(), |
| 716 | .io_pok_i({pinmux_pkg::NIOPokSignals{1'b1}}), |
| 717 | .sleep_en_i(1'b0), |
Timothy Chen | 4ba2531 | 2020-06-17 13:08:57 -0700 | [diff] [blame] | 718 | .aon_wkup_req_o(pwrmgr_wakeups), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 719 | .tl_i(pinmux_tl_req), |
| 720 | .tl_o(pinmux_tl_rsp), |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 721 | |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 722 | .periph_to_mio_i (mio_d2p ), |
| 723 | .periph_to_mio_oe_i (mio_d2p_en ), |
| 724 | .mio_to_periph_o (mio_p2d ), |
Michael Schaffner | 920e4cc | 2020-04-28 22:58:12 -0700 | [diff] [blame] | 725 | |
| 726 | .mio_out_o, |
| 727 | .mio_oe_o, |
| 728 | .mio_in_i, |
| 729 | |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 730 | .periph_to_dio_i (dio_d2p ), |
| 731 | .periph_to_dio_oe_i (dio_d2p_en ), |
| 732 | .dio_to_periph_o (dio_p2d ), |
Michael Schaffner | 920e4cc | 2020-04-28 22:58:12 -0700 | [diff] [blame] | 733 | |
| 734 | .dio_out_o, |
| 735 | .dio_oe_o, |
| 736 | .dio_in_i, |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 737 | .clk_i (clkmgr_clocks.clk_main_secure), |
Timothy Chen | 1faeb3c | 2020-05-11 22:06:32 -0700 | [diff] [blame] | 738 | .clk_aon_i (clkmgr_clocks.clk_io_secure), |
Michael Schaffner | 920e4cc | 2020-04-28 22:58:12 -0700 | [diff] [blame] | 739 | .rst_ni (rstmgr_resets.rst_sys_n), |
Timothy Chen | 1faeb3c | 2020-05-11 22:06:32 -0700 | [diff] [blame] | 740 | .rst_aon_ni (rstmgr_resets.rst_sys_io_n) |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 741 | ); |
| 742 | |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 743 | padctrl u_padctrl ( |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 744 | |
| 745 | // Inter-module signals |
| 746 | .tl_i(padctrl_tl_req), |
| 747 | .tl_o(padctrl_tl_rsp), |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 748 | |
| 749 | .mio_attr_o, |
| 750 | .dio_attr_o, |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 751 | .clk_i (clkmgr_clocks.clk_main_secure), |
| 752 | .rst_ni (rstmgr_resets.rst_sys_n) |
| 753 | ); |
| 754 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 755 | alert_handler u_alert_handler ( |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 756 | |
| 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 Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 762 | |
| 763 | // Inter-module signals |
| 764 | .tl_i(alert_handler_tl_req), |
| 765 | .tl_o(alert_handler_tl_rsp), |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 766 | // 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 Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 776 | .clk_i (clkmgr_clocks.clk_main_secure), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 777 | .rst_ni (rstmgr_resets.rst_sys_n) |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 778 | ); |
| 779 | |
Timothy Chen | 163050b | 2020-04-13 23:29:29 -0700 | [diff] [blame] | 780 | pwrmgr u_pwrmgr ( |
Timothy Chen | 163050b | 2020-04-13 23:29:29 -0700 | [diff] [blame] | 781 | |
| 782 | // Interrupt |
| 783 | .intr_wakeup_o (intr_pwrmgr_wakeup), |
| 784 | |
| 785 | // Inter-module signals |
Timothy Chen | 1555dce | 2020-08-11 11:26:50 -0700 | [diff] [blame] | 786 | .pwr_ast_o(pwrmgr_pwr_ast_req_o), |
| 787 | .pwr_ast_i(pwrmgr_pwr_ast_rsp_i), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 788 | .pwr_rst_o(pwrmgr_pwr_rst_req), |
| 789 | .pwr_rst_i(pwrmgr_pwr_rst_rsp), |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 790 | .pwr_clk_o(pwrmgr_pwr_clk_req), |
| 791 | .pwr_clk_i(pwrmgr_pwr_clk_rsp), |
Timothy Chen | 163050b | 2020-04-13 23:29:29 -0700 | [diff] [blame] | 792 | .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 Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 797 | .pwr_cpu_i(pwrmgr_pwr_cpu), |
Timothy Chen | 4ba2531 | 2020-06-17 13:08:57 -0700 | [diff] [blame] | 798 | .wakeups_i(pwrmgr_wakeups), |
| 799 | .rstreqs_i('0), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 800 | .tl_i(pwrmgr_tl_req), |
| 801 | .tl_o(pwrmgr_tl_rsp), |
Timothy Chen | 371c94d | 2020-06-30 17:18:14 -0700 | [diff] [blame] | 802 | .clk_i (clkmgr_clocks.clk_io_powerup), |
| 803 | .clk_slow_i (clkmgr_clocks.clk_aon_powerup), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 804 | .rst_ni (rstmgr_resets.rst_por_n), |
Timothy Chen | a4cc10d | 2020-05-08 16:06:20 -0700 | [diff] [blame] | 805 | .rst_slow_ni (rstmgr_resets.rst_por_aon_n) |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 806 | ); |
| 807 | |
| 808 | rstmgr u_rstmgr ( |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 809 | |
| 810 | // Inter-module signals |
| 811 | .pwr_i(pwrmgr_pwr_rst_req), |
| 812 | .pwr_o(pwrmgr_pwr_rst_rsp), |
| 813 | .resets_o(rstmgr_resets), |
Timothy Chen | 1555dce | 2020-08-11 11:26:50 -0700 | [diff] [blame] | 814 | .ast_i(rstmgr_ast_i), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 815 | .cpu_i(rstmgr_cpu), |
| 816 | .peri_i(rstmgr_pkg::RSTMGR_PERI_DEFAULT), |
Timothy Chen | 437fd9a | 2020-08-26 12:48:40 -0700 | [diff] [blame] | 817 | .resets_ast_o(rsts_ast_o), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 818 | .tl_i(rstmgr_tl_req), |
| 819 | .tl_o(rstmgr_tl_rsp), |
Timothy Chen | 371c94d | 2020-06-30 17:18:14 -0700 | [diff] [blame] | 820 | .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 Chen | 437fd9a | 2020-08-26 12:48:40 -0700 | [diff] [blame] | 826 | .clk_io_div4_i (clkmgr_clocks.clk_io_div4_powerup), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 827 | .rst_ni (rst_ni) |
Timothy Chen | 163050b | 2020-04-13 23:29:29 -0700 | [diff] [blame] | 828 | ); |
| 829 | |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 830 | clkmgr u_clkmgr ( |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 831 | |
| 832 | // Inter-module signals |
| 833 | .clocks_o(clkmgr_clocks), |
Eunchan Kim | 5511bbe | 2020-08-07 14:04:20 -0700 | [diff] [blame] | 834 | .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 Chen | 437fd9a | 2020-08-26 12:48:40 -0700 | [diff] [blame] | 838 | .clocks_ast_o(clks_ast_o), |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 839 | .pwr_i(pwrmgr_pwr_clk_req), |
| 840 | .pwr_o(pwrmgr_pwr_clk_rsp), |
| 841 | .dft_i(clkmgr_pkg::CLK_DFT_DEFAULT), |
Pirmin Vogel | a2d411d | 2020-07-13 17:33:42 +0200 | [diff] [blame] | 842 | .status_i(clkmgr_status), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 843 | .tl_i(clkmgr_tl_req), |
| 844 | .tl_o(clkmgr_tl_rsp), |
Timothy Chen | 371c94d | 2020-06-30 17:18:14 -0700 | [diff] [blame] | 845 | .clk_i (clkmgr_clocks.clk_io_powerup), |
Timothy Chen | a4cc10d | 2020-05-08 16:06:20 -0700 | [diff] [blame] | 846 | .rst_ni (rstmgr_resets.rst_por_io_n), |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 847 | .rst_main_ni (rstmgr_resets.rst_por_n), |
Timothy Chen | a4cc10d | 2020-05-08 16:06:20 -0700 | [diff] [blame] | 848 | .rst_io_ni (rstmgr_resets.rst_por_io_n), |
Timothy Chen | 371c94d | 2020-06-30 17:18:14 -0700 | [diff] [blame] | 849 | .rst_usb_ni (rstmgr_resets.rst_por_usb_n), |
Timothy Chen | e896d0c | 2020-08-20 11:11:09 -0700 | [diff] [blame] | 850 | .rst_io_div2_ni (rstmgr_resets.rst_por_io_div2_n), |
| 851 | .rst_io_div4_ni (rstmgr_resets.rst_por_io_div4_n) |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 852 | ); |
| 853 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 854 | nmi_gen u_nmi_gen ( |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 855 | |
| 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 Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 860 | |
| 861 | // Inter-module signals |
| 862 | .tl_i(nmi_gen_tl_req), |
| 863 | .tl_o(nmi_gen_tl_rsp), |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 864 | // escalation signal inputs |
Michael Schaffner | bdcbd20 | 2020-07-27 12:18:21 -0700 | [diff] [blame] | 865 | .esc_rx_o ( esc_rx[3:1] ), |
| 866 | .esc_tx_i ( esc_tx[3:1] ), |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 867 | .clk_i (clkmgr_clocks.clk_main_secure), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 868 | .rst_ni (rstmgr_resets.rst_sys_n) |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 869 | ); |
| 870 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 871 | usbdev u_usbdev ( |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 872 | |
Pirmin Vogel | b054fc0 | 2020-03-11 11:23:03 +0100 | [diff] [blame] | 873 | // 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 Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 878 | |
Pirmin Vogel | b054fc0 | 2020-03-11 11:23:03 +0100 | [diff] [blame] | 879 | // Output |
| 880 | .cio_se0_o (cio_usbdev_se0_d2p), |
| 881 | .cio_se0_en_o (cio_usbdev_se0_en_d2p), |
Pirmin Vogel | fe6863b | 2020-05-11 17:30:54 +0200 | [diff] [blame] | 882 | .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 Vogel | b054fc0 | 2020-03-11 11:23:03 +0100 | [diff] [blame] | 886 | .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 Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 896 | |
| 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 Vogel | dd3a2f0 | 2020-05-12 14:59:50 +0200 | [diff] [blame] | 915 | // Inter-module signals |
Timothy Chen | 1555dce | 2020-08-11 11:26:50 -0700 | [diff] [blame] | 916 | .usb_ref_val_o(usbdev_usb_ref_val_o), |
| 917 | .usb_ref_pulse_o(usbdev_usb_ref_pulse_o), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 918 | .tl_i(usbdev_tl_req), |
| 919 | .tl_o(usbdev_tl_rsp), |
Timothy Chen | 33b3b9d | 2020-05-08 10:14:17 -0700 | [diff] [blame] | 920 | .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 Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 923 | .rst_usb_48mhz_ni (rstmgr_resets.rst_usb_n) |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 924 | ); |
| 925 | |
Timothy Chen | 1555dce | 2020-08-11 11:26:50 -0700 | [diff] [blame] | 926 | sensor_ctrl u_sensor_ctrl ( |
| 927 | |
Timothy Chen | 1555dce | 2020-08-11 11:26:50 -0700 | [diff] [blame] | 928 | // [3]: ast_alerts |
| 929 | // [4]: ast_alerts |
| 930 | // [5]: ast_alerts |
| 931 | // [6]: ast_alerts |
| 932 | // [7]: ast_alerts |
| 933 | // [8]: ast_alerts |
Pirmin Vogel | 3dc24fc | 2020-07-29 19:51:22 +0200 | [diff] [blame] | 934 | // [9]: ast_alerts |
| 935 | .alert_tx_o ( alert_tx[9:3] ), |
| 936 | .alert_rx_i ( alert_rx[9:3] ), |
Timothy Chen | 1555dce | 2020-08-11 11:26:50 -0700 | [diff] [blame] | 937 | |
| 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 Wagner | a4a9e40 | 2020-06-22 12:06:56 +0100 | [diff] [blame] | 948 | otbn u_otbn ( |
Philipp Wagner | a4a9e40 | 2020-06-22 12:06:56 +0100 | [diff] [blame] | 949 | |
| 950 | // Interrupt |
| 951 | .intr_done_o (intr_otbn_done), |
| 952 | .intr_err_o (intr_otbn_err), |
| 953 | |
Pirmin Vogel | 3dc24fc | 2020-07-29 19:51:22 +0200 | [diff] [blame] | 954 | // [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 Wagner | a4a9e40 | 2020-06-22 12:06:56 +0100 | [diff] [blame] | 959 | |
| 960 | // Inter-module signals |
| 961 | .idle_o(), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 962 | .tl_i(otbn_tl_req), |
| 963 | .tl_o(otbn_tl_rsp), |
Philipp Wagner | a4a9e40 | 2020-06-22 12:06:56 +0100 | [diff] [blame] | 964 | .clk_i (clkmgr_clocks.clk_main_otbn), |
| 965 | .rst_ni (rstmgr_resets.rst_sys_n) |
| 966 | ); |
| 967 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 968 | // interrupt assignments |
| 969 | assign intr_vector = { |
Philipp Wagner | a4a9e40 | 2020-06-22 12:06:56 +0100 | [diff] [blame] | 970 | intr_otbn_err, |
| 971 | intr_otbn_done, |
Timothy Chen | 163050b | 2020-04-13 23:29:29 -0700 | [diff] [blame] | 972 | intr_pwrmgr_wakeup, |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 973 | 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 Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 989 | 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 Kim | 226eab6 | 2019-10-18 14:11:29 -0700 | [diff] [blame] | 996 | intr_hmac_hmac_err, |
Eunchan Kim | d9d69aa | 2020-03-20 10:21:11 -0700 | [diff] [blame] | 997 | intr_hmac_fifo_empty, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 998 | 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 Kim | 546c0d4 | 2019-09-24 15:07:06 -0700 | [diff] [blame] | 1005 | intr_spi_device_txunderflow, |
| 1006 | intr_spi_device_rxoverflow, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1007 | intr_spi_device_rxerr, |
| 1008 | intr_spi_device_txlvl, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1009 | intr_spi_device_rxlvl, |
Eunchan Kim | 8c57fe3 | 2019-09-02 21:14:24 -0700 | [diff] [blame] | 1010 | intr_spi_device_rxf, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1011 | 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 Chen | 087d4f4 | 2019-12-27 16:04:46 -0800 | [diff] [blame] | 1016 | intr_uart_tx_empty, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1017 | intr_uart_rx_watermark, |
| 1018 | intr_uart_tx_watermark, |
Eunchan Kim | 88a8615 | 2020-04-13 16:12:08 -0700 | [diff] [blame] | 1019 | intr_gpio_gpio, |
| 1020 | 1'b 0 // For ID 0. |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1021 | }; |
| 1022 | |
| 1023 | // TL-UL Crossbar |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1024 | xbar_main u_xbar_main ( |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 1025 | .clk_main_i (clkmgr_clocks.clk_main_infra), |
Timothy Chen | 33b3b9d | 2020-05-08 10:14:17 -0700 | [diff] [blame] | 1026 | .clk_fixed_i (clkmgr_clocks.clk_io_infra), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 1027 | .rst_main_ni (rstmgr_resets.rst_sys_n), |
Timothy Chen | 33b3b9d | 2020-05-08 10:14:17 -0700 | [diff] [blame] | 1028 | .rst_fixed_ni (rstmgr_resets.rst_sys_io_n), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 1029 | |
| 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 Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1098 | |
| 1099 | .scanmode_i |
| 1100 | ); |
Eunchan Kim | 55d7ae8 | 2019-12-19 17:08:35 -0800 | [diff] [blame] | 1101 | xbar_peri u_xbar_peri ( |
Timothy Chen | 33b3b9d | 2020-05-08 10:14:17 -0700 | [diff] [blame] | 1102 | .clk_peri_i (clkmgr_clocks.clk_io_infra), |
| 1103 | .rst_peri_ni (rstmgr_resets.rst_sys_io_n), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 1104 | |
| 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 Chen | 1555dce | 2020-08-11 11:26:50 -0700 | [diff] [blame] | 1145 | // port: tl_sensor_ctrl |
| 1146 | .tl_sensor_ctrl_o(sensor_ctrl_tl_req), |
| 1147 | .tl_sensor_ctrl_i(sensor_ctrl_tl_rsp), |
| 1148 | |
Timothy Chen | fb34fe3 | 2020-08-26 17:13:19 -0700 | [diff] [blame] | 1149 | // port: tl_ast_wrapper |
| 1150 | .tl_ast_wrapper_o(ast_tl_req_o), |
| 1151 | .tl_ast_wrapper_i(ast_tl_rsp_i), |
| 1152 | |
Eunchan Kim | 55d7ae8 | 2019-12-19 17:08:35 -0800 | [diff] [blame] | 1153 | |
| 1154 | .scanmode_i |
| 1155 | ); |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1156 | |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 1157 | // Pinmux connections |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 1158 | assign mio_d2p = { |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 1159 | cio_gpio_gpio_d2p |
| 1160 | }; |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 1161 | assign mio_d2p_en = { |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 1162 | cio_gpio_gpio_en_d2p |
| 1163 | }; |
| 1164 | assign { |
| 1165 | cio_gpio_gpio_p2d |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 1166 | } = mio_p2d; |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 1167 | |
Michael Schaffner | 920e4cc | 2020-04-28 22:58:12 -0700 | [diff] [blame] | 1168 | // Dedicated IO connections |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 1169 | // Input-only DIOs have no d2p signals |
| 1170 | assign dio_d2p = { |
Pirmin Vogel | fe6863b | 2020-05-11 17:30:54 +0200 | [diff] [blame] | 1171 | 1'b0, // DIO14: cio_spi_device_sck |
| 1172 | 1'b0, // DIO13: cio_spi_device_csb |
Scott Johnson | fe79c4b | 2020-07-08 10:31:08 -0700 | [diff] [blame] | 1173 | 1'b0, // DIO12: cio_spi_device_sdi |
| 1174 | cio_spi_device_sdo_d2p, // DIO11 |
Pirmin Vogel | fe6863b | 2020-05-11 17:30:54 +0200 | [diff] [blame] | 1175 | 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 Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 1181 | 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 Schaffner | 920e4cc | 2020-04-28 22:58:12 -0700 | [diff] [blame] | 1186 | }; |
| 1187 | |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 1188 | assign dio_d2p_en = { |
Pirmin Vogel | fe6863b | 2020-05-11 17:30:54 +0200 | [diff] [blame] | 1189 | 1'b0, // DIO14: cio_spi_device_sck |
| 1190 | 1'b0, // DIO13: cio_spi_device_csb |
Scott Johnson | fe79c4b | 2020-07-08 10:31:08 -0700 | [diff] [blame] | 1191 | 1'b0, // DIO12: cio_spi_device_sdi |
| 1192 | cio_spi_device_sdo_en_d2p, // DIO11 |
Pirmin Vogel | fe6863b | 2020-05-11 17:30:54 +0200 | [diff] [blame] | 1193 | 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 Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 1199 | 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 Schaffner | 920e4cc | 2020-04-28 22:58:12 -0700 | [diff] [blame] | 1204 | }; |
| 1205 | |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 1206 | // Output-only DIOs have no p2d signal |
Pirmin Vogel | fe6863b | 2020-05-11 17:30:54 +0200 | [diff] [blame] | 1207 | assign cio_spi_device_sck_p2d = dio_p2d[14]; // DIO14 |
| 1208 | assign cio_spi_device_csb_p2d = dio_p2d[13]; // DIO13 |
Scott Johnson | fe79c4b | 2020-07-08 10:31:08 -0700 | [diff] [blame] | 1209 | assign cio_spi_device_sdi_p2d = dio_p2d[12]; // DIO12 |
| 1210 | // DIO11: cio_spi_device_sdo |
Pirmin Vogel | fe6863b | 2020-05-11 17:30:54 +0200 | [diff] [blame] | 1211 | 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 Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 1217 | // 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 Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 1222 | |
Nils Graf | 78607aa | 2019-09-16 15:47:23 -0700 | [diff] [blame] | 1223 | // make sure scanmode_i is never X (including during reset) |
Eunchan Kim | 5511bbe | 2020-08-07 14:04:20 -0700 | [diff] [blame] | 1224 | `ASSERT_KNOWN(scanmodeKnown, scanmode_i, clk_main_i, 0) |
Nils Graf | 78607aa | 2019-09-16 15:47:23 -0700 | [diff] [blame] | 1225 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1226 | endmodule |