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. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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
if
statements, 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 ... #endif
in 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::ASTContext
orslang::ast::Expression::eval
which 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
Beta Was this translation helpful? Give feedback.
All reactions