Task/functions can have signed ports.

This commit is contained in:
steve 2003-06-13 00:27:09 +00:00
parent 83dfce00d2
commit dc90f0d52d
3 changed files with 33 additions and 10 deletions

29
parse.y
View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if HAVE_CVS_IDENT #if HAVE_CVS_IDENT
#ident "$Id: parse.y,v 1.177 2003/04/28 17:50:57 steve Exp $" #ident "$Id: parse.y,v 1.178 2003/06/13 00:27:09 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -992,20 +992,30 @@ expr_primary
function_item function_item
: K_input range_opt list_of_identifiers ';' : K_input range_opt list_of_identifiers ';'
{ svector<PWire*>*tmp { svector<PWire*>*tmp
= pform_make_task_ports(NetNet::PINPUT, $2, $3, = pform_make_task_ports(NetNet::PINPUT, false,
$2, $3,
@1.text, @1.first_line);
$$ = tmp;
}
| K_input K_signed range_opt list_of_identifiers ';'
{ svector<PWire*>*tmp
= pform_make_task_ports(NetNet::PINPUT, true,
$3, $4,
@1.text, @1.first_line); @1.text, @1.first_line);
$$ = tmp; $$ = tmp;
} }
| K_output range_opt list_of_identifiers ';' | K_output range_opt list_of_identifiers ';'
{ svector<PWire*>*tmp { svector<PWire*>*tmp
= pform_make_task_ports(NetNet::PINPUT, $2, $3, = pform_make_task_ports(NetNet::PINPUT, false,
$2, $3,
@1.text, @1.first_line); @1.text, @1.first_line);
$$ = tmp; $$ = tmp;
yyerror(@1, "Functions may not have output ports."); yyerror(@1, "Functions may not have output ports.");
} }
| K_inout range_opt list_of_identifiers ';' | K_inout range_opt list_of_identifiers ';'
{ svector<PWire*>*tmp { svector<PWire*>*tmp
= pform_make_task_ports(NetNet::PINPUT, $2, $3, = pform_make_task_ports(NetNet::PINPUT, false,
$2, $3,
@1.text, @1.first_line); @1.text, @1.first_line);
$$ = tmp; $$ = tmp;
yyerror(@1, "Functions may not have inout ports."); yyerror(@1, "Functions may not have inout ports.");
@ -2717,19 +2727,22 @@ task_item
{ $$ = new svector<PWire*>(0); } { $$ = new svector<PWire*>(0); }
| K_input range_opt list_of_identifiers ';' | K_input range_opt list_of_identifiers ';'
{ svector<PWire*>*tmp { svector<PWire*>*tmp
= pform_make_task_ports(NetNet::PINPUT, $2, = pform_make_task_ports(NetNet::PINPUT, false,
$3, @1.text, @1.first_line); $2, $3,
@1.text, @1.first_line);
$$ = tmp; $$ = tmp;
} }
| K_output range_opt list_of_identifiers ';' | K_output range_opt list_of_identifiers ';'
{ svector<PWire*>*tmp { svector<PWire*>*tmp
= pform_make_task_ports(NetNet::POUTPUT, $2, $3, = pform_make_task_ports(NetNet::POUTPUT, false,
$2, $3,
@1.text, @1.first_line); @1.text, @1.first_line);
$$ = tmp; $$ = tmp;
} }
| K_inout range_opt list_of_identifiers ';' | K_inout range_opt list_of_identifiers ';'
{ svector<PWire*>*tmp { svector<PWire*>*tmp
= pform_make_task_ports(NetNet::PINOUT, $2, $3, = pform_make_task_ports(NetNet::PINOUT, false,
$2, $3,
@1.text, @1.first_line); @1.text, @1.first_line);
$$ = tmp; $$ = tmp;
} }

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: pform.cc,v 1.113 2003/04/28 17:50:57 steve Exp $" #ident "$Id: pform.cc,v 1.114 2003/06/13 00:27:09 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -1121,6 +1121,7 @@ void pform_set_port_type(const char*nm, NetNet::PortType pt,
* no output or inout ports. * no output or inout ports.
*/ */
svector<PWire*>*pform_make_task_ports(NetNet::PortType pt, svector<PWire*>*pform_make_task_ports(NetNet::PortType pt,
bool signed_flag,
svector<PExpr*>*range, svector<PExpr*>*range,
list<char*>*names, list<char*>*names,
const char* file, const char* file,
@ -1146,6 +1147,8 @@ svector<PWire*>*pform_make_task_ports(NetNet::PortType pt,
pform_cur_module->add_wire(curw); pform_cur_module->add_wire(curw);
} }
curw->set_signed(signed_flag);
/* If there is a range involved, it needs to be set. */ /* If there is a range involved, it needs to be set. */
if (range) if (range)
curw->set_range((*range)[0], (*range)[1]); curw->set_range((*range)[0], (*range)[1]);
@ -1466,6 +1469,9 @@ int pform_parse(const char*path, FILE*file)
/* /*
* $Log: pform.cc,v $ * $Log: pform.cc,v $
* Revision 1.114 2003/06/13 00:27:09 steve
* Task/functions can have signed ports.
*
* Revision 1.113 2003/04/28 17:50:57 steve * Revision 1.113 2003/04/28 17:50:57 steve
* More 2001 port declaration support. * More 2001 port declaration support.
* *

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: pform.h,v 1.70 2003/04/28 17:50:57 steve Exp $" #ident "$Id: pform.h,v 1.71 2003/06/13 00:27:09 steve Exp $"
#endif #endif
# include "netlist.h" # include "netlist.h"
@ -264,6 +264,7 @@ extern void pform_make_pgassign_list(svector<PExpr*>*alist,
/* Given a port type and a list of names, make a list of wires that /* Given a port type and a list of names, make a list of wires that
can be used as task port information. */ can be used as task port information. */
extern svector<PWire*>*pform_make_task_ports(NetNet::PortType pt, extern svector<PWire*>*pform_make_task_ports(NetNet::PortType pt,
bool signed_flag,
svector<PExpr*>*range, svector<PExpr*>*range,
list<char*>*names, list<char*>*names,
const char* file, const char* file,
@ -280,6 +281,9 @@ extern void pform_dump(ostream&out, Module*mod);
/* /*
* $Log: pform.h,v $ * $Log: pform.h,v $
* Revision 1.71 2003/06/13 00:27:09 steve
* Task/functions can have signed ports.
*
* Revision 1.70 2003/04/28 17:50:57 steve * Revision 1.70 2003/04/28 17:50:57 steve
* More 2001 port declaration support. * More 2001 port declaration support.
* *