mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-06 06:03:23 +00:00
verilog: refactored constant function evaluation
Elaboration now attempts constant evaluation of any function call with only constant arguments, regardless of the context or contents of the function. This removes the concept of "recommended constant evaluation" which previously applied to functions with `for` loops or which were (sometimes erroneously) identified as recursive. Any function call in a constant context (e.g., `localparam`) or which contains a constant-only procedural construct (`while` or `repeat`) in its body will fail as before if constant evaluation does not succeed.
This commit is contained in:
parent
baf1875307
commit
b93b6f4285
4 changed files with 176 additions and 72 deletions
|
@ -264,10 +264,9 @@ namespace AST
|
|||
|
||||
// additional functionality for evaluating constant functions
|
||||
struct varinfo_t { RTLIL::Const val; int offset; bool is_signed; };
|
||||
bool has_const_only_constructs(bool &recommend_const_eval);
|
||||
bool has_const_only_constructs(std::set<std::string>& visited, bool &recommend_const_eval);
|
||||
void replace_variables(std::map<std::string, varinfo_t> &variables, AstNode *fcall);
|
||||
AstNode *eval_const_function(AstNode *fcall);
|
||||
bool has_const_only_constructs();
|
||||
bool replace_variables(std::map<std::string, varinfo_t> &variables, AstNode *fcall, bool must_succeed);
|
||||
AstNode *eval_const_function(AstNode *fcall, bool must_succeed);
|
||||
bool is_simple_const_expr();
|
||||
std::string process_format_str(const std::string &sformat, int next_arg, int stage, int width_hint, bool sign_hint);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue