From 2a85ee50597b80fa8f5348f1f3f7ecc6a2590733 Mon Sep 17 00:00:00 2001 From: steve Date: Wed, 2 Jun 1999 02:56:29 +0000 Subject: [PATCH] Net declaration assignments. --- parse.y | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/parse.y b/parse.y index 322ecd48a..1c7efabe9 100644 --- a/parse.y +++ b/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.30 1999/05/30 03:12:56 steve Exp $" +#ident "$Id: parse.y,v 1.31 1999/06/02 02:56:29 steve Exp $" #endif # include "parse_misc.h" @@ -96,6 +96,9 @@ extern void lex_end_table(); %type register_variable_list %type list_of_variables +%type net_decl_assign +%type net_decl_assigns + %type port %type list_of_ports list_of_ports_opt @@ -799,6 +802,14 @@ module_item } delete $3; } + | net_type range_opt net_decl_assigns ';' + { pform_makewire($3, $1); + if ($2) { + pform_set_net_range($3, $2); + delete $2; + } + delete $3; + } | port_type range_opt list_of_variables ';' { pform_set_port_type($3, $1); if ($2) { @@ -865,6 +876,34 @@ module_item_list | module_item ; + /* A net declaration assignment allows the programmer to combine the + net declaration and the continuous assignment into a single + statement. */ +net_decl_assign + : IDENTIFIER '=' expression + { PEIdent*id = new PEIdent(*$1); + PGAssign*tmp = pform_make_pgassign(id, $3); + tmp->set_file(@1.text); + tmp->set_lineno(@1.first_line); + $$ = $1; + } + ; + +net_decl_assigns + : net_decl_assigns ',' net_decl_assign + { list*tmp = $1; + tmp->push_back(*$3); + delete $3; + $$ = tmp; + } + | net_decl_assign + { list*tmp = new list; + tmp->push_back(*$1); + delete $1; + $$ = tmp; + } + ; + net_type : K_wire { $$ = NetNet::WIRE; } | K_tri { $$ = NetNet::TRI; }