Carry some line info to the netlist,
Dump line numbers for processes. Elaborate prints errors about port vector width mismatch Emit better handles null statements.
This commit is contained in:
parent
8e73ccf8f8
commit
a7ad8985ac
14
LineInfo.h
14
LineInfo.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: LineInfo.h,v 1.1 1999/01/25 05:45:56 steve Exp $"
|
||||
#ident "$Id: LineInfo.h,v 1.2 1999/02/01 00:26:48 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <cstdio>
|
||||
|
|
@ -34,6 +34,11 @@ class LineInfo {
|
|||
return file_ + ":" + buf;
|
||||
}
|
||||
|
||||
void set_line(const LineInfo&that)
|
||||
{ file_ = that.file_;
|
||||
lineno_ = that.lineno_;
|
||||
}
|
||||
|
||||
void set_file(const string&f) { file_ = f; }
|
||||
void set_lineno(unsigned n) { lineno_ = n; }
|
||||
|
||||
|
|
@ -44,6 +49,13 @@ class LineInfo {
|
|||
|
||||
/*
|
||||
* $Log: LineInfo.h,v $
|
||||
* Revision 1.2 1999/02/01 00:26:48 steve
|
||||
* Carry some line info to the netlist,
|
||||
* Dump line numbers for processes.
|
||||
* Elaborate prints errors about port vector
|
||||
* width mismatch
|
||||
* Emit better handles null statements.
|
||||
*
|
||||
* Revision 1.1 1999/01/25 05:45:56 steve
|
||||
* Add the LineInfo class to carry the source file
|
||||
* location of things. PGate, Statement and PProcess.
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: design_dump.cc,v 1.9 1998/12/20 02:05:41 steve Exp $"
|
||||
#ident "$Id: design_dump.cc,v 1.10 1999/02/01 00:26:48 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -260,10 +260,10 @@ void NetProcTop::dump(ostream&o, unsigned ind) const
|
|||
{
|
||||
switch (type_) {
|
||||
case NetProcTop::KINITIAL:
|
||||
o << "initial" << endl;
|
||||
o << "initial /* " << get_line() << " */" << endl;
|
||||
break;
|
||||
case NetProcTop::KALWAYS:
|
||||
o << "always" << endl;
|
||||
o << "always /* " << get_line() << " */" << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -338,9 +338,13 @@ void NetPEvent::dump(ostream&o, unsigned ind) const
|
|||
o << "wait (" << name() << ")";
|
||||
break;
|
||||
}
|
||||
o << endl;
|
||||
|
||||
if (statement_) {
|
||||
o << endl;
|
||||
statement_->dump(o, ind+2);
|
||||
} else {
|
||||
o << " /* noop */;" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -464,6 +468,13 @@ void Design::dump(ostream&o) const
|
|||
|
||||
/*
|
||||
* $Log: design_dump.cc,v $
|
||||
* Revision 1.10 1999/02/01 00:26:48 steve
|
||||
* Carry some line info to the netlist,
|
||||
* Dump line numbers for processes.
|
||||
* Elaborate prints errors about port vector
|
||||
* width mismatch
|
||||
* Emit better handles null statements.
|
||||
*
|
||||
* Revision 1.9 1998/12/20 02:05:41 steve
|
||||
* Function to calculate wire initial value.
|
||||
*
|
||||
|
|
|
|||
33
elaborate.cc
33
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.11 1999/01/25 05:45:56 steve Exp $"
|
||||
#ident "$Id: elaborate.cc,v 1.12 1999/02/01 00:26:49 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -226,6 +226,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, const string&path) const
|
|||
"of parameters. Expecting " << rmod->ports.size() <<
|
||||
", got " << pin_count() << "."
|
||||
<< endl;
|
||||
des->errors += 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -246,6 +247,17 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, const string&path) const
|
|||
rmod->ports[idx]->name);
|
||||
assert(prt);
|
||||
|
||||
// Check that the parts have matching pin counts. If
|
||||
// not, they are different widths.
|
||||
if (prt->pin_count() != sig->pin_count()) {
|
||||
cerr << get_line() << ": Port " <<
|
||||
rmod->ports[idx]->name << " of " << type_ <<
|
||||
" expects " << prt->pin_count() << " pins, got " <<
|
||||
sig->pin_count() << " from " << sig->name() << endl;
|
||||
des->errors += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
assert(prt->pin_count() == sig->pin_count());
|
||||
switch (prt->port_type()) {
|
||||
// INPUT and OUTPUT ports are directional. Handle
|
||||
|
|
@ -672,14 +684,21 @@ NetProc* PDelayStatement::elaborate(Design*des, const string&path) const
|
|||
/*
|
||||
* An event statement gets elaborated as a gate net that drives a
|
||||
* special node, the NetPEvent. The NetPEvent is also a NetProc class
|
||||
* becuase execution flows through it. Thus, the NetPEvent connects
|
||||
* because execution flows through it. Thus, the NetPEvent connects
|
||||
* the structural and the behavioral.
|
||||
*
|
||||
* Note that it is possible for the statement_ pointer to be 0. This
|
||||
* happens when the source has something like "@(E) ;". Note the null
|
||||
* statement.
|
||||
*/
|
||||
NetProc* PEventStatement::elaborate(Design*des, const string&path) const
|
||||
{
|
||||
NetProc*enet = statement_->elaborate(des, path);
|
||||
NetProc*enet = 0;
|
||||
if (statement_) {
|
||||
enet = statement_->elaborate(des, path);
|
||||
if (enet == 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
NetPEvent*ev = new NetPEvent(des->local_symbol(path), type_, enet);
|
||||
|
||||
|
|
@ -794,6 +813,7 @@ bool Module::elaborate(Design*des, const string&path) const
|
|||
break;
|
||||
}
|
||||
|
||||
top->set_line(*(*st));
|
||||
des->add_process(top);
|
||||
}
|
||||
|
||||
|
|
@ -831,6 +851,13 @@ Design* elaborate(const map<string,Module*>&modules,
|
|||
|
||||
/*
|
||||
* $Log: elaborate.cc,v $
|
||||
* Revision 1.12 1999/02/01 00:26:49 steve
|
||||
* Carry some line info to the netlist,
|
||||
* Dump line numbers for processes.
|
||||
* Elaborate prints errors about port vector
|
||||
* width mismatch
|
||||
* Emit better handles null statements.
|
||||
*
|
||||
* Revision 1.11 1999/01/25 05:45:56 steve
|
||||
* Add the LineInfo class to carry the source file
|
||||
* location of things. PGate, Statement and PProcess.
|
||||
|
|
|
|||
14
emit.cc
14
emit.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: emit.cc,v 1.4 1998/12/01 00:42:14 steve Exp $"
|
||||
#ident "$Id: emit.cc,v 1.5 1999/02/01 00:26:49 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -67,6 +67,7 @@ void NetBUFZ::emit_node(ostream&o, struct target_t*tgt) const
|
|||
|
||||
void NetProcTop::emit(ostream&o, struct target_t*tgt) const
|
||||
{
|
||||
assert(statement_);
|
||||
tgt->start_process(o, this);
|
||||
|
||||
statement_->emit_proc(o, tgt);
|
||||
|
|
@ -101,7 +102,7 @@ void NetPDelay::emit_proc(ostream&o, struct target_t*tgt) const
|
|||
|
||||
void NetPDelay::emit_proc_recurse(ostream&o, struct target_t*tgt) const
|
||||
{
|
||||
statement_->emit_proc(o, tgt);
|
||||
if (statement_) statement_->emit_proc(o, tgt);
|
||||
}
|
||||
|
||||
void NetPEvent::emit_proc(ostream&o, struct target_t*tgt) const
|
||||
|
|
@ -111,7 +112,7 @@ void NetPEvent::emit_proc(ostream&o, struct target_t*tgt) const
|
|||
|
||||
void NetPEvent::emit_proc_recurse(ostream&o, struct target_t*tgt) const
|
||||
{
|
||||
statement_->emit_proc(o, tgt);
|
||||
if (statement_) statement_->emit_proc(o, tgt);
|
||||
}
|
||||
|
||||
void NetTask::emit_proc(ostream&o, struct target_t*tgt) const
|
||||
|
|
@ -223,6 +224,13 @@ void emit(ostream&o, const Design*des, const char*type)
|
|||
|
||||
/*
|
||||
* $Log: emit.cc,v $
|
||||
* Revision 1.5 1999/02/01 00:26:49 steve
|
||||
* Carry some line info to the netlist,
|
||||
* Dump line numbers for processes.
|
||||
* Elaborate prints errors about port vector
|
||||
* width mismatch
|
||||
* Emit better handles null statements.
|
||||
*
|
||||
* Revision 1.4 1998/12/01 00:42:14 steve
|
||||
* Elaborate UDP devices,
|
||||
* Support UDP type attributes, and
|
||||
|
|
|
|||
13
main.cc
13
main.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: main.cc,v 1.12 1999/01/24 01:35:36 steve Exp $"
|
||||
#ident "$Id: main.cc,v 1.13 1999/02/01 00:26:49 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <stdio.h>
|
||||
|
|
@ -188,6 +188,10 @@ int main(int argc, char*argv[])
|
|||
cerr << "Unable to elaborate design." << endl;
|
||||
return 1;
|
||||
}
|
||||
if (des->errors) {
|
||||
cerr << des->errors << " error(s) elaborating design." << endl;
|
||||
return des->errors;
|
||||
}
|
||||
|
||||
des->set_flags(flags);
|
||||
|
||||
|
|
@ -224,6 +228,13 @@ int main(int argc, char*argv[])
|
|||
|
||||
/*
|
||||
* $Log: main.cc,v $
|
||||
* Revision 1.13 1999/02/01 00:26:49 steve
|
||||
* Carry some line info to the netlist,
|
||||
* Dump line numbers for processes.
|
||||
* Elaborate prints errors about port vector
|
||||
* width mismatch
|
||||
* Emit better handles null statements.
|
||||
*
|
||||
* Revision 1.12 1999/01/24 01:35:36 steve
|
||||
* Support null target for generating no output.
|
||||
*
|
||||
|
|
|
|||
17
netlist.h
17
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.15 1998/12/20 02:05:41 steve Exp $"
|
||||
#ident "$Id: netlist.h,v 1.16 1999/02/01 00:26:49 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -31,6 +31,7 @@
|
|||
# include <string>
|
||||
# include <map>
|
||||
# include "verinum.h"
|
||||
# include "LineInfo.h"
|
||||
|
||||
class NetNode;
|
||||
class NetProc;
|
||||
|
|
@ -662,7 +663,7 @@ class NetWhile : public NetProc {
|
|||
/* The is the top of any process. It carries the type (initial or
|
||||
always) and a pointer to the statement, probably a block, that
|
||||
makes up the process. */
|
||||
class NetProcTop {
|
||||
class NetProcTop : public LineInfo {
|
||||
|
||||
public:
|
||||
enum Type { KINITIAL, KALWAYS };
|
||||
|
|
@ -819,7 +820,7 @@ class NetESignal : public NetExpr {
|
|||
class Design {
|
||||
|
||||
public:
|
||||
Design() : signals_(0), nodes_(0), procs_(0), lcounter_(0) { }
|
||||
Design() : errors(0), signals_(0), nodes_(0), procs_(0), lcounter_(0) { }
|
||||
|
||||
/* The flags are a generic way of accepting command line
|
||||
parameters/flags and passing them to the processing steps
|
||||
|
|
@ -856,6 +857,9 @@ class Design {
|
|||
void clear_signal_marks();
|
||||
NetNet*find_signal(bool (*test)(const NetNet*));
|
||||
|
||||
// This is incremented by elaboration when an error is
|
||||
// detected. It prevents code being emitted.
|
||||
unsigned errors;
|
||||
|
||||
public:
|
||||
string local_symbol(const string&path);
|
||||
|
|
@ -921,6 +925,13 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
|||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.16 1999/02/01 00:26:49 steve
|
||||
* Carry some line info to the netlist,
|
||||
* Dump line numbers for processes.
|
||||
* Elaborate prints errors about port vector
|
||||
* width mismatch
|
||||
* Emit better handles null statements.
|
||||
*
|
||||
* Revision 1.15 1998/12/20 02:05:41 steve
|
||||
* Function to calculate wire initial value.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: pform_dump.cc,v 1.7 1998/12/01 00:42:14 steve Exp $"
|
||||
#ident "$Id: pform_dump.cc,v 1.8 1999/02/01 00:26:49 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -99,16 +99,16 @@ void PWire::dump(ostream&out) const
|
|||
|
||||
switch (port_type) {
|
||||
case NetNet::PIMPLICIT:
|
||||
out << "(implicit input) ";
|
||||
out << " (implicit input)";
|
||||
break;
|
||||
case NetNet::PINPUT:
|
||||
out << "(input) ";
|
||||
out << " (input)";
|
||||
break;
|
||||
case NetNet::POUTPUT:
|
||||
out << "(output) ";
|
||||
out << " (output)";
|
||||
break;
|
||||
case NetNet::PINOUT:
|
||||
out << "(input output) ";
|
||||
out << " (input output)";
|
||||
break;
|
||||
case NetNet::NOT_A_PORT:
|
||||
break;
|
||||
|
|
@ -116,10 +116,10 @@ void PWire::dump(ostream&out) const
|
|||
|
||||
if (lsb || msb) {
|
||||
assert(lsb && msb);
|
||||
out << "[" << *msb << ":" << *lsb << "] ";
|
||||
out << " [" << *msb << ":" << *lsb << "]";
|
||||
}
|
||||
|
||||
out << name << ";" << endl;
|
||||
out << " " << name << ";" << endl;
|
||||
for (map<string,string>::const_iterator idx = attributes.begin()
|
||||
; idx != attributes.end()
|
||||
; idx ++) {
|
||||
|
|
@ -182,13 +182,15 @@ void Statement::dump(ostream&out, unsigned ind) const
|
|||
so just print the C++ typeid and let the user figure
|
||||
it out. */
|
||||
out << setw(ind) << "";
|
||||
out << "/* " << typeid(*this) .name() << " */ ;" << endl;
|
||||
out << "/* " << get_line() << ": " << typeid(*this).name()
|
||||
<< " */ ;" << endl;
|
||||
}
|
||||
|
||||
void PAssign::dump(ostream&out, unsigned ind) const
|
||||
{
|
||||
out << setw(ind) << "";
|
||||
out << to_name_ << " = " << *expr_ << ";" << endl;
|
||||
out << to_name_ << " = " << *expr_ << ";";
|
||||
out << " /* " << get_line() << " */" << endl;
|
||||
}
|
||||
|
||||
void PBlock::dump(ostream&out, unsigned ind) const
|
||||
|
|
@ -254,9 +256,14 @@ void PEventStatement::dump(ostream&out, unsigned ind) const
|
|||
out << "positive ";
|
||||
break;
|
||||
}
|
||||
out << *expr_ << ")" << endl;
|
||||
out << *expr_ << ")";
|
||||
|
||||
if (statement_) {
|
||||
out << endl;
|
||||
statement_->dump(out, ind+2);
|
||||
} else {
|
||||
out << " ;" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void PForStatement::dump(ostream&out, unsigned ind) const
|
||||
|
|
@ -277,13 +284,15 @@ void PProcess::dump(ostream&out, unsigned ind) const
|
|||
{
|
||||
switch (type_) {
|
||||
case PProcess::PR_INITIAL:
|
||||
out << setw(ind) << "" << "initial" << endl;
|
||||
out << setw(ind) << "" << "initial";
|
||||
break;
|
||||
case PProcess::PR_ALWAYS:
|
||||
out << setw(ind) << "" << "always" << endl;
|
||||
out << setw(ind) << "" << "always";
|
||||
break;
|
||||
}
|
||||
|
||||
out << " /* " << get_line() << " */" << endl;
|
||||
|
||||
statement_->dump(out, ind+2);
|
||||
}
|
||||
|
||||
|
|
@ -364,6 +373,13 @@ void PUdp::dump(ostream&out) const
|
|||
|
||||
/*
|
||||
* $Log: pform_dump.cc,v $
|
||||
* Revision 1.8 1999/02/01 00:26:49 steve
|
||||
* Carry some line info to the netlist,
|
||||
* Dump line numbers for processes.
|
||||
* Elaborate prints errors about port vector
|
||||
* width mismatch
|
||||
* Emit better handles null statements.
|
||||
*
|
||||
* Revision 1.7 1998/12/01 00:42:14 steve
|
||||
* Elaborate UDP devices,
|
||||
* Support UDP type attributes, and
|
||||
|
|
|
|||
Loading…
Reference in New Issue