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 | 1555dce | 2020-08-11 11:26:50 -0700 | [diff] [blame] | 40 | input ast_wrapper_pkg::ast_rst_t rstmgr_ast_i, |
| 41 | output pwrmgr_pkg::pwr_ast_req_t pwrmgr_pwr_ast_req_o, |
| 42 | input pwrmgr_pkg::pwr_ast_rsp_t pwrmgr_pwr_ast_rsp_i, |
| 43 | input ast_wrapper_pkg::ast_alert_req_t sensor_ctrl_ast_alert_req_i, |
| 44 | output ast_wrapper_pkg::ast_alert_rsp_t sensor_ctrl_ast_alert_rsp_o, |
| 45 | input ast_wrapper_pkg::ast_status_t sensor_ctrl_ast_status_i, |
| 46 | output logic usbdev_usb_ref_val_o, |
| 47 | output logic usbdev_usb_ref_pulse_o, |
Timothy Chen | ac3a8c9 | 2020-06-29 20:17:07 -0700 | [diff] [blame] | 48 | input scan_rst_ni, // reset used for test mode |
| 49 | input scanmode_i // 1 for Scan |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 50 | ); |
| 51 | |
Philipp Wagner | 086b703 | 2019-10-25 17:06:15 +0100 | [diff] [blame] | 52 | // JTAG IDCODE for development versions of this code. |
| 53 | // Manufacturers of OpenTitan chips must replace this code with one of their |
| 54 | // own IDs. |
| 55 | // Field structure as defined in the IEEE 1149.1 (JTAG) specification, |
| 56 | // section 12.1.1. |
Michael Schaffner | d4d5d2f | 2020-04-17 15:45:55 -0700 | [diff] [blame] | 57 | localparam logic [31:0] JTAG_IDCODE = { |
Philipp Wagner | 086b703 | 2019-10-25 17:06:15 +0100 | [diff] [blame] | 58 | 4'h0, // Version |
| 59 | 16'h4F54, // Part Number: "OT" |
Philipp Wagner | f57964e | 2019-11-04 17:57:06 +0000 | [diff] [blame] | 60 | 11'h426, // Manufacturer Identity: Google |
Philipp Wagner | 086b703 | 2019-10-25 17:06:15 +0100 | [diff] [blame] | 61 | 1'b1 // (fixed) |
| 62 | }; |
| 63 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 64 | import tlul_pkg::*; |
| 65 | import top_pkg::*; |
| 66 | import tl_main_pkg::*; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 67 | |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 68 | // Signals |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 69 | logic [31:0] mio_p2d; |
| 70 | logic [31:0] mio_d2p; |
| 71 | logic [31:0] mio_d2p_en; |
Pirmin Vogel | fe6863b | 2020-05-11 17:30:54 +0200 | [diff] [blame] | 72 | logic [14:0] dio_p2d; |
| 73 | logic [14:0] dio_d2p; |
| 74 | logic [14:0] dio_d2p_en; |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 75 | // uart |
| 76 | logic cio_uart_rx_p2d; |
| 77 | logic cio_uart_tx_d2p; |
| 78 | logic cio_uart_tx_en_d2p; |
| 79 | // gpio |
| 80 | logic [31:0] cio_gpio_gpio_p2d; |
| 81 | logic [31:0] cio_gpio_gpio_d2p; |
| 82 | logic [31:0] cio_gpio_gpio_en_d2p; |
| 83 | // spi_device |
| 84 | logic cio_spi_device_sck_p2d; |
| 85 | logic cio_spi_device_csb_p2d; |
Scott Johnson | fe79c4b | 2020-07-08 10:31:08 -0700 | [diff] [blame] | 86 | logic cio_spi_device_sdi_p2d; |
| 87 | logic cio_spi_device_sdo_d2p; |
| 88 | logic cio_spi_device_sdo_en_d2p; |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 89 | // flash_ctrl |
| 90 | // rv_timer |
| 91 | // aes |
| 92 | // hmac |
| 93 | // rv_plic |
| 94 | // pinmux |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 95 | // padctrl |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 96 | // alert_handler |
Timothy Chen | 163050b | 2020-04-13 23:29:29 -0700 | [diff] [blame] | 97 | // pwrmgr |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 98 | // rstmgr |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 99 | // clkmgr |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 100 | // nmi_gen |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 101 | // usbdev |
| 102 | logic cio_usbdev_sense_p2d; |
Pirmin Vogel | b054fc0 | 2020-03-11 11:23:03 +0100 | [diff] [blame] | 103 | logic cio_usbdev_d_p2d; |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 104 | logic cio_usbdev_dp_p2d; |
| 105 | logic cio_usbdev_dn_p2d; |
Pirmin Vogel | b054fc0 | 2020-03-11 11:23:03 +0100 | [diff] [blame] | 106 | logic cio_usbdev_se0_d2p; |
| 107 | logic cio_usbdev_se0_en_d2p; |
Pirmin Vogel | fe6863b | 2020-05-11 17:30:54 +0200 | [diff] [blame] | 108 | logic cio_usbdev_dp_pullup_d2p; |
| 109 | logic cio_usbdev_dp_pullup_en_d2p; |
| 110 | logic cio_usbdev_dn_pullup_d2p; |
| 111 | logic cio_usbdev_dn_pullup_en_d2p; |
Pirmin Vogel | b054fc0 | 2020-03-11 11:23:03 +0100 | [diff] [blame] | 112 | logic cio_usbdev_tx_mode_se_d2p; |
| 113 | logic cio_usbdev_tx_mode_se_en_d2p; |
| 114 | logic cio_usbdev_suspend_d2p; |
| 115 | logic cio_usbdev_suspend_en_d2p; |
| 116 | logic cio_usbdev_d_d2p; |
| 117 | logic cio_usbdev_d_en_d2p; |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 118 | logic cio_usbdev_dp_d2p; |
| 119 | logic cio_usbdev_dp_en_d2p; |
| 120 | logic cio_usbdev_dn_d2p; |
| 121 | logic cio_usbdev_dn_en_d2p; |
Timothy Chen | 1555dce | 2020-08-11 11:26:50 -0700 | [diff] [blame] | 122 | // sensor_ctrl |
Philipp Wagner | a4a9e40 | 2020-06-22 12:06:56 +0100 | [diff] [blame] | 123 | // otbn |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 124 | |
| 125 | |
Michael Schaffner | e2193b3 | 2020-08-04 14:02:46 -0700 | [diff] [blame^] | 126 | logic [81:0] intr_vector; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 127 | // Interrupt source list |
| 128 | logic intr_uart_tx_watermark; |
| 129 | logic intr_uart_rx_watermark; |
Timothy Chen | 087d4f4 | 2019-12-27 16:04:46 -0800 | [diff] [blame] | 130 | logic intr_uart_tx_empty; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 131 | logic intr_uart_rx_overflow; |
| 132 | logic intr_uart_rx_frame_err; |
| 133 | logic intr_uart_rx_break_err; |
| 134 | logic intr_uart_rx_timeout; |
| 135 | logic intr_uart_rx_parity_err; |
| 136 | logic [31:0] intr_gpio_gpio; |
Eunchan Kim | 8c57fe3 | 2019-09-02 21:14:24 -0700 | [diff] [blame] | 137 | logic intr_spi_device_rxf; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 138 | logic intr_spi_device_rxlvl; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 139 | logic intr_spi_device_txlvl; |
| 140 | logic intr_spi_device_rxerr; |
Eunchan Kim | 546c0d4 | 2019-09-24 15:07:06 -0700 | [diff] [blame] | 141 | logic intr_spi_device_rxoverflow; |
| 142 | logic intr_spi_device_txunderflow; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 143 | logic intr_flash_ctrl_prog_empty; |
| 144 | logic intr_flash_ctrl_prog_lvl; |
| 145 | logic intr_flash_ctrl_rd_full; |
| 146 | logic intr_flash_ctrl_rd_lvl; |
| 147 | logic intr_flash_ctrl_op_done; |
| 148 | logic intr_flash_ctrl_op_error; |
| 149 | logic intr_rv_timer_timer_expired_0_0; |
| 150 | logic intr_hmac_hmac_done; |
Eunchan Kim | d9d69aa | 2020-03-20 10:21:11 -0700 | [diff] [blame] | 151 | logic intr_hmac_fifo_empty; |
Eunchan Kim | 226eab6 | 2019-10-18 14:11:29 -0700 | [diff] [blame] | 152 | logic intr_hmac_hmac_err; |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 153 | logic intr_alert_handler_classa; |
| 154 | logic intr_alert_handler_classb; |
| 155 | logic intr_alert_handler_classc; |
| 156 | logic intr_alert_handler_classd; |
Timothy Chen | 163050b | 2020-04-13 23:29:29 -0700 | [diff] [blame] | 157 | logic intr_pwrmgr_wakeup; |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 158 | logic intr_nmi_gen_esc0; |
| 159 | logic intr_nmi_gen_esc1; |
| 160 | logic intr_nmi_gen_esc2; |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 161 | logic intr_usbdev_pkt_received; |
| 162 | logic intr_usbdev_pkt_sent; |
| 163 | logic intr_usbdev_disconnected; |
| 164 | logic intr_usbdev_host_lost; |
| 165 | logic intr_usbdev_link_reset; |
| 166 | logic intr_usbdev_link_suspend; |
| 167 | logic intr_usbdev_link_resume; |
| 168 | logic intr_usbdev_av_empty; |
| 169 | logic intr_usbdev_rx_full; |
| 170 | logic intr_usbdev_av_overflow; |
| 171 | logic intr_usbdev_link_in_err; |
| 172 | logic intr_usbdev_rx_crc_err; |
| 173 | logic intr_usbdev_rx_pid_err; |
| 174 | logic intr_usbdev_rx_bitstuff_err; |
| 175 | logic intr_usbdev_frame; |
| 176 | logic intr_usbdev_connected; |
Philipp Wagner | a4a9e40 | 2020-06-22 12:06:56 +0100 | [diff] [blame] | 177 | logic intr_otbn_done; |
| 178 | logic intr_otbn_err; |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 179 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 180 | |
Michael Schaffner | d4d5d2f | 2020-04-17 15:45:55 -0700 | [diff] [blame] | 181 | |
Michael Schaffner | 1ba89b8 | 2019-11-03 14:25:54 -0800 | [diff] [blame] | 182 | logic [0:0] irq_plic; |
| 183 | logic [0:0] msip; |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 184 | logic [6:0] irq_id[1]; |
| 185 | logic [6:0] unused_irq_id[1]; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 186 | |
Michael Schaffner | 1ba89b8 | 2019-11-03 14:25:54 -0800 | [diff] [blame] | 187 | // this avoids lint errors |
| 188 | assign unused_irq_id = irq_id; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 189 | |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 190 | // Alert list |
Philipp Wagner | 79725e1 | 2020-03-03 23:34:38 +0000 | [diff] [blame] | 191 | prim_alert_pkg::alert_tx_t [alert_pkg::NAlerts-1:0] alert_tx; |
| 192 | prim_alert_pkg::alert_rx_t [alert_pkg::NAlerts-1:0] alert_rx; |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 193 | // Escalation outputs |
Philipp Wagner | 79725e1 | 2020-03-03 23:34:38 +0000 | [diff] [blame] | 194 | prim_esc_pkg::esc_tx_t [alert_pkg::N_ESC_SEV-1:0] esc_tx; |
| 195 | prim_esc_pkg::esc_rx_t [alert_pkg::N_ESC_SEV-1:0] esc_rx; |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 196 | |
| 197 | |
Eunchan Kim | 40098a9 | 2020-04-17 12:22:36 -0700 | [diff] [blame] | 198 | // define inter-module signals |
| 199 | flash_ctrl_pkg::flash_req_t flash_ctrl_flash_req; |
| 200 | flash_ctrl_pkg::flash_rsp_t flash_ctrl_flash_rsp; |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 201 | pwrmgr_pkg::pwr_rst_req_t pwrmgr_pwr_rst_req; |
| 202 | pwrmgr_pkg::pwr_rst_rsp_t pwrmgr_pwr_rst_rsp; |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 203 | pwrmgr_pkg::pwr_clk_req_t pwrmgr_pwr_clk_req; |
| 204 | pwrmgr_pkg::pwr_clk_rsp_t pwrmgr_pwr_clk_rsp; |
Eunchan Kim | 5152e88 | 2020-08-03 16:26:40 -0700 | [diff] [blame] | 205 | logic pwrmgr_wakeups; |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 206 | tlul_pkg::tl_h2d_t rom_tl_req; |
| 207 | tlul_pkg::tl_d2h_t rom_tl_rsp; |
| 208 | tlul_pkg::tl_h2d_t ram_main_tl_req; |
| 209 | tlul_pkg::tl_d2h_t ram_main_tl_rsp; |
| 210 | tlul_pkg::tl_h2d_t eflash_tl_req; |
| 211 | tlul_pkg::tl_d2h_t eflash_tl_rsp; |
| 212 | tlul_pkg::tl_h2d_t main_tl_peri_req; |
| 213 | tlul_pkg::tl_d2h_t main_tl_peri_rsp; |
| 214 | tlul_pkg::tl_h2d_t flash_ctrl_tl_req; |
| 215 | tlul_pkg::tl_d2h_t flash_ctrl_tl_rsp; |
| 216 | tlul_pkg::tl_h2d_t hmac_tl_req; |
| 217 | tlul_pkg::tl_d2h_t hmac_tl_rsp; |
| 218 | tlul_pkg::tl_h2d_t aes_tl_req; |
| 219 | tlul_pkg::tl_d2h_t aes_tl_rsp; |
| 220 | tlul_pkg::tl_h2d_t rv_plic_tl_req; |
| 221 | tlul_pkg::tl_d2h_t rv_plic_tl_rsp; |
| 222 | tlul_pkg::tl_h2d_t pinmux_tl_req; |
| 223 | tlul_pkg::tl_d2h_t pinmux_tl_rsp; |
| 224 | tlul_pkg::tl_h2d_t padctrl_tl_req; |
| 225 | tlul_pkg::tl_d2h_t padctrl_tl_rsp; |
| 226 | tlul_pkg::tl_h2d_t alert_handler_tl_req; |
| 227 | tlul_pkg::tl_d2h_t alert_handler_tl_rsp; |
| 228 | tlul_pkg::tl_h2d_t nmi_gen_tl_req; |
| 229 | tlul_pkg::tl_d2h_t nmi_gen_tl_rsp; |
| 230 | tlul_pkg::tl_h2d_t otbn_tl_req; |
| 231 | tlul_pkg::tl_d2h_t otbn_tl_rsp; |
| 232 | tlul_pkg::tl_h2d_t uart_tl_req; |
| 233 | tlul_pkg::tl_d2h_t uart_tl_rsp; |
| 234 | tlul_pkg::tl_h2d_t gpio_tl_req; |
| 235 | tlul_pkg::tl_d2h_t gpio_tl_rsp; |
| 236 | tlul_pkg::tl_h2d_t spi_device_tl_req; |
| 237 | tlul_pkg::tl_d2h_t spi_device_tl_rsp; |
| 238 | tlul_pkg::tl_h2d_t rv_timer_tl_req; |
| 239 | tlul_pkg::tl_d2h_t rv_timer_tl_rsp; |
| 240 | tlul_pkg::tl_h2d_t usbdev_tl_req; |
| 241 | tlul_pkg::tl_d2h_t usbdev_tl_rsp; |
| 242 | tlul_pkg::tl_h2d_t pwrmgr_tl_req; |
| 243 | tlul_pkg::tl_d2h_t pwrmgr_tl_rsp; |
| 244 | tlul_pkg::tl_h2d_t rstmgr_tl_req; |
| 245 | tlul_pkg::tl_d2h_t rstmgr_tl_rsp; |
| 246 | tlul_pkg::tl_h2d_t clkmgr_tl_req; |
| 247 | tlul_pkg::tl_d2h_t clkmgr_tl_rsp; |
| 248 | tlul_pkg::tl_h2d_t ram_ret_tl_req; |
| 249 | tlul_pkg::tl_d2h_t ram_ret_tl_rsp; |
Timothy Chen | 1555dce | 2020-08-11 11:26:50 -0700 | [diff] [blame] | 250 | tlul_pkg::tl_h2d_t sensor_ctrl_tl_req; |
| 251 | tlul_pkg::tl_d2h_t sensor_ctrl_tl_rsp; |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 252 | rstmgr_pkg::rstmgr_out_t rstmgr_resets; |
| 253 | rstmgr_pkg::rstmgr_cpu_t rstmgr_cpu; |
| 254 | pwrmgr_pkg::pwr_cpu_t pwrmgr_pwr_cpu; |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 255 | clkmgr_pkg::clkmgr_out_t clkmgr_clocks; |
Pirmin Vogel | a2d411d | 2020-07-13 17:33:42 +0200 | [diff] [blame] | 256 | logic aes_idle; |
| 257 | clkmgr_pkg::clk_hint_status_t clkmgr_status; |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 258 | tlul_pkg::tl_h2d_t main_tl_corei_req; |
| 259 | tlul_pkg::tl_d2h_t main_tl_corei_rsp; |
| 260 | tlul_pkg::tl_h2d_t main_tl_cored_req; |
| 261 | tlul_pkg::tl_d2h_t main_tl_cored_rsp; |
| 262 | tlul_pkg::tl_h2d_t main_tl_dm_sba_req; |
| 263 | tlul_pkg::tl_d2h_t main_tl_dm_sba_rsp; |
| 264 | tlul_pkg::tl_h2d_t main_tl_debug_mem_req; |
| 265 | tlul_pkg::tl_d2h_t main_tl_debug_mem_rsp; |
Pirmin Vogel | a2d411d | 2020-07-13 17:33:42 +0200 | [diff] [blame] | 266 | |
| 267 | always_comb begin |
| 268 | // TODO: So far just aes is connected |
| 269 | clkmgr_status.idle = clkmgr_pkg::CLK_HINT_STATUS_DEFAULT; |
| 270 | clkmgr_status.idle[0] = aes_idle; |
| 271 | end |
Timothy Chen | 80bd8aa | 2019-10-04 15:57:11 -0700 | [diff] [blame] | 272 | |
Timothy Chen | 3193b00 | 2019-10-04 16:56:05 -0700 | [diff] [blame] | 273 | // Non-debug module reset == reset for everything except for the debug module |
| 274 | logic ndmreset_req; |
| 275 | |
Timothy Chen | 3193b00 | 2019-10-04 16:56:05 -0700 | [diff] [blame] | 276 | // debug request from rv_dm to core |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 277 | logic debug_req; |
| 278 | |
| 279 | // processor core |
| 280 | rv_core_ibex #( |
Philipp Wagner | 25d88922 | 2020-04-03 11:52:41 +0100 | [diff] [blame] | 281 | .PMPEnable (1), |
| 282 | .PMPGranularity (0), // 2^(PMPGranularity+2) == 4 byte granularity |
| 283 | .PMPNumRegions (16), |
Greg Chadwick | dadb1af | 2020-04-16 17:10:23 +0100 | [diff] [blame] | 284 | .MHPMCounterNum (8), |
| 285 | .MHPMCounterWidth (40), |
| 286 | .RV32E (0), |
| 287 | .RV32M (1), |
| 288 | .BranchTargetALU (1), |
| 289 | .WritebackStage (1), |
| 290 | .MultiplierImplementation ("single-cycle"), |
Tom Roberts | 78bb2ae | 2020-06-03 15:24:22 +0100 | [diff] [blame] | 291 | .ICache (0), |
| 292 | .ICacheECC (0), |
Greg Chadwick | dadb1af | 2020-04-16 17:10:23 +0100 | [diff] [blame] | 293 | .DbgTriggerEn (1), |
Tom Roberts | 78bb2ae | 2020-06-03 15:24:22 +0100 | [diff] [blame] | 294 | .SecureIbex (0), |
Greg Chadwick | dadb1af | 2020-04-16 17:10:23 +0100 | [diff] [blame] | 295 | .DmHaltAddr (ADDR_SPACE_DEBUG_MEM + dm::HaltAddress), |
| 296 | .DmExceptionAddr (ADDR_SPACE_DEBUG_MEM + dm::ExceptionAddress), |
| 297 | .PipeLine (IbexPipeLine) |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 298 | ) u_rv_core_ibex ( |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 299 | // clock and reset |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 300 | .clk_i (clkmgr_clocks.clk_proc_main), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 301 | .rst_ni (rstmgr_resets.rst_sys_n), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 302 | .test_en_i (1'b0), |
| 303 | // static pinning |
Greg Chadwick | 53ef2ec | 2019-09-03 14:53:54 +0100 | [diff] [blame] | 304 | .hart_id_i (32'b0), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 305 | .boot_addr_i (ADDR_SPACE_ROM), |
| 306 | // TL-UL buses |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 307 | .tl_i_o (main_tl_corei_req), |
| 308 | .tl_i_i (main_tl_corei_rsp), |
| 309 | .tl_d_o (main_tl_cored_req), |
| 310 | .tl_d_i (main_tl_cored_rsp), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 311 | // interrupts |
| 312 | .irq_software_i (msip), |
| 313 | .irq_timer_i (intr_rv_timer_timer_expired_0_0), |
| 314 | .irq_external_i (irq_plic), |
Michael Schaffner | bdcbd20 | 2020-07-27 12:18:21 -0700 | [diff] [blame] | 315 | // escalation input from alert handler (NMI) |
| 316 | .esc_tx_i (esc_tx[0]), |
| 317 | .esc_rx_o (esc_rx[0]), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 318 | // debug interface |
| 319 | .debug_req_i (debug_req), |
| 320 | // CPU control signals |
Pirmin Vogel | ffc9e83 | 2019-09-13 16:16:05 +0100 | [diff] [blame] | 321 | .fetch_enable_i (1'b1), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 322 | .core_sleep_o (pwrmgr_pwr_cpu.core_sleeping) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 323 | ); |
| 324 | |
| 325 | // Debug Module (RISC-V Debug Spec 0.13) |
| 326 | // |
| 327 | |
| 328 | rv_dm #( |
Philipp Wagner | 086b703 | 2019-10-25 17:06:15 +0100 | [diff] [blame] | 329 | .NrHarts (1), |
| 330 | .IdcodeValue (JTAG_IDCODE) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 331 | ) u_dm_top ( |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 332 | .clk_i (clkmgr_clocks.clk_proc_main), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 333 | .rst_ni (rstmgr_resets.rst_lc_n), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 334 | .testmode_i (1'b0), |
Timothy Chen | 3193b00 | 2019-10-04 16:56:05 -0700 | [diff] [blame] | 335 | .ndmreset_o (ndmreset_req), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 336 | .dmactive_o (), |
| 337 | .debug_req_o (debug_req), |
| 338 | .unavailable_i (1'b0), |
| 339 | |
| 340 | // bus device with debug memory (for execution-based debug) |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 341 | .tl_d_i (main_tl_debug_mem_req), |
| 342 | .tl_d_o (main_tl_debug_mem_rsp), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 343 | |
| 344 | // bus host (for system bus accesses, SBA) |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 345 | .tl_h_o (main_tl_dm_sba_req), |
| 346 | .tl_h_i (main_tl_dm_sba_rsp), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 347 | |
| 348 | //JTAG |
| 349 | .tck_i (jtag_tck_i), |
| 350 | .tms_i (jtag_tms_i), |
| 351 | .trst_ni (jtag_trst_ni), |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 352 | .td_i (jtag_tdi_i), |
| 353 | .td_o (jtag_tdo_o), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 354 | .tdo_oe_o ( ) |
| 355 | ); |
| 356 | |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 357 | assign rstmgr_cpu.ndmreset_req = ndmreset_req; |
| 358 | assign rstmgr_cpu.rst_cpu_n = rstmgr_resets.rst_sys_n; |
| 359 | |
Timothy Chen | 4446103 | 2019-09-20 15:35:20 -0700 | [diff] [blame] | 360 | // ROM device |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 361 | logic rom_req; |
Timothy Chen | da2e344 | 2020-02-24 21:37:47 -0800 | [diff] [blame] | 362 | logic [11:0] rom_addr; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 363 | logic [31:0] rom_rdata; |
| 364 | logic rom_rvalid; |
| 365 | |
| 366 | tlul_adapter_sram #( |
Timothy Chen | da2e344 | 2020-02-24 21:37:47 -0800 | [diff] [blame] | 367 | .SramAw(12), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 368 | .SramDw(32), |
Eunchan Kim | 6c731a8 | 2020-03-04 14:48:52 -0800 | [diff] [blame] | 369 | .Outstanding(2), |
Timothy Chen | 4446103 | 2019-09-20 15:35:20 -0700 | [diff] [blame] | 370 | .ErrOnWrite(1) |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 371 | ) u_tl_adapter_rom ( |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 372 | .clk_i (clkmgr_clocks.clk_main_infra), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 373 | .rst_ni (rstmgr_resets.rst_sys_n), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 374 | |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 375 | .tl_i (rom_tl_req), |
| 376 | .tl_o (rom_tl_rsp), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 377 | |
| 378 | .req_o (rom_req), |
| 379 | .gnt_i (1'b1), // Always grant as only one requester exists |
Timothy Chen | 4446103 | 2019-09-20 15:35:20 -0700 | [diff] [blame] | 380 | .we_o (), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 381 | .addr_o (rom_addr), |
Timothy Chen | 4446103 | 2019-09-20 15:35:20 -0700 | [diff] [blame] | 382 | .wdata_o (), |
| 383 | .wmask_o (), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 384 | .rdata_i (rom_rdata), |
| 385 | .rvalid_i (rom_rvalid), |
| 386 | .rerror_i (2'b00) |
| 387 | ); |
| 388 | |
Michael Schaffner | 0beb8a4 | 2020-06-05 23:17:40 -0700 | [diff] [blame] | 389 | prim_rom_adv #( |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 390 | .Width(32), |
Philipp Wagner | a37bcfa | 2020-05-19 22:46:41 +0100 | [diff] [blame] | 391 | .Depth(4096), |
| 392 | .MemInitFile(BootRomInitFile) |
Timothy Chen | 4446103 | 2019-09-20 15:35:20 -0700 | [diff] [blame] | 393 | ) u_rom_rom ( |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 394 | .clk_i (clkmgr_clocks.clk_main_infra), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 395 | .rst_ni (rstmgr_resets.rst_sys_n), |
Michael Schaffner | 0beb8a4 | 2020-06-05 23:17:40 -0700 | [diff] [blame] | 396 | .req_i (rom_req), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 397 | .addr_i (rom_addr), |
Michael Schaffner | 0beb8a4 | 2020-06-05 23:17:40 -0700 | [diff] [blame] | 398 | .rdata_o (rom_rdata), |
| 399 | .rvalid_o (rom_rvalid), |
| 400 | .cfg_i ('0) // tied off for now |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 401 | ); |
Timothy Chen | 4446103 | 2019-09-20 15:35:20 -0700 | [diff] [blame] | 402 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 403 | // sram device |
| 404 | logic ram_main_req; |
| 405 | logic ram_main_we; |
| 406 | logic [13:0] ram_main_addr; |
| 407 | logic [31:0] ram_main_wdata; |
| 408 | logic [31:0] ram_main_wmask; |
| 409 | logic [31:0] ram_main_rdata; |
| 410 | logic ram_main_rvalid; |
Philipp Wagner | e1efc18 | 2020-05-21 18:26:17 +0100 | [diff] [blame] | 411 | logic [1:0] ram_main_rerror; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 412 | |
| 413 | tlul_adapter_sram #( |
| 414 | .SramAw(14), |
| 415 | .SramDw(32), |
Eunchan Kim | 6c731a8 | 2020-03-04 14:48:52 -0800 | [diff] [blame] | 416 | .Outstanding(2) |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 417 | ) u_tl_adapter_ram_main ( |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 418 | .clk_i (clkmgr_clocks.clk_main_infra), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 419 | .rst_ni (rstmgr_resets.rst_sys_n), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 420 | .tl_i (ram_main_tl_req), |
| 421 | .tl_o (ram_main_tl_rsp), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 422 | |
| 423 | .req_o (ram_main_req), |
| 424 | .gnt_i (1'b1), // Always grant as only one requester exists |
| 425 | .we_o (ram_main_we), |
| 426 | .addr_o (ram_main_addr), |
| 427 | .wdata_o (ram_main_wdata), |
| 428 | .wmask_o (ram_main_wmask), |
| 429 | .rdata_i (ram_main_rdata), |
| 430 | .rvalid_i (ram_main_rvalid), |
Philipp Wagner | e1efc18 | 2020-05-21 18:26:17 +0100 | [diff] [blame] | 431 | .rerror_i (ram_main_rerror) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 432 | ); |
| 433 | |
Philipp Wagner | e1efc18 | 2020-05-21 18:26:17 +0100 | [diff] [blame] | 434 | prim_ram_1p_adv #( |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 435 | .Width(32), |
| 436 | .Depth(16384), |
Philipp Wagner | e1efc18 | 2020-05-21 18:26:17 +0100 | [diff] [blame] | 437 | .DataBitsPerMask(8), |
Michael Schaffner | 25d73cf | 2020-06-10 22:31:40 -0700 | [diff] [blame] | 438 | .CfgW(8), |
| 439 | // TODO: enable parity once supported by the simulation infrastructure |
| 440 | .EnableParity(0) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 441 | ) u_ram1p_ram_main ( |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 442 | .clk_i (clkmgr_clocks.clk_main_infra), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 443 | .rst_ni (rstmgr_resets.rst_sys_n), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 444 | |
| 445 | .req_i (ram_main_req), |
| 446 | .write_i (ram_main_we), |
| 447 | .addr_i (ram_main_addr), |
| 448 | .wdata_i (ram_main_wdata), |
| 449 | .wmask_i (ram_main_wmask), |
Philipp Wagner | e1efc18 | 2020-05-21 18:26:17 +0100 | [diff] [blame] | 450 | .rdata_o (ram_main_rdata), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 451 | .rvalid_o (ram_main_rvalid), |
Philipp Wagner | e1efc18 | 2020-05-21 18:26:17 +0100 | [diff] [blame] | 452 | .rerror_o (ram_main_rerror), |
| 453 | .cfg_i ('0) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 454 | ); |
Timothy Chen | 6e2ba84 | 2020-06-29 15:04:13 -0700 | [diff] [blame] | 455 | // sram device |
| 456 | logic ram_ret_req; |
| 457 | logic ram_ret_we; |
| 458 | logic [9:0] ram_ret_addr; |
| 459 | logic [31:0] ram_ret_wdata; |
| 460 | logic [31:0] ram_ret_wmask; |
| 461 | logic [31:0] ram_ret_rdata; |
| 462 | logic ram_ret_rvalid; |
| 463 | logic [1:0] ram_ret_rerror; |
| 464 | |
| 465 | tlul_adapter_sram #( |
| 466 | .SramAw(10), |
| 467 | .SramDw(32), |
| 468 | .Outstanding(2) |
| 469 | ) u_tl_adapter_ram_ret ( |
| 470 | .clk_i (clkmgr_clocks.clk_io_infra), |
| 471 | .rst_ni (rstmgr_resets.rst_sys_io_n), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 472 | .tl_i (ram_ret_tl_req), |
| 473 | .tl_o (ram_ret_tl_rsp), |
Timothy Chen | 6e2ba84 | 2020-06-29 15:04:13 -0700 | [diff] [blame] | 474 | |
| 475 | .req_o (ram_ret_req), |
| 476 | .gnt_i (1'b1), // Always grant as only one requester exists |
| 477 | .we_o (ram_ret_we), |
| 478 | .addr_o (ram_ret_addr), |
| 479 | .wdata_o (ram_ret_wdata), |
| 480 | .wmask_o (ram_ret_wmask), |
| 481 | .rdata_i (ram_ret_rdata), |
| 482 | .rvalid_i (ram_ret_rvalid), |
| 483 | .rerror_i (ram_ret_rerror) |
| 484 | ); |
| 485 | |
| 486 | prim_ram_1p_adv #( |
| 487 | .Width(32), |
| 488 | .Depth(1024), |
| 489 | .DataBitsPerMask(8), |
| 490 | .CfgW(8), |
| 491 | // TODO: enable parity once supported by the simulation infrastructure |
| 492 | .EnableParity(0) |
| 493 | ) u_ram1p_ram_ret ( |
| 494 | .clk_i (clkmgr_clocks.clk_io_infra), |
| 495 | .rst_ni (rstmgr_resets.rst_sys_io_n), |
| 496 | |
| 497 | .req_i (ram_ret_req), |
| 498 | .write_i (ram_ret_we), |
| 499 | .addr_i (ram_ret_addr), |
| 500 | .wdata_i (ram_ret_wdata), |
| 501 | .wmask_i (ram_ret_wmask), |
| 502 | .rdata_o (ram_ret_rdata), |
| 503 | .rvalid_o (ram_ret_rvalid), |
| 504 | .rerror_o (ram_ret_rerror), |
| 505 | .cfg_i ('0) |
| 506 | ); |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 507 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 508 | // host to flash communication |
| 509 | logic flash_host_req; |
| 510 | logic flash_host_req_rdy; |
| 511 | logic flash_host_req_done; |
Timothy Chen | 1451840 | 2020-04-13 15:25:22 -0700 | [diff] [blame] | 512 | logic [flash_ctrl_pkg::BusWidth-1:0] flash_host_rdata; |
Timothy Chen | b35a340 | 2020-06-23 00:14:11 -0700 | [diff] [blame] | 513 | logic [flash_ctrl_pkg::BusAddrW-1:0] flash_host_addr; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 514 | |
Timothy Chen | 5aec528 | 2019-09-10 21:10:56 -0700 | [diff] [blame] | 515 | tlul_adapter_sram #( |
Timothy Chen | b35a340 | 2020-06-23 00:14:11 -0700 | [diff] [blame] | 516 | .SramAw(flash_ctrl_pkg::BusAddrW), |
Timothy Chen | 1451840 | 2020-04-13 15:25:22 -0700 | [diff] [blame] | 517 | .SramDw(flash_ctrl_pkg::BusWidth), |
Eunchan Kim | 6c731a8 | 2020-03-04 14:48:52 -0800 | [diff] [blame] | 518 | .Outstanding(2), |
Timothy Chen | 5aec528 | 2019-09-10 21:10:56 -0700 | [diff] [blame] | 519 | .ByteAccess(0), |
| 520 | .ErrOnWrite(1) |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 521 | ) u_tl_adapter_eflash ( |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 522 | .clk_i (clkmgr_clocks.clk_main_infra), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 523 | .rst_ni (rstmgr_resets.rst_lc_n), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 524 | |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 525 | .tl_i (eflash_tl_req), |
| 526 | .tl_o (eflash_tl_rsp), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 527 | |
Timothy Chen | 5aec528 | 2019-09-10 21:10:56 -0700 | [diff] [blame] | 528 | .req_o (flash_host_req), |
| 529 | .gnt_i (flash_host_req_rdy), |
| 530 | .we_o (), |
| 531 | .addr_o (flash_host_addr), |
| 532 | .wdata_o (), |
| 533 | .wmask_o (), |
| 534 | .rdata_i (flash_host_rdata), |
| 535 | .rvalid_i (flash_host_req_done), |
| 536 | .rerror_i (2'b00) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 537 | ); |
| 538 | |
Timothy Chen | 1451840 | 2020-04-13 15:25:22 -0700 | [diff] [blame] | 539 | flash_phy u_flash_eflash ( |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 540 | .clk_i (clkmgr_clocks.clk_main_infra), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 541 | .rst_ni (rstmgr_resets.rst_lc_n), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 542 | .host_req_i (flash_host_req), |
| 543 | .host_addr_i (flash_host_addr), |
| 544 | .host_req_rdy_o (flash_host_req_rdy), |
| 545 | .host_req_done_o (flash_host_req_done), |
| 546 | .host_rdata_o (flash_host_rdata), |
Eunchan Kim | 6599ba9 | 2020-04-13 15:27:16 -0700 | [diff] [blame] | 547 | .flash_ctrl_i (flash_ctrl_flash_req), |
| 548 | .flash_ctrl_o (flash_ctrl_flash_rsp) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 549 | ); |
| 550 | |
| 551 | |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 552 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 553 | uart u_uart ( |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 554 | |
| 555 | // Input |
| 556 | .cio_rx_i (cio_uart_rx_p2d), |
| 557 | |
| 558 | // Output |
| 559 | .cio_tx_o (cio_uart_tx_d2p), |
| 560 | .cio_tx_en_o (cio_uart_tx_en_d2p), |
| 561 | |
| 562 | // Interrupt |
| 563 | .intr_tx_watermark_o (intr_uart_tx_watermark), |
| 564 | .intr_rx_watermark_o (intr_uart_rx_watermark), |
Timothy Chen | 087d4f4 | 2019-12-27 16:04:46 -0800 | [diff] [blame] | 565 | .intr_tx_empty_o (intr_uart_tx_empty), |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 566 | .intr_rx_overflow_o (intr_uart_rx_overflow), |
| 567 | .intr_rx_frame_err_o (intr_uart_rx_frame_err), |
| 568 | .intr_rx_break_err_o (intr_uart_rx_break_err), |
| 569 | .intr_rx_timeout_o (intr_uart_rx_timeout), |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 570 | .intr_rx_parity_err_o (intr_uart_rx_parity_err), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 571 | |
| 572 | // Inter-module signals |
| 573 | .tl_i(uart_tl_req), |
| 574 | .tl_o(uart_tl_rsp), |
Timothy Chen | 33b3b9d | 2020-05-08 10:14:17 -0700 | [diff] [blame] | 575 | .clk_i (clkmgr_clocks.clk_io_secure), |
| 576 | .rst_ni (rstmgr_resets.rst_sys_io_n) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 577 | ); |
| 578 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 579 | gpio u_gpio ( |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 580 | |
| 581 | // Input |
| 582 | .cio_gpio_i (cio_gpio_gpio_p2d), |
| 583 | |
| 584 | // Output |
| 585 | .cio_gpio_o (cio_gpio_gpio_d2p), |
| 586 | .cio_gpio_en_o (cio_gpio_gpio_en_d2p), |
| 587 | |
| 588 | // Interrupt |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 589 | .intr_gpio_o (intr_gpio_gpio), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 590 | |
| 591 | // Inter-module signals |
| 592 | .tl_i(gpio_tl_req), |
| 593 | .tl_o(gpio_tl_rsp), |
Timothy Chen | 33b3b9d | 2020-05-08 10:14:17 -0700 | [diff] [blame] | 594 | .clk_i (clkmgr_clocks.clk_io_peri), |
| 595 | .rst_ni (rstmgr_resets.rst_sys_io_n) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 596 | ); |
| 597 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 598 | spi_device u_spi_device ( |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 599 | |
| 600 | // Input |
Timothy Chen | c38f789 | 2020-07-16 18:19:48 -0700 | [diff] [blame] | 601 | .cio_sck_i (cio_spi_device_sck_p2d), |
| 602 | .cio_csb_i (cio_spi_device_csb_p2d), |
| 603 | .cio_sdi_i (cio_spi_device_sdi_p2d), |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 604 | |
| 605 | // Output |
Timothy Chen | c38f789 | 2020-07-16 18:19:48 -0700 | [diff] [blame] | 606 | .cio_sdo_o (cio_spi_device_sdo_d2p), |
| 607 | .cio_sdo_en_o (cio_spi_device_sdo_en_d2p), |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 608 | |
| 609 | // Interrupt |
| 610 | .intr_rxf_o (intr_spi_device_rxf), |
| 611 | .intr_rxlvl_o (intr_spi_device_rxlvl), |
| 612 | .intr_txlvl_o (intr_spi_device_txlvl), |
| 613 | .intr_rxerr_o (intr_spi_device_rxerr), |
| 614 | .intr_rxoverflow_o (intr_spi_device_rxoverflow), |
Eunchan Kim | 546c0d4 | 2019-09-24 15:07:06 -0700 | [diff] [blame] | 615 | .intr_txunderflow_o (intr_spi_device_txunderflow), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 616 | |
| 617 | // Inter-module signals |
| 618 | .tl_i(spi_device_tl_req), |
| 619 | .tl_o(spi_device_tl_rsp), |
Eunchan Kim | 2cfadab | 2019-10-02 12:41:11 -0700 | [diff] [blame] | 620 | .scanmode_i (scanmode_i), |
Timothy Chen | 33b3b9d | 2020-05-08 10:14:17 -0700 | [diff] [blame] | 621 | .clk_i (clkmgr_clocks.clk_io_peri), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 622 | .rst_ni (rstmgr_resets.rst_spi_device_n) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 623 | ); |
| 624 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 625 | flash_ctrl u_flash_ctrl ( |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 626 | |
| 627 | // Interrupt |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 628 | .intr_prog_empty_o (intr_flash_ctrl_prog_empty), |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 629 | .intr_prog_lvl_o (intr_flash_ctrl_prog_lvl), |
| 630 | .intr_rd_full_o (intr_flash_ctrl_rd_full), |
| 631 | .intr_rd_lvl_o (intr_flash_ctrl_rd_lvl), |
| 632 | .intr_op_done_o (intr_flash_ctrl_op_done), |
| 633 | .intr_op_error_o (intr_flash_ctrl_op_error), |
| 634 | |
Eunchan Kim | e4a8507 | 2020-02-05 16:00:00 -0800 | [diff] [blame] | 635 | // Inter-module signals |
Eunchan Kim | 6599ba9 | 2020-04-13 15:27:16 -0700 | [diff] [blame] | 636 | .flash_o(flash_ctrl_flash_req), |
| 637 | .flash_i(flash_ctrl_flash_rsp), |
Timothy Chen | ac62065 | 2020-06-25 13:48:50 -0700 | [diff] [blame] | 638 | .otp_i(flash_ctrl_pkg::OTP_FLASH_DEFAULT), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 639 | .tl_i(flash_ctrl_tl_req), |
| 640 | .tl_o(flash_ctrl_tl_rsp), |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 641 | .clk_i (clkmgr_clocks.clk_main_infra), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 642 | .rst_ni (rstmgr_resets.rst_lc_n) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 643 | ); |
| 644 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 645 | rv_timer u_rv_timer ( |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 646 | |
| 647 | // Interrupt |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 648 | .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] | 649 | |
| 650 | // Inter-module signals |
| 651 | .tl_i(rv_timer_tl_req), |
| 652 | .tl_o(rv_timer_tl_rsp), |
Timothy Chen | 33b3b9d | 2020-05-08 10:14:17 -0700 | [diff] [blame] | 653 | .clk_i (clkmgr_clocks.clk_io_timers), |
| 654 | .rst_ni (rstmgr_resets.rst_sys_io_n) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 655 | ); |
| 656 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 657 | aes u_aes ( |
Pirmin Vogel | a2d411d | 2020-07-13 17:33:42 +0200 | [diff] [blame] | 658 | |
Pirmin Vogel | be4bcb7 | 2020-04-17 14:43:45 +0200 | [diff] [blame] | 659 | // [0]: ctrl_err |
| 660 | .alert_tx_o ( alert_tx[0:0] ), |
| 661 | .alert_rx_i ( alert_rx[0:0] ), |
| 662 | |
Pirmin Vogel | a2d411d | 2020-07-13 17:33:42 +0200 | [diff] [blame] | 663 | // Inter-module signals |
| 664 | .idle_o(aes_idle), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 665 | .tl_i(aes_tl_req), |
| 666 | .tl_o(aes_tl_rsp), |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 667 | .clk_i (clkmgr_clocks.clk_main_aes), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 668 | .rst_ni (rstmgr_resets.rst_sys_n) |
Pirmin Vogel | d453438 | 2019-10-17 13:18:31 +0100 | [diff] [blame] | 669 | ); |
| 670 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 671 | hmac u_hmac ( |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 672 | |
| 673 | // Interrupt |
Eunchan Kim | d9d69aa | 2020-03-20 10:21:11 -0700 | [diff] [blame] | 674 | .intr_hmac_done_o (intr_hmac_hmac_done), |
| 675 | .intr_fifo_empty_o (intr_hmac_fifo_empty), |
| 676 | .intr_hmac_err_o (intr_hmac_hmac_err), |
Michael Schaffner | d4d5d2f | 2020-04-17 15:45:55 -0700 | [diff] [blame] | 677 | |
Pirmin Vogel | be4bcb7 | 2020-04-17 14:43:45 +0200 | [diff] [blame] | 678 | // [1]: msg_push_sha_disabled |
| 679 | .alert_tx_o ( alert_tx[1:1] ), |
| 680 | .alert_rx_i ( alert_rx[1:1] ), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 681 | |
| 682 | // Inter-module signals |
| 683 | .tl_i(hmac_tl_req), |
| 684 | .tl_o(hmac_tl_rsp), |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 685 | .clk_i (clkmgr_clocks.clk_main_hmac), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 686 | .rst_ni (rstmgr_resets.rst_sys_n) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 687 | ); |
| 688 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 689 | rv_plic u_rv_plic ( |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 690 | |
| 691 | // Inter-module signals |
| 692 | .tl_i(rv_plic_tl_req), |
| 693 | .tl_o(rv_plic_tl_rsp), |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 694 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 695 | .intr_src_i (intr_vector), |
| 696 | .irq_o (irq_plic), |
| 697 | .irq_id_o (irq_id), |
| 698 | .msip_o (msip), |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 699 | .clk_i (clkmgr_clocks.clk_main_secure), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 700 | .rst_ni (rstmgr_resets.rst_sys_n) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 701 | ); |
| 702 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 703 | pinmux u_pinmux ( |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 704 | |
Michael Schaffner | 920e4cc | 2020-04-28 22:58:12 -0700 | [diff] [blame] | 705 | // Inter-module signals |
Michael Schaffner | 39ef7f5 | 2020-07-10 21:58:48 -0700 | [diff] [blame] | 706 | .lc_pinmux_strap_i('0), |
Michael Schaffner | 920e4cc | 2020-04-28 22:58:12 -0700 | [diff] [blame] | 707 | .lc_pinmux_strap_o(), |
Michael Schaffner | 39ef7f5 | 2020-07-10 21:58:48 -0700 | [diff] [blame] | 708 | .dft_strap_test_o(), |
| 709 | .io_pok_i({pinmux_pkg::NIOPokSignals{1'b1}}), |
| 710 | .sleep_en_i(1'b0), |
Timothy Chen | 4ba2531 | 2020-06-17 13:08:57 -0700 | [diff] [blame] | 711 | .aon_wkup_req_o(pwrmgr_wakeups), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 712 | .tl_i(pinmux_tl_req), |
| 713 | .tl_o(pinmux_tl_rsp), |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 714 | |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 715 | .periph_to_mio_i (mio_d2p ), |
| 716 | .periph_to_mio_oe_i (mio_d2p_en ), |
| 717 | .mio_to_periph_o (mio_p2d ), |
Michael Schaffner | 920e4cc | 2020-04-28 22:58:12 -0700 | [diff] [blame] | 718 | |
| 719 | .mio_out_o, |
| 720 | .mio_oe_o, |
| 721 | .mio_in_i, |
| 722 | |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 723 | .periph_to_dio_i (dio_d2p ), |
| 724 | .periph_to_dio_oe_i (dio_d2p_en ), |
| 725 | .dio_to_periph_o (dio_p2d ), |
Michael Schaffner | 920e4cc | 2020-04-28 22:58:12 -0700 | [diff] [blame] | 726 | |
| 727 | .dio_out_o, |
| 728 | .dio_oe_o, |
| 729 | .dio_in_i, |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 730 | .clk_i (clkmgr_clocks.clk_main_secure), |
Timothy Chen | 1faeb3c | 2020-05-11 22:06:32 -0700 | [diff] [blame] | 731 | .clk_aon_i (clkmgr_clocks.clk_io_secure), |
Michael Schaffner | 920e4cc | 2020-04-28 22:58:12 -0700 | [diff] [blame] | 732 | .rst_ni (rstmgr_resets.rst_sys_n), |
Timothy Chen | 1faeb3c | 2020-05-11 22:06:32 -0700 | [diff] [blame] | 733 | .rst_aon_ni (rstmgr_resets.rst_sys_io_n) |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 734 | ); |
| 735 | |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 736 | padctrl u_padctrl ( |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 737 | |
| 738 | // Inter-module signals |
| 739 | .tl_i(padctrl_tl_req), |
| 740 | .tl_o(padctrl_tl_rsp), |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 741 | |
| 742 | .mio_attr_o, |
| 743 | .dio_attr_o, |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 744 | .clk_i (clkmgr_clocks.clk_main_secure), |
| 745 | .rst_ni (rstmgr_resets.rst_sys_n) |
| 746 | ); |
| 747 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 748 | alert_handler u_alert_handler ( |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 749 | |
| 750 | // Interrupt |
| 751 | .intr_classa_o (intr_alert_handler_classa), |
| 752 | .intr_classb_o (intr_alert_handler_classb), |
| 753 | .intr_classc_o (intr_alert_handler_classc), |
| 754 | .intr_classd_o (intr_alert_handler_classd), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 755 | |
| 756 | // Inter-module signals |
| 757 | .tl_i(alert_handler_tl_req), |
| 758 | .tl_o(alert_handler_tl_rsp), |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 759 | // TODO: wire this to hardware debug circuit |
| 760 | .crashdump_o ( ), |
| 761 | // TODO: wire this to TRNG |
| 762 | .entropy_i ( 1'b0 ), |
| 763 | // alert signals |
| 764 | .alert_rx_o ( alert_rx ), |
| 765 | .alert_tx_i ( alert_tx ), |
| 766 | // escalation outputs |
| 767 | .esc_rx_i ( esc_rx ), |
| 768 | .esc_tx_o ( esc_tx ), |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 769 | .clk_i (clkmgr_clocks.clk_main_secure), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 770 | .rst_ni (rstmgr_resets.rst_sys_n) |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 771 | ); |
| 772 | |
Timothy Chen | 163050b | 2020-04-13 23:29:29 -0700 | [diff] [blame] | 773 | pwrmgr u_pwrmgr ( |
Timothy Chen | 163050b | 2020-04-13 23:29:29 -0700 | [diff] [blame] | 774 | |
| 775 | // Interrupt |
| 776 | .intr_wakeup_o (intr_pwrmgr_wakeup), |
| 777 | |
| 778 | // Inter-module signals |
Timothy Chen | 1555dce | 2020-08-11 11:26:50 -0700 | [diff] [blame] | 779 | .pwr_ast_o(pwrmgr_pwr_ast_req_o), |
| 780 | .pwr_ast_i(pwrmgr_pwr_ast_rsp_i), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 781 | .pwr_rst_o(pwrmgr_pwr_rst_req), |
| 782 | .pwr_rst_i(pwrmgr_pwr_rst_rsp), |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 783 | .pwr_clk_o(pwrmgr_pwr_clk_req), |
| 784 | .pwr_clk_i(pwrmgr_pwr_clk_rsp), |
Timothy Chen | 163050b | 2020-04-13 23:29:29 -0700 | [diff] [blame] | 785 | .pwr_otp_o(), |
| 786 | .pwr_otp_i(pwrmgr_pkg::PWR_OTP_RSP_DEFAULT), |
| 787 | .pwr_lc_o(), |
| 788 | .pwr_lc_i(pwrmgr_pkg::PWR_LC_RSP_DEFAULT), |
| 789 | .pwr_flash_i(pwrmgr_pkg::PWR_FLASH_DEFAULT), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 790 | .pwr_cpu_i(pwrmgr_pwr_cpu), |
Timothy Chen | 4ba2531 | 2020-06-17 13:08:57 -0700 | [diff] [blame] | 791 | .wakeups_i(pwrmgr_wakeups), |
| 792 | .rstreqs_i('0), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 793 | .tl_i(pwrmgr_tl_req), |
| 794 | .tl_o(pwrmgr_tl_rsp), |
Timothy Chen | 371c94d | 2020-06-30 17:18:14 -0700 | [diff] [blame] | 795 | .clk_i (clkmgr_clocks.clk_io_powerup), |
| 796 | .clk_slow_i (clkmgr_clocks.clk_aon_powerup), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 797 | .rst_ni (rstmgr_resets.rst_por_n), |
Timothy Chen | a4cc10d | 2020-05-08 16:06:20 -0700 | [diff] [blame] | 798 | .rst_slow_ni (rstmgr_resets.rst_por_aon_n) |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 799 | ); |
| 800 | |
| 801 | rstmgr u_rstmgr ( |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 802 | |
| 803 | // Inter-module signals |
| 804 | .pwr_i(pwrmgr_pwr_rst_req), |
| 805 | .pwr_o(pwrmgr_pwr_rst_rsp), |
| 806 | .resets_o(rstmgr_resets), |
Timothy Chen | 1555dce | 2020-08-11 11:26:50 -0700 | [diff] [blame] | 807 | .ast_i(rstmgr_ast_i), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 808 | .cpu_i(rstmgr_cpu), |
| 809 | .peri_i(rstmgr_pkg::RSTMGR_PERI_DEFAULT), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 810 | .tl_i(rstmgr_tl_req), |
| 811 | .tl_o(rstmgr_tl_rsp), |
Timothy Chen | ac3a8c9 | 2020-06-29 20:17:07 -0700 | [diff] [blame] | 812 | .scanmode_i (scanmode_i), |
| 813 | .scan_rst_ni (scan_rst_ni), |
Timothy Chen | 371c94d | 2020-06-30 17:18:14 -0700 | [diff] [blame] | 814 | .clk_i (clkmgr_clocks.clk_io_powerup), |
| 815 | .clk_aon_i (clkmgr_clocks.clk_aon_powerup), |
| 816 | .clk_main_i (clkmgr_clocks.clk_main_powerup), |
| 817 | .clk_io_i (clkmgr_clocks.clk_io_powerup), |
| 818 | .clk_usb_i (clkmgr_clocks.clk_usb_powerup), |
| 819 | .clk_io_div2_i (clkmgr_clocks.clk_io_div2_powerup), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 820 | .rst_ni (rst_ni) |
Timothy Chen | 163050b | 2020-04-13 23:29:29 -0700 | [diff] [blame] | 821 | ); |
| 822 | |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 823 | clkmgr u_clkmgr ( |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 824 | |
| 825 | // Inter-module signals |
| 826 | .clocks_o(clkmgr_clocks), |
Eunchan Kim | 5511bbe | 2020-08-07 14:04:20 -0700 | [diff] [blame] | 827 | .clk_main_i(clk_main_i), |
| 828 | .clk_io_i(clk_io_i), |
| 829 | .clk_usb_i(clk_usb_i), |
| 830 | .clk_aon_i(clk_aon_i), |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 831 | .pwr_i(pwrmgr_pwr_clk_req), |
| 832 | .pwr_o(pwrmgr_pwr_clk_rsp), |
| 833 | .dft_i(clkmgr_pkg::CLK_DFT_DEFAULT), |
Pirmin Vogel | a2d411d | 2020-07-13 17:33:42 +0200 | [diff] [blame] | 834 | .status_i(clkmgr_status), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 835 | .tl_i(clkmgr_tl_req), |
| 836 | .tl_o(clkmgr_tl_rsp), |
Timothy Chen | 371c94d | 2020-06-30 17:18:14 -0700 | [diff] [blame] | 837 | .clk_i (clkmgr_clocks.clk_io_powerup), |
Timothy Chen | a4cc10d | 2020-05-08 16:06:20 -0700 | [diff] [blame] | 838 | .rst_ni (rstmgr_resets.rst_por_io_n), |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 839 | .rst_main_ni (rstmgr_resets.rst_por_n), |
Timothy Chen | a4cc10d | 2020-05-08 16:06:20 -0700 | [diff] [blame] | 840 | .rst_io_ni (rstmgr_resets.rst_por_io_n), |
Timothy Chen | 371c94d | 2020-06-30 17:18:14 -0700 | [diff] [blame] | 841 | .rst_usb_ni (rstmgr_resets.rst_por_usb_n), |
| 842 | .rst_io_div2_ni (rstmgr_resets.rst_por_io_div2_n) |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 843 | ); |
| 844 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 845 | nmi_gen u_nmi_gen ( |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 846 | |
| 847 | // Interrupt |
| 848 | .intr_esc0_o (intr_nmi_gen_esc0), |
| 849 | .intr_esc1_o (intr_nmi_gen_esc1), |
| 850 | .intr_esc2_o (intr_nmi_gen_esc2), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 851 | |
| 852 | // Inter-module signals |
| 853 | .tl_i(nmi_gen_tl_req), |
| 854 | .tl_o(nmi_gen_tl_rsp), |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 855 | // escalation signal inputs |
Michael Schaffner | bdcbd20 | 2020-07-27 12:18:21 -0700 | [diff] [blame] | 856 | .esc_rx_o ( esc_rx[3:1] ), |
| 857 | .esc_tx_i ( esc_tx[3:1] ), |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 858 | .clk_i (clkmgr_clocks.clk_main_secure), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 859 | .rst_ni (rstmgr_resets.rst_sys_n) |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 860 | ); |
| 861 | |
Michael Schaffner | a39557e | 2020-03-17 18:30:21 -0700 | [diff] [blame] | 862 | usbdev u_usbdev ( |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 863 | |
Pirmin Vogel | b054fc0 | 2020-03-11 11:23:03 +0100 | [diff] [blame] | 864 | // Input |
| 865 | .cio_sense_i (cio_usbdev_sense_p2d), |
| 866 | .cio_d_i (cio_usbdev_d_p2d), |
| 867 | .cio_dp_i (cio_usbdev_dp_p2d), |
| 868 | .cio_dn_i (cio_usbdev_dn_p2d), |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 869 | |
Pirmin Vogel | b054fc0 | 2020-03-11 11:23:03 +0100 | [diff] [blame] | 870 | // Output |
| 871 | .cio_se0_o (cio_usbdev_se0_d2p), |
| 872 | .cio_se0_en_o (cio_usbdev_se0_en_d2p), |
Pirmin Vogel | fe6863b | 2020-05-11 17:30:54 +0200 | [diff] [blame] | 873 | .cio_dp_pullup_o (cio_usbdev_dp_pullup_d2p), |
| 874 | .cio_dp_pullup_en_o (cio_usbdev_dp_pullup_en_d2p), |
| 875 | .cio_dn_pullup_o (cio_usbdev_dn_pullup_d2p), |
| 876 | .cio_dn_pullup_en_o (cio_usbdev_dn_pullup_en_d2p), |
Pirmin Vogel | b054fc0 | 2020-03-11 11:23:03 +0100 | [diff] [blame] | 877 | .cio_tx_mode_se_o (cio_usbdev_tx_mode_se_d2p), |
| 878 | .cio_tx_mode_se_en_o (cio_usbdev_tx_mode_se_en_d2p), |
| 879 | .cio_suspend_o (cio_usbdev_suspend_d2p), |
| 880 | .cio_suspend_en_o (cio_usbdev_suspend_en_d2p), |
| 881 | .cio_d_o (cio_usbdev_d_d2p), |
| 882 | .cio_d_en_o (cio_usbdev_d_en_d2p), |
| 883 | .cio_dp_o (cio_usbdev_dp_d2p), |
| 884 | .cio_dp_en_o (cio_usbdev_dp_en_d2p), |
| 885 | .cio_dn_o (cio_usbdev_dn_d2p), |
| 886 | .cio_dn_en_o (cio_usbdev_dn_en_d2p), |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 887 | |
| 888 | // Interrupt |
| 889 | .intr_pkt_received_o (intr_usbdev_pkt_received), |
| 890 | .intr_pkt_sent_o (intr_usbdev_pkt_sent), |
| 891 | .intr_disconnected_o (intr_usbdev_disconnected), |
| 892 | .intr_host_lost_o (intr_usbdev_host_lost), |
| 893 | .intr_link_reset_o (intr_usbdev_link_reset), |
| 894 | .intr_link_suspend_o (intr_usbdev_link_suspend), |
| 895 | .intr_link_resume_o (intr_usbdev_link_resume), |
| 896 | .intr_av_empty_o (intr_usbdev_av_empty), |
| 897 | .intr_rx_full_o (intr_usbdev_rx_full), |
| 898 | .intr_av_overflow_o (intr_usbdev_av_overflow), |
| 899 | .intr_link_in_err_o (intr_usbdev_link_in_err), |
| 900 | .intr_rx_crc_err_o (intr_usbdev_rx_crc_err), |
| 901 | .intr_rx_pid_err_o (intr_usbdev_rx_pid_err), |
| 902 | .intr_rx_bitstuff_err_o (intr_usbdev_rx_bitstuff_err), |
| 903 | .intr_frame_o (intr_usbdev_frame), |
| 904 | .intr_connected_o (intr_usbdev_connected), |
| 905 | |
Pirmin Vogel | dd3a2f0 | 2020-05-12 14:59:50 +0200 | [diff] [blame] | 906 | // Inter-module signals |
Timothy Chen | 1555dce | 2020-08-11 11:26:50 -0700 | [diff] [blame] | 907 | .usb_ref_val_o(usbdev_usb_ref_val_o), |
| 908 | .usb_ref_pulse_o(usbdev_usb_ref_pulse_o), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 909 | .tl_i(usbdev_tl_req), |
| 910 | .tl_o(usbdev_tl_rsp), |
Timothy Chen | 33b3b9d | 2020-05-08 10:14:17 -0700 | [diff] [blame] | 911 | .clk_i (clkmgr_clocks.clk_io_peri), |
| 912 | .clk_usb_48mhz_i (clkmgr_clocks.clk_usb_peri), |
| 913 | .rst_ni (rstmgr_resets.rst_sys_io_n), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 914 | .rst_usb_48mhz_ni (rstmgr_resets.rst_usb_n) |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 915 | ); |
| 916 | |
Timothy Chen | 1555dce | 2020-08-11 11:26:50 -0700 | [diff] [blame] | 917 | sensor_ctrl u_sensor_ctrl ( |
| 918 | |
| 919 | // [2]: ast_alerts |
| 920 | // [3]: ast_alerts |
| 921 | // [4]: ast_alerts |
| 922 | // [5]: ast_alerts |
| 923 | // [6]: ast_alerts |
| 924 | // [7]: ast_alerts |
| 925 | // [8]: ast_alerts |
| 926 | .alert_tx_o ( alert_tx[8:2] ), |
| 927 | .alert_rx_i ( alert_rx[8:2] ), |
| 928 | |
| 929 | // Inter-module signals |
| 930 | .ast_alert_i(sensor_ctrl_ast_alert_req_i), |
| 931 | .ast_alert_o(sensor_ctrl_ast_alert_rsp_o), |
| 932 | .ast_status_i(sensor_ctrl_ast_status_i), |
| 933 | .tl_i(sensor_ctrl_tl_req), |
| 934 | .tl_o(sensor_ctrl_tl_rsp), |
| 935 | .clk_i (clkmgr_clocks.clk_io_secure), |
| 936 | .rst_ni (rstmgr_resets.rst_sys_io_n) |
| 937 | ); |
| 938 | |
Philipp Wagner | a4a9e40 | 2020-06-22 12:06:56 +0100 | [diff] [blame] | 939 | otbn u_otbn ( |
Philipp Wagner | a4a9e40 | 2020-06-22 12:06:56 +0100 | [diff] [blame] | 940 | |
| 941 | // Interrupt |
| 942 | .intr_done_o (intr_otbn_done), |
| 943 | .intr_err_o (intr_otbn_err), |
| 944 | |
Timothy Chen | 1555dce | 2020-08-11 11:26:50 -0700 | [diff] [blame] | 945 | // [9]: imem_uncorrectable |
| 946 | // [10]: dmem_uncorrectable |
| 947 | // [11]: reg_uncorrectable |
| 948 | .alert_tx_o ( alert_tx[11:9] ), |
| 949 | .alert_rx_i ( alert_rx[11:9] ), |
Philipp Wagner | a4a9e40 | 2020-06-22 12:06:56 +0100 | [diff] [blame] | 950 | |
| 951 | // Inter-module signals |
| 952 | .idle_o(), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 953 | .tl_i(otbn_tl_req), |
| 954 | .tl_o(otbn_tl_rsp), |
Philipp Wagner | a4a9e40 | 2020-06-22 12:06:56 +0100 | [diff] [blame] | 955 | .clk_i (clkmgr_clocks.clk_main_otbn), |
| 956 | .rst_ni (rstmgr_resets.rst_sys_n) |
| 957 | ); |
| 958 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 959 | // interrupt assignments |
| 960 | assign intr_vector = { |
Philipp Wagner | a4a9e40 | 2020-06-22 12:06:56 +0100 | [diff] [blame] | 961 | intr_otbn_err, |
| 962 | intr_otbn_done, |
Timothy Chen | 163050b | 2020-04-13 23:29:29 -0700 | [diff] [blame] | 963 | intr_pwrmgr_wakeup, |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 964 | intr_usbdev_connected, |
| 965 | intr_usbdev_frame, |
| 966 | intr_usbdev_rx_bitstuff_err, |
| 967 | intr_usbdev_rx_pid_err, |
| 968 | intr_usbdev_rx_crc_err, |
| 969 | intr_usbdev_link_in_err, |
| 970 | intr_usbdev_av_overflow, |
| 971 | intr_usbdev_rx_full, |
| 972 | intr_usbdev_av_empty, |
| 973 | intr_usbdev_link_resume, |
| 974 | intr_usbdev_link_suspend, |
| 975 | intr_usbdev_link_reset, |
| 976 | intr_usbdev_host_lost, |
| 977 | intr_usbdev_disconnected, |
| 978 | intr_usbdev_pkt_sent, |
| 979 | intr_usbdev_pkt_received, |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 980 | intr_nmi_gen_esc2, |
| 981 | intr_nmi_gen_esc1, |
| 982 | intr_nmi_gen_esc0, |
| 983 | intr_alert_handler_classd, |
| 984 | intr_alert_handler_classc, |
| 985 | intr_alert_handler_classb, |
| 986 | intr_alert_handler_classa, |
Eunchan Kim | 226eab6 | 2019-10-18 14:11:29 -0700 | [diff] [blame] | 987 | intr_hmac_hmac_err, |
Eunchan Kim | d9d69aa | 2020-03-20 10:21:11 -0700 | [diff] [blame] | 988 | intr_hmac_fifo_empty, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 989 | intr_hmac_hmac_done, |
| 990 | intr_flash_ctrl_op_error, |
| 991 | intr_flash_ctrl_op_done, |
| 992 | intr_flash_ctrl_rd_lvl, |
| 993 | intr_flash_ctrl_rd_full, |
| 994 | intr_flash_ctrl_prog_lvl, |
| 995 | intr_flash_ctrl_prog_empty, |
Eunchan Kim | 546c0d4 | 2019-09-24 15:07:06 -0700 | [diff] [blame] | 996 | intr_spi_device_txunderflow, |
| 997 | intr_spi_device_rxoverflow, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 998 | intr_spi_device_rxerr, |
| 999 | intr_spi_device_txlvl, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1000 | intr_spi_device_rxlvl, |
Eunchan Kim | 8c57fe3 | 2019-09-02 21:14:24 -0700 | [diff] [blame] | 1001 | intr_spi_device_rxf, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1002 | intr_uart_rx_parity_err, |
| 1003 | intr_uart_rx_timeout, |
| 1004 | intr_uart_rx_break_err, |
| 1005 | intr_uart_rx_frame_err, |
| 1006 | intr_uart_rx_overflow, |
Timothy Chen | 087d4f4 | 2019-12-27 16:04:46 -0800 | [diff] [blame] | 1007 | intr_uart_tx_empty, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1008 | intr_uart_rx_watermark, |
| 1009 | intr_uart_tx_watermark, |
Eunchan Kim | 88a8615 | 2020-04-13 16:12:08 -0700 | [diff] [blame] | 1010 | intr_gpio_gpio, |
| 1011 | 1'b 0 // For ID 0. |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1012 | }; |
| 1013 | |
| 1014 | // TL-UL Crossbar |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1015 | xbar_main u_xbar_main ( |
Timothy Chen | f56c1b5 | 2020-04-28 17:00:43 -0700 | [diff] [blame] | 1016 | .clk_main_i (clkmgr_clocks.clk_main_infra), |
Timothy Chen | 33b3b9d | 2020-05-08 10:14:17 -0700 | [diff] [blame] | 1017 | .clk_fixed_i (clkmgr_clocks.clk_io_infra), |
Timothy Chen | c59f701 | 2020-04-16 19:11:42 -0700 | [diff] [blame] | 1018 | .rst_main_ni (rstmgr_resets.rst_sys_n), |
Timothy Chen | 33b3b9d | 2020-05-08 10:14:17 -0700 | [diff] [blame] | 1019 | .rst_fixed_ni (rstmgr_resets.rst_sys_io_n), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 1020 | |
| 1021 | // port: tl_corei |
| 1022 | .tl_corei_i(main_tl_corei_req), |
| 1023 | .tl_corei_o(main_tl_corei_rsp), |
| 1024 | |
| 1025 | // port: tl_cored |
| 1026 | .tl_cored_i(main_tl_cored_req), |
| 1027 | .tl_cored_o(main_tl_cored_rsp), |
| 1028 | |
| 1029 | // port: tl_dm_sba |
| 1030 | .tl_dm_sba_i(main_tl_dm_sba_req), |
| 1031 | .tl_dm_sba_o(main_tl_dm_sba_rsp), |
| 1032 | |
| 1033 | // port: tl_rom |
| 1034 | .tl_rom_o(rom_tl_req), |
| 1035 | .tl_rom_i(rom_tl_rsp), |
| 1036 | |
| 1037 | // port: tl_debug_mem |
| 1038 | .tl_debug_mem_o(main_tl_debug_mem_req), |
| 1039 | .tl_debug_mem_i(main_tl_debug_mem_rsp), |
| 1040 | |
| 1041 | // port: tl_ram_main |
| 1042 | .tl_ram_main_o(ram_main_tl_req), |
| 1043 | .tl_ram_main_i(ram_main_tl_rsp), |
| 1044 | |
| 1045 | // port: tl_eflash |
| 1046 | .tl_eflash_o(eflash_tl_req), |
| 1047 | .tl_eflash_i(eflash_tl_rsp), |
| 1048 | |
| 1049 | // port: tl_peri |
| 1050 | .tl_peri_o(main_tl_peri_req), |
| 1051 | .tl_peri_i(main_tl_peri_rsp), |
| 1052 | |
| 1053 | // port: tl_flash_ctrl |
| 1054 | .tl_flash_ctrl_o(flash_ctrl_tl_req), |
| 1055 | .tl_flash_ctrl_i(flash_ctrl_tl_rsp), |
| 1056 | |
| 1057 | // port: tl_hmac |
| 1058 | .tl_hmac_o(hmac_tl_req), |
| 1059 | .tl_hmac_i(hmac_tl_rsp), |
| 1060 | |
| 1061 | // port: tl_aes |
| 1062 | .tl_aes_o(aes_tl_req), |
| 1063 | .tl_aes_i(aes_tl_rsp), |
| 1064 | |
| 1065 | // port: tl_rv_plic |
| 1066 | .tl_rv_plic_o(rv_plic_tl_req), |
| 1067 | .tl_rv_plic_i(rv_plic_tl_rsp), |
| 1068 | |
| 1069 | // port: tl_pinmux |
| 1070 | .tl_pinmux_o(pinmux_tl_req), |
| 1071 | .tl_pinmux_i(pinmux_tl_rsp), |
| 1072 | |
| 1073 | // port: tl_padctrl |
| 1074 | .tl_padctrl_o(padctrl_tl_req), |
| 1075 | .tl_padctrl_i(padctrl_tl_rsp), |
| 1076 | |
| 1077 | // port: tl_alert_handler |
| 1078 | .tl_alert_handler_o(alert_handler_tl_req), |
| 1079 | .tl_alert_handler_i(alert_handler_tl_rsp), |
| 1080 | |
| 1081 | // port: tl_nmi_gen |
| 1082 | .tl_nmi_gen_o(nmi_gen_tl_req), |
| 1083 | .tl_nmi_gen_i(nmi_gen_tl_rsp), |
| 1084 | |
| 1085 | // port: tl_otbn |
| 1086 | .tl_otbn_o(otbn_tl_req), |
| 1087 | .tl_otbn_i(otbn_tl_rsp), |
| 1088 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1089 | |
| 1090 | .scanmode_i |
| 1091 | ); |
Eunchan Kim | 55d7ae8 | 2019-12-19 17:08:35 -0800 | [diff] [blame] | 1092 | xbar_peri u_xbar_peri ( |
Timothy Chen | 33b3b9d | 2020-05-08 10:14:17 -0700 | [diff] [blame] | 1093 | .clk_peri_i (clkmgr_clocks.clk_io_infra), |
| 1094 | .rst_peri_ni (rstmgr_resets.rst_sys_io_n), |
Eunchan Kim | 0f54954 | 2020-08-04 10:40:11 -0700 | [diff] [blame] | 1095 | |
| 1096 | // port: tl_main |
| 1097 | .tl_main_i(main_tl_peri_req), |
| 1098 | .tl_main_o(main_tl_peri_rsp), |
| 1099 | |
| 1100 | // port: tl_uart |
| 1101 | .tl_uart_o(uart_tl_req), |
| 1102 | .tl_uart_i(uart_tl_rsp), |
| 1103 | |
| 1104 | // port: tl_gpio |
| 1105 | .tl_gpio_o(gpio_tl_req), |
| 1106 | .tl_gpio_i(gpio_tl_rsp), |
| 1107 | |
| 1108 | // port: tl_spi_device |
| 1109 | .tl_spi_device_o(spi_device_tl_req), |
| 1110 | .tl_spi_device_i(spi_device_tl_rsp), |
| 1111 | |
| 1112 | // port: tl_rv_timer |
| 1113 | .tl_rv_timer_o(rv_timer_tl_req), |
| 1114 | .tl_rv_timer_i(rv_timer_tl_rsp), |
| 1115 | |
| 1116 | // port: tl_usbdev |
| 1117 | .tl_usbdev_o(usbdev_tl_req), |
| 1118 | .tl_usbdev_i(usbdev_tl_rsp), |
| 1119 | |
| 1120 | // port: tl_pwrmgr |
| 1121 | .tl_pwrmgr_o(pwrmgr_tl_req), |
| 1122 | .tl_pwrmgr_i(pwrmgr_tl_rsp), |
| 1123 | |
| 1124 | // port: tl_rstmgr |
| 1125 | .tl_rstmgr_o(rstmgr_tl_req), |
| 1126 | .tl_rstmgr_i(rstmgr_tl_rsp), |
| 1127 | |
| 1128 | // port: tl_clkmgr |
| 1129 | .tl_clkmgr_o(clkmgr_tl_req), |
| 1130 | .tl_clkmgr_i(clkmgr_tl_rsp), |
| 1131 | |
| 1132 | // port: tl_ram_ret |
| 1133 | .tl_ram_ret_o(ram_ret_tl_req), |
| 1134 | .tl_ram_ret_i(ram_ret_tl_rsp), |
| 1135 | |
Timothy Chen | 1555dce | 2020-08-11 11:26:50 -0700 | [diff] [blame] | 1136 | // port: tl_sensor_ctrl |
| 1137 | .tl_sensor_ctrl_o(sensor_ctrl_tl_req), |
| 1138 | .tl_sensor_ctrl_i(sensor_ctrl_tl_rsp), |
| 1139 | |
Eunchan Kim | 55d7ae8 | 2019-12-19 17:08:35 -0800 | [diff] [blame] | 1140 | |
| 1141 | .scanmode_i |
| 1142 | ); |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1143 | |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 1144 | // Pinmux connections |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 1145 | assign mio_d2p = { |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 1146 | cio_gpio_gpio_d2p |
| 1147 | }; |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 1148 | assign mio_d2p_en = { |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 1149 | cio_gpio_gpio_en_d2p |
| 1150 | }; |
| 1151 | assign { |
| 1152 | cio_gpio_gpio_p2d |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 1153 | } = mio_p2d; |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 1154 | |
Michael Schaffner | 920e4cc | 2020-04-28 22:58:12 -0700 | [diff] [blame] | 1155 | // Dedicated IO connections |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 1156 | // Input-only DIOs have no d2p signals |
| 1157 | assign dio_d2p = { |
Pirmin Vogel | fe6863b | 2020-05-11 17:30:54 +0200 | [diff] [blame] | 1158 | 1'b0, // DIO14: cio_spi_device_sck |
| 1159 | 1'b0, // DIO13: cio_spi_device_csb |
Scott Johnson | fe79c4b | 2020-07-08 10:31:08 -0700 | [diff] [blame] | 1160 | 1'b0, // DIO12: cio_spi_device_sdi |
| 1161 | cio_spi_device_sdo_d2p, // DIO11 |
Pirmin Vogel | fe6863b | 2020-05-11 17:30:54 +0200 | [diff] [blame] | 1162 | 1'b0, // DIO10: cio_uart_rx |
| 1163 | cio_uart_tx_d2p, // DIO9 |
| 1164 | 1'b0, // DIO8: cio_usbdev_sense |
| 1165 | cio_usbdev_se0_d2p, // DIO7 |
| 1166 | cio_usbdev_dp_pullup_d2p, // DIO6 |
| 1167 | cio_usbdev_dn_pullup_d2p, // DIO5 |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 1168 | cio_usbdev_tx_mode_se_d2p, // DIO4 |
| 1169 | cio_usbdev_suspend_d2p, // DIO3 |
| 1170 | cio_usbdev_d_d2p, // DIO2 |
| 1171 | cio_usbdev_dp_d2p, // DIO1 |
| 1172 | cio_usbdev_dn_d2p // DIO0 |
Michael Schaffner | 920e4cc | 2020-04-28 22:58:12 -0700 | [diff] [blame] | 1173 | }; |
| 1174 | |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 1175 | assign dio_d2p_en = { |
Pirmin Vogel | fe6863b | 2020-05-11 17:30:54 +0200 | [diff] [blame] | 1176 | 1'b0, // DIO14: cio_spi_device_sck |
| 1177 | 1'b0, // DIO13: cio_spi_device_csb |
Scott Johnson | fe79c4b | 2020-07-08 10:31:08 -0700 | [diff] [blame] | 1178 | 1'b0, // DIO12: cio_spi_device_sdi |
| 1179 | cio_spi_device_sdo_en_d2p, // DIO11 |
Pirmin Vogel | fe6863b | 2020-05-11 17:30:54 +0200 | [diff] [blame] | 1180 | 1'b0, // DIO10: cio_uart_rx |
| 1181 | cio_uart_tx_en_d2p, // DIO9 |
| 1182 | 1'b0, // DIO8: cio_usbdev_sense |
| 1183 | cio_usbdev_se0_en_d2p, // DIO7 |
| 1184 | cio_usbdev_dp_pullup_en_d2p, // DIO6 |
| 1185 | cio_usbdev_dn_pullup_en_d2p, // DIO5 |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 1186 | cio_usbdev_tx_mode_se_en_d2p, // DIO4 |
| 1187 | cio_usbdev_suspend_en_d2p, // DIO3 |
| 1188 | cio_usbdev_d_en_d2p, // DIO2 |
| 1189 | cio_usbdev_dp_en_d2p, // DIO1 |
| 1190 | cio_usbdev_dn_en_d2p // DIO0 |
Michael Schaffner | 920e4cc | 2020-04-28 22:58:12 -0700 | [diff] [blame] | 1191 | }; |
| 1192 | |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 1193 | // Output-only DIOs have no p2d signal |
Pirmin Vogel | fe6863b | 2020-05-11 17:30:54 +0200 | [diff] [blame] | 1194 | assign cio_spi_device_sck_p2d = dio_p2d[14]; // DIO14 |
| 1195 | assign cio_spi_device_csb_p2d = dio_p2d[13]; // DIO13 |
Scott Johnson | fe79c4b | 2020-07-08 10:31:08 -0700 | [diff] [blame] | 1196 | assign cio_spi_device_sdi_p2d = dio_p2d[12]; // DIO12 |
| 1197 | // DIO11: cio_spi_device_sdo |
Pirmin Vogel | fe6863b | 2020-05-11 17:30:54 +0200 | [diff] [blame] | 1198 | assign cio_uart_rx_p2d = dio_p2d[10]; // DIO10 |
| 1199 | // DIO9: cio_uart_tx |
| 1200 | assign cio_usbdev_sense_p2d = dio_p2d[8]; // DIO8 |
| 1201 | // DIO7: cio_usbdev_se0 |
| 1202 | // DIO6: cio_usbdev_dp_pullup |
| 1203 | // DIO5: cio_usbdev_dn_pullup |
Michael Schaffner | 79eb65f | 2020-05-01 19:12:47 -0700 | [diff] [blame] | 1204 | // DIO4: cio_usbdev_tx_mode_se |
| 1205 | // DIO3: cio_usbdev_suspend |
| 1206 | assign cio_usbdev_d_p2d = dio_p2d[2]; // DIO2 |
| 1207 | assign cio_usbdev_dp_p2d = dio_p2d[1]; // DIO1 |
| 1208 | assign cio_usbdev_dn_p2d = dio_p2d[0]; // DIO0 |
Eunchan Kim | 769065e | 2019-10-29 17:29:26 -0700 | [diff] [blame] | 1209 | |
Nils Graf | 78607aa | 2019-09-16 15:47:23 -0700 | [diff] [blame] | 1210 | // make sure scanmode_i is never X (including during reset) |
Eunchan Kim | 5511bbe | 2020-08-07 14:04:20 -0700 | [diff] [blame] | 1211 | `ASSERT_KNOWN(scanmodeKnown, scanmode_i, clk_main_i, 0) |
Nils Graf | 78607aa | 2019-09-16 15:47:23 -0700 | [diff] [blame] | 1212 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1213 | endmodule |