ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
rrr::BddAnalyzer< Ntk > Class Template Reference

#include <rrrBddAnalyzer.h>

Public Member Functions

 BddAnalyzer ()
 
 BddAnalyzer (Parameter const *pPar)
 
 ~BddAnalyzer ()
 
void AssignNetwork (Ntk *pNtk_, bool fReuse)
 
bool CheckRedundancy (int id, int idx)
 
bool CheckFeasibility (int id, int fi, bool c)
 
void ResetSummary ()
 
summary< int > GetStatsSummary () const
 
summary< double > GetTimesSummary () const
 

Detailed Description

template<typename Ntk>
class rrr::BddAnalyzer< Ntk >

Definition at line 12 of file rrrBddAnalyzer.h.

Constructor & Destructor Documentation

◆ BddAnalyzer() [1/2]

template<typename Ntk>
rrr::BddAnalyzer< Ntk >::BddAnalyzer ( )

Definition at line 602 of file rrrBddAnalyzer.h.

602 :
603 pNtk(NULL),
604 nVerbose(0),
605 fInitialized(false),
606 pBdd(NULL),
607 target(-1),
608 fResim(false) {
609 ResetSummary();
610 }
Here is the call graph for this function:

◆ BddAnalyzer() [2/2]

template<typename Ntk>
rrr::BddAnalyzer< Ntk >::BddAnalyzer ( Parameter const * pPar)

Definition at line 613 of file rrrBddAnalyzer.h.

613 :
614 pNtk(NULL),
615 nVerbose(pPar->nAnalyzerVerbose),
616 fInitialized(false),
617 pBdd(NULL),
618 target(-1),
619 fResim(false) {
620 ResetSummary();
621 }
Here is the call graph for this function:

◆ ~BddAnalyzer()

template<typename Ntk>
rrr::BddAnalyzer< Ntk >::~BddAnalyzer ( )

Definition at line 624 of file rrrBddAnalyzer.h.

624 {
625 Reset();
626 }

Member Function Documentation

◆ AssignNetwork()

template<typename Ntk>
void rrr::BddAnalyzer< Ntk >::AssignNetwork ( Ntk * pNtk_,
bool fReuse )

Definition at line 629 of file rrrBddAnalyzer.h.

629 {
630 Reset(fReuse);
631 pNtk = pNtk_;
633 }

◆ CheckFeasibility()

template<typename Ntk>
bool rrr::BddAnalyzer< Ntk >::CheckFeasibility ( int id,
int fi,
bool c )

Definition at line 675 of file rrrBddAnalyzer.h.

675 {
676 if(!fInitialized) {
677 Initialize();
678 } else if(target != id && (target == -1 || vUpdates[target])) {
679 // resimulation is required if there are pending updates in TFI of new fanin
680 // but it seems not worthwhile to check that condition every time
681 // so we update if pending updates are not only at current target
682 Simulate();
683 }
684 target = id;
685 Cspf(id, false);
687 bool fFeasible = false;
688 switch(pNtk->GetNodeType(id)) {
689 case AND: {
690 lit x = pBdd->Or(pBdd->LitNot(vFs[id]), vGs[id]);
691 IncRef(x);
692 lit y = pBdd->Or(x, pBdd->LitNotCond(vFs[fi], c));
693 DecRef(x);
694 if(pBdd->IsConst1(y)) {
695 fFeasible = true;
696 }
697 break;
698 }
699 default:
700 assert(0);
701 }
702 if(nVerbose) {
703 if(fFeasible) {
704 std::cout << "node " << id << " fanin " << (c? "!": "") << fi << " is feasible" << std::endl;
705 } else {
706 std::cout << "node " << id << " fanin " << (c? "!": "") << fi << " is NOT feasible" << std::endl;
707 }
708 }
709 durationCheck += Duration(timeStart, GetCurrentTime());
710 return fFeasible;
711 }
#define assert(ex)
Definition util_old.h:213

◆ CheckRedundancy()

template<typename Ntk>
bool rrr::BddAnalyzer< Ntk >::CheckRedundancy ( int id,
int idx )

Definition at line 640 of file rrrBddAnalyzer.h.

640 {
641 if(!fInitialized) {
642 Initialize();
643 } else if(fResim) {
644 Simulate();
645 fResim = false;
646 }
647 Cspf(id);
649 bool fRedundant = false;
650 switch(pNtk->GetNodeType(id)) {
651 case AND: {
652 int fi = pNtk->GetFanin(id, idx);
653 bool c = pNtk->GetCompl(id, idx);
654 lit x = pBdd->Or(pBdd->LitNotCond(vFs[fi], c), vvCs[id][idx]);
655 if(pBdd->IsConst1(x)) {
656 fRedundant = true;
657 }
658 break;
659 }
660 default:
661 assert(0);
662 }
663 if(nVerbose) {
664 if(fRedundant) {
665 std::cout << "node " << id << " fanin " << (pNtk->GetCompl(id, idx)? "!": "") << pNtk->GetFanin(id, idx) << " index " << idx << " is redundant" << std::endl;
666 } else {
667 std::cout << "node " << id << " fanin " << (pNtk->GetCompl(id, idx)? "!": "") << pNtk->GetFanin(id, idx) << " index " << idx << " is NOT redundant" << std::endl;
668 }
669 }
670 durationCheck += Duration(timeStart, GetCurrentTime());
671 return fRedundant;
672 }

◆ GetStatsSummary()

template<typename Ntk>
summary< int > rrr::BddAnalyzer< Ntk >::GetStatsSummary ( ) const

Definition at line 732 of file rrrBddAnalyzer.h.

732 {
734 v.emplace_back("bdd node", pBdd->GetNumTotalCreatedNodes() - nNodesOld + nNodesAccumulated);
735 return v;
736 }

◆ GetTimesSummary()

template<typename Ntk>
summary< double > rrr::BddAnalyzer< Ntk >::GetTimesSummary ( ) const

Definition at line 739 of file rrrBddAnalyzer.h.

739 {
741 v.emplace_back("bdd symbolic simulation", durationSimulation);
742 v.emplace_back("bdd care computation", durationPf);
743 v.emplace_back("bdd check", durationCheck);
744 v.emplace_back("bdd reorder", durationReorder);
745 return v;
746 }

◆ ResetSummary()

template<typename Ntk>
void rrr::BddAnalyzer< Ntk >::ResetSummary ( )

Definition at line 718 of file rrrBddAnalyzer.h.

718 {
719 if(pBdd) {
720 nNodesOld = pBdd->GetNumTotalCreatedNodes();
721 } else {
722 nNodesOld = 0;
723 }
724 nNodesAccumulated = 0;
725 durationSimulation = 0;
726 durationPf = 0;
727 durationCheck = 0;
728 durationReorder = 0;
729 }
Here is the caller graph for this function:

The documentation for this class was generated from the following file: