From 77722a62c2b43306984739c8b28c47537ca12ea9 Mon Sep 17 00:00:00 2001 From: Cary R Date: Wed, 19 Mar 2008 14:34:34 -0700 Subject: [PATCH] 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". --- design_dump.cc | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/design_dump.cc b/design_dump.cc index 8d166d66b..f95842476 100644 --- a/design_dump.cc +++ b/design_dump.cc @@ -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 << ""; + 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