8000 surfer: Initial inclusion by infinitymdm · Pull Request #3626 · siliconcompiler/siliconcompiler · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

surfer: Initial inclusion #3626

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

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

infinitymdm
Copy link
@infinitymdm infinitymdm commented May 27, 2025

Summary

This PR aims to add support for surfer, an up-and-coming waveform viewer similar to gtkwave.

Details

Surfer is a pretty fancy upgrade over gtkwave. It supports a lot of nice features, such as automatic recognition of RISC-V instructions. It's also significantly snappier and IMO easier to use, though its current release lacks customizable keybinds. It's still in pretty early stages, but lots of open source projects have started adding support for it.

Perhaps its most interesting feature is the web-based viewer. This PR does not target that interface, instead making use of the native-installed viewer binary for simplicity's sake, but it's probably worth exploring the web viewer in the future.

My primary motivations for adding this tool are

  • To learn more about siliconcompiler's tool API, starting with a relatively simple tool
  • To provide an interface for a tool that I often use

Most of the work I've done so far is heavily based on the gtkwave tool interface, plus a smattering of observations from other tool interface code. Not sure if I'm doing this right; we'll see if I can get it working.

To do before Ready for Review:

  • Figure out how to use surfer in a flow (maybe find examples that use gtkwave?)
  • Figure out what sc_show.cmd script is supposed to do (assuming add waves) Not needed, as far as I can tell; removed from latest commits
  • Test thoroughly (automated testing? Look into testing methodology for other tools)

@gadfort
Copy link
Member
gadfort commented May 27, 2025

@infinitymdm thanks. You'll need to add the tool to the _tools.json along with the build scripts for ubuntu as install-surfer.sh to enable building of this (that would be needed to support testing).

@infinitymdm
Copy link
Author

I've got surfer working with the heartbeat_sim.py example. Looking for more information on how to more thoroughly test this.

@infinitymdm infinitymdm marked this pull request as ready for review May 28, 2025 19:47
Comment on lines +29 to +31
# Don't exit on show
chip.set('tool', tool, 'task', task, 'var', 'show_exit', False,
step=step, index=index, clobber=False)
Copy link
Member

Choose a reason for hiding this comment

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

I don't see anything using this.
We use this flag in the other tools to indicate the tool should exit after opening, but it requires the tool driver doing something.

@@ -34,6 +35,7 @@ def setup(chip):
chip.register_showtool('vg', yosys_screenshot)

chip.register_showtool('vcd', gtkwave_show)
chip.register_showtool('vcd', surfer_show)
Copy link
Member

Choose a reason for hiding this comment

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

this will require a little though, since this is really just replacing the gtkwave as the viewer (which might be alright if this is a better viewer, but want to avoid making that change suddenly)

Copy link
Author

Choose a reason for hiding this comment

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

I see what you're saying; this change may not be needed. Is there another mechanism to allow users to select which vcd showtool they'd like to use?

Copy link
Member

Choose a reason for hiding this comment

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

we don't (atleast not anything particularly nice). Maybe the thing to so is to check if surfer is installed and use that otherwise default back to gtkwave?

if shutil.which("surfer") is not None:
  chip.register_showtool('vcd', surfer_show)
else:
  chip.register_showtool('vcd', gtkwave_show)

@gadfort
Copy link
Member
gadfort commented May 29, 2025

@infinitymdm I'll trigger the tool build since that requires write permissions: https://github.com/siliconcompiler/siliconcompiler/actions/runs/15326634211

Passes: https://github.com/siliconcompiler/siliconcompiler/actions/runs/15327813860

You also need to mark the scripts as executable, ie: chmod +x {}

@infinitymdm
Copy link
Author

I notice the tests are failing, but I'm not sure what's going wrong. Can you make anything of this? https://github.com/siliconcompiler/siliconcompiler/actions/runs/15326634211/job/43126098152#step:6:95

It looks to me like surfer successfully loads the vcd file, then the test monitor dies. Is this perhaps related to the 'show_exit' stuff in tools/surfer/show.py?

@gadfort
Copy link
Member
gadfort commented May 29, 2025

I notice the tests are failing, but I'm not sure what's going wrong. Can you make anything of this? https://github.com/siliconcompiler/siliconcompiler/actions/runs/15326634211/job/43126098152#step:6:95

It looks to me like surfer successfully loads the vcd file, then the test monitor dies. Is this perhaps related to the 'show_exit' stuff in tools/surfer/show.py?

Yes, I think you need to add a small script to just exit.
Something like if show_exit? add --script=exit.cmd else don't add this file (probably do this as runtime_options

@infinitymdm infinitymdm marked this pull request as draft June 18, 2025 18:32
@infinitymdm
Copy link
Author

In its current implementation, surfer only supports passing startup scripts. This means that the exit command won't work; surfer will happily parse it, then ignore it and continue loading.

The next release should address this, as the relevant issue was recently closed: https://gitlab.com/surfer-project/surfer/-/issues/413

@gadfort
Copy link
Member
gadfort commented Jun 18, 2025

@infinitymdm I see, thanks for clarifying, in that case I think it would be best to have the tests for the CI in there, but disable them for now:
@pytest.mark.skip(reason="exit not supported until release XXX")
That way once that version is ready we can enable the testing.
Beyond marking the tests, is anything else missing? or is this ready for final review?

@infinitymdm
Copy link
Author

Beyond marking the tests, is anything else missing? or is this ready for final review?

I can't think of anything. In practice, surfer with siliconcompiler is a pretty great experience. I was thinking you would want to wait until the automated testing would work; that's why I converted this PR back to draft.

I'll rebase on main, disable the test, add the check for whether surfer is installed, and then mark this ready for review.

@gadfort
Copy link
Member
gadfort commented Jun 18, 2025

@infinitymdm that sounds good to me, I am okay waiting on the testing since it requires a new version of surfer and that could leave this hanging. When ready just mark it ready and I'll review.

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
0