Fix default parameter type if localparams are present.

localparam declarations were messing up the state of parser variables
so that the default types of following parameters got messed up.
This commit is contained in:
Stephen Williams 2008-06-05 14:38:56 -07:00
parent 2ee976d1c0
commit f132e09475
4 changed files with 11 additions and 4 deletions

View File

@ -94,7 +94,7 @@ class Module : public PScope, public LineInfo {
module is elaborated. During parsing, I put the parameters
into this map. */
struct param_expr_t : public LineInfo {
param_expr_t() : range(0) { }
param_expr_t() : type(IVL_VT_NO_TYPE), msb(0), lsb(0), signed_flag(false), expr(0), range(0) { }
// Type information
ivl_variable_type_t type;
PExpr*msb;

View File

@ -529,6 +529,10 @@ void NetScope::evaluate_parameters(Design*des)
cerr << (*cur).second.get_fileline() << ": internal error: "
<< "Unexpected expression type " << (*cur).second.type
<< "." << endl;
cerr << (*cur).second.get_fileline() << ": : "
<< "Parameter name: " << (*cur).first << endl;
cerr << (*cur).second.get_fileline() << ": : "
<< "Expression is: " << *(*cur).second.expr << endl;
ivl_assert((*cur).second, 0);
break;
}

View File

@ -121,6 +121,9 @@ NetExpr* NetScope::set_parameter(perm_string key, NetExpr*expr,
ivl_assert(file_line, ref.range == 0);
ref.range = range_list;
ref.set_line(file_line);
ivl_assert(file_line, type != IVL_VT_NO_TYPE);
return res;
}

View File

@ -2480,7 +2480,7 @@ localparam_assign_decl
localparam_assign_list
{ param_active_range = 0;
param_active_signed = false;
param_active_type = IVL_VT_NO_TYPE;
param_active_type = IVL_VT_LOGIC;
}
| K_integer
{ param_active_range = 0;
@ -2490,7 +2490,7 @@ localparam_assign_decl
localparam_assign_list
{ param_active_range = 0;
param_active_signed = false;
param_active_type = IVL_VT_NO_TYPE;
param_active_type = IVL_VT_LOGIC;
}
| K_real
{ param_active_range = 0;
@ -2500,7 +2500,7 @@ localparam_assign_decl
localparam_assign_list
{ param_active_range = 0;
param_active_signed = false;
param_active_type = IVL_VT_NO_TYPE;
param_active_type = IVL_VT_LOGIC;
}
;