Replies: 1 comment
|
Yes, this should be straightforward to do. Create an EvalContext and create local values for variables by using EvalContext::createLocal which returns a pointer to the ConstantValue which you can read or write to be whatever you want. Then call Expression::eval with your context and you'll get a result back. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi there !
In the context of my language server I would like to try and evaluate the various conditions of a SystemVerilog RTL (design) file.
The idea would be to extract all
ifstatements, evaluate the expression with signal value that I provide from the simulation, and display in editor the "false" sections in grayed out or equivalent.(That would be the same as you would get when using a
#ifdef ... #else ... #endifin a C++ editor).While I should be good for the extraction part and UI stuff, I would like to get some pointer on the evaluation capabilities of slang, and how to use them. I saw stuff like
slang::ast::ASTContextorslang::ast::Expression::evalwhich looks promising, but I don't want to invest too much time on a dead-end.Could you confirm that this use case is reasonable with regards to slang capabilities and could you roughly explain the required steps to perform this ?
Thanks a lot for slang and the help already provided !
Julien FAUCHER
All reactions