Fix for pr3527022.
This patch adds support for an explicit range or type in a parameter declaration that is part of a module parameter port list.
This commit is contained in:
parent
2d0c786bfb
commit
f7ba954ef7
168
parse.y
168
parse.y
|
|
@ -1833,8 +1833,8 @@ block_item_decl
|
|||
{ pform_make_events($2, @1.text, @1.first_line);
|
||||
}
|
||||
|
||||
| K_parameter parameter_assign_decl ';'
|
||||
| K_localparam localparam_assign_decl ';'
|
||||
| K_parameter param_type parameter_assign_list ';'
|
||||
| K_localparam param_type localparam_assign_list ';'
|
||||
|
||||
/* Blocks can have type declarations. */
|
||||
|
||||
|
|
@ -3932,9 +3932,9 @@ module_parameter_port_list_opt
|
|||
;
|
||||
|
||||
module_parameter_port_list
|
||||
: K_parameter parameter_assign
|
||||
: K_parameter param_type parameter_assign
|
||||
| module_parameter_port_list ',' parameter_assign
|
||||
| module_parameter_port_list ',' K_parameter parameter_assign
|
||||
| module_parameter_port_list ',' K_parameter param_type parameter_assign
|
||||
;
|
||||
|
||||
module_item
|
||||
|
|
@ -4474,18 +4474,14 @@ var_type
|
|||
: K_reg { $$ = NetNet::REG; }
|
||||
;
|
||||
|
||||
/* In this rule we have matched the "parameter" keyword. The rule
|
||||
generates a type (optional) and a list of assignments. */
|
||||
|
||||
parameter_assign_decl
|
||||
: parameter_assign_list
|
||||
| range
|
||||
{ param_active_range = $1;
|
||||
param_type
|
||||
:
|
||||
{ param_active_range = 0;
|
||||
param_active_signed = false;
|
||||
param_active_type = IVL_VT_LOGIC;
|
||||
}
|
||||
parameter_assign_list
|
||||
{ param_active_range = 0;
|
||||
| range
|
||||
{ param_active_range = $1;
|
||||
param_active_signed = false;
|
||||
param_active_type = IVL_VT_LOGIC;
|
||||
}
|
||||
|
|
@ -4494,68 +4490,48 @@ parameter_assign_decl
|
|||
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;
|
||||
param_active_type = IVL_VT_LOGIC;
|
||||
}
|
||||
parameter_assign_list
|
||||
{ param_active_range = 0;
|
||||
param_active_signed = false;
|
||||
param_active_type = IVL_VT_LOGIC;
|
||||
}
|
||||
| K_integer
|
||||
{ param_active_range = make_range_from_width(integer_width);
|
||||
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_time
|
||||
{ param_active_range = make_range_from_width(64);
|
||||
param_active_signed = false;
|
||||
param_active_type = IVL_VT_LOGIC;
|
||||
}
|
||||
parameter_assign_list
|
||||
{ param_active_range = 0;
|
||||
param_active_signed = false;
|
||||
param_active_type = IVL_VT_LOGIC;
|
||||
}
|
||||
| real_or_realtime
|
||||
{ param_active_range = 0;
|
||||
param_active_signed = true;
|
||||
param_active_type = IVL_VT_REAL;
|
||||
}
|
||||
parameter_assign_list
|
||||
{ param_active_range = 0;
|
||||
param_active_signed = false;
|
||||
param_active_type = IVL_VT_LOGIC;
|
||||
}
|
||||
| atom2_type
|
||||
{ param_active_range = make_range_from_width($1);
|
||||
param_active_signed = true;
|
||||
param_active_type = IVL_VT_BOOL;
|
||||
}
|
||||
parameter_assign_list
|
||||
{ param_active_range = 0;
|
||||
param_active_signed = false;
|
||||
param_active_type = IVL_VT_LOGIC;
|
||||
}
|
||||
;
|
||||
|
||||
/* parameter and localparam assignment lists are broken into
|
||||
separate BNF so that I can call slightly different parameter
|
||||
handling code. localparams parse the same as parameters, they
|
||||
just behave differently when someone tries to override them. */
|
||||
|
||||
parameter_assign_list
|
||||
: parameter_assign
|
||||
| parameter_assign_list ',' parameter_assign
|
||||
;
|
||||
|
||||
localparam_assign_list
|
||||
: localparam_assign
|
||||
| localparam_assign_list ',' localparam_assign
|
||||
;
|
||||
|
||||
parameter_assign
|
||||
: IDENTIFIER '=' expression parameter_value_ranges_opt
|
||||
{ PExpr*tmp = $3;
|
||||
|
|
@ -4565,6 +4541,15 @@ parameter_assign
|
|||
}
|
||||
;
|
||||
|
||||
localparam_assign
|
||||
: IDENTIFIER '=' expression
|
||||
{ PExpr*tmp = $3;
|
||||
pform_set_localparam(@1, lex_strings.make($1), param_active_type,
|
||||
param_active_signed, param_active_range, tmp);
|
||||
delete[]$1;
|
||||
}
|
||||
;
|
||||
|
||||
parameter_value_ranges_opt : parameter_value_ranges { $$ = $1; } | { $$ = 0; } ;
|
||||
|
||||
parameter_value_ranges
|
||||
|
|
@ -4596,103 +4581,6 @@ value_range_expression
|
|||
|
||||
from_exclude : K_from { $$ = false; } | K_exclude { $$ = true; } ;
|
||||
|
||||
/* Localparam assignments and assignment lists are broken into
|
||||
separate BNF so that I can call slightly different parameter
|
||||
handling code. They parse the same as parameters, they just
|
||||
behave differently when someone tries to override them. */
|
||||
|
||||
localparam_assign
|
||||
: IDENTIFIER '=' expression
|
||||
{ PExpr*tmp = $3;
|
||||
pform_set_localparam(@1, lex_strings.make($1),
|
||||
param_active_type,
|
||||
param_active_signed,
|
||||
param_active_range, tmp);
|
||||
delete[]$1;
|
||||
}
|
||||
;
|
||||
|
||||
localparam_assign_decl
|
||||
: localparam_assign_list
|
||||
| range
|
||||
{ param_active_range = $1;
|
||||
param_active_signed = false;
|
||||
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
|
||||
{ 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;
|
||||
param_active_type = IVL_VT_LOGIC;
|
||||
}
|
||||
localparam_assign_list
|
||||
{ param_active_range = 0;
|
||||
param_active_signed = false;
|
||||
param_active_type = IVL_VT_LOGIC;
|
||||
}
|
||||
| K_integer
|
||||
{ param_active_range = make_range_from_width(integer_width);
|
||||
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_time
|
||||
{ param_active_range = make_range_from_width(64);
|
||||
param_active_signed = false;
|
||||
param_active_type = IVL_VT_LOGIC;
|
||||
}
|
||||
localparam_assign_list
|
||||
{ param_active_range = 0;
|
||||
param_active_signed = false;
|
||||
param_active_type = IVL_VT_LOGIC;
|
||||
}
|
||||
| real_or_realtime
|
||||
{ param_active_range = 0;
|
||||
param_active_signed = true;
|
||||
param_active_type = IVL_VT_REAL;
|
||||
}
|
||||
localparam_assign_list
|
||||
{ param_active_range = 0;
|
||||
param_active_signed = false;
|
||||
param_active_type = IVL_VT_LOGIC;
|
||||
}
|
||||
| atom2_type
|
||||
{ param_active_range = make_range_from_width($1);
|
||||
param_active_signed = true;
|
||||
param_active_type = IVL_VT_BOOL;
|
||||
}
|
||||
localparam_assign_list
|
||||
{ param_active_range = 0;
|
||||
param_active_signed = false;
|
||||
param_active_type = IVL_VT_LOGIC;
|
||||
}
|
||||
;
|
||||
|
||||
localparam_assign_list
|
||||
: localparam_assign
|
||||
| localparam_assign_list ',' localparam_assign
|
||||
;
|
||||
|
||||
|
||||
|
||||
/* The parameters of a module instance can be overridden by writing
|
||||
a list of expressions in a syntax much like a delay list. (The
|
||||
difference being the list can have any length.) The pform that
|
||||
|
|
|
|||
Loading…
Reference in New Issue