-
Notifications
You must be signed in to change notification settings - Fork 232
[ACT] ACTs and coverage points for machine mode software and timer interrupts #567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, equations with constants (e.g. mip>>3 & 0x1!= 0x1) are not satisfactory. What would be satisfactory would be ((mip & MIP_MSIP)==0), where MIP_MSIP is #defined - and you don't even have to define it yourself because it is already defined in encoding.h which is #included. Note that this applies of almost CSR fields . The comments are quite appreciated, on the other hand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost all tests need to initialize MIP.MSIP/MTIP before doing anything else.
The MAX_VALE should be renamed TEST_VALUE, since it isn't a max value at all.
I think you could combine a lot of the 32 and 64b tests, except for the cases that need to write all 64bits of MTIME and MTiMECMP (which I would do with a macro to and read them differently depending on XLEN)
riscv-test-suite/rv32i_m/m_interrupts_32/src/CHK-M-INTR-PRIORITY.S
Outdated
Show resolved
Hide resolved
riscv-test-suite/rv32i_m/m_interrupts_32/src/CHK-M-INTR-PRIORITY.S
Outdated
Show resolved
Hide resolved
riscv-test-suite/rv32i_m/m_interrupts_32/src/CHK-M-INTR-PRIORITY.S
Outdated
Show resolved
Hide resolved
riscv-test-suite/rv32i_m/m_interrupts_32/src/CHK-MSIP-FUNCTIONALITY.S
Outdated
Show resolved
Hide resolved
riscv-test-suite/rv32i_m/m_interrupts_32/src/CHK-MTIME-LENGTH.S
Outdated
Show resolved
Hide resolved
riscv-test-suite/rv32i_m/m_interrupts_32/src/CHK-MTIP-FUNCTIONALITY.S
Outdated
Show resolved
Hide resolved
…ftware and timer interrupts
…test.h to mitigate the issue of spurious interrupt
e9d4d12
to
6a00d29
Compare
riscv-test-suite/rv32i_m/m_interrupts_32/src/CHK-M-SOFTWARE-INTR.S
Outdated
Show resolved
Hide resolved
d1bcf98
to
d4efbfb
Compare
70d8faf
to
6a00d29
Compare
…P into vector signature Signed-off-by: Umer Shahid <[email protected]>
Signed-off-by: Umer Shahid <[email protected]>
…tart of the test Signed-off-by: Umer Shahid <[email protected]>
…ncoding file compatibility
Signed-off-by: Umer Shahid <[email protected]>
Signed-off-by: Umer Shahid <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All requested changes have been done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the first batch of overall changes that are needed. I'll come back and do another review when these are fixed (I haven't made it all the way through yet.
riscv-test-suite/env/arch_test.h
Outdated
sv_\__MODE__\()ip: // note: clear has no effect on MxIP | ||
SREG T4, 2*REGWIDTH(T1) // save 3rd sig value, (xip) | ||
csrrc T2, CSR_MIDELEG, x0 // read machine interrupt delegation | ||
nop // if mideleg is not used and trap occur |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to document the reason for this. This is setting up the trap handler to take an exception whenever it interrupts into Smode (because it can't read the mideleg CSR that caused it to go to Smode?)
The problem here is that the trap signature for an illegal instruction won't store mideleg - so the test can never tell whether mideleg was set or not. It would be best to have the test (not the trap handler) explicitly store mideleg whenever it changes it, and avoid the extra trap.
riscv-test-suite/env/arch_test.h
Outdated
srl T4, T4, T2 // move xIE to LSB | ||
andi T4, T4, 0b10001 // mask xIE and xPIE | ||
SREG T4, 2*REGWIDTH(T1) // save 3rd sig value, (xstatus.XIE and xstatus.XPIE) | ||
nop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there a nop here? This shouldn't ever trap. Also: you're storing individual bits from Xstatus, XIE, and XIP; you should collect the 3 bits and store them in the first signature entry, (label sv__MODE_()vect, the first word of the signature entry; there are lots of free bits in that entry. This avoids changing the size of the interrupt trap signature entry. That size is pre-calculated, is used to update the trap signature pointer, and is stored in this entry. Changing the size introduces a bug because the pointer is pre-incremented with it, and the next trap will overwrite the extra word of this entry.
riscv-test-suite/rv32i_m/m_interrupts_32/src/CHK-M-INTR-PRIORITY.S
Outdated
Show resolved
Hide resolved
riscv-test-suite/rv32i_m/m_interrupts_32/src/CHK-M-INTR-PRIORITY.S
Outdated
Show resolved
Hide resolved
riscv-test-suite/rv32i_m/m_interrupts_32/src/CHK-M-SOFTWARE-INTR.S
Outdated
Show resolved
Hide resolved
val_comb: | ||
# Verify MSIP set and clear mechanisms | ||
'(call_type != "interrupt") and ((mstatus & ${MSTATUS_MIE}) == 0) and ((mip & ${MIP_MSIP}) == ${MIP_MSIP})' : 0 # Checks software interrupt pending mechanism when writing 1 to memory-mapped MSIP control register without immediate interrupt service. | ||
'(call_type != "interrupt") and ((mstatus & ${MSTATUS_MIE}) == 0) and ((mip & ${MIP_MSIP}) == 0)' : 0 # Validates software interrupt clearing mechanism when writing 0 to memory-mapped MSIP control register. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one will get hit right out of reset. This needs to be conditioned on the old value of MIP_MSIP
val_comb: | ||
# Verify MTIP set and clear mechanisms | ||
'(call_type != "interrupt") and ((mstatus & ${MSTATUS_MIE}) == 0) and ((mip & ${MIP_MTIP}) == ${MIP_MTIP})' : 0 # Verifies Machine Timer Interrupt Pending (MTIP) bit setting mechanism during non-interrupt execution. | ||
'(call_type != "interrupt") and ((mstatus & ${MSTATUS_MIE}) == 0) and ((mip & ${MIP_MTIP}) == 0)' : 0 # Checks MTIP bit clearing mechanism when no interrupt is being processed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will generate false positives unless you can check for edges rather than levels, i.e. mip=MTIP and old_mip!=MTIP
csrrc: 0 | ||
sw : 0 | ||
val_comb: | ||
'(call_type != "interrupt") and ((mstatus & ${MSTATUS_MIE}) == 0) and ((mie & ${MIE_MSIE}) == ${MIE_MSIE}) and ((mip & ${MIP_MSIP}) == ${MIP_MSIP})' : 0 # Confirms that no software interrupt is taken when global machine interrupt is disabled, despite local interrupt enable being active. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anytime you are checking for call_type != "interrupt" you'll get false positives; but edge checking in all of them.
mret : 0 | ||
val_comb: | ||
# Validate software interrupt handling | ||
'(call_type == "interrupt") and ((mstatus & ${MSTATUS_MPP}) == ${MSTATUS_MPP_M}) and ((mstatus & ${MSTATUS_MPIE}) == ${MSTATUS_MPIE}) and ((mstatus & ${MSTATUS_MIE}) == 0) and ((mcause & ${INTERRUPT_MASK}) == ${CAUSE_M_SOFT_INTR}) and ((mie & ${MIE_MSIE}) == ${MIE_MSIE}) and ((mip & ${MIP_MSIP}) == ${MIP_MSIP})': 0 # Validates software interrupt processing when global machine interrupt is enabled, verifying all required interrupt conditions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this testing only trapping from Mmode? Don't we also want to test from Umode and Smode? Pretty tricky because you wo't necessarily have access to Mmode registers.
@@ -52,13 +56,32 @@ RVMODEL_DATA_SECTION ;\ | |||
//RVTEST_IO_ASSERT_DFPR_EQ | |||
#define RVMODEL_IO_ASSERT_DFPR_EQ(_D, _R, _I) | |||
|
|||
#define RVMODEL_SET_MSW_INT | |||
#define RVMODEL_SET_MSW_INT ;\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RVMODEL_Set/Clr_M/H/Sxxx_INT macros need to be redefined so that the aren't placed inline, but are called as simple subroutines with a JAL, and return to the test with a JR. The should be instantiated (not defined) in model_test.h as they are #defined, but with the name as a label at the start (instead of #define), and a JR at the end with a fixed link register (that tests will have to accomodate).
Description
This pull request introduces tests and covergroups to verify machine mode software and timer interrupts. The tests and covergroups were developed following the guidelines outlined in the Test Plan
Related Issues
This pull request relies on the changes in the following PRs for full functionality and compatibility:
Ratified/Unratified Extensions
List Extensions
N/A
Reference Model Used
DUT Model Used
Mandatory Checklist:
Optional Checklist: