Line information with nets.

This commit is contained in:
steve 1999-06-02 15:38:46 +00:00
parent 2a85ee5059
commit f3a91a10b3
7 changed files with 56 additions and 21 deletions

View File

@ -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 <map>
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.
*

View File

@ -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<string,Module*>&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.
*

View File

@ -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 <cassert>
@ -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.
*

View File

@ -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.
*

16
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.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))

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.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<string>*names, NetNet::Type type)
void pform_makewire(const vlltype&li, const list<string>*names,
NetNet::Type type)
{
for (list<string>::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<string,Module*>&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.
*

12
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.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<string>*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<string>*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<string>*names,
NetNet::Type type);
extern void pform_set_port_type(list<string>*names, NetNet::PortType);
extern void pform_set_net_range(list<string>*names, const svector<PExpr*>*);
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.
*