Cleanup unused junk in NetAddSub class.

This class was old, and its original design pulled literally from
the LPM reference. But of nine pins declared, only 4 were used.
Remove all the excess junk and clean up the designed dump handling
of the device.
This commit is contained in:
Stephen Williams 2008-09-13 18:28:43 -07:00
parent 7d6b391572
commit 0339e9eb1e
3 changed files with 33 additions and 37 deletions

View File

@ -241,10 +241,14 @@ void NetNode::dump_node(ostream&o, unsigned ind) const
/* This is the generic dumping of all the signals connected to each
pin of the object. The "this" object is not printed, only the
signals connected to this. */
void NetPins::dump_node_pins(ostream&o, unsigned ind) const
void NetPins::dump_node_pins(ostream&o, unsigned ind, const char**pin_names) const
{
for (unsigned idx = 0 ; idx < pin_count() ; idx += 1) {
o << setw(ind) << "" << idx << " pin" << idx;
o << setw(ind) << "" << idx;
if (pin_names && pin_names[idx])
o << " " << pin_names[idx];
else
o << " pin" << idx;
switch (pin(idx).get_dir()) {
case Link::PASSIVE:
@ -293,7 +297,14 @@ void NetAddSub::dump_node(ostream&o, unsigned ind) const
o << setw(ind) << "" << "Adder (NetAddSub): " << name()
<< " width=" << width() << " pin_count=" << pin_count()
<< endl;
dump_node_pins(o, ind+4);
static const char* pin_names[] = {
"Cout ",
"DataA ",
"DataB ",
"Result"
};
dump_node_pins(o, ind+4, pin_names);
dump_obj_attr(o, ind+4);
}

View File

@ -1083,28 +1083,18 @@ unsigned NetAbs::width() const
/*
* The NetAddSub class represents an LPM_ADD_SUB device. The pinout is
* assigned like so:
* 0 -- Add_Sub
* 1 -- Aclr
* 2 -- Clock
* 3 -- Cin
* 4 -- Cout
* 5 -- Overflow
* 6 -- DataA (normally a vector)
* 7 -- DataB (normally a vector)
* 8 -- Result (normally a vector)
* 0 -- Cout
* 1 -- DataA (normally a vector)
* 2 -- DataB (normally a vector)
* 3 -- Result (normally a vector)
*/
NetAddSub::NetAddSub(NetScope*s, perm_string n, unsigned w)
: NetNode(s, n, 9), width_(w)
: NetNode(s, n, 4), width_(w)
{
pin(0).set_dir(Link::INPUT);
pin(1).set_dir(Link::INPUT);
pin(2).set_dir(Link::INPUT);
pin(3).set_dir(Link::INPUT);
pin(4).set_dir(Link::OUTPUT);
pin(5).set_dir(Link::OUTPUT);
pin(6).set_dir(Link::INPUT);
pin(7).set_dir(Link::INPUT);
pin(8).set_dir(Link::OUTPUT);
pin(0).set_dir(Link::OUTPUT); // Cout
pin(1).set_dir(Link::INPUT); // DataA
pin(2).set_dir(Link::INPUT); // DataB
pin(3).set_dir(Link::OUTPUT); // Result
}
NetAddSub::~NetAddSub()
@ -1118,42 +1108,42 @@ unsigned NetAddSub::width()const
Link& NetAddSub::pin_Cout()
{
return pin(4);
return pin(0);
}
const Link& NetAddSub::pin_Cout() const
{
return pin(4);
return pin(0);
}
Link& NetAddSub::pin_DataA()
{
return pin(6);
return pin(1);
}
const Link& NetAddSub::pin_DataA() const
{
return pin(6);
return pin(1);
}
Link& NetAddSub::pin_DataB()
{
return pin(7);
return pin(2);
}
const Link& NetAddSub::pin_DataB() const
{
return pin(7);
return pin(2);
}
Link& NetAddSub::pin_Result()
{
return pin(8);
return pin(3);
}
const Link& NetAddSub::pin_Result() const
{
return pin(8);
return pin(3);
}
NetArrayDq::NetArrayDq(NetScope*s, perm_string n, NetNet*mem, unsigned awid)
@ -1313,6 +1303,7 @@ void NetCompare::set_signed(bool flag)
signed_flag_ = flag;
}
Link& NetCompare::pin_Aclr()
{
return pin(0);

View File

@ -89,7 +89,7 @@ class NetPins : public LineInfo {
Link&pin(unsigned idx);
const Link&pin(unsigned idx) const;
void dump_node_pins(ostream&, unsigned) const;
void dump_node_pins(ostream&, unsigned, const char**pin_names =0) const;
private:
Link*pins_;
@ -907,13 +907,7 @@ class NetAddSub : public NetNode {
// operands and results).
unsigned width() const;
Link& pin_Aclr();
Link& pin_Add_Sub();
Link& pin_Clock();
Link& pin_Cin();
Link& pin_Cout();
Link& pin_Overflow();
Link& pin_DataA();
Link& pin_DataB();
Link& pin_Result();