ABC_NAMESPACE_IMPL_START //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// /**Function************************************************************* Synopsis [Node type conversions.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ char * Ptr_HopToType( Abc_Obj_t * pObj ) { static word uTruth, uTruths6[3] = { ABC_CONST(0xAAAAAAAAAAAAAAAA), ABC_CONST(0xCCCCCCCCCCCCCCCC), ABC_CONST(0xF0F0F0F0F0F0F0F0), }; assert( Abc_ObjIsNode(pObj) ); uTruth = Hop_ManComputeTruth6( (Hop_Man_t *)Abc_ObjNtk(pObj)->pManFunc, (Hop_Obj_t *)pObj->pData, Abc_ObjFaninNum(pObj) ); /* if ( uTruth == 0 ) return "BAC_BOX_C0"; if ( uTruth == ~(word)0 ) return "BAC_BOX_C1"; if ( uTruth == uTruths6[0] ) return "BAC_BOX_BUF"; if ( uTruth == ~uTruths6[0] ) return "BAC_BOX_INV"; if ( uTruth == (uTruths6[0] & uTruths6[1]) ) return "BAC_BOX_AND"; if ( uTruth ==~(uTruths6[0] & uTruths6[1]) ) return "BAC_BOX_NAND"; if ( uTruth == (uTruths6[0] | uTruths6[1]) ) return "BAC_BOX_OR"; if ( uTruth ==~(uTruths6[0] | uTruths6[1]) ) return "BAC_BOX_NOR"; if ( uTruth == (uTruths6[0] ^ uTruths6[1]) ) return "BAC_BOX_XOR"; if ( uTruth ==~(uTruths6[0] ^ uTruths6[1]) ) return "BAC_BOX_XNOR"; */ if ( uTruth == 0 ) return "Const0T"; if ( uTruth == ~(word)0 ) return "Const1T"; if ( uTruth == uTruths6[0] ) return "BufT"; if ( uTruth == ~uTruths6[0] ) return "InvT"; if ( uTruth == (uTruths6[0] & uTruths6[1]) ) return "AndT"; if ( uTruth ==~(uTruths6[0] & uTruths6[1]) ) return "NandT"; if ( uTruth == (uTruths6[0] | uTruths6[1]) ) return "OrT"; if ( uTruth ==~(uTruths6[0] | uTruths6[1]) ) return "NorT"; if ( uTruth == (uTruths6[0] ^ uTruths6[1]) ) return "XorT"; if ( uTruth ==~(uTruths6[0] ^ uTruths6[1]) ) return "XnorT"; assert( 0 ); return NULL; }
Vec_Ptr_t * Cba_ManCollectGateNamesByTruth( Mio_Library_t * pLib ) { static word uTruths6[3] = { ABC_CONST(0xAAAAAAAAAAAAAAAA), ABC_CONST(0xCCCCCCCCCCCCCCCC), ABC_CONST(0xF0F0F0F0F0F0F0F0), }; Vec_Ptr_t * vGateNames = Vec_PtrStart( PTR_GATE_UNKNOWN ); Cba_ManCollectGateNameOne( pLib, PTR_GATE_C0, 0, vGateNames ); Cba_ManCollectGateNameOne( pLib, PTR_GATE_C1, ~(word)0, vGateNames ); Cba_ManCollectGateNameOne( pLib, PTR_GATE_BUF, uTruths6[0], vGateNames ); Cba_ManCollectGateNameOne( pLib, PTR_GATE_INV, ~uTruths6[0], vGateNames ); Cba_ManCollectGateNameOne( pLib, PTR_GATE_AND, (uTruths6[0] & uTruths6[1]), vGateNames ); Cba_ManCollectGateNameOne( pLib, PTR_GATE_NAND, ~(uTruths6[0] & uTruths6[1]), vGateNames ); Cba_ManCollectGateNameOne( pLib, PTR_GATE_OR, (uTruths6[0] | uTruths6[1]), vGateNames ); Cba_ManCollectGateNameOne( pLib, PTR_GATE_NOR, ~(uTruths6[0] | uTruths6[1]), vGateNames ); Cba_ManCollectGateNameOne( pLib, PTR_GATE_XOR, (uTruths6[0] ^ uTruths6[1]), vGateNames ); Cba_ManCollectGateNameOne( pLib, PTR_GATE_XNOR, ~(uTruths6[0] ^ uTruths6[1]), vGateNames ); return vGateNames; }
// returns the first shift from the left in word x that has One bit in it. // blockSize = ShiftSize/4 inline int firstShiftWithOneBit(word x, int blockSize) { int n = 0; if(blockSize == 16){ return 0;} if (x >= ABC_CONST(0x0000000100000000)) {n = n + 32; x = x >> 32;}
Synopsis [Truth table minimization procedures for up to 16 vars.] Author [Jake] Date [Started - September 2012] ***********************************************************************/ #include "luckyInt.h" //#define LUCKY_VERIFY ABC_NAMESPACE_IMPL_START static word SFmask[5][4] = { {ABC_CONST(0x8888888888888888),ABC_CONST(0x4444444444444444),ABC_CONST(0x2222222222222222),ABC_CONST(0x1111111111111111)}, {ABC_CONST(0xC0C0C0C0C0C0C0C0),ABC_CONST(0x3030303030303030),ABC_CONST(0x0C0C0C0C0C0C0C0C),ABC_CONST(0x0303030303030303)}, {ABC_CONST(0xF000F000F000F000),ABC_CONST(0x0F000F000F000F00),ABC_CONST(0x00F000F000F000F0),ABC_CONST(0x000F000F000F000F)}, {ABC_CONST(0xFF000000FF000000),ABC_CONST(0x00FF000000FF0000),ABC_CONST(0x0000FF000000FF00),ABC_CONST(0x000000FF000000FF)}, {ABC_CONST(0xFFFF000000000000),ABC_CONST(0x0000FFFF00000000),ABC_CONST(0x00000000FFFF0000),ABC_CONST(0x000000000000FFFF)} }; // we need next two functions only for verification of lucky method in debugging mode void swapAndFlip(word* pAfter, int nVars, int iVarInPosition, int jVar, char * pCanonPerm, unsigned* pUCanonPhase) { int Temp; swap_ij(pAfter, nVars, iVarInPosition, jVar); Temp = pCanonPerm[iVarInPosition]; pCanonPerm[iVarInPosition] = pCanonPerm[jVar]; pCanonPerm[jVar] = Temp;
#include "gia.h" #include "misc/vec/vecMem.h" #include "misc/vec/vecWec.h" #include "misc/util/utilTruth.h" #include "opt/dau/dau.h" ABC_NAMESPACE_IMPL_START //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// static word s_Truth6[6] = { ABC_CONST(0xAAAAAAAAAAAAAAAA), ABC_CONST(0xCCCCCCCCCCCCCCCC), ABC_CONST(0xF0F0F0F0F0F0F0F0), ABC_CONST(0xFF00FF00FF00FF00), ABC_CONST(0xFFFF0000FFFF0000), ABC_CONST(0xFFFFFFFF00000000) }; static inline word * Gla_ObjTruthElem( Gia_Man_t * p, int i ) { return (word *)Vec_PtrEntry( p->vTtInputs, i ); } static inline word * Gla_ObjTruthNodeId( Gia_Man_t * p, int Id ) { return Vec_WrdArray(p->vTtMemory) + p->nTtWords * Id; } static inline word * Gla_ObjTruthNode( Gia_Man_t * p, Gia_Obj_t * pObj ) { return Vec_WrdArray(p->vTtMemory) + p->nTtWords * Gia_ObjNum(p, pObj); } static inline word * Gla_ObjTruthFree1( Gia_Man_t * p ) { return Vec_WrdArray(p->vTtMemory) + Vec_WrdSize(p->vTtMemory) - p->nTtWords * 1; } static inline word * Gla_ObjTruthFree2( Gia_Man_t * p ) { return Vec_WrdArray(p->vTtMemory) + Vec_WrdSize(p->vTtMemory) - p->nTtWords * 2; } static inline word * Gla_ObjTruthConst0( Gia_Man_t * p, word * pDst ) { int w; for ( w = 0; w < p->nTtWords; w++ ) pDst[w] = 0; return pDst; } static inline word * Gla_ObjTruthDup( Gia_Man_t * p, word * pDst, word * pSrc, int c ) { int w; for ( w = 0; w < p->nTtWords; w++ ) pDst[w] = c ? ~pSrc[w] : pSrc[w]; return pDst; }
Synopsis [Swapping variables in the truth table.] Author [Jake] Date [Started - August 2012] ***********************************************************************/ #include "luckyInt.h" ABC_NAMESPACE_IMPL_START static word mask0[6] = { ABC_CONST(0x5555555555555555),ABC_CONST(0x3333333333333333), ABC_CONST(0x0F0F0F0F0F0F0F0F),ABC_CONST(0x00FF00FF00FF00FF),ABC_CONST(0x0000FFFF0000FFFF), ABC_CONST(0x00000000FFFFFFFF)}; /* static word mask1[6] = { 0xAAAAAAAAAAAAAAAA,0xCCCCCCCCCCCCCCCC, 0xF0F0F0F0F0F0F0F0,0xFF00FF00FF00FF00,0xFFFF0000FFFF0000, 0xFFFFFFFF00000000 }; static word mask[6][2] = { {0x5555555555555555,0xAAAAAAAAAAAAAAAA}, {0x3333333333333333,0xCCCCCCCCCCCCCCCC}, {0x0F0F0F0F0F0F0F0F,0xF0F0F0F0F0F0F0F0}, {0x00FF00FF00FF00FF,0xFF00FF00FF00FF00}, {0x0000FFFF0000FFFF,0xFFFF0000FFFF0000}, {0x00000000FFFFFFFF,0xFFFFFFFF00000000} }; */ int Kit_TruthWordNum_64bit( int nVars ) { return nVars <= 6 ? 1 : (1 << (nVars - 6));} int Kit_WordCountOnes_64bit(word x)