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