Skip to content
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

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

Open
micreven opened this issue Aug 3, 2024 · 2 comments
Open

Comments

@micreven
Copy link

micreven commented Aug 3, 2024

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

@pdonahue-ventana
Copy link
Collaborator

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.

@micreven
Copy link
Author

micreven commented Aug 7, 2024

Got it.
Thanks a lot.

rtwfroody added a commit to rtwfroody/riscv-isa-sim that referenced this issue Aug 12, 2024
I doubt this code was ever tested, and this change isn't tested either,
because OpenOCD doesn't use this trigger type.

This problem was reported in
riscv/riscv-debug-spec#1057
rtwfroody added a commit to rtwfroody/riscv-isa-sim that referenced this issue Aug 19, 2024
I doubt this code was ever tested, and this change isn't tested either,
because OpenOCD doesn't use this trigger type.

This problem was reported in
riscv/riscv-debug-spec#1057
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants