Skip to content

Commit 9173e84

Browse files
ziuziakowskamarnovandermaas
authored andcommitted
hw: correct PLIC context interrupt enable stride
See lowRISC/opentitan#30371. Signed-off-by: Alice Ziuziakowska <a.ziuziakowska@lowrisc.org>
1 parent 99206f4 commit 9173e84

7 files changed

Lines changed: 22 additions & 9 deletions

File tree

hw/top_chip/ip_autogen/rv_plic/data/rv_plic.hjson

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
],
158158
}
159159
}
160-
{ skipto: "0x2100" }
160+
{ skipto: "0x2080" }
161161
{ multireg: {
162162
name: "IE1",
163163
desc: "Interrupt Enable for Target 1",

hw/top_chip/ip_autogen/rv_plic/rtl/rv_plic_reg_pkg.sv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ package rv_plic_reg_pkg;
141141
parameter logic [BlockAw-1:0] RV_PLIC_PRIO_31_OFFSET = 27'h 7c;
142142
parameter logic [BlockAw-1:0] RV_PLIC_IP_OFFSET = 27'h 1000;
143143
parameter logic [BlockAw-1:0] RV_PLIC_IE0_OFFSET = 27'h 2000;
144-
parameter logic [BlockAw-1:0] RV_PLIC_IE1_OFFSET = 27'h 2100;
144+
parameter logic [BlockAw-1:0] RV_PLIC_IE1_OFFSET = 27'h 2080;
145145
parameter logic [BlockAw-1:0] RV_PLIC_THRESHOLD0_OFFSET = 27'h 200000;
146146
parameter logic [BlockAw-1:0] RV_PLIC_CC0_OFFSET = 27'h 200004;
147147
parameter logic [BlockAw-1:0] RV_PLIC_THRESHOLD1_OFFSET = 27'h 201000;

hw/vendor/lowrisc_ip.vendor.hjson

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
{from: "hw/ip_templates/gpio", to: "ip_templates/gpio", patch_dir: "gpio"}, // General purpose I/O
4747
{from: "hw/ip_templates/pwrmgr", to: "ip_templates/pwrmgr", patch_dir: "pwrmgr"},
4848
{from: "hw/ip_templates/rstmgr", to: "ip_templates/rstmgr", patch_dir: "rstmgr"},
49-
{from: "hw/ip_templates/rv_plic", to: "ip_templates/rv_plic"},
49+
{from: "hw/ip_templates/rv_plic", to: "ip_templates/rv_plic", patch_dir: "rv_plic"},
5050

5151
// Primitives.
5252
{from: "hw/ip/prim", to: "ip/prim", patch_dir: "prim"},

hw/vendor/lowrisc_ip/ip_templates/rv_plic/data/rv_plic.hjson.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179
}
180180
},
181181
% for i in range(target):
182-
{ skipto: "${"0x{:x}".format(0x00002000 + i * 0x100)}" }
182+
{ skipto: "${"0x{:x}".format(0x00002000 + i * 0x80)}" }
183183
{ multireg: {
184184
name: "IE${i}",
185185
desc: "Interrupt Enable for Target ${i}",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/data/rv_plic.hjson.tpl b/data/rv_plic.hjson.tpl
2+
index 68936643..b5d79762 100644
3+
--- a/data/rv_plic.hjson.tpl
4+
+++ b/data/rv_plic.hjson.tpl
5+
@@ -179,7 +179,7 @@
6+
}
7+
},
8+
% for i in range(target):
9+
- { skipto: "${"0x{:x}".format(0x00002000 + i * 0x100)}" }
10+
+ { skipto: "${"0x{:x}".format(0x00002000 + i * 0x80)}" }
11+
{ multireg: {
12+
name: "IE${i}",
13+
desc: "Interrupt Enable for Target ${i}",

rdl/ip/plic.rdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,6 @@ addrmap rv_plic #(
724724
reset = 0x0;
725725
desc = "Interrupt Enable of Source";
726726
} E_31[31:31];
727-
} IE1[1] @ 0x2100;
727+
} IE1[1] @ 0x2080;
728728

729729
};

sw/device/lib/hal/autogen/plic.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ typedef volatile struct [[gnu::aligned(4)]] plic_memory_layout {
6262
/* plic.ie0 (0x2000) */
6363
uint32_t ie0;
6464

65-
const uint8_t __reserved2[0x2100 - 0x2004];
65+
const uint8_t __reserved2[0x2080 - 0x2004];
6666

67-
/* plic.ie1 (0x2100) */
67+
/* plic.ie1 (0x2080) */
6868
uint32_t ie1;
6969

70-
const uint8_t __reserved3[0x200000 - 0x2104];
70+
const uint8_t __reserved3[0x200000 - 0x2084];
7171

7272
/* plic.threshold0 (0x200000) */
7373
plic_threshold0 threshold0;
@@ -103,7 +103,7 @@ _Static_assert(__builtin_offsetof(struct plic_memory_layout, ip) == 0x1000ul,
103103
"incorrect register ip offset");
104104
_Static_assert(__builtin_offsetof(struct plic_memory_layout, ie0) == 0x2000ul,
105105
"incorrect register ie0 offset");
106-
_Static_assert(__builtin_offsetof(struct plic_memory_layout, ie1) == 0x2100ul,
106+
_Static_assert(__builtin_offsetof(struct plic_memory_layout, ie1) == 0x2080ul,
107107
"incorrect register ie1 offset");
108108
_Static_assert(__builtin_offsetof(struct plic_memory_layout, threshold0) == 0x200000ul,
109109
"incorrect register threshold0 offset");

0 commit comments

Comments
 (0)