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 | // |
| 5 | // TOP Earlgrey configuration |
| 6 | { name: "earlgrey", |
| 7 | type: "top", |
| 8 | |
| 9 | datawidth: "32", # 32-bit datawidth |
| 10 | |
| 11 | clocks: [ |
| 12 | { name: "main", freq: "100000000" } |
Timothy Chen | 65d7425 | 2019-11-08 14:03:35 -0800 | [diff] [blame] | 13 | { name: "fixed", freq: "100000000" } |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 14 | { name: "usb", freq: "48000000" } |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 15 | ] |
| 16 | |
Timothy Chen | 3193b00 | 2019-10-04 16:56:05 -0700 | [diff] [blame] | 17 | // Reset attributes |
Timothy Chen | e8cb3bd | 2020-04-14 16:12:26 -0700 | [diff] [blame] | 18 | // name: name of reset. |
| 19 | // If type is "gen", then real name is `name`_rst_n |
| 20 | // If type is "por", then real name is just `name` |
| 21 | // The root type is temporary until rstmgr integration |
| 22 | // |
| 23 | // root: The parent reset. |
| 24 | // If type is "por", there is no root, since it is the root |
| 25 | // |
Timothy Chen | 3193b00 | 2019-10-04 16:56:05 -0700 | [diff] [blame] | 26 | // clk: related clock domain for synchronous release |
Timothy Chen | e8cb3bd | 2020-04-14 16:12:26 -0700 | [diff] [blame] | 27 | // If type is "por", there is not related clock, since it is |
| 28 | // likely external or generated from a voltage comparator |
| 29 | // |
Timothy Chen | 3193b00 | 2019-10-04 16:56:05 -0700 | [diff] [blame] | 30 | resets: [ |
Timothy Chen | e8cb3bd | 2020-04-14 16:12:26 -0700 | [diff] [blame] | 31 | // The rst_ni and por resets are relevant once rstmgr / pwrmgr are integrated |
| 32 | // { name: "rst_ni", type: "por" } |
| 33 | // { name: "por", type: "gen", root: "lc", clk: "fixed" } |
| 34 | { name: "lc", type: "root", root: "lc", clk: "fixed" } |
| 35 | { name: "sys", type: "root", root: "sys", clk: "main" } |
| 36 | { name: "sys_fixed", type: "gen", root: "sys", clk: "fixed" } |
| 37 | { name: "spi_device", type: "gen", root: "sys", clk: "fixed", sw: 1} |
| 38 | { name: "usb", type: "gen", root: "sys", clk: "usb", sw: 1} |
Timothy Chen | 3193b00 | 2019-10-04 16:56:05 -0700 | [diff] [blame] | 39 | ] |
| 40 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 41 | // Number of cores: used in rv_plic and timer |
| 42 | num_cores: "1", |
| 43 | |
| 44 | // `module` defines the peripherals. |
| 45 | // Details are coming from each modules' config file `ip.hjson` |
| 46 | // TODO: Define parameter here |
| 47 | module: [ |
| 48 | { name: "uart", // instance name |
| 49 | type: "uart", // Must be matched to the ip name in `ip.hson` (_reg, _cfg permitted) |
| 50 | // and `hw/ip/{type}` |
Timothy Chen | 3193b00 | 2019-10-04 16:56:05 -0700 | [diff] [blame] | 51 | |
Timothy Chen | 80bd8aa | 2019-10-04 15:57:11 -0700 | [diff] [blame] | 52 | // clock connections defines the port to top level clock connection |
| 53 | // the ip.hjson will declare the clock port names |
| 54 | // If none are defined at ip.hjson, clk_i is used by default |
Timothy Chen | 65d7425 | 2019-11-08 14:03:35 -0800 | [diff] [blame] | 55 | clock_connections: {clk_i: "fixed"}, |
Timothy Chen | 3193b00 | 2019-10-04 16:56:05 -0700 | [diff] [blame] | 56 | |
| 57 | // reset connections defines the port to top level reset connection |
| 58 | // the ip.hjson will declare the reset port names |
Timothy Chen | 80bd8aa | 2019-10-04 15:57:11 -0700 | [diff] [blame] | 59 | // If none are defined at ip.hjson, rst_ni is used by default |
Timothy Chen | 65d7425 | 2019-11-08 14:03:35 -0800 | [diff] [blame] | 60 | reset_connections: {rst_ni: "sys_fixed"}, |
Timothy Chen | 80bd8aa | 2019-10-04 15:57:11 -0700 | [diff] [blame] | 61 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 62 | base_addr: "0x40000000", |
| 63 | }, |
| 64 | { name: "gpio", |
| 65 | type: "gpio", |
Timothy Chen | 65d7425 | 2019-11-08 14:03:35 -0800 | [diff] [blame] | 66 | clock_connections: {clk_i: "fixed"}, |
| 67 | reset_connections: {rst_ni: "sys_fixed"}, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 68 | base_addr: "0x40010000", |
| 69 | } |
| 70 | |
| 71 | { name: "spi_device", |
| 72 | type: "spi_device", |
Timothy Chen | 65d7425 | 2019-11-08 14:03:35 -0800 | [diff] [blame] | 73 | clock_connections: {clk_i: "fixed"}, |
Timothy Chen | 3193b00 | 2019-10-04 16:56:05 -0700 | [diff] [blame] | 74 | reset_connections: {rst_ni: "spi_device"}, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 75 | base_addr: "0x40020000", |
| 76 | }, |
| 77 | { name: "flash_ctrl", |
| 78 | type: "flash_ctrl", |
Timothy Chen | 80bd8aa | 2019-10-04 15:57:11 -0700 | [diff] [blame] | 79 | clock_connections: {clk_i: "main"}, |
Timothy Chen | 3193b00 | 2019-10-04 16:56:05 -0700 | [diff] [blame] | 80 | reset_connections: {rst_ni: "lc"}, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 81 | base_addr: "0x40030000", |
| 82 | }, |
| 83 | { name: "rv_timer", |
| 84 | type: "rv_timer", |
Timothy Chen | 65d7425 | 2019-11-08 14:03:35 -0800 | [diff] [blame] | 85 | clock_connections: {clk_i: "fixed"}, |
| 86 | reset_connections: {rst_ni: "sys_fixed"}, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 87 | base_addr: "0x40080000", |
| 88 | }, |
Pirmin Vogel | d453438 | 2019-10-17 13:18:31 +0100 | [diff] [blame] | 89 | { name: "aes", |
| 90 | type: "aes", |
| 91 | clock_connections: {clk_i: "main"}, |
| 92 | reset_connections: {rst_ni: "sys"}, |
| 93 | base_addr: "0x40110000", |
| 94 | }, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 95 | { name: "hmac", |
| 96 | type: "hmac", |
Timothy Chen | 80bd8aa | 2019-10-04 15:57:11 -0700 | [diff] [blame] | 97 | clock_connections: {clk_i: "main"}, |
Timothy Chen | 3193b00 | 2019-10-04 16:56:05 -0700 | [diff] [blame] | 98 | reset_connections: {rst_ni: "sys"}, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 99 | base_addr: "0x40120000", |
| 100 | }, |
| 101 | { name: "rv_plic", |
| 102 | type: "rv_plic", |
Timothy Chen | 80bd8aa | 2019-10-04 15:57:11 -0700 | [diff] [blame] | 103 | clock_connections: {clk_i: "main"}, |
Timothy Chen | 3193b00 | 2019-10-04 16:56:05 -0700 | [diff] [blame] | 104 | reset_connections: {rst_ni: "sys"}, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 105 | base_addr: "0x40090000", |
| 106 | generated: "true" // Indicate this module is generated in the topgen |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 107 | } |
Eunchan Kim | 436d224 | 2019-10-29 17:25:51 -0700 | [diff] [blame] | 108 | { name: "pinmux", |
| 109 | type: "pinmux", |
| 110 | clock: "main", |
| 111 | clock_connections: {clk_i: "main"}, |
| 112 | reset_connections: {rst_ni: "sys"}, |
| 113 | base_addr: "0x40070000", |
| 114 | generated: "true" |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 115 | }, |
| 116 | { name: "alert_handler", |
| 117 | type: "alert_handler", |
| 118 | clock_connections: {clk_i: "main"}, |
| 119 | reset_connections: {rst_ni: "sys"}, |
| 120 | base_addr: "0x40130000", |
| 121 | generated: "true" // Indicate this module is generated in the topgen |
| 122 | localparam: { |
| 123 | EscCntDw: 32, |
| 124 | AccuCntDw: 16, |
| 125 | LfsrSeed: "0x7FFFFFFF" |
| 126 | } |
| 127 | } |
| 128 | // dummy module to capture the alert handler escalation signals |
| 129 | // and test them by converting them into IRQs |
| 130 | { name: "nmi_gen", |
| 131 | type: "nmi_gen", |
| 132 | clock_connections: {clk_i: "main"}, |
| 133 | reset_connections: {rst_ni: "sys"}, |
| 134 | base_addr: "0x40140000", |
Eunchan Kim | 436d224 | 2019-10-29 17:25:51 -0700 | [diff] [blame] | 135 | } |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 136 | { name: "usbdev", |
| 137 | type: "usbdev", |
| 138 | clock_connections: {clk_i: "fixed", clk_usb_48mhz_i: "usb"}, |
| 139 | reset_connections: {rst_ni: "sys_fixed", rst_usb_48mhz_ni: "usb"}, |
| 140 | base_addr: "0x40150000", |
| 141 | }, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 142 | ] |
| 143 | |
| 144 | // Memories (ROM, RAM, eFlash) are defined at the top. |
| 145 | // It utilizes the primitive cells but configurable |
| 146 | memory: [ |
Timothy Chen | 80bd8aa | 2019-10-04 15:57:11 -0700 | [diff] [blame] | 147 | { name: "rom", |
| 148 | clock_connections: {clk_i: "main"}, |
| 149 | reset_connections: {rst_ni: "sys"}, |
| 150 | type: "rom", |
| 151 | base_addr: "0x00008000", |
Timothy Chen | da2e344 | 2020-02-24 21:37:47 -0800 | [diff] [blame] | 152 | size: "0x4000" |
Timothy Chen | 80bd8aa | 2019-10-04 15:57:11 -0700 | [diff] [blame] | 153 | }, |
| 154 | { name: "ram_main", |
| 155 | clock_connections: {clk_i: "main"}, |
| 156 | reset_connections: {rst_ni: "sys"}, |
| 157 | type: "ram_1p", |
| 158 | base_addr: "0x10000000", |
| 159 | size: "0x10000" }, |
| 160 | { name: "eflash", |
| 161 | clock_connections: {clk_i: "main"}, |
| 162 | reset_connections: {rst_ni: "lc"}, |
| 163 | type: "eflash", |
| 164 | base_addr: "0x20000000", |
Eunchan Kim | e4a8507 | 2020-02-05 16:00:00 -0800 | [diff] [blame] | 165 | size: "0x80000", |
| 166 | inter_signal_list: [ |
| 167 | { struct: "flash", // flash_req_t, flash_rsp_t |
| 168 | type: "req_rsp", |
| 169 | name: "flash_ctrl", // flash_ctrl_i (req), flash_ctrl_o (rsp) |
Eunchan Kim | 40098a9 | 2020-04-17 12:22:36 -0700 | [diff] [blame^] | 170 | act: "rsp", |
Eunchan Kim | e4a8507 | 2020-02-05 16:00:00 -0800 | [diff] [blame] | 171 | } |
| 172 | ], |
| 173 | }, |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 174 | ], |
| 175 | |
Eunchan Kim | e4a8507 | 2020-02-05 16:00:00 -0800 | [diff] [blame] | 176 | // Inter-module Connection. |
| 177 | // format: |
| 178 | // requester: [ resp1, resp2, ... ], |
| 179 | // |
Eunchan Kim | 40098a9 | 2020-04-17 12:22:36 -0700 | [diff] [blame^] | 180 | // the field and value should be module_inst.port_name |
Eunchan Kim | e4a8507 | 2020-02-05 16:00:00 -0800 | [diff] [blame] | 181 | // e.g flash_ctrl0.flash: [flash_phy0.flash_ctrl] |
| 182 | inter_module: { |
Eunchan Kim | 40098a9 | 2020-04-17 12:22:36 -0700 | [diff] [blame^] | 183 | 'connect': { |
| 184 | 'flash_ctrl.flash': ['eflash.flash_ctrl'] |
| 185 | } |
| 186 | |
| 187 | // top is to connect to top net/struct. |
| 188 | // It defines the signal in the top and connect from the module, |
| 189 | // use of the signal is up to top template |
| 190 | 'top': [], |
| 191 | |
| 192 | // ext is to create port in the top. |
| 193 | 'ext': [], |
Eunchan Kim | e4a8507 | 2020-02-05 16:00:00 -0800 | [diff] [blame] | 194 | }, |
| 195 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 196 | debug_mem_base_addr: "0x1A110000", |
| 197 | |
| 198 | // Crossbars: having a top level crossbar |
| 199 | // This version assumes all crossbars are instantiated at the top. |
| 200 | // Assume xbar.hjson is located in the same directory of top.hjson |
| 201 | xbar: [ |
| 202 | { name: "main", |
Timothy Chen | 65d7425 | 2019-11-08 14:03:35 -0800 | [diff] [blame] | 203 | clock_connections: {clk_main_i: "main", clk_fixed_i: "fixed"}, |
Timothy Chen | 3193b00 | 2019-10-04 16:56:05 -0700 | [diff] [blame] | 204 | reset: "sys", |
Timothy Chen | 65d7425 | 2019-11-08 14:03:35 -0800 | [diff] [blame] | 205 | reset_connections: {rst_main_ni: "sys", rst_fixed_ni: "sys_fixed"} |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 206 | }, |
Eunchan Kim | 0523f6b | 2019-12-17 13:53:11 -0800 | [diff] [blame] | 207 | { name: "peri", |
| 208 | clock_connections: {clk_peri_i: "fixed"}, |
| 209 | reset: "sys_fixed", |
| 210 | reset_connections: {rst_peri_ni: "sys_fixed"}, |
| 211 | } |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 212 | ], |
| 213 | |
| 214 | // ===== INTERRUPT CTRL ===================================================== |
| 215 | // `rv_plic` will be instantiate (need to be defined in `module` field |
| 216 | // If interrupt is not defined, it uses the order from the module list |
| 217 | // and include every modules. |
| 218 | // first item goes to LSB of the interrupt source |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 219 | interrupt_module: ["gpio", "uart", "spi_device", "flash_ctrl", |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 220 | "hmac", "alert_handler", "nmi_gen", "usbdev" ] |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 221 | |
| 222 | // RV_PLIC has two searching algorithm internally to pick the most highest priority interrupt |
| 223 | // source. "sequential" is smaller but slower, "matrix" is larger but faster. |
| 224 | // Choose depends on the criteria. Currently it is set to "matrix" to meet FPGA timing @ 50MHz |
| 225 | |
| 226 | // generated: |
| 227 | interrupt: [ |
| 228 | ] |
| 229 | |
Michael Schaffner | 666dde1 | 2019-10-25 11:57:54 -0700 | [diff] [blame] | 230 | // ===== ALERT HANDLER ====================================================== |
| 231 | // list all modules that expose alerts |
| 232 | // first item goes to LSB of the interrupt source |
| 233 | alert_module: [ "hmac" ] |
| 234 | |
| 235 | // generated list of alerts: |
| 236 | alert: [ |
| 237 | ] |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 238 | |
| 239 | // TODO: PINMUX |
Eunchan Kim | 632c6f7 | 2019-09-30 11:11:51 -0700 | [diff] [blame] | 240 | pinmux: { |
| 241 | |
Eunchan Kim | 436d224 | 2019-10-29 17:25:51 -0700 | [diff] [blame] | 242 | // Total number of Multiplexed I/O |
| 243 | // All the input/outputs from IPs are muxed in pinmux, and it has # of I/O |
| 244 | // talks to the outside of top_earlgrey. |
| 245 | // This field will be replaced to the length of PAD if padctrl is defined |
| 246 | num_mio: 32 |
| 247 | |
Eunchan Kim | 632c6f7 | 2019-09-30 11:11:51 -0700 | [diff] [blame] | 248 | // Dedicated IO modules. The in/out ports of the modules below are connected |
| 249 | // to TOP IO port through PADS directly. It bypasses PINMUX multiplexers |
| 250 | dio_modules: [ |
| 251 | { name: "spi_device", pad: ["ChB[0..3]"] }, |
Eunchan Kim | 436d224 | 2019-10-29 17:25:51 -0700 | [diff] [blame] | 252 | //{ name: "uart.tx", pad: ["ChA[0]"]}, |
| 253 | { name: "uart", pad: ["ChA[0..1]"]}, |
Eunchan Kim | 632c6f7 | 2019-09-30 11:11:51 -0700 | [diff] [blame] | 254 | // { name: "dio_module.signal_input", pad: ["ChA[31]"] } |
Pirmin Vogel | b054fc0 | 2020-03-11 11:23:03 +0100 | [diff] [blame] | 255 | { name: "usbdev", pad: ["ChC[0..7]"]}, |
Eunchan Kim | 632c6f7 | 2019-09-30 11:11:51 -0700 | [diff] [blame] | 256 | ], |
| 257 | |
| 258 | // Multiplexing IO modules. The in/out ports of the modules below are |
| 259 | // connected through PINMUX, which gives controllability of the connection |
| 260 | // between the modules and the IO PADS. |
| 261 | // If `mio_modules` aren't defined, it uses all remaining modules from |
| 262 | // module list except defined in `dio_modules`. |
| 263 | mio_modules: ["uart", "gpio"] |
| 264 | |
| 265 | // If any module isn't defined in above two lists, its inputs will be tied |
| 266 | // to 0, and the output/OE signals will be floating (or connected to |
| 267 | // unused signal). `rv_plic` is special module, shouldn't be defined here. |
| 268 | nc_modules: ["rv_timer", "hmac"] |
| 269 | |
| 270 | // Below fields are generated. |
| 271 | // inputs: [ |
| 272 | // { name: "xxx", width: xx }, |
| 273 | // ] |
| 274 | // outputs: [ |
| 275 | // { name: "xxx", width: xx }, |
| 276 | // ] |
| 277 | // inouts: [ |
| 278 | // { name: "xxx", width: xx }, |
| 279 | // ] |
| 280 | } |
| 281 | |
| 282 | // PADS instantiation |
| 283 | // Number of in/outs and the numer of PAD instances doesn't have to be |
| 284 | // same. The number given below excludes clock/reset and other necessary |
| 285 | // PADS but only defines GPIO pads. |
| 286 | padctrl: { |
| 287 | attr_default: ["STRONG"], |
| 288 | pads: [ |
| 289 | { name: "ChA" type: "IO_33V", count: 32 }, // Accessing as ChA[0] .. ChA[31] |
| 290 | { name: "ChB" type: "IO_33V", count: 4, attr: ["KEEP", "WEAK"]}, |
Pirmin Vogel | ea91b30 | 2020-01-14 18:53:01 +0000 | [diff] [blame] | 291 | { name: "ChC" type: "IO_33V", count: 4, attr: ["KEEP", "STRONG"]}, |
Eunchan Kim | 632c6f7 | 2019-09-30 11:11:51 -0700 | [diff] [blame] | 292 | ] |
| 293 | } |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 294 | |
| 295 | } |