continuous assignment lists.

This commit is contained in:
steve 1999-08-27 15:08:37 +00:00
parent 23acca48ff
commit 3017636c05
3 changed files with 50 additions and 9 deletions

30
parse.y
View File

@ -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.60 1999/08/25 22:22:41 steve Exp $"
#ident "$Id: parse.y,v 1.61 1999/08/27 15:08:37 steve Exp $"
#endif
# include "parse_misc.h"
@ -129,6 +129,7 @@ extern void lex_end_table();
%type <expr> delay_value
%type <exprs> delay delay_opt delay_value_list
%type <exprs> expression_list
%type <exprs> assign assign_list
%type <exprs> range range_opt
%type <nettype> net_type
@ -923,6 +924,26 @@ lpvalue
}
;
assign
: lavalue '=' expression
{ svector<PExpr*>*tmp = new svector<PExpr*>(2);
(*tmp)[0] = $1;
(*tmp)[1] = $3;
$$ = tmp;
}
;
assign_list
: assign_list ',' assign
{ svector<PExpr*>*tmp = new svector<PExpr*>(*$1, *$3);
delete $1;
delete $3;
$$ = tmp;
}
| assign
{ $$ = $1; }
;
module
: K_module IDENTIFIER list_of_ports_opt ';'
{ pform_startmodule($2, $3);
@ -994,11 +1015,8 @@ module_item
{ pform_make_modgates($1, $2, $3);
delete $1;
}
| K_assign delay_opt lavalue '=' expression ';'
{ PGAssign*tmp = pform_make_pgassign($3, $5, $2);
tmp->set_file(@1.text);
tmp->set_lineno(@1.first_line);
}
| K_assign delay_opt assign_list ';'
{ pform_make_pgassign_list($3, $2, @1.text, @1.first_line); }
| K_assign error '=' expression ';'
| K_always statement
{ PProcess*tmp = pform_make_behavior(PProcess::PR_ALWAYS, $2);

View File

@ -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.39 1999/08/25 22:22:41 steve Exp $"
#ident "$Id: pform.cc,v 1.40 1999/08/27 15:08:37 steve Exp $"
#endif
# include "compiler.h"
@ -382,6 +382,20 @@ PGAssign* pform_make_pgassign(PExpr*lval, PExpr*rval,
return cur;
}
void pform_make_pgassign_list(svector<PExpr*>*alist,
svector<PExpr*>*del,
const string& text,
unsigned lineno)
{
PGAssign*tmp;
for (unsigned idx = 0 ; idx < alist->count()/2 ; idx += 1) {
tmp = pform_make_pgassign((*alist)[2*idx],
(*alist)[2*idx+1], del);
tmp->set_file(text);
tmp->set_lineno(lineno);
}
}
void pform_makewire(const vlltype&li, const string&nm,
NetNet::Type type)
{
@ -668,6 +682,9 @@ int pform_parse(const char*path, map<string,Module*>&modules,
/*
* $Log: pform.cc,v $
* Revision 1.40 1999/08/27 15:08:37 steve
* continuous assignment lists.
*
* Revision 1.39 1999/08/25 22:22:41 steve
* elaborate some aspects of functions.
*

10
pform.h
View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: pform.h,v 1.29 1999/08/25 22:22:41 steve Exp $"
#ident "$Id: pform.h,v 1.30 1999/08/27 15:08:37 steve Exp $"
#endif
# include "netlist.h"
@ -148,7 +148,10 @@ extern void pform_make_modgates(const string&type,
/* Make a continuous assignment node, with optional bit- or part- select. */
extern PGAssign* pform_make_pgassign(PExpr*lval, PExpr*rval,
svector<PExpr*>*delays);
extern void pform_make_pgassign_list(svector<PExpr*>*alist,
svector<PExpr*>*del,
const string& text,
unsigned lineno);
/* Given a port type and a list of names, make a list of wires that
can be used as task port information. */
@ -169,6 +172,9 @@ extern void pform_dump(ostream&out, Module*mod);
/*
* $Log: pform.h,v $
* Revision 1.30 1999/08/27 15:08:37 steve
* continuous assignment lists.
*
* Revision 1.29 1999/08/25 22:22:41 steve
* elaborate some aspects of functions.
*