Fix width and sign determination for package scoped function calls

`PECallFunction::test_width()` does not consider the package scope and will
not return any information for package scoped function calls.

As a result in contexts where the width or sign of a expression must be
known produces the wrong result when using a package scoped function.

Make sure to search for the function name in the package scope if a package
is specified.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-12-25 15:09:34 -08:00
parent 50d7d66043
commit 5634dc6915
1 changed files with 7 additions and 1 deletions

View File

@ -1531,9 +1531,15 @@ unsigned PECallFunction::test_width(Design*des, NetScope*scope,
if (peek_tail_name(path_)[0] == '$')
return test_width_sfunc_(des, scope, mode);
NetScope *use_scope = scope;
if (package_) {
use_scope = des->find_package(package_->pscope_name());
ivl_assert(*this, use_scope);
}
// Search for the symbol. This should turn up a scope.
symbol_search_results search_results;
bool search_flag = symbol_search(this, des, scope, path_, &search_results);
bool search_flag = symbol_search(this, des, use_scope, path_, &search_results);
if (debug_elaborate) {
cerr << get_fileline() << ": PECallFunction::test_width: "