Skip to content

Commit e104cdd

Browse files
committed
[SystemRDL] Create a sonata top level description
Signed-off-by: Douglas Reis <doreis@lowrisc.org>
1 parent 380849c commit e104cdd

17 files changed

Lines changed: 5109 additions & 3 deletions

File tree

data/sonata_udp.rdl

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
6+
/* Indicates what the signal is used for.
7+
*/
8+
enum SigType {
9+
None;
10+
PadInOut; // Signal is a pad for In and Out. i.e: i2c.sda.
11+
PadInput; // Signal is a pad for Input. i.e: uart.rx
12+
PadOutput; // Signal is a pad for Output. i.e: uart.tx
13+
Interrupt;// Signal is an Interrupt
14+
};
15+
16+
/* Indicates what the signal will be used for.
17+
*/
18+
property sigtype {
19+
type = SigType;
20+
component = signal;
21+
default = SigType::None;
22+
};
23+
24+
enum IoCombine {
25+
None;
26+
Mux;
27+
And;
28+
Or;
29+
};
30+
31+
/*
32+
*/
33+
property io_combine {
34+
type = IoCombine;
35+
component = signal;
36+
default = IoCombine::None;
37+
};
38+
39+
struct parameter {
40+
string type_;
41+
string name;
42+
string value;
43+
};
44+
45+
property xbar {
46+
type = parameter[];
47+
component = addrmap|mem;
48+
default = '{};
49+
};
50+

data/top.rdl

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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+
6+
`include "udp.rdl"
7+
`include "sonata_udp.rdl"
8+
`include "../rtl/ip/system_info/data/system_info.rdl"
9+
`include "../rtl/ip/spi/data/spi.rdl"
10+
`include "../rtl/ip/rgbled_ctrl/data/rgbled_ctrl.rdl"
11+
`include "../rtl/ip/pwm/data/pwm.rdl"
12+
`include "../rtl/ip/gpio/data/gpio.rdl"
13+
`include "../rtl/ip/usbdev/data/usbdev.rdl"
14+
`include "../rtl/ip/i2c/data/i2c.rdl"
15+
`include "../rtl/ip/uart/data/uart.rdl"
16+
`include "../rtl/ip/xadc/data/xadc.rdl"
17+
`include "../rtl/ip/rev_ctl/data/rev_ctl.rdl"
18+
`include "../rtl/system/data/rv_plic.rdl"
19+
`include "../rtl/system/data/pinmux.rdl"
20+
`include "../rtl/system/data/rv_timer.rdl"
21+
22+
addrmap top_sonata {
23+
external mem sram {
24+
mementries = 0x20000; memwidth=8;
25+
clk_input = '{ "clk_sys_i" };
26+
rst_input = '{ "rst_sys_ni" };
27+
} SRAM @ 0x00100000;
28+
29+
external mem hyperram {
30+
mementries = 0x100000; memwidth=8;
31+
clk_input = '{ "clk_sys_i" };
32+
rst_input = '{ "rst_sys_ni" };
33+
} HYPERRAM @ 0x40000000;
34+
35+
external mem rev_tag {
36+
mementries = 0x800; memwidth=8;
37+
clk_input = '{ "clk_sys_i" };
38+
rst_input = '{ "rst_sys_ni" };
39+
} REV_TAG @ 0x30000000;
40+
41+
gpio GPIO[6] @ 0x80000000 += 0x40;
42+
43+
pwm PWM[1] @ 0x80001000 += 0x1000;
44+
45+
pinmux PINMUX @ 0x80005000;
46+
47+
rgbled_ctrl RGBLED_CTRL @ 0x80009000;
48+
49+
rev_ctl HW_REV @ 0x8000A000;
50+
51+
xadc XADC @ 0x8000B000;
52+
53+
system_info SYSTEM_INFO @ 0x8000C000;
54+
55+
rv_timer TIMER @ 0x80040000;
56+
57+
uart uart[3] @ 0x80100000 += 0x1000;
58+
59+
i2c I2C[2] @ 0x80200000 += 0x1000;
60+
61+
spi SPI_LCD @ 0x80300000;
62+
63+
spi SPI_ETHMAC @ 0x80301000;
64+
65+
spi SPI[3] @ 0x80302000 += 0x1000;
66+
67+
usbdev USBDEV @ 0x80400000;
68+
69+
// This block is overaligned to 0x0800_0000 bytes since OpenTitan RV_PLIC block expects it.
70+
rv_plic RV_PLIC @ 0x88000000;
71+
72+
external mem dgb_dev {
73+
mementries = 0x1000; memwidth=8;
74+
xbar = '{ parameter'{ type_: "bool", name: "pipeline", value: "true" }};
75+
clk_input = '{ "clk_sys_i" };
76+
rst_input = '{ "rst_sys_ni" };
77+
} DBG_DEV @ 0xB0000000;
78+
};
79+

data/udp.rdl

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
/* Copyright lowRISC contributors (OpenTitan project).
2+
* Licensed under the Apache License, Version 2.0; see LICENSE for details.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/**
7+
* 4-bits boolean values
8+
*/
9+
enum MultiBitBool4 {
10+
True = 0x6;
11+
False = 0x9;
12+
};
13+
14+
/**
15+
* 8-bits boolean values
16+
*/
17+
enum MultiBitBool8 {
18+
True = 0x96;
19+
False = 0x69;
20+
};
21+
22+
/**
23+
* 12-bits boolean values
24+
*/
25+
enum MultiBitBool12 {
26+
True = 0x696;
27+
False = 0x969;
28+
};
29+
30+
/**
31+
* 16-bits boolean values
32+
*/
33+
enum MultiBitBool16 {
34+
True = 0x9696;
35+
False = 0x6969;
36+
};
37+
38+
/**
39+
* 20-bits boolean values
40+
*/
41+
enum MultiBitBool20 {
42+
True = 0x69696;
43+
False = 0x96969;
44+
};
45+
46+
/**
47+
* 24-bits boolean values
48+
*/
49+
enum MultiBitBool24 {
50+
True = 0x969696;
51+
False = 0x696969;
52+
};
53+
54+
/**
55+
* 28-bits boolean values
56+
*/
57+
enum MultiBitBool28 {
58+
True = 0x6969696;
59+
False = 0x9696969;
60+
};
61+
62+
/**
63+
* 32-bits boolean values
64+
*/
65+
enum MultiBitBool32 {
66+
True = 0x96969696;
67+
False = 0x69696969;
68+
};
69+
70+
/**
71+
* true if hardware uses `re` signal, which is latched signal of software read pulse.
72+
* The standard SystemRDL property `swacc` cannot be used here because `swacc = hwre | swmod`.
73+
*/
74+
property hwre {
75+
type = boolean;
76+
component = reg;
77+
default = false;
78+
};
79+
80+
/* If it is true, the register will be implemented using the prim_subreg_shadow module.
81+
* Shadow registers are a mechanism to guard sensitive registers against this specific
82+
* type of attack. They come at a cost of increased area, and a modified SW interaction.
83+
*/
84+
property shadowed {
85+
type = boolean;
86+
component = reg;
87+
default = false;
88+
};
89+
90+
/* Indicates the register must cross to a different clock domain before use.
91+
* The value shown here should correspond to one of the module’s clocks.
92+
*/
93+
property async_clk {
94+
type = boolean;
95+
component = reg;
96+
default = false;
97+
};
98+
99+
property clk_input {
100+
type = string[];
101+
component = addrmap|regfile|reg|mem;
102+
default = '{};
103+
};
104+
105+
/* If true, integrity bits are passed through directly from the memory.
106+
*/
107+
property integrity_bypass {
108+
type = boolean;
109+
component = mem;
110+
default = false;
111+
};
112+
113+
property rst_input {
114+
type = string[];
115+
component = addrmap|regfile|reg|mem;
116+
default = '{};
117+
};
118+
119+

rtl/ip/gpio/data/gpio.rdl

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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+
6+
addrmap gpio #(
7+
longint num_pads = 32
8+
){
9+
10+
xbar = '{
11+
parameter'{ type_: "bool", name: "pipeline", value: "true" },
12+
parameter'{ type_: "bool", name: "req_fifo_pass", value: "false" },
13+
parameter'{ type_: "bool", name: "rsp_fifo_pass", value: "false" }
14+
};
15+
clk_input = '{ "clk_sys_i" };
16+
rst_input = '{ "rst_sys_ni" };
17+
18+
// Ios pads.
19+
signal {sigtype=SigType::PadInOut; io_combine=IoCombine::Mux; } ios[num_pads];
20+
// signal {sigtype=SigType::PadInOut; io_combine=IoCombine::Mux; } ios_rpi[32];
21+
// signal {sigtype=SigType::PadInOut; io_combine=IoCombine::Mux; } ios_arduino[32];
22+
// signal {sigtype=SigType::PadInOut; io_combine=IoCombine::Mux; } ios_pmod0[32];
23+
// signal {sigtype=SigType::PadInOut; io_combine=IoCombine::Mux; } ios_pmod1[32];
24+
// signal {sigtype=SigType::PadInOut; io_combine=IoCombine::Mux; } ios_pmodc[32];
25+
26+
addrmap gpio_spec_t {
27+
reg {
28+
field {
29+
sw=w;
30+
reset = 0;
31+
desc = "Pins.";
32+
} PINS[32] = 0;
33+
} OUT @0x0000;
34+
35+
reg {
36+
field {
37+
sw=r;
38+
reset = 0;
39+
desc = "Pins.";
40+
} PINS[32] = 0;
41+
} IN @0x0004;
42+
43+
reg {
44+
field {
45+
sw=r;
46+
reset = 0;
47+
desc = "DBNC.";
48+
} PINS[32] = 0;
49+
} IN_DBNC @0x0008;
50+
51+
reg {
52+
field {
53+
sw=rw;
54+
reset = 0;
55+
desc = "val";
56+
} PINS[32] = 0;
57+
} OUTPUT_ENABLE @0x000c;
58+
};
59+
60+
gpio_spec_t gpio;
61+
// gpio_spec_t gpio_rpi;
62+
// gpio_spec_t gpio_arduino;
63+
// gpio_spec_t gpio_pmod[2];
64+
// gpio_spec_t gpio_pmodc;
65+
};

0 commit comments

Comments
 (0)