riscv-tests icon indicating copy to clipboard operation
riscv-tests copied to clipboard

TriggerDmode case fail,when accessing 8-9 trigger

Open zhajio1988 opened this issue 2 years ago • 2 comments

our riscv core vendor specify that tselect.index 0-7 can only be mcontrol, 8-9 can only be one of icount/ietrigger. TriggerDmode case trigger.S traverses the index from 0-9, and the type selected is 2, at this time, icount and itrigger, etrigger can only be accessed when the type is equal to 3,4,5, which leads to an error at tselect.index 8. How to deal with the situation? Shouldn't we read the value of tinfo when we write tselect and then decide the value of a0? li a0, (2<<60) | (2<<28) | (1<<6) | (1<<1)

zhajio1988 avatar Apr 22 '24 08:04 zhajio1988

icount and itrigger, etrigger can only be accessed when the type is equal to 3,4,5, which leads to an error at tselect.index 8.

Do you mean writing tdata1 with tdata1.type == 2 while tselect is 8 causes an illegal instruction exception on your HW? This behavior is prohibited by the spec, namely [Chapter 5. Sdtrig (ISA Extension)] (The RISC-V Debug Specification, Version 1.0.0-rc3):

M-Mode and Debug Mode accesses to trigger CSRs that are used by any of the implemented triggers must succeed, regardless of the current type of the currently selected trigger.

However, the implementation of write_store_trigger has some flaws, e.g. write_triggers should disable the trigger by writing tdata1 = 0 before writing tdata2 (see [5.7. Trigger Module Registers]). https://github.com/riscv-software-src/riscv-tests/blob/b0eb63a6cb11842c6aeeb7f92340d09728c35caa/debug/programs/trigger.S#L66-L78

en-sc avatar Jul 01 '24 15:07 en-sc

@en-sc Do you mean writing tdata1 with tdata1.type == 2 while tselect is 8 causes an illegal instruction exception on your HW? Yes, it is.

zhajio1988 avatar Jul 02 '24 02:07 zhajio1988