-
Notifications
You must be signed in to change notification settings - Fork 166
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
Add Debug Native Trigger Support #573
base: master
Are you sure you want to change the base?
Add Debug Native Trigger Support #573
Conversation
a70a138
to
67f737a
Compare
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've never written anything for sail, so take this feedback with a large grain of salt.
Looks like you're modifying each instruction that does a memory access, but I don't see this for vector operations. Did those get missed?
I only looked at the first half of this change so far. I'll read through the rest later.
1ec830e
to
ce3e483
Compare
Co-authored-by: Tim Newsome <[email protected]> Signed-off-by: Yazan Hussnain <[email protected]>
@rtwfroody, Thanks for the initial feedback Actually, I have never worked on the vector extension, so I planned to do it later. Today, I looked into the vector code in sail-riscv and added the trigger for vector load/store. I asked one of my colleagues to write a basic vector load test and check the load address trigger, and it’s working. However, we need feature complete vector ACTs to verify the functionality. |
That's an interesting topic. The ACTs assume that all memory accesses are treated the same. In this SAIL implementation that is not the case, but I do feel that the SAIL implementation is unusual in that way. (E.g. spike has an MMU object and all memory accesses go through there, regardless of which instruction caused them.) Is there hardware where vector memory accesses are inadvertantly treated different from regular memory accesses? |
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.
Sorry to review so little each day, but I am working on it...
No, all memory accesses go through a function called translateAddr. However, my only concern in this case is that misaligned load/store addresses have a higher priority than breakpoint exceptions in the SAIL implementation. There are two functions common to all memory access:
In the file where One solution I can think of is to move both the trigger match check and the misaligned exception check inside I believe we should proceed with the current implementation, but if you have any other suggestions, please let me know. |
No worries at all |
@pmundkur Can you approve the workflow for this PR? |
The workflow is running but it is failing since you have trailing whitespace in the new files. See the log here: https://github.com/riscv/sail-riscv/actions/runs/11274637767/job/32185366539?pr=573 |
Co-authored-by: Tim Newsome <[email protected]> Signed-off-by: Yazan Hussnain <[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.
I'm not a SAIL expert so I might miss some of the subtleties. It looks like @rtwfroody already commented on some of the other things I noticed, but here are my additional comments.
Co-authored-by: Paul Donahue <[email protected]> Signed-off-by: Yazan Hussnain <[email protected]>
bb2e3bf
to
ff62e68
Compare
Co-authored-by: Paul Donahue <[email protected]> Signed-off-by: Yazan Hussnain <[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.
Still working through this, slowly...
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 rest of this looks OK. Thank you.
There is trigger matching here for |
I had not added the trigger earlier due to the TODO comment on the remaining sail-riscv/model/riscv_insts_zicbom.sail Lines 49 to 51 in 0b9c639
|
Debug native trigger support
This PR adds the debug native trigger support in sail RISC-V golden model. RISC-V Debug Specification
tdata
registers--reent-opt1
flag to enable the second solution. Only one solution can be enabled at a timeImplemented Functions
tdata1
register at the selectedtselect
.tdata1
for the following triggers:icount
,itrigger
,etrigger
, andmcontrol6
.tdata1
register at the selectedtselect
.tdata2
register at the selectedtselect
.tdata2
register at the selectedtselect
.tdata3
register at the selectedtselect
.tdata3
register at the selectedtselect
.tcontrol
register: onlymte
andmpte
fields are writable.true
if trigger matching and firing are valid.icount
,itrigger
,etrigger
, andmcontrol6
.Files Changed
riscv_csr_begin.sail
: Created CSR map fortinfo
andtcontrol
.riscv_types.sail
: Defined mappings for Trigger Type and Match Options.riscv_sys_regs.sail
: Defined CSR read/write and legalization functions.riscv_sys_control.sail
: Defined trigger match and trigger firing check functions.riscv_insts_zicsr.sail
: Added read/write CSR definitions for the implemented CSRs.riscv_step.sail
: Called instruction count, instruction match, and check trigger firing functions.riscv_insts_base.sail
: Checked for Data Match trigger on Load/Store instructions.riscv_insts_aext.sail
: Checked for Data Match trigger on Load/Store instructions.riscv_insts_zicboz.sail
: Checked for Data Match trigger forcbo.zero
.