Skip to content

Commit 31c0161

Browse files
committed
[rtl, gpio] Refactor the gpio instance declaration
The gpio was as declared in some places as having a single instance, but in other places it had 6 instances, but in the xbar it only had one instance. This commit makes it consistent. Signed-off-by: Douglas Reis <doreis@lowrisc.org>
1 parent fb71040 commit 31c0161

14 files changed

Lines changed: 486 additions & 343 deletions

data/top_config.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[[blocks]]
22
name = "gpio"
3-
instances = 5 # RPi, Ard, Pmod0, Pmod1, PmodC
3+
instances = 6 # RPi, Ard, Pmod0, Pmod1, PmodC
44
ios = [
55
{
66
name = "ios",
@@ -9,8 +9,9 @@ ios = [
99
length = 32
1010
},
1111
]
12-
memory_start = 0x80000040
12+
memory_start = 0x80000000
1313
memory_size = 0x00000040
14+
xbar = { pipeline = "true"}
1415

1516
[[blocks]]
1617
name = "pwm"

data/xbar_main.hjson

Lines changed: 73 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
size_byte: "0x00000800",
6262
}],
6363
},
64-
{ name: "gpio", // General purpose input and output
64+
{ name: "gpio0",
6565
type: "device",
6666
clock: "clk_sys_i",
6767
reset: "rst_sys_ni",
@@ -70,7 +70,72 @@
7070
xbar: false,
7171
addr_range: [{
7272
base_addr: "0x80000000",
73-
size_byte: "0x00001000",
73+
size_byte: "0x40",
74+
}],
75+
pipeline: true,
76+
},
77+
{ name: "gpio1",
78+
type: "device",
79+
clock: "clk_sys_i",
80+
reset: "rst_sys_ni",
81+
req_fifo_pass: false,
82+
rsp_fifo_pass: false,
83+
xbar: false,
84+
addr_range: [{
85+
base_addr: "0x80000040",
86+
size_byte: "0x40",
87+
}],
88+
pipeline: true,
89+
},
90+
{ name: "gpio2",
91+
type: "device",
92+
clock: "clk_sys_i",
93+
reset: "rst_sys_ni",
94+
req_fifo_pass: false,
95+
rsp_fifo_pass: false,
96+
xbar: false,
97+
addr_range: [{
98+
base_addr: "0x80000080",
99+
size_byte: "0x40",
100+
}],
101+
pipeline: true,
102+
},
103+
{ name: "gpio3",
104+
type: "device",
105+
clock: "clk_sys_i",
106+
reset: "rst_sys_ni",
107+
req_fifo_pass: false,
108+
rsp_fifo_pass: false,
109+
xbar: false,
110+
addr_range: [{
111+
base_addr: "0x800000c0",
112+
size_byte: "0x40",
113+
}],
114+
pipeline: true,
115+
},
116+
{ name: "gpio4",
117+
type: "device",
118+
clock: "clk_sys_i",
119+
reset: "rst_sys_ni",
120+
req_fifo_pass: false,
121+
rsp_fifo_pass: false,
122+
xbar: false,
123+
addr_range: [{
124+
base_addr: "0x80000100",
125+
size_byte: "0x40",
126+
}],
127+
pipeline: true,
128+
},
129+
{ name: "gpio5",
130+
type: "device",
131+
clock: "clk_sys_i",
132+
reset: "rst_sys_ni",
133+
req_fifo_pass: false,
134+
rsp_fifo_pass: false,
135+
xbar: false,
136+
addr_range: [{
137+
base_addr: "0x80000140",
138+
size_byte: "0x40",
74139
}],
75140
pipeline: true,
76141
},
@@ -313,7 +378,6 @@
313378
"hyperram",
314379
"rev_tag",
315380
"dbg_dev",
316-
"gpio",
317381
"pinmux",
318382
"system_info",
319383
"rgbled_ctrl",
@@ -322,6 +386,12 @@
322386
"timer",
323387
"spi_lcd",
324388
"spi_ethmac",
389+
"gpio0",
390+
"gpio1",
391+
"gpio2",
392+
"gpio3",
393+
"gpio4",
394+
"gpio5",
325395
"pwm0",
326396
"uart0",
327397
"uart1",

data/xbar_main.hjson.tpl

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,27 @@
6161
size_byte: "0x00000800",
6262
}],
6363
},
64-
{ name: "gpio", // General purpose input and output
64+
% for block in config.blocks:
65+
% if block.name == "gpio":
66+
% for i in range(block.instances):
67+
{ name: "${f"{block.name}{i}"}",
6568
type: "device",
6669
clock: "clk_sys_i",
6770
reset: "rst_sys_ni",
6871
req_fifo_pass: false,
6972
rsp_fifo_pass: false,
7073
xbar: false,
7174
addr_range: [{
72-
base_addr: "0x80000000",
73-
size_byte: "0x00001000",
75+
base_addr: "${hex(block.memory_start + i * block.memory_size)}",
76+
size_byte: "${hex(block.memory_size)}",
7477
}],
75-
pipeline: true,
78+
% for (setting, value) in block.xbar.items():
79+
${setting}: ${value},
80+
% endfor
7681
},
82+
% endfor
83+
% endif
84+
% endfor
7785
{ name: "pinmux", // Pin multiplexer
7886
type: "device",
7987
clock: "clk_sys_i",
@@ -224,7 +232,6 @@
224232
"hyperram",
225233
"rev_tag",
226234
"dbg_dev",
227-
"gpio",
228235
"pinmux",
229236
"system_info",
230237
"rgbled_ctrl",
@@ -234,11 +241,9 @@
234241
"spi_lcd",
235242
"spi_ethmac",
236243
% for block in config.blocks:
237-
% if not block.name == "gpio":
238244
% for i in range(block.instances):
239245
"${f"{block.name}{i}"}",
240246
% endfor
241-
% endif
242247
% endfor
243248
"usbdev",
244249
"rv_plic",

rtl/bus/sonata_xbar_main.sv

Lines changed: 14 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rtl/bus/tl_main_pkg.sv

Lines changed: 39 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)