diff --git a/net_design.cc b/net_design.cc index 4b4ba5692..6a9ebe386 100644 --- a/net_design.cc +++ b/net_design.cc @@ -405,11 +405,11 @@ void NetScope::evaluate_parameter_logic_(Design*des, param_ref_t cur) } (*cur).second.val = expr; - /* If the parameter has range information, then make - sure the type is set right. Note that if the - parameter doesn't have an explicit range, then it - will get the signedness from the expression itself. */ - if (range_flag) { + /* If the parameter has type or range information, then make + sure the type is set right. Note that if the parameter + doesn't have an explicit type or range, then it will get + the signedness from the expression itself. */ + if ((*cur).second.signed_flag || range_flag) { /* If we have a real value convert it to an integer. */ if(NetECReal*tmp = dynamic_cast(expr)) { verinum nval(tmp->value().as_long64(), (unsigned)lv_width); diff --git a/parse.y b/parse.y index c783a21e4..3f4c78dbf 100644 --- a/parse.y +++ b/parse.y @@ -3312,6 +3312,16 @@ parameter_assign_decl param_active_signed = false; param_active_type = IVL_VT_LOGIC; } + | K_signed + { param_active_range = 0; + param_active_signed = true; + param_active_type = IVL_VT_LOGIC; + } + parameter_assign_list + { param_active_range = 0; + param_active_signed = false; + param_active_type = IVL_VT_LOGIC; + } | K_signed range { param_active_range = $2; param_active_signed = true; @@ -3427,6 +3437,16 @@ localparam_assign_decl param_active_signed = false; param_active_type = IVL_VT_LOGIC; } + | K_signed + { param_active_range = 0; + param_active_signed = true; + param_active_type = IVL_VT_LOGIC; + } + localparam_assign_list + { param_active_range = 0; + param_active_signed = false; + param_active_type = IVL_VT_LOGIC; + } | K_signed range { param_active_range = $2; param_active_signed = true;