-
Notifications
You must be signed in to change notification settings - Fork 713
Add V3Instrumentation-Pass and V3DumpSignals-Pass #6518
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
base: master
Are you sure you want to change the base?
Add V3Instrumentation-Pass and V3DumpSignals-Pass #6518
Conversation
|
Thanks I'll look through this tonight. Meanwhile please fix the tests (unless this is just a draft and mark draft if so). Can you please indicate more about how you are using this in a real project? Are there similar capabilities in other simulators - or said another way how do you accomplish what you need using other simulators today? How do you accomplish what you need today in Verilator (if you do)? |
|
Thanks for the quick reaction. I hope I addressed the issues properly and the tests run as expected. This idea originated from a research project me and @wallento are working on, which focuses on exploring fast, design-level simulation of fault injection and hardware faults. The goal is to allow early-stage testing of hardware designs and to evaluate resilience against potential attacks, while staying as close to the provided design and its abstraction level as possible. This fault-injection simulation is the main usage in real projects for us. I do not have a simulator in mind, which automatically adds DPI calls, which can be used for a certain functionality, for specific signals.
The approach here aims to be much faster by leveraging simulator optimizations to provide a fast simulation, which is very welcome when doing extensive Fault Injection simulation/testing. I hope that answers your questions :) |
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 am concerned that this will get added and no one else will ever use it, especially as it's non-standard.
Is the downstream project open sourced/will it be?
DPI isn't too heavyweight but is still a lot more than native code. Or do you only do this on a small portion of a large design? What is the performance difference you see by doing this versus no annotation on a design you are experimenting on?
Mutation/fault coverage itself is interesting, is it more valuable to add that directly? Or is that too large/hard/whatever?
Why is a new output needed, is the .json missing something? If so please add it to the .json - probably better as a separate pre-pull.
Need to add documentation, both on the new .vlt statement and how to use this generally. This would also help me gauge the value - feel free to make it super-rough to start.
There's style cleanups needed in V3Instrument, compare it to other files and you'll see the comments look quite different. I'll add more feedback on that file when we settle on some of the above.
f4c8259 to
c03ef34
Compare
8cefd55 to
021e122
Compare
021e122 to
e449552
Compare
|
To avoid other people getting a mails on your push please develop on another branch, and when everything is working and you are ready for more feedback, push to this branch. Thanks. |
This PR introduces new DPI-Instrumentation capabilities for Verilator. Additionally to make the configuration of the instrumantion via the Verilator configuration file easier a signal dumping capability is introduced, that prints the signal hierarchy that is needed for the instrumentation into a log file.
Motivation
Verilator supports the usage of the DPI functionalities of SystemVerilog, but implementing the DPI into the design, especially for complex designs, can be cumbersome. This PR provides a pass for automating the adding of DPI calls into the provided module. (V3Instrumentation)
To make the configuration of this automation easier for the user the instrumentation an additional pass is part of the PR, which dumps signals that can be currently addressed by the DPI-Instrumentation. (V3DumpSignals)
Features
V3Instrumentation:
--instrument.instrument --model "<function name>" --id "<switch_case_id>" --target "<topmodule.instance.instance.variable>"instrumentinforms Verilator that instrumentation is required for the provided signal hierarchy.modelspecifies the DPI function to be called.iddefines the case, if a case depended functionality like a switch case statement is used. This can be used if depending on the provided case a different functionality should be executed by the DPI while keeping the same function name, e.g. fault injection stuck-at-1 vs. stuck-at-0 for the same signal type.targetprovides the full hierarchical path to the signal that should be instrumented.--targetpath, and stores it in a map. It also inserts parameters along the module hierarchy to ensure structural consistency and enable precise instrumentation. These parameters are used to enable the instrumentation for specific hierarchy paths while disabling them for hierarchy paths that should not use the instrumentation.V3DumpSignals:
signalDump.logfile insideobj_dir.--dump-signals.Limitations
Future Plans/To Dos
Thanks a lot in advance for any feedback for my first big PR. Looking forward for the upcoming discussions, improvements and ideas!