Ejemplo n.º 1
0
void CirGate::netflow(int &cnt, bool flag[]) const
{   assert(getTypeStr() != "UNDEF");
    if (flag[_id]) return;
    for (int i = 0; i < _fanin.size(); ++i)
    {   CirGate* ptr = (CirGate*)(_fanin[i] & ~(size_t)(0x1));
        if (ptr->getTypeStr() != "UNDEF")
            ptr->netflow(cnt, flag);
    }

    flag[_id] = true; // Visited
    cout << "["<< cnt++ << "] ";
    if (getTypeStr() == "CONST")
        cout << "CONST0";
    else if (getTypeStr() == "AIG")
        cout << "AIG";
    else if (getTypeStr() == "PI")
        cout << "PI ";
    else if (getTypeStr() == "PO")
        cout << "PO ";
    if (_id) cout << " " << _id;
    for (int i = 0; i < _fanin.size(); ++i)
    {   cout << " ";
        CirGate* ptr = (CirGate*)(_fanin[i] & ~(size_t)0x1);
        if (ptr->getTypeStr() == "UNDEF") cout << "*";
        if (_fanin[i] & 1) cout << "!";
        cout << ptr->_id;
    }
    if (getTypeStr() == "PI" && ((CirPiGate*)this)->_name != "") cout << " (" << ((CirPiGate*)this)->_name << ")";
    if (getTypeStr() == "PO" && ((CirPoGate*)this)->_name != "") cout << " (" << ((CirPoGate*)this)->_name << ")";
    cout << endl;
}
Ejemplo n.º 2
0
void CirGate::netflow(bool flag[], vector<CirGate*>& list, bool checkDel) const
{   if (flag[_id]) return;
    if (checkDel && getType() == PI_GATE) return ;
    for (int i = 0; i < _fanin.size(); ++i)
    {   CirGate* ptr = (CirGate*)(_fanin[i] & ~(size_t)(0x1));
        if (checkDel || ptr->getType() != UNDEF_GATE)
            ptr->netflow(flag, list, checkDel);
    }

    flag[_id] = true; // Visited
    list.push_back((CirGate*)this);
}