Fix assertion failure on multiple instantiation of implicitly real-typed parameter declaration (issue #732)

If the parameter has no explicit type, the type is inferred from the RHS
expression. The first time the parameter is evaluated, the RHS hasn't yet
been elaborated, so the type is unknown. This causes the evaluation to be
performed by NetScope::evaluate_parameter_logic_, which correctly handles
both logic and real types. However, on subsequent evaluations of the
parameter, the expression type is now known, so the evaluation was being
performed by NetScope::evaluate_parameter_real_. This function requires
the parameter to have an explicit type.

For now, rather than add more code to NetScope::evaluate_parameter_real_
to handle an implicit type, force NetScope::evaluate_parameter_logic_ to
be used whenever we have an implicit type. This should probably be reworked
if support for more complex types is added.
This commit is contained in:
Martin Whitaker 2022-08-24 15:21:16 +01:00
parent 542da11669
commit 2ceb90b95e
1 changed files with 2 additions and 2 deletions

View File

@ -842,12 +842,12 @@ void NetScope::evaluate_parameter_(Design*des, param_ref_t cur)
// Guess the varaiable type of the parameter. If the parameter has no
// given type, then guess the type from the expression and use that to
// evaluate.
// evaluate (this is currently handled in evaluate_parameter_logic_()).
ivl_variable_type_t use_type;
if (param_type)
use_type = param_type->base_type();
else
use_type = cur->second.val_expr->expr_type();
use_type = IVL_VT_NO_TYPE;
if (cur->second.solving) {
cerr << cur->second.get_fileline() << ": error: "