From f3a91a10b37f957bac4b84850f0a6e76b993c3ef Mon Sep 17 00:00:00 2001 From: steve Date: Wed, 2 Jun 1999 15:38:46 +0000 Subject: [PATCH] Line information with nets. --- PWire.h | 8 ++++++-- elaborate.cc | 6 +++++- netlist.cc | 10 +++++++--- netlist.h | 7 +++++-- parse.y | 16 +++++++++++----- pform.cc | 18 +++++++++++++----- pform.h | 12 +++++++++--- 7 files changed, 56 insertions(+), 21 deletions(-) diff --git a/PWire.h b/PWire.h index e9ca7b870..5139f6fe4 100644 --- a/PWire.h +++ b/PWire.h @@ -19,10 +19,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: PWire.h,v 1.3 1999/04/19 01:59:36 steve Exp $" +#ident "$Id: PWire.h,v 1.4 1999/06/02 15:38:46 steve Exp $" #endif # include "netlist.h" +# include "LineInfo.h" # include class ostream; class PExpr; @@ -33,7 +34,7 @@ class Design; * a port by declaration, so ports are not seperate. The module * identifies a port by keeping it in its port list. */ -class PWire { +class PWire : public LineInfo { public: PWire(const string&n, NetNet::Type t =NetNet::IMPLICIT) @@ -67,6 +68,9 @@ class PWire { /* * $Log: PWire.h,v $ + * Revision 1.4 1999/06/02 15:38:46 steve + * Line information with nets. + * * Revision 1.3 1999/04/19 01:59:36 steve * Add memories to the parse and elaboration phases. * diff --git a/elaborate.cc b/elaborate.cc index b9e92ac09..1cd61523f 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: elaborate.cc,v 1.31 1999/05/31 15:45:35 steve Exp $" +#ident "$Id: elaborate.cc,v 1.32 1999/06/02 15:38:46 steve Exp $" #endif /* @@ -162,6 +162,7 @@ void PWire::elaborate(Design*des, const string&path) const } else { NetNet*sig = new NetNet(path + "." + name, wtype, wid); + sig->set_line(*this); sig->port_type(port_type); sig->set_attributes(attributes); des->add_signal(sig); @@ -1247,6 +1248,9 @@ Design* elaborate(const map&modules, /* * $Log: elaborate.cc,v $ + * Revision 1.32 1999/06/02 15:38:46 steve + * Line information with nets. + * * Revision 1.31 1999/05/31 15:45:35 steve * Fix error message. * diff --git a/netlist.cc b/netlist.cc index cef105641..604e0b1a5 100644 --- a/netlist.cc +++ b/netlist.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: netlist.cc,v 1.29 1999/05/30 01:11:46 steve Exp $" +#ident "$Id: netlist.cc,v 1.30 1999/06/02 15:38:46 steve Exp $" #endif # include @@ -527,6 +527,7 @@ NetEMemory* NetEMemory::dup_expr() const NetESignal::NetESignal(NetNet*n) : NetExpr(n->pin_count()), NetNode(n->name(), n->pin_count()) { + set_line(*n); for (unsigned idx = 0 ; idx < n->pin_count() ; idx += 1) { connect(pin(idx), n->pin(idx)); } @@ -539,8 +540,8 @@ NetESignal::~NetESignal() bool NetESignal::set_width(unsigned w) { if (w != pin_count()) { - cerr << get_line() << ": Width of " << w << " does not match " - << *this << endl; + cerr << get_line() << ": " << *this << " cannot be made " + << w << " bits wide." << endl; return false; } assert(w == pin_count()); @@ -1068,6 +1069,9 @@ NetNet* Design::find_signal(bool (*func)(const NetNet*)) /* * $Log: netlist.cc,v $ + * Revision 1.30 1999/06/02 15:38:46 steve + * Line information with nets. + * * Revision 1.29 1999/05/30 01:11:46 steve * Exressions are trees that can duplicate, and not DAGS. * diff --git a/netlist.h b/netlist.h index 246cf71c2..ffa7225e3 100644 --- a/netlist.h +++ b/netlist.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: netlist.h,v 1.33 1999/05/30 01:11:46 steve Exp $" +#ident "$Id: netlist.h,v 1.34 1999/06/02 15:38:46 steve Exp $" #endif /* @@ -212,7 +212,7 @@ class NetNode : public NetObj { * of the NetObj class is used to make a set of identical wires, in * order to support ranges, or busses. */ -class NetNet : public NetObj { +class NetNet : public NetObj, public LineInfo { public: enum Type { IMPLICIT, WIRE, TRI, TRI1, SUPPLY0, WAND, TRIAND, @@ -1165,6 +1165,9 @@ extern ostream& operator << (ostream&, NetNet::Type); /* * $Log: netlist.h,v $ + * Revision 1.34 1999/06/02 15:38:46 steve + * Line information with nets. + * * Revision 1.33 1999/05/30 01:11:46 steve * Exressions are trees that can duplicate, and not DAGS. * diff --git a/parse.y b/parse.y index 1c7efabe9..fd910881d 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.31 1999/06/02 02:56:29 steve Exp $" +#ident "$Id: parse.y,v 1.32 1999/06/02 15:38:46 steve Exp $" #endif # include "parse_misc.h" @@ -795,7 +795,7 @@ module module_item : net_type range_opt list_of_variables ';' - { pform_makewire($3, $1); + { pform_makewire(@1, $3, $1); if ($2) { pform_set_net_range($3, $2); delete $2; @@ -803,7 +803,7 @@ module_item delete $3; } | net_type range_opt net_decl_assigns ';' - { pform_makewire($3, $1); + { pform_makewire(@1, $3, $1); if ($2) { pform_set_net_range($3, $2); delete $2; @@ -944,11 +944,15 @@ port : IDENTIFIER { $$ = new PWire(*$1, NetNet::IMPLICIT); $$->port_type = NetNet::PIMPLICIT; + $$->set_file(@1.text); + $$->set_lineno(@1.first_line); delete $1; } | IDENTIFIER '[' expression ':' expression ']' { PWire*tmp = new PWire(*$1, NetNet::IMPLICIT); tmp->port_type = NetNet::PIMPLICIT; + tmp->set_file(@1.text); + tmp->set_lineno(@1.first_line); if (!pform_expression_is_constant($3)) { yyerror(@3, "msb expression of port bit select " "must be constant."); @@ -970,6 +974,8 @@ port { yyerror(@1, "invalid port bit select"); $$ = new PWire(*$1, NetNet::IMPLICIT); $$->port_type = NetNet::PIMPLICIT; + $$->set_file(@1.text); + $$->set_lineno(@1.first_line); delete $1; } ; @@ -1058,11 +1064,11 @@ range_or_type_opt so that bit ranges can be assigned. */ register_variable : IDENTIFIER - { pform_makewire(*$1, NetNet::REG); + { pform_makewire(@1, *$1, NetNet::REG); $$ = $1; } | IDENTIFIER '[' expression ':' expression ']' - { pform_makewire(*$1, NetNet::REG); + { pform_makewire(@1, *$1, NetNet::REG); if (! pform_expression_is_constant($3)) yyerror(@3, "msb of register range must be constant."); if (! pform_expression_is_constant($5)) diff --git a/pform.cc b/pform.cc index e371d818b..b08396b6f 100644 --- a/pform.cc +++ b/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.21 1999/05/31 15:45:59 steve Exp $" +#ident "$Id: pform.cc,v 1.22 1999/06/02 15:38:46 steve Exp $" #endif # include "pform.h" @@ -353,13 +353,15 @@ PGAssign* pform_make_pgassign(PExpr*lval, PExpr*rval) return cur; } -void pform_makewire(const string&name, NetNet::Type type) +void pform_makewire(const vlltype&li, const string&name, + NetNet::Type type) { PWire*cur = cur_module->get_wire(name); if (cur) { if (cur->type != NetNet::IMPLICIT) { strstream msg; - msg << "Duplicate definition of " << name << "."; + msg << name << " previously defined at " << + cur->get_line() << "."; VLerror(msg.str()); } cur->type = type; @@ -367,15 +369,18 @@ void pform_makewire(const string&name, NetNet::Type type) } cur = new PWire(name, type); + cur->set_file(li.text); + cur->set_lineno(li.first_line); cur_module->add_wire(cur); } -void pform_makewire(const list*names, NetNet::Type type) +void pform_makewire(const vlltype&li, const list*names, + NetNet::Type type) { for (list::const_iterator cur = names->begin() ; cur != names->end() ; cur ++ ) - pform_makewire(*cur, type); + pform_makewire(li, *cur, type); } @@ -556,6 +561,9 @@ int pform_parse(const char*path, map&modules, /* * $Log: pform.cc,v $ + * Revision 1.22 1999/06/02 15:38:46 steve + * Line information with nets. + * * Revision 1.21 1999/05/31 15:45:59 steve * makegates infinite loop fixed. * diff --git a/pform.h b/pform.h index c6a54fd6c..2f77a2e53 100644 --- a/pform.h +++ b/pform.h @@ -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.16 1999/05/29 02:36:17 steve Exp $" +#ident "$Id: pform.h,v 1.17 1999/06/02 15:38:46 steve Exp $" #endif # include "netlist.h" @@ -55,6 +55,7 @@ */ class PGate; class PExpr; +struct vlltype; /* * These type are lexical types -- that is, types that are used as @@ -105,8 +106,10 @@ extern void pform_make_udp(string*name, list*parms, * The makewire functions announce to the pform code new wires. These * go into a module that is currently opened. */ -extern void pform_makewire(const string&name, NetNet::Type type = NetNet::IMPLICIT); -extern void pform_makewire(const list*names, NetNet::Type type); +extern void pform_makewire(const struct vlltype&li, const string&name, + NetNet::Type type = NetNet::IMPLICIT); +extern void pform_makewire(const struct vlltype&li, const list*names, + NetNet::Type type); extern void pform_set_port_type(list*names, NetNet::PortType); extern void pform_set_net_range(list*names, const svector*); extern void pform_set_reg_idx(const string&name, PExpr*l, PExpr*r); @@ -148,6 +151,9 @@ extern void pform_dump(ostream&out, Module*mod); /* * $Log: pform.h,v $ + * Revision 1.17 1999/06/02 15:38:46 steve + * Line information with nets. + * * Revision 1.16 1999/05/29 02:36:17 steve * module parameter bind by name. *