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
194
parse.y
194
parse.y
|
|
@ -1833,8 +1833,8 @@ block_item_decl
|
||||||
{ pform_make_events($2, @1.text, @1.first_line);
|
{ pform_make_events($2, @1.text, @1.first_line);
|
||||||
}
|
}
|
||||||
|
|
||||||
| K_parameter parameter_assign_decl ';'
|
| K_parameter param_type parameter_assign_list ';'
|
||||||
| K_localparam localparam_assign_decl ';'
|
| K_localparam param_type localparam_assign_list ';'
|
||||||
|
|
||||||
/* Blocks can have type declarations. */
|
/* Blocks can have type declarations. */
|
||||||
|
|
||||||
|
|
@ -1853,15 +1853,15 @@ block_item_decl
|
||||||
yyerrok;
|
yyerrok;
|
||||||
}
|
}
|
||||||
|
|
||||||
| K_parameter error ';'
|
| K_parameter error ';'
|
||||||
{ yyerror(@1, "error: syntax error in parameter list.");
|
{ yyerror(@1, "error: syntax error in parameter list.");
|
||||||
yyerrok;
|
yyerrok;
|
||||||
}
|
}
|
||||||
| K_localparam error ';'
|
| K_localparam error ';'
|
||||||
{ yyerror(@1, "error: syntax error localparam list.");
|
{ yyerror(@1, "error: syntax error localparam list.");
|
||||||
yyerrok;
|
yyerrok;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
block_item_decls
|
block_item_decls
|
||||||
: block_item_decl
|
: block_item_decl
|
||||||
|
|
@ -3932,9 +3932,9 @@ module_parameter_port_list_opt
|
||||||
;
|
;
|
||||||
|
|
||||||
module_parameter_port_list
|
module_parameter_port_list
|
||||||
: K_parameter parameter_assign
|
: K_parameter param_type parameter_assign
|
||||||
| module_parameter_port_list ',' 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
|
module_item
|
||||||
|
|
@ -4474,19 +4474,15 @@ var_type
|
||||||
: K_reg { $$ = NetNet::REG; }
|
: K_reg { $$ = NetNet::REG; }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* In this rule we have matched the "parameter" keyword. The rule
|
param_type
|
||||||
generates a type (optional) and a list of assignments. */
|
:
|
||||||
|
{ param_active_range = 0;
|
||||||
parameter_assign_decl
|
|
||||||
: parameter_assign_list
|
|
||||||
| range
|
|
||||||
{ param_active_range = $1;
|
|
||||||
param_active_signed = false;
|
param_active_signed = false;
|
||||||
param_active_type = IVL_VT_LOGIC;
|
param_active_type = IVL_VT_LOGIC;
|
||||||
}
|
}
|
||||||
parameter_assign_list
|
| range
|
||||||
{ param_active_range = 0;
|
{ param_active_range = $1;
|
||||||
param_active_signed = false;
|
param_active_signed = false;
|
||||||
param_active_type = IVL_VT_LOGIC;
|
param_active_type = IVL_VT_LOGIC;
|
||||||
}
|
}
|
||||||
| K_signed
|
| K_signed
|
||||||
|
|
@ -4494,67 +4490,47 @@ parameter_assign_decl
|
||||||
param_active_signed = true;
|
param_active_signed = true;
|
||||||
param_active_type = IVL_VT_LOGIC;
|
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
|
| K_signed range
|
||||||
{ param_active_range = $2;
|
{ param_active_range = $2;
|
||||||
param_active_signed = true;
|
param_active_signed = true;
|
||||||
param_active_type = IVL_VT_LOGIC;
|
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
|
| K_integer
|
||||||
{ param_active_range = make_range_from_width(integer_width);
|
{ param_active_range = make_range_from_width(integer_width);
|
||||||
param_active_signed = true;
|
param_active_signed = true;
|
||||||
param_active_type = IVL_VT_LOGIC;
|
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
|
| K_time
|
||||||
{ param_active_range = make_range_from_width(64);
|
{ param_active_range = make_range_from_width(64);
|
||||||
param_active_signed = false;
|
param_active_signed = false;
|
||||||
param_active_type = IVL_VT_LOGIC;
|
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
|
| real_or_realtime
|
||||||
{ param_active_range = 0;
|
{ param_active_range = 0;
|
||||||
param_active_signed = true;
|
param_active_signed = true;
|
||||||
param_active_type = IVL_VT_REAL;
|
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
|
| atom2_type
|
||||||
{ param_active_range = make_range_from_width($1);
|
{ param_active_range = make_range_from_width($1);
|
||||||
param_active_signed = true;
|
param_active_signed = true;
|
||||||
param_active_type = IVL_VT_BOOL;
|
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_list
|
||||||
: parameter_assign
|
: parameter_assign
|
||||||
| parameter_assign_list ',' parameter_assign
|
| parameter_assign_list ',' parameter_assign
|
||||||
;
|
;
|
||||||
|
|
||||||
|
localparam_assign_list
|
||||||
|
: localparam_assign
|
||||||
|
| localparam_assign_list ',' localparam_assign
|
||||||
|
;
|
||||||
|
|
||||||
parameter_assign
|
parameter_assign
|
||||||
: IDENTIFIER '=' expression parameter_value_ranges_opt
|
: IDENTIFIER '=' expression parameter_value_ranges_opt
|
||||||
|
|
@ -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_opt : parameter_value_ranges { $$ = $1; } | { $$ = 0; } ;
|
||||||
|
|
||||||
parameter_value_ranges
|
parameter_value_ranges
|
||||||
|
|
@ -4596,103 +4581,6 @@ value_range_expression
|
||||||
|
|
||||||
from_exclude : K_from { $$ = false; } | K_exclude { $$ = true; } ;
|
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
|
/* The parameters of a module instance can be overridden by writing
|
||||||
a list of expressions in a syntax much like a delay list. (The
|
a list of expressions in a syntax much like a delay list. (The
|
||||||
difference being the list can have any length.) The pform that
|
difference being the list can have any length.) The pform that
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue