Skip to content

Conversation

@hirooih
Copy link

@hirooih hirooih commented Nov 1, 2025

This PR includes several minor fixes for the debug tests.

See the commit log for details of each commit.

Thank you for these great test suites!

Set MCONTROL_S and/or MCONTROL_U bits only if the hart supports S-mode
and/or U-mode.

Signed-off-by: Hiroo HAYASHI <[email protected]>
TranslateTest depends on the S extension being supported.
Without this change, the test fails on targets that do not support S
extension.

Signed-off-by: Hiroo HAYASHI <[email protected]>
The default size argument of set_pmp_deny() is 4KB.
However, bad_address in spike32.py and spike64.py assumes that
the size is less than or equal to 8 bytes.
8 bytes is enough for each test calling set_pmp_deny().
So, set the size argument of set_pmp_deny() to 8 explicitly.

Signed-off-by: Hiroo HAYASHI <[email protected]>
This is for the dmode bit in tdata1.

Signed-off-by: Hiroo HAYASHI <[email protected]>
This suppresses warnings like:
  Warning: Command 'gdb_port' is deprecated, please use 'gdb port' instead.
  Warning: Command 'tcl_port' is deprecated, please use 'tcl port' instead.
  Warning: Command 'telnet_port' is deprecated, please use 'telnet port' instead.

from debug/README.md:

> openocd ..., which should be the latest from https://github.com/riscv/riscv-openocd.git.

Signed-off-by: Hiroo HAYASHI <[email protected]>
This change makes debug/testlib.py not throw an exception
when an expected error occurs while creating the logs/ directory.

Fixing this is useful when debugging with python
debugger not to break at the exception every time.

Signed-off-by: Hiroo HAYASHI <[email protected]>
U500Sim.py is the only example of a target that uses VcsSim class.
It does not work without this fix.

Signed-off-by: Hiroo HAYASHI <[email protected]>
example: for https://github.com/fjullien/jtag_vpi/blob/master/jtag_common.c#L80

    def create(self):
        return testlib.VcsSim(..., server_stared="^Starting jtag_vpi server:.*, port (\d+)/tcp")

Signed-off-by: Hiroo HAYASHI <[email protected]>
Copy link
Collaborator

@en-sc en-sc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fixes!
I have a few concerns. Please, take a look.

print(name)
return 0

try:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this try/except is no longer needed. Perhaps it can be removed?

bad_address = self.hart.bad_address or 0
if self.target.support_set_pmp_deny:
self.set_pmp_deny(bad_address)
self.set_pmp_deny(bad_address, 8)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid this will break the targets with insufficient PMP granularity (see [3.7.1.1. Address Matching] of the Priv Spec).
One way to address this is to:

  • Introduce PMP granularity as a target parameter.
  • Check the specified granularity using the algorithm from the spec.
  • Use a supported size here.

Perhaps there is a better way to address the issue. In any case this needs to be addressed.

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

Successfully merging this pull request may close these issues.

2 participants