Fix module parameter override syntax.
This commit is contained in:
parent
cbd353fbb8
commit
7e37b61a05
20
parse.y
20
parse.y
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: parse.y,v 1.79 1999/12/31 17:39:00 steve Exp $"
|
||||
#ident "$Id: parse.y,v 1.80 2000/01/01 23:47:58 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "parse_misc.h"
|
||||
|
|
@ -127,7 +127,7 @@ extern void lex_end_table();
|
|||
%type <expr> expression expr_primary
|
||||
%type <expr> lavalue lpvalue
|
||||
%type <expr> delay_value
|
||||
%type <exprs> delay1 delay3 delay3_opt
|
||||
%type <exprs> delay1 delay3 delay3_opt parameter_value_opt
|
||||
%type <exprs> expression_list
|
||||
%type <exprs> assign assign_list
|
||||
|
||||
|
|
@ -1088,7 +1088,7 @@ module_item
|
|||
| gatetype delay3_opt gate_instance_list ';'
|
||||
{ pform_makegates($1, $2, $3);
|
||||
}
|
||||
| IDENTIFIER delay3_opt gate_instance_list ';'
|
||||
| IDENTIFIER parameter_value_opt gate_instance_list ';'
|
||||
{ pform_make_modgates($1, $2, $3);
|
||||
delete $1;
|
||||
}
|
||||
|
|
@ -1217,6 +1217,20 @@ parameter_assign_list
|
|||
| parameter_assign_list ',' parameter_assign
|
||||
;
|
||||
|
||||
|
||||
/* The parameters of a module instance can be overridden by writing
|
||||
a list of expressions in a syntax much line a delay list. (The
|
||||
difference being the list can have any length.) The pform that
|
||||
attaches the expression list to the module checks that the
|
||||
expressions are constant. */
|
||||
|
||||
parameter_value_opt
|
||||
: '#' '(' expression_list ')'
|
||||
{ $$ = $3; }
|
||||
|
|
||||
{ $$ = 0; }
|
||||
;
|
||||
|
||||
/* The port (of a module) is a fairle complex item. Each port is
|
||||
handled as a Module::port_t object. A simple port reference has a
|
||||
name and a PWire object, but more complex constructs are possible
|
||||
|
|
|
|||
12
pform.cc
12
pform.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: pform.cc,v 1.49 1999/12/30 19:06:14 steve Exp $"
|
||||
#ident "$Id: pform.cc,v 1.50 2000/01/01 23:47:58 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "compiler.h"
|
||||
|
|
@ -355,6 +355,13 @@ void pform_make_modgates(const string&type,
|
|||
svector<PExpr*>*overrides,
|
||||
svector<lgate>*gates)
|
||||
{
|
||||
for (unsigned idx = 0 ; idx < overrides->count() ; idx += 1)
|
||||
if (! pform_expression_is_constant((*overrides)[idx])) {
|
||||
VLerror("error: Parameter override expression"
|
||||
" must be constant.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (unsigned idx = 0 ; idx < gates->count() ; idx += 1) {
|
||||
lgate cur = (*gates)[idx];
|
||||
|
||||
|
|
@ -765,6 +772,9 @@ int pform_parse(const char*path, map<string,Module*>&modules,
|
|||
|
||||
/*
|
||||
* $Log: pform.cc,v $
|
||||
* Revision 1.50 2000/01/01 23:47:58 steve
|
||||
* Fix module parameter override syntax.
|
||||
*
|
||||
* Revision 1.49 1999/12/30 19:06:14 steve
|
||||
* Support reg initial assignment syntax.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue