Skip to content

Commit 0653f78

Browse files
authored
Draft: Add m-mode CLIC interrupt testcases
This is a draft version of the m-mode (Smclic) CLIC interrupt testcases using clint MSW and MTIMER macros. Note, pulls are not yet available for spike or sail that support CLIC but these testcases should help enable their development. This pull requires: riscv-software-src/riscv-config#169, riscv-software-src/riscof#106 riscv-software-src/riscv-isa-sim#1596 To include m-mode CLIC interrupt tests in riscof testlist flow, add Smclic to riscof yaml file, e.g.: spike/spike_isa.yaml: ISA: RV32IMCZicsr_Zifencei_Smclic Signed-off-by: Dan Smathers <dan.smathers@seagate.com>
1 parent 8a52b01 commit 0653f78

File tree

1 file changed

+218
-0
lines changed

1 file changed

+218
-0
lines changed
Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
==== clicnomint-01.S
2+
.Description: expect interrupts will not trigger in m-mode unless mstatus.mie is set
3+
- enable clicintie (default)
4+
- generate interrupt1
5+
- nop
6+
- jump to finish
7+
[%autofit]
8+
----
9+
RVMODEL_MSTATUS_MIE = 0
10+
RVMODEL_SET_INT1 = RVMODEL_SET_MSW_INT
11+
RVMODEL_SET_INT2 = RVMODEL_SET_MTIMER_INT
12+
RVMODEL_CLEAR_INT1 = RVMODEL_CLEAR_MSW_INT
13+
RVMODEL_CLEAR_INT2 = RVMODEL_CLEAR_MTIMER_INT
14+
RVMODEL_WFI = nop
15+
----
16+
Coverage
17+
----
18+
mstatus.mie | verify no interrupt occurs in m-mode if mstatus.mie is 0
19+
----
20+
==== clicnomint-02.S
21+
.Description: expect interrupts will not trigger in m-mode unless clicintie.x is set
22+
- disable clicintie
23+
- generate interrupt1
24+
- enable mstatus.mie
25+
- nop
26+
- jump to finish
27+
[%autofit]
28+
----
29+
RVMODEL_INT1_CLICINTIE = 0
30+
RVMODEL_INT2_CLICINTIE = 0
31+
RVMODEL_SET_INT1 = RVMODEL_SET_MSW_INT
32+
RVMODEL_SET_INT2 = RVMODEL_SET_MTIMER_INT
33+
RVMODEL_CLEAR_INT1 = RVMODEL_CLEAR_MSW_INT
34+
RVMODEL_CLEAR_INT2 = RVMODEL_CLEAR_MTIMER_INT
35+
RVMODEL_WFI = nop
36+
----
37+
Coverage
38+
----
39+
clicintie[msw] | verify no msw interrupt occurs if clicintie[msw] is 0
40+
clicintie[mtimer] | verify no mtimer interrupt occurs if clicintie[mtimer] is 0
41+
----
42+
==== clicnomint-03.S
43+
.Description: expect interrupts will not trigger in m-mode unless clicintctrl.x > mintthresh
44+
- enable clicintie (default)
45+
- generate interrupt1
46+
- enable mstatus.mie
47+
- nop
48+
- jump to finish
49+
[%autofit]
50+
----
51+
RVMODEL_MINTTHRESH = RVMODEL_MINTTHRESH_MAX
52+
RVMODEL_SET_INT1 = RVMODEL_SET_MSW_INT
53+
RVMODEL_SET_INT2 = RVMODEL_SET_MTIMER_INT
54+
RVMODEL_CLEAR_INT1 = RVMODEL_CLEAR_MSW_INT
55+
RVMODEL_CLEAR_INT2 = RVMODEL_CLEAR_MTIMER_INT
56+
RVMODEL_WFI = nop
57+
----
58+
Coverage
59+
----
60+
mintthresh | verify no msw interrupt occurs if mintthresh is max
61+
----
62+
==== clicwfi-01.S
63+
.Description: expect wfi to behave like a nop when a single interrupt is pending when mstatus.mie is disabled
64+
- enable clicintie (default)
65+
- generate interrupt1
66+
- wfi
67+
- wakeup
68+
- jump to finish
69+
[%autofit]
70+
----
71+
RVMODEL_MSTATUS_MIE = 0
72+
RVMODEL_SET_INT1 = RVMODEL_SET_MSW_INT
73+
RVMODEL_SET_INT2 = RVMODEL_SET_MSW_INT
74+
RVMODEL_CLEAR_INT1 = RVMODEL_CLEAR_MSW_INT
75+
RVMODEL_CLEAR_INT2 = RVMODEL_CLEAR_MSW_INT
76+
----
77+
Coverage
78+
----
79+
mstatus.mie | verify no interrupt occurs in m-mode if mstatus.mie is 0
80+
wfi | verify wakeup/nop occurs with mstatus.mie = 0
81+
wfi | verify wakeup/nop occurs with pending interrupt
82+
----
83+
==== clicdirect-01.S
84+
.Description: trigger, clear, no retrigger of same interrupt. Will hang if no interrupt occurs
85+
- enable clicintie (default)
86+
- generate interrupt1
87+
- enable mstatus.mie
88+
- trigger m-mode handler
89+
- clear 1st interrupt
90+
- generate interrupt1 again (ignored)
91+
- set mepc to finish
92+
- mret to finish
93+
[%autofit]
94+
----
95+
RVMODEL_SET_INT1 = RVMODEL_SET_MSW_INT
96+
RVMODEL_SET_INT2 = RVMODEL_SET_MSW_INT
97+
RVMODEL_CLEAR_INT1 = RVMODEL_CLEAR_MSW_INT
98+
RVMODEL_CLEAR_INT2 = RVMODEL_CLEAR_MSW_INT
99+
RVMODEL_MINTTHRESH = RVMODEL_MINTTHRESH_MIN
100+
RVMODEL_WFI = jump_to_self
101+
----
102+
Coverage
103+
----
104+
mtvec.mode | verify direct mode is used to handle interrupt
105+
no msip retrigger | verify after mstatus.mie is enabled in interrupt handler, msip will not retrigger because msip intlevel is not > mintstatus
106+
msip trigger | verify RVMODEL_SET_MSW_INT trigger
107+
msip clear | verify RVMODEL_CLEAR_MSW_INT clear
108+
mcause | verify machine software interrupt signature
109+
mstatus | verify mstatus.mie/mpie/mpp signature in interrupt handler and after mret
110+
mtvec | verify interrupt uses mtvec to calculate pc of interrupt handler (direct)
111+
mepc | verify mepc location is jump_to_self location
112+
----
113+
114+
==== cliclevel-01.S
115+
.Description: verify interrupt level order, 2 interrupts asserted in 1st interrupt handler, min level int followed by max level int
116+
- enable clicintie (default)
117+
- generate interrupt 1
118+
- enable mstatus.mie
119+
- trigger m-mode handler
120+
- generate interrupt 2 (both interrupts now pending)
121+
- if clicintctrl represents levels, mnxti csrrsi updates mcause.id for 2nd interrupt
122+
- if clicintctrl represents priority, no 2nd interrupt occurs.
123+
- set mepc to finish
124+
- clear mstatus.mpie
125+
- mret to finish
126+
[%autofit]
127+
----
128+
RVMODEL_SET_INT1 = RVMODEL_SET_MSW_INT
129+
RVMODEL_SET_INT2 = RVMODEL_SET_MTIMER_INT
130+
RVMODEL_CLEAR_INT1 = <EMPTY>
131+
RVMODEL_CLEAR_INT2 = RVMODEL_CLEAR_MTIMER_INT
132+
RVMODEL_INT1_CLICINTCTL = RVMODEL_CLICINTCTL_MIN
133+
RVMODEL_INT2_CLICINTCTL = RVMODEL_CLICINTCTL_MAX
134+
----
135+
Coverage
136+
----
137+
Interrupt ordering - both interrupts asserted in first interrupt handler
138+
----
139+
140+
==== cliclevel-02.S
141+
.Description: verify interrupt level order, 2 interrupts asserted in 1st interrupt handler, min level int followed by max level int
142+
- enable clicintie (default)
143+
- generate interrupt 1
144+
- enable mstatus.mie
145+
- trigger m-mode handler
146+
- generate interrupt 2 (both interrupts now pending)
147+
- if clicintctrl represents levels, trigger 2nd m-mode handler
148+
- if clicintctrl represents priority, no 2nd interrupt occurs.
149+
- set mepc to finish
150+
- clear mstatus.mpie
151+
- mret to finish
152+
[%autofit]
153+
----
154+
RVMODEL_SET_INT1 = RVMODEL_SET_MSW_INT
155+
RVMODEL_SET_INT2 = RVMODEL_SET_MTIMER_INT
156+
RVMODEL_CLEAR_INT1 = <EMPTY>
157+
RVMODEL_CLEAR_INT2 = RVMODEL_CLEAR_MTIMER_INT
158+
RVMODEL_INT1_CLICINTCTL = RVMODEL_CLICINTCTL_MIN
159+
RVMODEL_INT2_CLICINTCTL = RVMODEL_CLICINTCTL_MAX
160+
RVMODEL_MNXTI_SIMMED = 0
161+
----
162+
Coverage
163+
----
164+
Interrupt ordering - both interrupts asserted in first interrupt handler
165+
----
166+
167+
==== cliclevel-03.S
168+
.Description: verify interrupt level order, 2 interrupts asserted in 1st interrupt handler, max level int followed by min level int
169+
- enable clicintie (default)
170+
- generate interrupt 1
171+
- enable mstatus.mie
172+
- trigger m-mode handler
173+
- generate interrupt 2 (both interrupts now pending)
174+
- if clicintctrl represents levels, 2nd interrupt is lower than current interupt level, no 2nd interrupt occurs.
175+
- if clicintctrl represents priority, 2nd interrupt is same level, no 2nd interrupt occurs.
176+
- set mepc to finish
177+
- clear mstatus.mpie
178+
- mret to finish
179+
[%autofit]
180+
----
181+
RVMODEL_SET_INT1 = RVMODEL_SET_MSW_INT
182+
RVMODEL_SET_INT2 = RVMODEL_SET_MTIMER_INT
183+
RVMODEL_CLEAR_INT1 = <EMPTY>
184+
RVMODEL_CLEAR_INT2 = RVMODEL_CLEAR_MTIMER_INT
185+
RVMODEL_INT1_CLICINTCTL = RVMODEL_CLICINTCTL_MAX
186+
RVMODEL_INT2_CLICINTCTL = RVMODEL_CLICINTCTL_MIN
187+
----
188+
Coverage
189+
----
190+
Interrupt ordering - both interrupts asserted in first interrupt handler
191+
----
192+
193+
==== cliclevel-04.S
194+
.Description: verify interrupt level order, 2 interrupts asserted in 1st interrupt handler, min level int followed by max level int with max mintthresh setting.
195+
- enable clicintie (default)
196+
- generate interrupt 1
197+
- enable mstatus.mie
198+
- trigger m-mode handler
199+
- generate interrupt 2 (both interrupts now pending)
200+
- if clicintctrl represents levels, 2nd interrupt is higher than current interupt level but equal to mintthresh, no 2nd interrupt occurs.
201+
- if clicintctrl represents priority, 2nd interrupt is same level, no 2nd interrupt occurs.
202+
- set mepc to finish
203+
- clear mstatus.mpie
204+
- mret to finish
205+
[%autofit]
206+
----
207+
RVMODEL_SET_INT1 = RVMODEL_SET_MSW_INT
208+
RVMODEL_SET_INT2 = RVMODEL_SET_MTIMER_INT
209+
RVMODEL_CLEAR_INT1 = <EMPTY>
210+
RVMODEL_CLEAR_INT2 = RVMODEL_CLEAR_MTIMER_INT
211+
RVMODEL_INT1_CLICINTCTL = RVMODEL_CLICINTCTL_MIN
212+
RVMODEL_INT2_CLICINTCTL = RVMODEL_CLICINTCTL_MAX
213+
RVMODEL_MINTTHRESH_HNDLR1 = RVMODEL_MINTTHRESH_MAX
214+
----
215+
Coverage
216+
----
217+
Interrupt ordering - both interrupts asserted in first interrupt handler
218+
----

0 commit comments

Comments
 (0)