riscv/riscv-debug-spec

Question about Trigger Match Control Type6 CSR's "match" field function

micreven opened this issue · 2 comments

Hi All,

I have a question about the mc6 trigger CSR's match field.

When I read the "match" field function, I think the compare formula should be like below if I config match=5.
"results=((compare_value[63:32]&tdata2[63:32])==(tdata2[31:0]))"

But the SPIKE code shows the tdata2[31:0] also ANDed with tdata[63:32], which seems mismatch with SPEC(Because I think the SPEC doesn't say the tdata2[31:0] should ANDed with tdata2[63:32])

the SPIKE code copied below,from https://github.com/riscv-software-src/riscv-isa-sim/blob/master/riscv/triggers.cc

截屏2024-08-03 10 21 35

the same question is also existed for match=4、5、12、13.

Could anyone help me explain the SPEC description ?

Best regards,
Micreven

You're right. The Spike code looks wrong. It seems like it should be something like ((value >> (xlen/2)) & mask) == (tdata2 & ((1<<(xlen/2))-1).

If I want to match when value[1:0]=3 then I need to program tdata2=0x0000000300000003 where [31:2] must be 0 according to the spec. If I have non-zero in [31:2] like 0x00000003DEADBEEF then the trigger cannot possibly match. The Spike bug was probably never caught because nobody programmed the trigger in this way that made it impossible to match.

Got it.
Thanks a lot.