Add support for parameter declarations with type but no range.
The standard allows a parameter (or localparam) declaration of the form "parameter signed my_param = ...". The parser currently rejects this. A small adjustment is also required in the parameter evaluation code to correctly apply the type.
This commit is contained in:
parent
95e25ad40f
commit
37be84483c
|
|
@ -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<NetECReal*>(expr)) {
|
||||
verinum nval(tmp->value().as_long64(), (unsigned)lv_width);
|
||||
|
|
|
|||
20
parse.y
20
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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue