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