blob: 6b4e8133206695d04e785f500e3a0d90cc924e9d [file] [log] [blame]
lowRISC Contributors802543a2019-08-31 12:12:56 +01001// 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 Chen65d74252019-11-08 14:03:35 -080013 { name: "fixed", freq: "100000000" }
Pirmin Vogelea91b302020-01-14 18:53:01 +000014 { name: "usb", freq: "48000000" }
lowRISC Contributors802543a2019-08-31 12:12:56 +010015 ]
16
Timothy Chen3193b002019-10-04 16:56:05 -070017 // Reset attributes
Timothy Chene8cb3bd2020-04-14 16:12:26 -070018 // 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 Chen3193b002019-10-04 16:56:05 -070026 // clk: related clock domain for synchronous release
Timothy Chene8cb3bd2020-04-14 16:12:26 -070027 // If type is "por", there is not related clock, since it is
28 // likely external or generated from a voltage comparator
29 //
Timothy Chen3193b002019-10-04 16:56:05 -070030 resets: [
Timothy Chene8cb3bd2020-04-14 16:12:26 -070031 // 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 Chen3193b002019-10-04 16:56:05 -070039 ]
40
lowRISC Contributors802543a2019-08-31 12:12:56 +010041 // 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 Chen3193b002019-10-04 16:56:05 -070051
Timothy Chen80bd8aa2019-10-04 15:57:11 -070052 // 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 Chen65d74252019-11-08 14:03:35 -080055 clock_connections: {clk_i: "fixed"},
Timothy Chen3193b002019-10-04 16:56:05 -070056
57 // reset connections defines the port to top level reset connection
58 // the ip.hjson will declare the reset port names
Timothy Chen80bd8aa2019-10-04 15:57:11 -070059 // If none are defined at ip.hjson, rst_ni is used by default
Timothy Chen65d74252019-11-08 14:03:35 -080060 reset_connections: {rst_ni: "sys_fixed"},
Timothy Chen80bd8aa2019-10-04 15:57:11 -070061
lowRISC Contributors802543a2019-08-31 12:12:56 +010062 base_addr: "0x40000000",
63 },
64 { name: "gpio",
65 type: "gpio",
Timothy Chen65d74252019-11-08 14:03:35 -080066 clock_connections: {clk_i: "fixed"},
67 reset_connections: {rst_ni: "sys_fixed"},
lowRISC Contributors802543a2019-08-31 12:12:56 +010068 base_addr: "0x40010000",
69 }
70
71 { name: "spi_device",
72 type: "spi_device",
Timothy Chen65d74252019-11-08 14:03:35 -080073 clock_connections: {clk_i: "fixed"},
Timothy Chen3193b002019-10-04 16:56:05 -070074 reset_connections: {rst_ni: "spi_device"},
lowRISC Contributors802543a2019-08-31 12:12:56 +010075 base_addr: "0x40020000",
76 },
77 { name: "flash_ctrl",
78 type: "flash_ctrl",
Timothy Chen80bd8aa2019-10-04 15:57:11 -070079 clock_connections: {clk_i: "main"},
Timothy Chen3193b002019-10-04 16:56:05 -070080 reset_connections: {rst_ni: "lc"},
lowRISC Contributors802543a2019-08-31 12:12:56 +010081 base_addr: "0x40030000",
82 },
83 { name: "rv_timer",
84 type: "rv_timer",
Timothy Chen65d74252019-11-08 14:03:35 -080085 clock_connections: {clk_i: "fixed"},
86 reset_connections: {rst_ni: "sys_fixed"},
lowRISC Contributors802543a2019-08-31 12:12:56 +010087 base_addr: "0x40080000",
88 },
Pirmin Vogeld4534382019-10-17 13:18:31 +010089 { name: "aes",
90 type: "aes",
91 clock_connections: {clk_i: "main"},
92 reset_connections: {rst_ni: "sys"},
93 base_addr: "0x40110000",
94 },
lowRISC Contributors802543a2019-08-31 12:12:56 +010095 { name: "hmac",
96 type: "hmac",
Timothy Chen80bd8aa2019-10-04 15:57:11 -070097 clock_connections: {clk_i: "main"},
Timothy Chen3193b002019-10-04 16:56:05 -070098 reset_connections: {rst_ni: "sys"},
lowRISC Contributors802543a2019-08-31 12:12:56 +010099 base_addr: "0x40120000",
100 },
101 { name: "rv_plic",
102 type: "rv_plic",
Timothy Chen80bd8aa2019-10-04 15:57:11 -0700103 clock_connections: {clk_i: "main"},
Timothy Chen3193b002019-10-04 16:56:05 -0700104 reset_connections: {rst_ni: "sys"},
lowRISC Contributors802543a2019-08-31 12:12:56 +0100105 base_addr: "0x40090000",
106 generated: "true" // Indicate this module is generated in the topgen
lowRISC Contributors802543a2019-08-31 12:12:56 +0100107 }
Eunchan Kim436d2242019-10-29 17:25:51 -0700108 { 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 Schaffner666dde12019-10-25 11:57:54 -0700115 },
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 Kim436d2242019-10-29 17:25:51 -0700135 }
Pirmin Vogelea91b302020-01-14 18:53:01 +0000136 { 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 Contributors802543a2019-08-31 12:12:56 +0100142 ]
143
144 // Memories (ROM, RAM, eFlash) are defined at the top.
145 // It utilizes the primitive cells but configurable
146 memory: [
Timothy Chen80bd8aa2019-10-04 15:57:11 -0700147 { name: "rom",
148 clock_connections: {clk_i: "main"},
149 reset_connections: {rst_ni: "sys"},
150 type: "rom",
151 base_addr: "0x00008000",
Timothy Chenda2e3442020-02-24 21:37:47 -0800152 size: "0x4000"
Timothy Chen80bd8aa2019-10-04 15:57:11 -0700153 },
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 Kime4a85072020-02-05 16:00:00 -0800165 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 Kim40098a92020-04-17 12:22:36 -0700170 act: "rsp",
Eunchan Kime4a85072020-02-05 16:00:00 -0800171 }
172 ],
173 },
lowRISC Contributors802543a2019-08-31 12:12:56 +0100174 ],
175
Eunchan Kime4a85072020-02-05 16:00:00 -0800176 // Inter-module Connection.
177 // format:
178 // requester: [ resp1, resp2, ... ],
179 //
Eunchan Kim40098a92020-04-17 12:22:36 -0700180 // the field and value should be module_inst.port_name
Eunchan Kime4a85072020-02-05 16:00:00 -0800181 // e.g flash_ctrl0.flash: [flash_phy0.flash_ctrl]
182 inter_module: {
Eunchan Kim40098a92020-04-17 12:22:36 -0700183 '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 Kime4a85072020-02-05 16:00:00 -0800194 },
195
lowRISC Contributors802543a2019-08-31 12:12:56 +0100196 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 Chen65d74252019-11-08 14:03:35 -0800203 clock_connections: {clk_main_i: "main", clk_fixed_i: "fixed"},
Timothy Chen3193b002019-10-04 16:56:05 -0700204 reset: "sys",
Timothy Chen65d74252019-11-08 14:03:35 -0800205 reset_connections: {rst_main_ni: "sys", rst_fixed_ni: "sys_fixed"}
lowRISC Contributors802543a2019-08-31 12:12:56 +0100206 },
Eunchan Kim0523f6b2019-12-17 13:53:11 -0800207 { name: "peri",
208 clock_connections: {clk_peri_i: "fixed"},
209 reset: "sys_fixed",
210 reset_connections: {rst_peri_ni: "sys_fixed"},
211 }
lowRISC Contributors802543a2019-08-31 12:12:56 +0100212 ],
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 Schaffner666dde12019-10-25 11:57:54 -0700219 interrupt_module: ["gpio", "uart", "spi_device", "flash_ctrl",
Pirmin Vogelea91b302020-01-14 18:53:01 +0000220 "hmac", "alert_handler", "nmi_gen", "usbdev" ]
lowRISC Contributors802543a2019-08-31 12:12:56 +0100221
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 Schaffner666dde12019-10-25 11:57:54 -0700230 // ===== 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 Contributors802543a2019-08-31 12:12:56 +0100238
239 // TODO: PINMUX
Eunchan Kim632c6f72019-09-30 11:11:51 -0700240 pinmux: {
241
Eunchan Kim436d2242019-10-29 17:25:51 -0700242 // 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 Kim632c6f72019-09-30 11:11:51 -0700248 // 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 Kim436d2242019-10-29 17:25:51 -0700252 //{ name: "uart.tx", pad: ["ChA[0]"]},
253 { name: "uart", pad: ["ChA[0..1]"]},
Eunchan Kim632c6f72019-09-30 11:11:51 -0700254 // { name: "dio_module.signal_input", pad: ["ChA[31]"] }
Pirmin Vogelb054fc02020-03-11 11:23:03 +0100255 { name: "usbdev", pad: ["ChC[0..7]"]},
Eunchan Kim632c6f72019-09-30 11:11:51 -0700256 ],
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 Vogelea91b302020-01-14 18:53:01 +0000291 { name: "ChC" type: "IO_33V", count: 4, attr: ["KEEP", "STRONG"]},
Eunchan Kim632c6f72019-09-30 11:11:51 -0700292 ]
293 }
lowRISC Contributors802543a2019-08-31 12:12:56 +0100294
295}