Add some debug convenience functions.
This commit is contained in:
parent
58ec35a6af
commit
c1e533d484
|
|
@ -237,6 +237,68 @@ ostream& operator <<(ostream&o, struct __ObjectPathManip marg)
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ostream& operator <<(ostream&fd, Link::DIR dir)
|
||||||
|
{
|
||||||
|
switch (dir) {
|
||||||
|
case Link::PASSIVE:
|
||||||
|
fd << "PASSIVE";
|
||||||
|
break;
|
||||||
|
case Link::INPUT:
|
||||||
|
fd << "INPUT";
|
||||||
|
break;
|
||||||
|
case Link::OUTPUT:
|
||||||
|
fd << "OUTPUT";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fd << "<" << (int)dir << ">";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetPins::show_type(ostream&fd) const
|
||||||
|
{
|
||||||
|
fd << typeid(*this).name();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetObj::show_type(ostream&fd) const
|
||||||
|
{
|
||||||
|
fd << typeid(*this).name() << "[" << scope_path(scope_) << "." << name_ << "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
struct __ShowTypeManip { const NetPins*pins; };
|
||||||
|
inline __ShowTypeManip show_type(const NetPins*pins)
|
||||||
|
{ __ShowTypeManip tmp; tmp.pins = pins; return tmp; }
|
||||||
|
|
||||||
|
inline ostream& operator << (ostream&fd, __ShowTypeManip man)
|
||||||
|
{
|
||||||
|
if (man.pins == 0)
|
||||||
|
fd << "NexusSet";
|
||||||
|
else
|
||||||
|
man.pins->show_type(fd);
|
||||||
|
return fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Link::dump_link(ostream&fd, unsigned ind) const
|
||||||
|
{
|
||||||
|
const Link*cur;
|
||||||
|
const Nexus*nex = nexus();
|
||||||
|
|
||||||
|
if (nex == 0) {
|
||||||
|
fd << setw(ind) << "" << "<unlinked>" << endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (cur = nex->first_nlink() ; cur; cur = cur->next_nlink()) {
|
||||||
|
const NetPins*obj = cur->get_obj();
|
||||||
|
unsigned pin = cur->get_pin();
|
||||||
|
fd << setw(ind) << "" << "Pin " << pin
|
||||||
|
<< " of " << show_type(obj)
|
||||||
|
<< ", dir=" << cur->dir_ << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void NetBranch::dump(ostream&o, unsigned ind) const
|
void NetBranch::dump(ostream&o, unsigned ind) const
|
||||||
{
|
{
|
||||||
static const char*pin_names[2] = {
|
static const char*pin_names[2] = {
|
||||||
|
|
|
||||||
|
|
@ -561,6 +561,8 @@ void NetNet::calculate_slice_widths_from_packed_dims_(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const list<netrange_t> NetNet::not_an_array;
|
||||||
|
|
||||||
NetNet::NetNet(NetScope*s, perm_string n, Type t,
|
NetNet::NetNet(NetScope*s, perm_string n, Type t,
|
||||||
const list<netrange_t>&unpacked, ivl_type_t use_net_type)
|
const list<netrange_t>&unpacked, ivl_type_t use_net_type)
|
||||||
: NetObj(s, n, calculate_count(unpacked)),
|
: NetObj(s, n, calculate_count(unpacked)),
|
||||||
|
|
|
||||||
10
netlist.h
10
netlist.h
|
|
@ -161,6 +161,8 @@ class Link {
|
||||||
NetPins*get_obj();
|
NetPins*get_obj();
|
||||||
unsigned get_pin() const;
|
unsigned get_pin() const;
|
||||||
|
|
||||||
|
void dump_link(ostream&fd, unsigned ind) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// The NetNode manages these. They point back to the
|
// The NetNode manages these. They point back to the
|
||||||
// NetNode so that following the links can get me here.
|
// NetNode so that following the links can get me here.
|
||||||
|
|
@ -208,6 +210,10 @@ class NetPins : public LineInfo {
|
||||||
bool pins_are_virtual(void) const;
|
bool pins_are_virtual(void) const;
|
||||||
void devirtualize_pins(void);
|
void devirtualize_pins(void);
|
||||||
|
|
||||||
|
// This is for showing a brief description of the object to
|
||||||
|
// the stream. It is used for debug and diagnostics.
|
||||||
|
virtual void show_type(std::ostream&fd) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Link*pins_;
|
Link*pins_;
|
||||||
const unsigned npins_;
|
const unsigned npins_;
|
||||||
|
|
@ -258,6 +264,8 @@ class NetObj : public NetPins, public Attrib {
|
||||||
|
|
||||||
void dump_obj_attr(ostream&, unsigned) const;
|
void dump_obj_attr(ostream&, unsigned) const;
|
||||||
|
|
||||||
|
virtual void show_type(std::ostream&fd) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NetScope*scope_;
|
NetScope*scope_;
|
||||||
perm_string name_;
|
perm_string name_;
|
||||||
|
|
@ -642,6 +650,8 @@ class NetNet : public NetObj, public PortType {
|
||||||
|
|
||||||
typedef PortType::Enum PortType;
|
typedef PortType::Enum PortType;
|
||||||
|
|
||||||
|
static const std::list<netrange_t>not_an_array;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// This form is the more generic form of the constructor. For
|
// This form is the more generic form of the constructor. For
|
||||||
// now, the unpacked type is not buried into an ivl_type_s object.
|
// now, the unpacked type is not buried into an ivl_type_s object.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue