Enhance dump() for function definitions.

This patch enhances dump() for function definitions, by indicating a
signed result with a prepended "+" and also printing the MSB and LSB.
This matches other dump() routines. It also prints the arguments with
the same information. The arguments also include their type "input",
"output" or "inout".
This commit is contained in:
Cary R 2008-03-19 14:34:34 -07:00 committed by Stephen Williams
parent a2ea980a7a
commit 77722a62c2
1 changed files with 29 additions and 3 deletions

View File

@ -840,9 +840,35 @@ void NetForever::dump(ostream&o, unsigned ind) const
void NetFuncDef::dump(ostream&o, unsigned ind) const
{
o << setw(ind) << "" << "function definition for " << scope_path(scope_) << endl;
if (result_sig_)
o << setw(ind+2) << "" << "Return signal: "
<< result_sig_->name() << endl;
if (result_sig_) {
o << setw(ind+2) << "" << "Return signal: ";
if (result_sig_->get_signed()) o << "+";
o << result_sig_->name() << "[" << result_sig_->msb() << ":"
<< result_sig_->lsb() << "]" << endl;
}
o << setw(ind+2) << "" << "Arguments: ";
if (port_count() == 0) o << "<none>";
o << endl;
for (unsigned idx = 0; idx < port_count(); idx += 1) {
o << setw(ind+4) << "" << "Arg[" << idx+1 << "] = ";
switch (port(idx)->port_type()) {
default:
o << "implicit-port? ";
break;
case NetNet::PINPUT:
o << "input ";
break;
case NetNet::POUTPUT:
o << "output ";
break;
case NetNet::PINOUT:
o << "inout ";
break;
}
if (port(idx)->get_signed()) o << "+";
o << port(idx)->name() << "[" << port(idx)->msb() << ":"
<< port(idx)->lsb() << "]" << endl;
}
if (statement_)
statement_->dump(o, ind+2);
else