summaryrefslogtreecommitdiffstats
path: root/src/aig/dar
diff options
context:
space:
mode:
Diffstat (limited to 'src/aig/dar')
-rw-r--r--src/aig/dar/dar.h428
-rw-r--r--src/aig/dar/darBalance.c129
-rw-r--r--src/aig/dar/darCheck.c121
-rw-r--r--src/aig/dar/darCore.c151
-rw-r--r--src/aig/dar/darCut.c303
-rw-r--r--src/aig/dar/darData.c1684
-rw-r--r--src/aig/dar/darDfs.c381
-rw-r--r--src/aig/dar/darInt.h158
-rw-r--r--src/aig/dar/darLib.c312
-rw-r--r--src/aig/dar/darMan.c189
-rw-r--r--src/aig/dar/darMem.c601
-rw-r--r--src/aig/dar/darObj.c308
-rw-r--r--src/aig/dar/darOper.c429
-rw-r--r--src/aig/dar/darSeq.c497
-rw-r--r--src/aig/dar/darTable.c279
-rw-r--r--src/aig/dar/darTruth.c111
-rw-r--r--src/aig/dar/darUtil.c625
-rw-r--r--src/aig/dar/module.make10
18 files changed, 2520 insertions, 4196 deletions
diff --git a/src/aig/dar/dar.h b/src/aig/dar/dar.h
index 8e82cdf4..cff2785b 100644
--- a/src/aig/dar/dar.h
+++ b/src/aig/dar/dar.h
@@ -29,14 +29,6 @@ extern "C" {
/// INCLUDES ///
////////////////////////////////////////////////////////////////////////
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <time.h>
-
-#include "vec.h"
-
////////////////////////////////////////////////////////////////////////
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
@@ -46,434 +38,34 @@ extern "C" {
////////////////////////////////////////////////////////////////////////
typedef struct Dar_Par_t_ Dar_Par_t;
-typedef struct Dar_Man_t_ Dar_Man_t;
-typedef struct Dar_Obj_t_ Dar_Obj_t;
-typedef struct Dar_Cut_t_ Dar_Cut_t;
-typedef struct Dar_Cnf_t_ Dar_Cnf_t;
-typedef struct Dar_MmFixed_t_ Dar_MmFixed_t;
-typedef struct Dar_MmFlex_t_ Dar_MmFlex_t;
-typedef struct Dar_MmStep_t_ Dar_MmStep_t;
-
-// the maximum number of cuts stored at a node
-#define DAR_CUT_BASE 64
-// object types
-typedef enum {
- DAR_AIG_NONE, // 0: non-existent object
- DAR_AIG_CONST1, // 1: constant 1
- DAR_AIG_PI, // 2: primary input
- DAR_AIG_PO, // 3: primary output
- DAR_AIG_BUF, // 4: buffer node
- DAR_AIG_AND, // 5: AND node
- DAR_AIG_EXOR, // 6: EXOR node
- DAR_AIG_LATCH, // 7: latch
- DAR_AIG_VOID // 8: unused object
-} Dar_Type_t;
-
-// the parameters
+// the rewriting parameters
struct Dar_Par_t_
{
- int fUpdateLevel;
- int fUseZeros;
- int fVerbose;
- int fVeryVerbose;
-};
-
-// the AIG 4-cut
-struct Dar_Cut_t_ // 8 words
-{
- unsigned uSign;
- unsigned uTruth : 16; // the truth table of the cut function
- unsigned Cost : 5; // the cost of the cut in terms of CNF clauses
- unsigned FanRefs : 4; // the average number of fanin references
- unsigned NoRefs : 3; // the average number of fanin references
- unsigned nLeaves : 3; // the number of leaves
- unsigned fBest : 1; // marks the best cut
- int pLeaves[4]; // the array of leaves
-// unsigned char pIndices[4];
- float Area; // the area flow or exact area of the cut
-};
-
-// the AIG node
-struct Dar_Obj_t_ // 8 words
-{
- void * pData; // misc (cuts, copy, etc)
- Dar_Obj_t * pNext; // strashing table
- Dar_Obj_t * pFanin0; // fanin
- Dar_Obj_t * pFanin1; // fanin
- unsigned long Type : 3; // object type
- unsigned long fPhase : 1; // value under 000...0 pattern
- unsigned long fMarkA : 1; // multipurpose mask
- unsigned long fMarkB : 1; // multipurpose mask
- unsigned long nRefs : 26; // reference count
- unsigned Level : 24; // the level of this node
- unsigned nCuts : 8; // the number of cuts
- int TravId; // unique ID of last traversal involving the node
- int Id; // unique ID of the node
-};
-
-// the AIG manager
-struct Dar_Man_t_
-{
- // parameters governing rewriting
- Dar_Par_t * pPars;
- // AIG nodes
- Vec_Ptr_t * vPis; // the array of PIs
- Vec_Ptr_t * vPos; // the array of POs
- Vec_Ptr_t * vObjs; // the array of all nodes (optional)
- Dar_Obj_t * pConst1; // the constant 1 node
- Dar_Obj_t Ghost; // the ghost node
- // AIG node counters
- int nObjs[DAR_AIG_VOID];// the number of objects by type
- int nCreated; // the number of created objects
- int nDeleted; // the number of deleted objects
- // structural hash table
- Dar_Obj_t ** pTable; // structural hash table
- int nTableSize; // structural hash table size
- // 4-input cuts of the nodes
- Dar_Cut_t * pBaseCuts[DAR_CUT_BASE];
- Dar_Cut_t BaseCuts[DAR_CUT_BASE];
- int nBaseCuts;
- int nCutsUsed;
- int nCutsFiltered;
- // current rewriting step
- int nNodesInit; // the original number of nodes
- Vec_Ptr_t * vLeavesBest; // the best set of leaves
- int OutBest; // the best output (in the library)
- int OutNumBest; // the best number of the output
- int GainBest; // the best gain
- int LevelBest; // the level of node with the best gain
- int ClassBest; // the equivalence class of the best replacement
- int nTotalSubgs; // the total number of subgraphs tried
- int ClassTimes[222];// the runtimes for each class
- int ClassGains[222];// the gains for each class
- int ClassSubgs[222];// the graphs for each class
- int nCutMemUsed; // memory used for cuts
- // various data members
- Dar_MmFixed_t * pMemObjs; // memory manager for objects
- Dar_MmFlex_t * pMemCuts; // memory manager for cuts
- Vec_Int_t * vRequired; // the required times
- int nLevelMax; // maximum number of levels
- void * pData; // the temporary data
- int nTravIds; // the current traversal ID
- int fCatchExor; // enables EXOR nodes
- // CNF mapping
- void * pManCnf; // CNF conversion manager
- // rewriting statistics
- int nCutsBad;
- int nCutsGood;
- // timing statistics
- int timeCuts;
- int timeEval;
- int timeOther;
- int timeTotal;
- int time1;
- int time2;
-};
-
-// the CNF asserting outputs of AIG to be 1
-struct Dar_Cnf_t_
-{
- Dar_Man_t * pMan; // the AIG manager, for which CNF is computed
- int nLiterals; // the number of CNF literals
- int nClauses; // the number of CNF clauses
- int ** pClauses; // the CNF clauses
- int * pVarNums; // the number of CNF variable for each node ID (-1 if unused)
+ int nCutsMax; // the maximum number of cuts to try
+ int nSubgMax; // the maximum number of subgraphs to try
+ int fUpdateLevel; // update level
+ int fUseZeros; // performs zero-cost replacement
+ int fVerbose; // enables verbose output
+ int fVeryVerbose; // enables very verbose output
};
////////////////////////////////////////////////////////////////////////
/// MACRO DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
-#define DAR_MIN(a,b) (((a) < (b))? (a) : (b))
-#define DAR_MAX(a,b) (((a) > (b))? (a) : (b))
-#define DAR_INFINITY (100000000)
-
-#ifndef PRT
-#define PRT(a,t) printf("%s = ", (a)); printf("%6.2f sec\n", (float)(t)/(float)(CLOCKS_PER_SEC))
-#endif
-
-static inline int Dar_BitWordNum( int nBits ) { return (nBits>>5) + ((nBits&31) > 0); }
-static inline int Dar_TruthWordNum( int nVars ) { return nVars <= 5 ? 1 : (1 << (nVars - 5)); }
-static inline int Dar_InfoHasBit( unsigned * p, int i ) { return (p[(i)>>5] & (1<<((i) & 31))) > 0; }
-static inline void Dar_InfoSetBit( unsigned * p, int i ) { p[(i)>>5] |= (1<<((i) & 31)); }
-static inline void Dar_InfoXorBit( unsigned * p, int i ) { p[(i)>>5] ^= (1<<((i) & 31)); }
-
-static inline Dar_Obj_t * Dar_Regular( Dar_Obj_t * p ) { return (Dar_Obj_t *)((unsigned long)(p) & ~01); }
-static inline Dar_Obj_t * Dar_Not( Dar_Obj_t * p ) { return (Dar_Obj_t *)((unsigned long)(p) ^ 01); }
-static inline Dar_Obj_t * Dar_NotCond( Dar_Obj_t * p, int c ) { return (Dar_Obj_t *)((unsigned long)(p) ^ (c)); }
-static inline int Dar_IsComplement( Dar_Obj_t * p ) { return (int )(((unsigned long)p) & 01); }
-
-static inline Dar_Obj_t * Dar_ManConst0( Dar_Man_t * p ) { return Dar_Not(p->pConst1); }
-static inline Dar_Obj_t * Dar_ManConst1( Dar_Man_t * p ) { return p->pConst1; }
-static inline Dar_Obj_t * Dar_ManGhost( Dar_Man_t * p ) { return &p->Ghost; }
-static inline Dar_Obj_t * Dar_ManPi( Dar_Man_t * p, int i ) { return (Dar_Obj_t *)Vec_PtrEntry(p->vPis, i); }
-static inline Dar_Obj_t * Dar_ManPo( Dar_Man_t * p, int i ) { return (Dar_Obj_t *)Vec_PtrEntry(p->vPos, i); }
-static inline Dar_Obj_t * Dar_ManObj( Dar_Man_t * p, int i ) { return p->vObjs ? (Dar_Obj_t *)Vec_PtrEntry(p->vObjs, i) : NULL; }
-
-static inline int Dar_ManPiNum( Dar_Man_t * p ) { return p->nObjs[DAR_AIG_PI]; }
-static inline int Dar_ManPoNum( Dar_Man_t * p ) { return p->nObjs[DAR_AIG_PO]; }
-static inline int Dar_ManBufNum( Dar_Man_t * p ) { return p->nObjs[DAR_AIG_BUF]; }
-static inline int Dar_ManAndNum( Dar_Man_t * p ) { return p->nObjs[DAR_AIG_AND]; }
-static inline int Dar_ManExorNum( Dar_Man_t * p ) { return p->nObjs[DAR_AIG_EXOR]; }
-static inline int Dar_ManLatchNum( Dar_Man_t * p ) { return p->nObjs[DAR_AIG_LATCH]; }
-static inline int Dar_ManNodeNum( Dar_Man_t * p ) { return p->nObjs[DAR_AIG_AND]+p->nObjs[DAR_AIG_EXOR]; }
-static inline int Dar_ManGetCost( Dar_Man_t * p ) { return p->nObjs[DAR_AIG_AND]+3*p->nObjs[DAR_AIG_EXOR]; }
-static inline int Dar_ManObjNum( Dar_Man_t * p ) { return p->nCreated - p->nDeleted; }
-static inline int Dar_ManObjIdMax( Dar_Man_t * p ) { return Vec_PtrSize(p->vObjs); }
-
-static inline Dar_Type_t Dar_ObjType( Dar_Obj_t * pObj ) { return (Dar_Type_t)pObj->Type; }
-static inline int Dar_ObjIsNone( Dar_Obj_t * pObj ) { return pObj->Type == DAR_AIG_NONE; }
-static inline int Dar_ObjIsConst1( Dar_Obj_t * pObj ) { assert(!Dar_IsComplement(pObj)); return pObj->Type == DAR_AIG_CONST1; }
-static inline int Dar_ObjIsPi( Dar_Obj_t * pObj ) { return pObj->Type == DAR_AIG_PI; }
-static inline int Dar_ObjIsPo( Dar_Obj_t * pObj ) { return pObj->Type == DAR_AIG_PO; }
-static inline int Dar_ObjIsBuf( Dar_Obj_t * pObj ) { return pObj->Type == DAR_AIG_BUF; }
-static inline int Dar_ObjIsAnd( Dar_Obj_t * pObj ) { return pObj->Type == DAR_AIG_AND; }
-static inline int Dar_ObjIsExor( Dar_Obj_t * pObj ) { return pObj->Type == DAR_AIG_EXOR; }
-static inline int Dar_ObjIsLatch( Dar_Obj_t * pObj ) { return pObj->Type == DAR_AIG_LATCH; }
-static inline int Dar_ObjIsNode( Dar_Obj_t * pObj ) { return pObj->Type == DAR_AIG_AND || pObj->Type == DAR_AIG_EXOR; }
-static inline int Dar_ObjIsTerm( Dar_Obj_t * pObj ) { return pObj->Type == DAR_AIG_PI || pObj->Type == DAR_AIG_PO || pObj->Type == DAR_AIG_CONST1; }
-static inline int Dar_ObjIsHash( Dar_Obj_t * pObj ) { return pObj->Type == DAR_AIG_AND || pObj->Type == DAR_AIG_EXOR || pObj->Type == DAR_AIG_LATCH; }
-
-static inline int Dar_ObjIsMarkA( Dar_Obj_t * pObj ) { return pObj->fMarkA; }
-static inline void Dar_ObjSetMarkA( Dar_Obj_t * pObj ) { pObj->fMarkA = 1; }
-static inline void Dar_ObjClearMarkA( Dar_Obj_t * pObj ) { pObj->fMarkA = 0; }
-
-static inline void Dar_ObjSetTravId( Dar_Obj_t * pObj, int TravId ) { pObj->TravId = TravId; }
-static inline void Dar_ObjSetTravIdCurrent( Dar_Man_t * p, Dar_Obj_t * pObj ) { pObj->TravId = p->nTravIds; }
-static inline void Dar_ObjSetTravIdPrevious( Dar_Man_t * p, Dar_Obj_t * pObj ) { pObj->TravId = p->nTravIds - 1; }
-static inline int Dar_ObjIsTravIdCurrent( Dar_Man_t * p, Dar_Obj_t * pObj ) { return (int)(pObj->TravId == p->nTravIds); }
-static inline int Dar_ObjIsTravIdPrevious( Dar_Man_t * p, Dar_Obj_t * pObj ) { return (int)(pObj->TravId == p->nTravIds - 1); }
-
-static inline int Dar_ObjTravId( Dar_Obj_t * pObj ) { return (int)pObj->pData; }
-static inline int Dar_ObjPhase( Dar_Obj_t * pObj ) { return pObj->fPhase; }
-static inline int Dar_ObjRefs( Dar_Obj_t * pObj ) { return pObj->nRefs; }
-static inline void Dar_ObjRef( Dar_Obj_t * pObj ) { pObj->nRefs++; }
-static inline void Dar_ObjDeref( Dar_Obj_t * pObj ) { assert( pObj->nRefs > 0 ); pObj->nRefs--; }
-static inline void Dar_ObjClearRef( Dar_Obj_t * pObj ) { pObj->nRefs = 0; }
-static inline int Dar_ObjFaninC0( Dar_Obj_t * pObj ) { return Dar_IsComplement(pObj->pFanin0); }
-static inline int Dar_ObjFaninC1( Dar_Obj_t * pObj ) { return Dar_IsComplement(pObj->pFanin1); }
-static inline Dar_Obj_t * Dar_ObjFanin0( Dar_Obj_t * pObj ) { return Dar_Regular(pObj->pFanin0); }
-static inline Dar_Obj_t * Dar_ObjFanin1( Dar_Obj_t * pObj ) { return Dar_Regular(pObj->pFanin1); }
-static inline Dar_Obj_t * Dar_ObjChild0( Dar_Obj_t * pObj ) { return pObj->pFanin0; }
-static inline Dar_Obj_t * Dar_ObjChild1( Dar_Obj_t * pObj ) { return pObj->pFanin1; }
-static inline Dar_Obj_t * Dar_ObjChild0Copy( Dar_Obj_t * pObj ) { assert( !Dar_IsComplement(pObj) ); return Dar_ObjFanin0(pObj)? Dar_NotCond((Dar_Obj_t *)Dar_ObjFanin0(pObj)->pData, Dar_ObjFaninC0(pObj)) : NULL; }
-static inline Dar_Obj_t * Dar_ObjChild1Copy( Dar_Obj_t * pObj ) { assert( !Dar_IsComplement(pObj) ); return Dar_ObjFanin1(pObj)? Dar_NotCond((Dar_Obj_t *)Dar_ObjFanin1(pObj)->pData, Dar_ObjFaninC1(pObj)) : NULL; }
-static inline int Dar_ObjLevel( Dar_Obj_t * pObj ) { return pObj->nRefs; }
-static inline int Dar_ObjLevelNew( Dar_Obj_t * pObj ) { return 1 + Dar_ObjIsExor(pObj) + DAR_MAX(Dar_ObjFanin0(pObj)->Level, Dar_ObjFanin1(pObj)->Level); }
-static inline int Dar_ObjFaninPhase( Dar_Obj_t * pObj ) { return Dar_Regular(pObj)->fPhase ^ Dar_IsComplement(pObj); }
-static inline void Dar_ObjClean( Dar_Obj_t * pObj ) { memset( pObj, 0, sizeof(Dar_Obj_t) ); }
-static inline int Dar_ObjWhatFanin( Dar_Obj_t * pObj, Dar_Obj_t * pFanin )
-{
- if ( Dar_ObjFanin0(pObj) == pFanin ) return 0;
- if ( Dar_ObjFanin1(pObj) == pFanin ) return 1;
- assert(0); return -1;
-}
-static inline int Dar_ObjFanoutC( Dar_Obj_t * pObj, Dar_Obj_t * pFanout )
-{
- if ( Dar_ObjFanin0(pFanout) == pObj ) return Dar_ObjFaninC0(pObj);
- if ( Dar_ObjFanin1(pFanout) == pObj ) return Dar_ObjFaninC1(pObj);
- assert(0); return -1;
-}
-static inline Dar_Cut_t * Dar_ObjBestCut( Dar_Obj_t * pObj )
-{
- Dar_Cut_t * pCut; int i;
- for ( pCut = pObj->pData, i = 0; i < (int)pObj->nCuts; i++, pCut++ )
- if ( pCut->fBest )
- return pCut;
- return NULL;
-}
-static inline void Dar_ObjSetBestCut( Dar_Cut_t * pCut ) { assert( !pCut->fBest ); pCut->fBest = 1; }
-static inline void Dar_ObjClearBestCut( Dar_Cut_t * pCut ) { assert( pCut->fBest ); pCut->fBest = 0; }
-
-// create the ghost of the new node
-static inline Dar_Obj_t * Dar_ObjCreateGhost( Dar_Man_t * p, Dar_Obj_t * p0, Dar_Obj_t * p1, Dar_Type_t Type )
-{
- Dar_Obj_t * pGhost;
- assert( Type != DAR_AIG_AND || !Dar_ObjIsConst1(Dar_Regular(p0)) );
- assert( p1 == NULL || !Dar_ObjIsConst1(Dar_Regular(p1)) );
- assert( Type == DAR_AIG_PI || Dar_Regular(p0) != Dar_Regular(p1) );
- pGhost = Dar_ManGhost(p);
- pGhost->Type = Type;
- if ( p1 == NULL || Dar_Regular(p0)->Id < Dar_Regular(p1)->Id )
- {
- pGhost->pFanin0 = p0;
- pGhost->pFanin1 = p1;
- }
- else
- {
- pGhost->pFanin0 = p1;
- pGhost->pFanin1 = p0;
- }
- return pGhost;
-}
-
-// internal memory manager
-static inline Dar_Obj_t * Dar_ManFetchMemory( Dar_Man_t * p )
-{
- extern char * Dar_MmFixedEntryFetch( Dar_MmFixed_t * p );
- Dar_Obj_t * pTemp;
- pTemp = (Dar_Obj_t *)Dar_MmFixedEntryFetch( p->pMemObjs );
- memset( pTemp, 0, sizeof(Dar_Obj_t) );
- Vec_PtrPush( p->vObjs, pTemp );
- pTemp->Id = p->nCreated++;
- return pTemp;
-}
-static inline void Dar_ManRecycleMemory( Dar_Man_t * p, Dar_Obj_t * pEntry )
-{
- extern void Dar_MmFixedEntryRecycle( Dar_MmFixed_t * p, char * pEntry );
- assert( pEntry->nRefs == 0 );
- pEntry->Type = DAR_AIG_NONE; // distinquishes a dead node from a live node
- Dar_MmFixedEntryRecycle( p->pMemObjs, (char *)pEntry );
- p->nDeleted++;
-}
-
-
////////////////////////////////////////////////////////////////////////
/// ITERATORS ///
////////////////////////////////////////////////////////////////////////
-// iterator over the primary inputs
-#define Dar_ManForEachPi( p, pObj, i ) \
- Vec_PtrForEachEntry( p->vPis, pObj, i )
-// iterator over the primary outputs
-#define Dar_ManForEachPo( p, pObj, i ) \
- Vec_PtrForEachEntry( p->vPos, pObj, i )
-// iterator over all objects, including those currently not used
-#define Dar_ManForEachObj( p, pObj, i ) \
- Vec_PtrForEachEntry( p->vObjs, pObj, i ) if ( (pObj) == NULL ) {} else
-// iterator over all nodes
-#define Dar_ManForEachNode( p, pObj, i ) \
- Vec_PtrForEachEntry( p->vObjs, pObj, i ) if ( (pObj) == NULL || !Dar_ObjIsNode(pObj) ) {} else
-// iterator over all cuts of the node
-#define Dar_ObjForEachCut( pObj, pCut, i ) \
- for ( pCut = pObj->pData, i = 0; i < (int)pObj->nCuts; i++, pCut++ ) if ( i==0 ) {} else
-// iterator over leaves of the cut
-#define Dar_CutForEachLeaf( p, pCut, pLeaf, i ) \
- for ( i = 0; (i < (int)(pCut)->nLeaves) && ((pLeaf) = Dar_ManObj(p, (pCut)->pLeaves[i])); i++ )
-
////////////////////////////////////////////////////////////////////////
/// FUNCTION DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
-/*=== darBalance.c ========================================================*/
-extern Dar_Man_t * Dar_ManBalance( Dar_Man_t * p, int fUpdateLevel );
-extern Dar_Obj_t * Dar_NodeBalanceBuildSuper( Dar_Man_t * p, Vec_Ptr_t * vSuper, Dar_Type_t Type, int fUpdateLevel );
-/*=== darCheck.c ========================================================*/
-extern int Dar_ManCheck( Dar_Man_t * p );
-/*=== darCnf.c ========================================================*/
-extern Dar_Cnf_t * Dar_ManDeriveCnf( Dar_Man_t * p );
-extern Dar_Cut_t * Dar_ObjFindBestCut( Dar_Obj_t * pObj );
-extern void Dar_CutAssignAreaFlow( Dar_Man_t * p, Dar_Cut_t * pCut );
-extern void Dar_CutAssignArea( Dar_Man_t * p, Dar_Cut_t * pCut );
-extern void Dar_CnfFree( Dar_Cnf_t * pCnf );
/*=== darCore.c ========================================================*/
-extern int Dar_ManRewrite( Dar_Man_t * p );
-extern int Dar_ManComputeCuts( Dar_Man_t * p );
-/*=== darCut.c ========================================================*/
-extern void Dar_ManSetupPis( Dar_Man_t * p );
-extern Dar_Cut_t * Dar_ObjComputeCuts_rec( Dar_Man_t * p, Dar_Obj_t * pObj );
-extern Dar_Cut_t * Dar_ObjComputeCuts( Dar_Man_t * p, Dar_Obj_t * pObj );
-extern void Dar_ManCutsFree( Dar_Man_t * p );
-/*=== darData.c ========================================================*/
-extern Vec_Int_t * Dar_LibReadNodes();
-extern Vec_Int_t * Dar_LibReadOuts();
-/*=== darData2.c ========================================================*/
-extern void Dar_LibReadMsops( char ** ppSopSizes, char *** ppSops );
-/*=== darDfs.c ==========================================================*/
-extern Vec_Ptr_t * Dar_ManDfs( Dar_Man_t * p );
-extern Vec_Ptr_t * Dar_ManDfsNodes( Dar_Man_t * p, Dar_Obj_t ** ppNodes, int nNodes );
-extern int Dar_ManCountLevels( Dar_Man_t * p );
-extern void Dar_ManCreateRefs( Dar_Man_t * p );
-extern int Dar_DagSize( Dar_Obj_t * pObj );
-extern void Dar_ConeUnmark_rec( Dar_Obj_t * pObj );
-extern Dar_Obj_t * Dar_Transfer( Dar_Man_t * pSour, Dar_Man_t * pDest, Dar_Obj_t * pObj, int nVars );
-extern Dar_Obj_t * Dar_Compose( Dar_Man_t * p, Dar_Obj_t * pRoot, Dar_Obj_t * pFunc, int iVar );
-/*=== darLib.c ==========================================================*/
-extern void Dar_LibStart();
-extern void Dar_LibStop();
-extern void Dar_LibEval( Dar_Man_t * p, Dar_Obj_t * pRoot, Dar_Cut_t * pCut, int Required );
-extern Dar_Obj_t * Dar_LibBuildBest( Dar_Man_t * p );
-/*=== darMan.c ==========================================================*/
-extern Dar_Man_t * Dar_ManStart();
-extern Dar_Man_t * Dar_ManStartFrom( Dar_Man_t * p );
-extern Dar_Man_t * Dar_ManDup( Dar_Man_t * p );
-extern void Dar_ManStop( Dar_Man_t * p );
-extern int Dar_ManCleanup( Dar_Man_t * p );
-extern void Dar_ManPrintStats( Dar_Man_t * p );
-extern void Dar_ManPrintRuntime( Dar_Man_t * p );
-/*=== darMem.c ==========================================================*/
-extern void Dar_ManStartMemory( Dar_Man_t * p );
-extern void Dar_ManStopMemory( Dar_Man_t * p );
-/*=== darObj.c ==========================================================*/
-extern Dar_Obj_t * Dar_ObjCreatePi( Dar_Man_t * p );
-extern Dar_Obj_t * Dar_ObjCreatePo( Dar_Man_t * p, Dar_Obj_t * pDriver );
-extern Dar_Obj_t * Dar_ObjCreate( Dar_Man_t * p, Dar_Obj_t * pGhost );
-extern void Dar_ObjConnect( Dar_Man_t * p, Dar_Obj_t * pObj, Dar_Obj_t * pFan0, Dar_Obj_t * pFan1 );
-extern void Dar_ObjDisconnect( Dar_Man_t * p, Dar_Obj_t * pObj );
-extern void Dar_ObjDelete( Dar_Man_t * p, Dar_Obj_t * pObj );
-extern void Dar_ObjDelete_rec( Dar_Man_t * p, Dar_Obj_t * pObj, int fFreeTop );
-extern void Dar_ObjPatchFanin0( Dar_Man_t * p, Dar_Obj_t * pObj, Dar_Obj_t * pFaninNew );
-extern void Dar_ObjReplace( Dar_Man_t * p, Dar_Obj_t * pObjOld, Dar_Obj_t * pObjNew, int fNodesOnly );
-/*=== darOper.c =========================================================*/
-extern Dar_Obj_t * Dar_IthVar( Dar_Man_t * p, int i );
-extern Dar_Obj_t * Dar_Oper( Dar_Man_t * p, Dar_Obj_t * p0, Dar_Obj_t * p1, Dar_Type_t Type );
-extern Dar_Obj_t * Dar_And( Dar_Man_t * p, Dar_Obj_t * p0, Dar_Obj_t * p1 );
-extern Dar_Obj_t * Dar_Latch( Dar_Man_t * p, Dar_Obj_t * pObj, int fInitOne );
-extern Dar_Obj_t * Dar_Or( Dar_Man_t * p, Dar_Obj_t * p0, Dar_Obj_t * p1 );
-extern Dar_Obj_t * Dar_Exor( Dar_Man_t * p, Dar_Obj_t * p0, Dar_Obj_t * p1 );
-extern Dar_Obj_t * Dar_Mux( Dar_Man_t * p, Dar_Obj_t * pC, Dar_Obj_t * p1, Dar_Obj_t * p0 );
-extern Dar_Obj_t * Dar_Maj( Dar_Man_t * p, Dar_Obj_t * pA, Dar_Obj_t * pB, Dar_Obj_t * pC );
-extern Dar_Obj_t * Dar_Miter( Dar_Man_t * p, Vec_Ptr_t * vPairs );
-extern Dar_Obj_t * Dar_CreateAnd( Dar_Man_t * p, int nVars );
-extern Dar_Obj_t * Dar_CreateOr( Dar_Man_t * p, int nVars );
-extern Dar_Obj_t * Dar_CreateExor( Dar_Man_t * p, int nVars );
-/*=== darSeq.c ========================================================*/
-extern int Dar_ManSeqStrash( Dar_Man_t * p, int nLatches, int * pInits );
-/*=== darTable.c ========================================================*/
-extern Dar_Obj_t * Dar_TableLookup( Dar_Man_t * p, Dar_Obj_t * pGhost );
-extern void Dar_TableInsert( Dar_Man_t * p, Dar_Obj_t * pObj );
-extern void Dar_TableDelete( Dar_Man_t * p, Dar_Obj_t * pObj );
-extern int Dar_TableCountEntries( Dar_Man_t * p );
-extern void Dar_TableProfile( Dar_Man_t * p );
-/*=== darUtil.c =========================================================*/
-extern Dar_Par_t * Dar_ManDefaultParams();
-extern void Dar_ManIncrementTravId( Dar_Man_t * p );
-extern int Dar_ManLevels( Dar_Man_t * p );
-extern void Dar_ManCleanData( Dar_Man_t * p );
-extern void Dar_ObjCleanData_rec( Dar_Obj_t * pObj );
-extern void Dar_ObjCollectMulti( Dar_Obj_t * pFunc, Vec_Ptr_t * vSuper );
-extern int Dar_ObjIsMuxType( Dar_Obj_t * pObj );
-extern int Dar_ObjRecognizeExor( Dar_Obj_t * pObj, Dar_Obj_t ** ppFan0, Dar_Obj_t ** ppFan1 );
-extern Dar_Obj_t * Dar_ObjRecognizeMux( Dar_Obj_t * pObj, Dar_Obj_t ** ppObjT, Dar_Obj_t ** ppObjE );
-extern Dar_Obj_t * Dar_ObjReal_rec( Dar_Obj_t * pObj );
-extern void Dar_ObjPrintEqn( FILE * pFile, Dar_Obj_t * pObj, Vec_Vec_t * vLevels, int Level );
-extern void Dar_ObjPrintVerilog( FILE * pFile, Dar_Obj_t * pObj, Vec_Vec_t * vLevels, int Level );
-extern void Dar_ObjPrintVerbose( Dar_Obj_t * pObj, int fHaig );
-extern void Dar_ManPrintVerbose( Dar_Man_t * p, int fHaig );
-extern void Dar_ManDumpBlif( Dar_Man_t * p, char * pFileName );
-
-/*=== darMem.c ===========================================================*/
-// fixed-size-block memory manager
-extern Dar_MmFixed_t * Dar_MmFixedStart( int nEntrySize, int nEntriesMax );
-extern void Dar_MmFixedStop( Dar_MmFixed_t * p, int fVerbose );
-extern char * Dar_MmFixedEntryFetch( Dar_MmFixed_t * p );
-extern void Dar_MmFixedEntryRecycle( Dar_MmFixed_t * p, char * pEntry );
-extern void Dar_MmFixedRestart( Dar_MmFixed_t * p );
-extern int Dar_MmFixedReadMemUsage( Dar_MmFixed_t * p );
-extern int Dar_MmFixedReadMaxEntriesUsed( Dar_MmFixed_t * p );
-// flexible-size-block memory manager
-extern Dar_MmFlex_t * Dar_MmFlexStart();
-extern void Dar_MmFlexStop( Dar_MmFlex_t * p, int fVerbose );
-extern char * Dar_MmFlexEntryFetch( Dar_MmFlex_t * p, int nBytes );
-extern void Dar_MmFlexRestart( Dar_MmFlex_t * p );
-extern int Dar_MmFlexReadMemUsage( Dar_MmFlex_t * p );
-// hierarchical memory manager
-extern Dar_MmStep_t * Dar_MmStepStart( int nSteps );
-extern void Dar_MmStepStop( Dar_MmStep_t * p, int fVerbose );
-extern char * Dar_MmStepEntryFetch( Dar_MmStep_t * p, int nBytes );
-extern void Dar_MmStepEntryRecycle( Dar_MmStep_t * p, char * pEntry, int nBytes );
-extern int Dar_MmStepReadMemUsage( Dar_MmStep_t * p );
+extern void Dar_ManDefaultParams( Dar_Par_t * pPars );
+extern int Dar_ManRewrite( Aig_Man_t * pAig, Dar_Par_t * pPars );
+extern Aig_MmFixed_t * Dar_ManComputeCuts( Aig_Man_t * pAig );
#ifdef __cplusplus
}
diff --git a/src/aig/dar/darBalance.c b/src/aig/dar/darBalance.c
index 2d9a48d4..a1502382 100644
--- a/src/aig/dar/darBalance.c
+++ b/src/aig/dar/darBalance.c
@@ -18,17 +18,18 @@
***********************************************************************/
-#include "dar.h"
+#include "darInt.h"
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
-static Dar_Obj_t * Dar_NodeBalance_rec( Dar_Man_t * pNew, Dar_Obj_t * pObj, Vec_Vec_t * vStore, int Level, int fUpdateLevel );
-static Vec_Ptr_t * Dar_NodeBalanceCone( Dar_Obj_t * pObj, Vec_Vec_t * vStore, int Level );
-static int Dar_NodeBalanceFindLeft( Vec_Ptr_t * vSuper );
-static void Dar_NodeBalancePermute( Dar_Man_t * p, Vec_Ptr_t * vSuper, int LeftBound, int fExor );
-static void Dar_NodeBalancePushUniqueOrderByLevel( Vec_Ptr_t * vStore, Dar_Obj_t * pObj );
+static Aig_Obj_t * Dar_Balance_rec( Aig_Man_t * pNew, Aig_Obj_t * pObj, Vec_Vec_t * vStore, int Level, int fUpdateLevel );
+static Vec_Ptr_t * Dar_BalanceCone( Aig_Obj_t * pObj, Vec_Vec_t * vStore, int Level );
+static int Dar_BalanceFindLeft( Vec_Ptr_t * vSuper );
+static void Dar_BalancePermute( Aig_Man_t * p, Vec_Ptr_t * vSuper, int LeftBound, int fExor );
+static void Dar_BalancePushUniqueOrderByLevel( Vec_Ptr_t * vStore, Aig_Obj_t * pObj );
+static Aig_Obj_t * Dar_BalanceBuildSuper( Aig_Man_t * p, Vec_Ptr_t * vSuper, Aig_Type_t Type, int fUpdateLevel );
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
@@ -45,33 +46,33 @@ static void Dar_NodeBalancePushUniqueOrderByLevel( Vec_Ptr_t * vStore, Da
SeeAlso []
***********************************************************************/
-Dar_Man_t * Dar_ManBalance( Dar_Man_t * p, int fUpdateLevel )
+Aig_Man_t * Dar_ManBalance( Aig_Man_t * p, int fUpdateLevel )
{
- Dar_Man_t * pNew;
- Dar_Obj_t * pObj, * pObjNew;
+ Aig_Man_t * pNew;
+ Aig_Obj_t * pObj, * pObjNew;
Vec_Vec_t * vStore;
int i;
// create the new manager
- pNew = Dar_ManStart();
+ pNew = Aig_ManStart();
// map the PI nodes
- Dar_ManCleanData( p );
- Dar_ManConst1(p)->pData = Dar_ManConst1(pNew);
- Dar_ManForEachPi( p, pObj, i )
- pObj->pData = Dar_ObjCreatePi(pNew);
+ Aig_ManCleanData( p );
+ Aig_ManConst1(p)->pData = Aig_ManConst1(pNew);
+ Aig_ManForEachPi( p, pObj, i )
+ pObj->pData = Aig_ObjCreatePi(pNew);
// balance the AIG
vStore = Vec_VecAlloc( 50 );
- Dar_ManForEachPo( p, pObj, i )
+ Aig_ManForEachPo( p, pObj, i )
{
- pObjNew = Dar_NodeBalance_rec( pNew, Dar_ObjFanin0(pObj), vStore, 0, fUpdateLevel );
- Dar_ObjCreatePo( pNew, Dar_NotCond( pObjNew, Dar_ObjFaninC0(pObj) ) );
+ pObjNew = Dar_Balance_rec( pNew, Aig_ObjFanin0(pObj), vStore, 0, fUpdateLevel );
+ Aig_ObjCreatePo( pNew, Aig_NotCond( pObjNew, Aig_ObjFaninC0(pObj) ) );
}
Vec_VecFree( vStore );
// remove dangling nodes
-// Dar_ManCreateRefs( pNew );
-// if ( i = Dar_ManCleanup( pNew ) )
+// Aig_ManCreateRefs( pNew );
+// if ( i = Aig_ManCleanup( pNew ) )
// printf( "Cleanup after balancing removed %d dangling nodes.\n", i );
// check the resulting AIG
- if ( !Dar_ManCheck(pNew) )
+ if ( !Aig_ManCheck(pNew) )
printf( "Dar_ManBalance(): The check has failed.\n" );
return pNew;
}
@@ -87,33 +88,33 @@ Dar_Man_t * Dar_ManBalance( Dar_Man_t * p, int fUpdateLevel )
SeeAlso []
***********************************************************************/
-Dar_Obj_t * Dar_NodeBalance_rec( Dar_Man_t * pNew, Dar_Obj_t * pObjOld, Vec_Vec_t * vStore, int Level, int fUpdateLevel )
+Aig_Obj_t * Dar_Balance_rec( Aig_Man_t * pNew, Aig_Obj_t * pObjOld, Vec_Vec_t * vStore, int Level, int fUpdateLevel )
{
- Dar_Obj_t * pObjNew;
+ Aig_Obj_t * pObjNew;
Vec_Ptr_t * vSuper;
int i;
- assert( !Dar_IsComplement(pObjOld) );
+ assert( !Aig_IsComplement(pObjOld) );
// return if the result is known
if ( pObjOld->pData )
return pObjOld->pData;
- assert( Dar_ObjIsNode(pObjOld) );
+ assert( Aig_ObjIsNode(pObjOld) );
// get the implication supergate
- vSuper = Dar_NodeBalanceCone( pObjOld, vStore, Level );
+ vSuper = Dar_BalanceCone( pObjOld, vStore, Level );
// check if supergate contains two nodes in the opposite polarity
if ( vSuper->nSize == 0 )
- return pObjOld->pData = Dar_ManConst0(pNew);
+ return pObjOld->pData = Aig_ManConst0(pNew);
if ( Vec_PtrSize(vSuper) < 2 )
printf( "BUG!\n" );
// for each old node, derive the new well-balanced node
for ( i = 0; i < Vec_PtrSize(vSuper); i++ )
{
- pObjNew = Dar_NodeBalance_rec( pNew, Dar_Regular(vSuper->pArray[i]), vStore, Level + 1, fUpdateLevel );
- vSuper->pArray[i] = Dar_NotCond( pObjNew, Dar_IsComplement(vSuper->pArray[i]) );
+ pObjNew = Dar_Balance_rec( pNew, Aig_Regular(vSuper->pArray[i]), vStore, Level + 1, fUpdateLevel );
+ vSuper->pArray[i] = Aig_NotCond( pObjNew, Aig_IsComplement(vSuper->pArray[i]) );
}
// build the supergate
- pObjNew = Dar_NodeBalanceBuildSuper( pNew, vSuper, Dar_ObjType(pObjOld), fUpdateLevel );
+ pObjNew = Dar_BalanceBuildSuper( pNew, vSuper, Aig_ObjType(pObjOld), fUpdateLevel );
// make sure the balanced node is not assigned
-// assert( pObjOld->Level >= Dar_Regular(pObjNew)->Level );
+// assert( pObjOld->Level >= Aig_Regular(pObjNew)->Level );
assert( pObjOld->pData == NULL );
return pObjOld->pData = pObjNew;
}
@@ -129,11 +130,11 @@ Dar_Obj_t * Dar_NodeBalance_rec( Dar_Man_t * pNew, Dar_Obj_t * pObjOld, Vec_Vec_
SeeAlso []
***********************************************************************/
-int Dar_NodeBalanceCone_rec( Dar_Obj_t * pRoot, Dar_Obj_t * pObj, Vec_Ptr_t * vSuper )
+int Dar_BalanceCone_rec( Aig_Obj_t * pRoot, Aig_Obj_t * pObj, Vec_Ptr_t * vSuper )
{
int RetValue1, RetValue2, i;
// check if the node is visited
- if ( Dar_Regular(pObj)->fMarkB )
+ if ( Aig_Regular(pObj)->fMarkB )
{
// check if the node occurs in the same polarity
for ( i = 0; i < vSuper->nSize; i++ )
@@ -141,23 +142,23 @@ int Dar_NodeBalanceCone_rec( Dar_Obj_t * pRoot, Dar_Obj_t * pObj, Vec_Ptr_t * vS
return 1;
// check if the node is present in the opposite polarity
for ( i = 0; i < vSuper->nSize; i++ )
- if ( vSuper->pArray[i] == Dar_Not(pObj) )
+ if ( vSuper->pArray[i] == Aig_Not(pObj) )
return -1;
assert( 0 );
return 0;
}
// if the new node is complemented or a PI, another gate begins
- if ( pObj != pRoot && (Dar_IsComplement(pObj) || Dar_ObjType(pObj) != Dar_ObjType(pRoot) || Dar_ObjRefs(pObj) > 1) )
+ if ( pObj != pRoot && (Aig_IsComplement(pObj) || Aig_ObjType(pObj) != Aig_ObjType(pRoot) || Aig_ObjRefs(pObj) > 1) )
{
Vec_PtrPush( vSuper, pObj );
- Dar_Regular(pObj)->fMarkB = 1;
+ Aig_Regular(pObj)->fMarkB = 1;
return 0;
}
- assert( !Dar_IsComplement(pObj) );
- assert( Dar_ObjIsNode(pObj) );
+ assert( !Aig_IsComplement(pObj) );
+ assert( Aig_ObjIsNode(pObj) );
// go through the branches
- RetValue1 = Dar_NodeBalanceCone_rec( pRoot, Dar_ObjChild0(pObj), vSuper );
- RetValue2 = Dar_NodeBalanceCone_rec( pRoot, Dar_ObjChild1(pObj), vSuper );
+ RetValue1 = Dar_BalanceCone_rec( pRoot, Aig_ObjChild0(pObj), vSuper );
+ RetValue2 = Dar_BalanceCone_rec( pRoot, Aig_ObjChild1(pObj), vSuper );
if ( RetValue1 == -1 || RetValue2 == -1 )
return -1;
// return 1 if at least one branch has a duplicate
@@ -175,11 +176,11 @@ int Dar_NodeBalanceCone_rec( Dar_Obj_t * pRoot, Dar_Obj_t * pObj, Vec_Ptr_t * vS
SeeAlso []
***********************************************************************/
-Vec_Ptr_t * Dar_NodeBalanceCone( Dar_Obj_t * pObj, Vec_Vec_t * vStore, int Level )
+Vec_Ptr_t * Dar_BalanceCone( Aig_Obj_t * pObj, Vec_Vec_t * vStore, int Level )
{
Vec_Ptr_t * vNodes;
int RetValue, i;
- assert( !Dar_IsComplement(pObj) );
+ assert( !Aig_IsComplement(pObj) );
// extend the storage
if ( Vec_VecSize( vStore ) <= Level )
Vec_VecPush( vStore, Level, 0 );
@@ -187,11 +188,11 @@ Vec_Ptr_t * Dar_NodeBalanceCone( Dar_Obj_t * pObj, Vec_Vec_t * vStore, int Level
vNodes = Vec_VecEntry( vStore, Level );
Vec_PtrClear( vNodes );
// collect the nodes in the implication supergate
- RetValue = Dar_NodeBalanceCone_rec( pObj, pObj, vNodes );
+ RetValue = Dar_BalanceCone_rec( pObj, pObj, vNodes );
assert( vNodes->nSize > 1 );
// unmark the visited nodes
Vec_PtrForEachEntry( vNodes, pObj, i )
- Dar_Regular(pObj)->fMarkB = 0;
+ Aig_Regular(pObj)->fMarkB = 0;
// if we found the node and its complement in the same implication supergate,
// return empty set of nodes (meaning that we should use constant-0 node)
if ( RetValue == -1 )
@@ -210,9 +211,9 @@ Vec_Ptr_t * Dar_NodeBalanceCone( Dar_Obj_t * pObj, Vec_Vec_t * vStore, int Level
SeeAlso []
***********************************************************************/
-int Dar_NodeCompareLevelsDecrease( Dar_Obj_t ** pp1, Dar_Obj_t ** pp2 )
+int Aig_NodeCompareLevelsDecrease( Aig_Obj_t ** pp1, Aig_Obj_t ** pp2 )
{
- int Diff = Dar_ObjLevel(Dar_Regular(*pp1)) - Dar_ObjLevel(Dar_Regular(*pp2));
+ int Diff = Aig_ObjLevel(Aig_Regular(*pp1)) - Aig_ObjLevel(Aig_Regular(*pp2));
if ( Diff > 0 )
return -1;
if ( Diff < 0 )
@@ -231,24 +232,24 @@ int Dar_NodeCompareLevelsDecrease( Dar_Obj_t ** pp1, Dar_Obj_t ** pp2 )
SeeAlso []
***********************************************************************/
-Dar_Obj_t * Dar_NodeBalanceBuildSuper( Dar_Man_t * p, Vec_Ptr_t * vSuper, Dar_Type_t Type, int fUpdateLevel )
+Aig_Obj_t * Dar_BalanceBuildSuper( Aig_Man_t * p, Vec_Ptr_t * vSuper, Aig_Type_t Type, int fUpdateLevel )
{
- Dar_Obj_t * pObj1, * pObj2;
+ Aig_Obj_t * pObj1, * pObj2;
int LeftBound;
assert( vSuper->nSize > 1 );
// sort the new nodes by level in the decreasing order
- Vec_PtrSort( vSuper, Dar_NodeCompareLevelsDecrease );
+ Vec_PtrSort( vSuper, Aig_NodeCompareLevelsDecrease );
// balance the nodes
while ( vSuper->nSize > 1 )
{
// find the left bound on the node to be paired
- LeftBound = (!fUpdateLevel)? 0 : Dar_NodeBalanceFindLeft( vSuper );
+ LeftBound = (!fUpdateLevel)? 0 : Dar_BalanceFindLeft( vSuper );
// find the node that can be shared (if no such node, randomize choice)
- Dar_NodeBalancePermute( p, vSuper, LeftBound, Type == DAR_AIG_EXOR );
+ Dar_BalancePermute( p, vSuper, LeftBound, Type == AIG_OBJ_EXOR );
// pull out the last two nodes
pObj1 = Vec_PtrPop(vSuper);
pObj2 = Vec_PtrPop(vSuper);
- Dar_NodeBalancePushUniqueOrderByLevel( vSuper, Dar_Oper(p, pObj1, pObj2, Type) );
+ Dar_BalancePushUniqueOrderByLevel( vSuper, Aig_Oper(p, pObj1, pObj2, Type) );
}
return Vec_PtrEntry(vSuper, 0);
}
@@ -268,9 +269,9 @@ Dar_Obj_t * Dar_NodeBalanceBuildSuper( Dar_Man_t * p, Vec_Ptr_t * vSuper, Dar_Ty
SeeAlso []
***********************************************************************/
-int Dar_NodeBalanceFindLeft( Vec_Ptr_t * vSuper )
+int Dar_BalanceFindLeft( Vec_Ptr_t * vSuper )
{
- Dar_Obj_t * pObjRight, * pObjLeft;
+ Aig_Obj_t * pObjRight, * pObjLeft;
int Current;
// if two or less nodes, pair with the first
if ( Vec_PtrSize(vSuper) < 3 )
@@ -284,13 +285,13 @@ int Dar_NodeBalanceFindLeft( Vec_Ptr_t * vSuper )
// get the next node on the left
pObjLeft = Vec_PtrEntry( vSuper, Current );
// if the level of this node is different, quit the loop
- if ( Dar_ObjLevel(Dar_Regular(pObjLeft)) != Dar_ObjLevel(Dar_Regular(pObjRight)) )
+ if ( Aig_ObjLevel(Aig_Regular(pObjLeft)) != Aig_ObjLevel(Aig_Regular(pObjRight)) )
break;
}
Current++;
// get the node, for which the equality holds
pObjLeft = Vec_PtrEntry( vSuper, Current );
- assert( Dar_ObjLevel(Dar_Regular(pObjLeft)) == Dar_ObjLevel(Dar_Regular(pObjRight)) );
+ assert( Aig_ObjLevel(Aig_Regular(pObjLeft)) == Aig_ObjLevel(Aig_Regular(pObjRight)) );
return Current;
}
@@ -306,9 +307,9 @@ int Dar_NodeBalanceFindLeft( Vec_Ptr_t * vSuper )
SeeAlso []
***********************************************************************/
-void Dar_NodeBalancePermute( Dar_Man_t * p, Vec_Ptr_t * vSuper, int LeftBound, int fExor )
+void Dar_BalancePermute( Aig_Man_t * p, Vec_Ptr_t * vSuper, int LeftBound, int fExor )
{
- Dar_Obj_t * pObj1, * pObj2, * pObj3, * pGhost;
+ Aig_Obj_t * pObj1, * pObj2, * pObj3, * pGhost;
int RightBound, i;
// get the right bound
RightBound = Vec_PtrSize(vSuper) - 2;
@@ -318,20 +319,20 @@ void Dar_NodeBalancePermute( Dar_Man_t * p, Vec_Ptr_t * vSuper, int LeftBound, i
// get the two last nodes
pObj1 = Vec_PtrEntry( vSuper, RightBound + 1 );
pObj2 = Vec_PtrEntry( vSuper, RightBound );
- if ( Dar_Regular(pObj1) == p->pConst1 || Dar_Regular(pObj2) == p->pConst1 )
+ if ( Aig_Regular(pObj1) == p->pConst1 || Aig_Regular(pObj2) == p->pConst1 )
return;
// find the first node that can be shared
for ( i = RightBound; i >= LeftBound; i-- )
{
pObj3 = Vec_PtrEntry( vSuper, i );
- if ( Dar_Regular(pObj3) == p->pConst1 )
+ if ( Aig_Regular(pObj3) == p->pConst1 )
{
Vec_PtrWriteEntry( vSuper, i, pObj2 );
Vec_PtrWriteEntry( vSuper, RightBound, pObj3 );
return;
}
- pGhost = Dar_ObjCreateGhost( p, pObj1, pObj3, fExor? DAR_AIG_EXOR : DAR_AIG_AND );
- if ( Dar_TableLookup( p, pGhost ) )
+ pGhost = Aig_ObjCreateGhost( p, pObj1, pObj3, fExor? AIG_OBJ_EXOR : AIG_OBJ_AND );
+ if ( Aig_TableLookup( p, pGhost ) )
{
if ( pObj3 == pObj2 )
return;
@@ -364,9 +365,9 @@ void Dar_NodeBalancePermute( Dar_Man_t * p, Vec_Ptr_t * vSuper, int LeftBound, i
SeeAlso []
***********************************************************************/
-void Dar_NodeBalancePushUniqueOrderByLevel( Vec_Ptr_t * vStore, Dar_Obj_t * pObj )
+void Dar_BalancePushUniqueOrderByLevel( Vec_Ptr_t * vStore, Aig_Obj_t * pObj )
{
- Dar_Obj_t * pObj1, * pObj2;
+ Aig_Obj_t * pObj1, * pObj2;
int i;
if ( Vec_PtrPushUnique(vStore, pObj) )
return;
@@ -375,7 +376,7 @@ void Dar_NodeBalancePushUniqueOrderByLevel( Vec_Ptr_t * vStore, Dar_Obj_t * pObj
{
pObj1 = vStore->pArray[i ];
pObj2 = vStore->pArray[i-1];
- if ( Dar_ObjLevel(Dar_Regular(pObj1)) <= Dar_ObjLevel(Dar_Regular(pObj2)) )
+ if ( Aig_ObjLevel(Aig_Regular(pObj1)) <= Aig_ObjLevel(Aig_Regular(pObj2)) )
break;
vStore->pArray[i ] = pObj2;
vStore->pArray[i-1] = pObj1;
diff --git a/src/aig/dar/darCheck.c b/src/aig/dar/darCheck.c
deleted file mode 100644
index 5c7a2390..00000000
--- a/src/aig/dar/darCheck.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/**CFile****************************************************************
-
- FileName [darCheck.c]
-
- SystemName [ABC: Logic synthesis and verification system.]
-
- PackageName [DAG-aware AIG rewriting.]
-
- Synopsis [AIG checking procedures.]
-
- Author [Alan Mishchenko]
-
- Affiliation [UC Berkeley]
-
- Date [Ver. 1.0. Started - April 28, 2007.]
-
- Revision [$Id: darCheck.c,v 1.00 2007/04/28 00:00:00 alanmi Exp $]
-
-***********************************************************************/
-
-#include "dar.h"
-
-////////////////////////////////////////////////////////////////////////
-/// DECLARATIONS ///
-////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////
-/// FUNCTION DEFINITIONS ///
-////////////////////////////////////////////////////////////////////////
-
-/**Function*************************************************************
-
- Synopsis [Checks the consistency of the AIG manager.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Dar_ManCheck( Dar_Man_t * p )
-{
- Dar_Obj_t * pObj, * pObj2;
- int i;
- // check primary inputs
- Dar_ManForEachPi( p, pObj, i )
- {
- if ( Dar_ObjFanin0(pObj) || Dar_ObjFanin1(pObj) )
- {
- printf( "Dar_ManCheck: The PI node \"%p\" has fanins.\n", pObj );
- return 0;
- }
- }
- // check primary outputs
- Dar_ManForEachPo( p, pObj, i )
- {
- if ( !Dar_ObjFanin0(pObj) )
- {
- printf( "Dar_ManCheck: The PO node \"%p\" has NULL fanin.\n", pObj );
- return 0;
- }
- if ( Dar_ObjFanin1(pObj) )
- {
- printf( "Dar_ManCheck: The PO node \"%p\" has second fanin.\n", pObj );
- return 0;
- }
- }
- // check internal nodes
- Dar_ManForEachObj( p, pObj, i )
- {
- if ( !Dar_ObjIsNode(pObj) )
- continue;
- if ( !Dar_ObjFanin0(pObj) || !Dar_ObjFanin1(pObj) )
- {
- printf( "Dar_ManCheck: The AIG has internal node \"%p\" with a NULL fanin.\n", pObj );
- return 0;
- }
- if ( Dar_ObjFanin0(pObj)->Id >= Dar_ObjFanin1(pObj)->Id )
- {
- printf( "Dar_ManCheck: The AIG has node \"%p\" with a wrong ordering of fanins.\n", pObj );
- return 0;
- }
- pObj2 = Dar_TableLookup( p, pObj );
- if ( pObj2 != pObj )
- {
- printf( "Dar_ManCheck: Node \"%p\" is not in the structural hashing table.\n", pObj );
- return 0;
- }
- }
- // count the total number of nodes
- if ( Dar_ManObjNum(p) != 1 + Dar_ManPiNum(p) + Dar_ManPoNum(p) + Dar_ManBufNum(p) + Dar_ManAndNum(p) + Dar_ManExorNum(p) + Dar_ManLatchNum(p) )
- {
- printf( "Dar_ManCheck: The number of created nodes is wrong.\n" );
- printf( "C1 = %d. Pi = %d. Po = %d. Buf = %d. And = %d. Xor = %d. Lat = %d. Total = %d.\n",
- 1, Dar_ManPiNum(p), Dar_ManPoNum(p), Dar_ManBufNum(p), Dar_ManAndNum(p), Dar_ManExorNum(p), Dar_ManLatchNum(p),
- 1 + Dar_ManPiNum(p) + Dar_ManPoNum(p) + Dar_ManBufNum(p) + Dar_ManAndNum(p) + Dar_ManExorNum(p) + Dar_ManLatchNum(p) );
- printf( "Created = %d. Deleted = %d. Existing = %d.\n",
- p->nCreated, p->nDeleted, p->nCreated - p->nDeleted );
- return 0;
- }
- // count the number of nodes in the table
- if ( Dar_TableCountEntries(p) != Dar_ManAndNum(p) + Dar_ManExorNum(p) + Dar_ManLatchNum(p) )
- {
- printf( "Dar_ManCheck: The number of nodes in the structural hashing table is wrong.\n" );
- printf( "Entries = %d. And = %d. Xor = %d. Lat = %d. Total = %d.\n",
- Dar_TableCountEntries(p), Dar_ManAndNum(p), Dar_ManExorNum(p), Dar_ManLatchNum(p),
- Dar_ManAndNum(p) + Dar_ManExorNum(p) + Dar_ManLatchNum(p) );
-
- return 0;
- }
-// if ( !Dar_ManIsAcyclic(p) )
-// return 0;
- return 1;
-}
-
-////////////////////////////////////////////////////////////////////////
-/// END OF FILE ///
-////////////////////////////////////////////////////////////////////////
-
-
diff --git a/src/aig/dar/darCore.c b/src/aig/dar/darCore.c
index 23563766..a617f5d6 100644
--- a/src/aig/dar/darCore.c
+++ b/src/aig/dar/darCore.c
@@ -18,7 +18,7 @@
***********************************************************************/
-#include "dar.h"
+#include "darInt.h"
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
@@ -30,6 +30,28 @@
/**Function*************************************************************
+ Synopsis [Returns the structure with default assignment of parameters.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Dar_ManDefaultParams( Dar_Par_t * pPars )
+{
+ memset( pPars, 0, sizeof(Dar_Par_t) );
+ pPars->nCutsMax = 8;
+ pPars->nSubgMax = 4;
+ pPars->fUpdateLevel = 0;
+ pPars->fUseZeros = 0;
+ pPars->fVerbose = 0;
+ pPars->fVeryVerbose = 0;
+}
+
+/**Function*************************************************************
+
Synopsis []
Description []
@@ -39,89 +61,107 @@
SeeAlso []
***********************************************************************/
-int Dar_ManRewrite( Dar_Man_t * p )
+int Dar_ManRewrite( Aig_Man_t * pAig, Dar_Par_t * pPars )
{
+ Dar_Man_t * p;
ProgressBar * pProgress;
- Dar_Cut_t * pCutSet;
- Dar_Obj_t * pObj, * pObjNew;
+ Dar_Cut_t * pCut;
+ Aig_Obj_t * pObj, * pObjNew;
int i, k, nNodesOld, nNodeBefore, nNodeAfter, Required;
int clk = 0, clkStart;
+ // create rewriting manager
+ p = Dar_ManStart( pAig, pPars );
// remove dangling nodes
- Dar_ManCleanup( p );
+ Aig_ManCleanup( pAig );
// set elementary cuts for the PIs
- Dar_ManSetupPis( p );
+// Dar_ManSetupPis( p );
+ Aig_ManCleanData( pAig );
+ Dar_ObjPrepareCuts( p, Aig_ManConst1(pAig) );
+ Aig_ManForEachPi( pAig, pObj, i )
+ Dar_ObjPrepareCuts( p, pObj );
// if ( p->pPars->fUpdateLevel )
-// Dar_NtkStartReverseLevels( p );
+// Aig_NtkStartReverseLevels( p );
// resynthesize each node once
clkStart = clock();
- p->nNodesInit = Dar_ManNodeNum(p);
- nNodesOld = Vec_PtrSize( p->vObjs );
+ p->nNodesInit = Aig_ManNodeNum(pAig);
+ nNodesOld = Vec_PtrSize( pAig->vObjs );
pProgress = Extra_ProgressBarStart( stdout, nNodesOld );
- Dar_ManForEachObj( p, pObj, i )
+ Aig_ManForEachObj( pAig, pObj, i )
{
Extra_ProgressBarUpdate( pProgress, i, NULL );
- if ( !Dar_ObjIsNode(pObj) )
+ if ( !Aig_ObjIsNode(pObj) )
continue;
if ( i > nNodesOld )
break;
// compute cuts for the node
clk = clock();
- pCutSet = Dar_ObjComputeCuts_rec( p, pObj );
+ Dar_ObjComputeCuts_rec( p, pObj );
p->timeCuts += clock() - clk;
- // go through the cuts of this node
- Required = 1000000;
- p->GainBest = -1;
- for ( k = 1; k < (int)pObj->nCuts; k++ )
+
+ // check if there is a trivial cut
+ Dar_ObjForEachCut( pObj, pCut, k )
+ if ( pCut->nLeaves == 0 || (pCut->nLeaves == 1 && pCut->pLeaves[0] != pObj->Id) )
+ break;
+ if ( k < (int)pObj->nCuts )
{
-/*
- if ( pObj->Id == 654 )
+ assert( pCut->nLeaves < 2 );
+ if ( pCut->nLeaves == 0 ) // replace by constant
{
- int m;
- for ( m = 0; m < 4; m++ )
- printf( "%d ", pCutSet[k].pLeaves[m] );
- printf( "\n" );
+ assert( pCut->uTruth == 0 || pCut->uTruth == 0xFFFF );
+ pObjNew = Aig_NotCond( Aig_ManConst1(p->pAig), pCut->uTruth==0 );
}
-*/
- Dar_LibEval( p, pObj, pCutSet + k, Required );
+ else
+ {
+ assert( pCut->uTruth == 0xAAAA || pCut->uTruth == 0x5555 );
+ pObjNew = Aig_NotCond( Aig_ManObj(p->pAig, pCut->pLeaves[0]), pCut->uTruth==0x5555 );
+ }
+ // replace the node
+ Aig_ObjReplace( pAig, pObj, pObjNew, 1 );
+ // remove the old cuts
+ Dar_ObjSetCuts( pObj, NULL );
+ continue;
}
+
+ // evaluate the cuts
+ p->GainBest = -1;
+ Required = 1000000;
+ Dar_ObjForEachCut( pObj, pCut, k )
+ Dar_LibEval( p, pObj, pCut, Required );
// check the best gain
if ( !(p->GainBest > 0 || p->GainBest == 0 && p->pPars->fUseZeros) )
continue;
// if we end up here, a rewriting step is accepted
- nNodeBefore = Dar_ManNodeNum( p );
+ nNodeBefore = Aig_ManNodeNum( pAig );
pObjNew = Dar_LibBuildBest( p );
- pObjNew = Dar_NotCond( pObjNew, pObjNew->fPhase ^ pObj->fPhase );
- assert( (int)Dar_Regular(pObjNew)->Level <= Required );
+ pObjNew = Aig_NotCond( pObjNew, pObjNew->fPhase ^ pObj->fPhase );
+ assert( (int)Aig_Regular(pObjNew)->Level <= Required );
// replace the node
- Dar_ObjReplace( p, pObj, pObjNew, 1 );
+ Aig_ObjReplace( pAig, pObj, pObjNew, 1 );
// remove the old cuts
- pObj->pData = NULL;
+ Dar_ObjSetCuts( pObj, NULL );
// compare the gains
- nNodeAfter = Dar_ManNodeNum( p );
+ nNodeAfter = Aig_ManNodeNum( pAig );
assert( p->GainBest <= nNodeBefore - nNodeAfter );
// count gains of this class
p->ClassGains[p->ClassBest] += nNodeBefore - nNodeAfter;
-
-// if ( p->ClassBest == 29 )
-// printf( "%d ", p->OutNumBest );
-
}
p->timeTotal = clock() - clkStart;
p->timeOther = p->timeTotal - p->timeCuts - p->timeEval;
Extra_ProgressBarStop( pProgress );
- p->nCutMemUsed = Dar_MmFlexReadMemUsage(p->pMemCuts)/(1<<20);
+ p->nCutMemUsed = Aig_MmFixedReadMemUsage(p->pMemCuts)/(1<<20);
Dar_ManCutsFree( p );
+ // stop the rewriting manager
+ Dar_ManStop( p );
// put the nodes into the DFS order and reassign their IDs
-// Dar_NtkReassignIds( p );
-
+// Aig_NtkReassignIds( p );
// fix the levels
// if ( p->pPars->fUpdateLevel )
-// Dar_NtkStopReverseLevels( p );
+// Aig_NtkStopReverseLevels( p );
// check
- if ( !Dar_ManCheck( p ) )
+ if ( !Aig_ManCheck( pAig ) )
{
- printf( "Dar_ManRewrite: The network check has failed.\n" );
+ printf( "Aig_ManRewrite: The network check has failed.\n" );
return 0;
}
return 1;
@@ -138,32 +178,37 @@ p->timeOther = p->timeTotal - p->timeCuts - p->timeEval;
SeeAlso []
***********************************************************************/
-int Dar_ManComputeCuts( Dar_Man_t * p )
+Aig_MmFixed_t * Dar_ManComputeCuts( Aig_Man_t * pAig )
{
- Dar_Obj_t * pObj;
+ Dar_Man_t * p;
+ Aig_Obj_t * pObj;
+ Aig_MmFixed_t * pMemCuts;
int i, clk = 0, clkStart = clock();
int nCutsMax = 0, nCutsTotal = 0;
+ // create rewriting manager
+ p = Dar_ManStart( pAig, NULL );
// remove dangling nodes
- Dar_ManCleanup( p );
+ Aig_ManCleanup( pAig );
// set elementary cuts for the PIs
- Dar_ManSetupPis( p );
+// Dar_ManSetupPis( p );
+ Aig_ManForEachPi( pAig, pObj, i )
+ Dar_ObjPrepareCuts( p, pObj );
// compute cuts for each nodes in the topological order
- Dar_ManForEachObj( p, pObj, i )
+ Aig_ManForEachObj( pAig, pObj, i )
{
- if ( !Dar_ObjIsNode(pObj) )
+ if ( !Aig_ObjIsNode(pObj) )
continue;
Dar_ObjComputeCuts( p, pObj );
nCutsTotal += pObj->nCuts - 1;
- nCutsMax = DAR_MAX( nCutsMax, (int)pObj->nCuts - 1 );
+ nCutsMax = AIG_MAX( nCutsMax, (int)pObj->nCuts - 1 );
}
- // print statistics on the number of non-trivial cuts
- printf( "Node = %6d. Cut = %8d. Max = %3d. Ave = %.2f. Filter = %8d. Created = %8d.\n",
- Dar_ManNodeNum(p), nCutsTotal, nCutsMax, (float)nCutsTotal/Dar_ManNodeNum(p),
- p->nCutsFiltered, p->nCutsFiltered+nCutsTotal+Dar_ManNodeNum(p)+Dar_ManPiNum(p) );
- PRT( "Time", clock() - clkStart );
// free the cuts
+ pMemCuts = p->pMemCuts;
+ p->pMemCuts = NULL;
// Dar_ManCutsFree( p );
- return 1;
+ // stop the rewriting manager
+ Dar_ManStop( p );
+ return pMemCuts;
}
diff --git a/src/aig/dar/darCut.c b/src/aig/dar/darCut.c
index 48f4dc6c..af9d1227 100644
--- a/src/aig/dar/darCut.c
+++ b/src/aig/dar/darCut.c
@@ -18,7 +18,7 @@
***********************************************************************/
-#include "dar.h"
+#include "darInt.h"
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
@@ -30,6 +30,97 @@
/**Function*************************************************************
+ Synopsis [Returns the number of 1s in the machine word.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline int Dar_WordCountOnes( unsigned uWord )
+{
+ uWord = (uWord & 0x55555555) + ((uWord>>1) & 0x55555555);
+ uWord = (uWord & 0x33333333) + ((uWord>>2) & 0x33333333);
+ uWord = (uWord & 0x0F0F0F0F) + ((uWord>>4) & 0x0F0F0F0F);
+ uWord = (uWord & 0x00FF00FF) + ((uWord>>8) & 0x00FF00FF);
+ return (uWord & 0x0000FFFF) + (uWord>>16);
+}
+
+/**Function*************************************************************
+
+ Synopsis [Compute the cost of the cut.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline int Dar_CutFindValue( Dar_Man_t * p, Dar_Cut_t * pCut )
+{
+ Aig_Obj_t * pLeaf;
+ int i, Value;
+ assert( pCut->fUsed );
+ if ( pCut->nLeaves < 2 )
+ return 1001;
+ Value = 0;
+ Dar_CutForEachLeaf( p->pAig, pCut, pLeaf, i )
+ {
+ if ( pLeaf == NULL )
+ return 0;
+ assert( pLeaf != NULL );
+ Value += pLeaf->nRefs;
+ }
+ if ( Value > 1000 )
+ Value = 1000;
+ return Value;
+}
+
+/**Function*************************************************************
+
+ Synopsis [Returns the next free cut to use.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline Dar_Cut_t * Dar_CutFindFree( Dar_Man_t * p, Aig_Obj_t * pObj )
+{
+ Dar_Cut_t * pCut, * pCutMax;
+ int i;
+ pCutMax = NULL;
+ Dar_ObjForEachCutAll( pObj, pCut, i )
+ {
+ if ( pCut->fUsed == 0 )
+ return pCut;
+ if ( pCut->nLeaves < 3 )
+ continue;
+ if ( pCutMax == NULL || pCutMax->Value > pCut->Value )
+ pCutMax = pCut;
+ }
+ if ( pCutMax == NULL )
+ {
+ Dar_ObjForEachCutAll( pObj, pCut, i )
+ {
+ if ( pCut->nLeaves < 2 )
+ continue;
+ if ( pCutMax == NULL || pCutMax->Value > pCut->Value )
+ pCutMax = pCut;
+ }
+ }
+ assert( pCutMax != NULL );
+ pCutMax->fUsed = 0;
+ return pCutMax;
+}
+
+/**Function*************************************************************
+
Synopsis [Returns 1 if pDom is contained in pCut.]
Description []
@@ -42,6 +133,7 @@
static inline int Dar_CutCheckDominance( Dar_Cut_t * pDom, Dar_Cut_t * pCut )
{
int i, k;
+ assert( pDom->fUsed && pCut->fUsed );
for ( i = 0; i < (int)pDom->nLeaves; i++ )
{
for ( k = 0; k < (int)pCut->nLeaves; k++ )
@@ -65,14 +157,16 @@ static inline int Dar_CutCheckDominance( Dar_Cut_t * pDom, Dar_Cut_t * pCut )
SeeAlso []
***********************************************************************/
-static inline int Dar_CutFilter( Dar_Man_t * p, Dar_Cut_t * pCut )
+static inline int Dar_CutFilter( Aig_Obj_t * pObj, Dar_Cut_t * pCut )
{
Dar_Cut_t * pTemp;
- int i, k;
- assert( p->pBaseCuts[p->nCutsUsed] == pCut );
- for ( i = 0; i < p->nCutsUsed; i++ )
+ int i;
+ assert( pCut->fUsed );
+ // go through the cuts of the node
+ Dar_ObjForEachCut( pObj, pTemp, i )
{
- pTemp = p->pBaseCuts[i];
+ if ( pTemp == pCut )
+ continue;
if ( pTemp->nLeaves > pCut->nLeaves )
{
// skip the non-contained cuts
@@ -81,17 +175,8 @@ static inline int Dar_CutFilter( Dar_Man_t * p, Dar_Cut_t * pCut )
// check containment seriously
if ( Dar_CutCheckDominance( pCut, pTemp ) )
{
-// p->ppCuts[i] = p->ppCuts[p->nCuts-1];
-// p->ppCuts[p->nCuts-1] = pTemp;
-// p->nCuts--;
-// i--;
// remove contained cut
- for ( k = i; k < p->nCutsUsed; k++ )
- p->pBaseCuts[k] = p->pBaseCuts[k+1];
- p->pBaseCuts[p->nCutsUsed] = pTemp;
- p->nCutsUsed--;
- i--;
- p->nCutsFiltered++;
+ pTemp->fUsed = 0;
}
}
else
@@ -102,7 +187,8 @@ static inline int Dar_CutFilter( Dar_Man_t * p, Dar_Cut_t * pCut )
// check containment seriously
if ( Dar_CutCheckDominance( pTemp, pCut ) )
{
- p->nCutsFiltered++;
+ // remove the given cut
+ pCut->fUsed = 0;
return 1;
}
}
@@ -215,6 +301,7 @@ static inline int Dar_CutMergeOrdered( Dar_Cut_t * pC, Dar_Cut_t * pC0, Dar_Cut_
***********************************************************************/
static inline int Dar_CutMerge( Dar_Cut_t * pCut, Dar_Cut_t * pCut0, Dar_Cut_t * pCut1 )
{
+ assert( !pCut->fUsed );
// merge the nodes
if ( pCut0->nLeaves <= pCut1->nLeaves )
{
@@ -227,6 +314,7 @@ static inline int Dar_CutMerge( Dar_Cut_t * pCut, Dar_Cut_t * pCut0, Dar_Cut_t *
return 0;
}
pCut->uSign = pCut0->uSign | pCut1->uSign;
+ pCut->fUsed = 1;
return 1;
}
@@ -377,6 +465,8 @@ static inline int Dar_CutSuppMinimize( Dar_Cut_t * pCut )
};
unsigned uPhase = 0, uTruth = 0xFFFF & pCut->uTruth;
int i, k, nLeaves;
+ assert( pCut->fUsed );
+ assert( pCut->nLeaves > 0 );
// compute the truth support of the cut's function
nLeaves = pCut->nLeaves;
for ( i = 0; i < (int)pCut->nLeaves; i++ )
@@ -395,10 +485,8 @@ static inline int Dar_CutSuppMinimize( Dar_Cut_t * pCut )
{
if ( !(uPhase & (1 << i)) )
continue;
- pCut->pLeaves[k] = pCut->pLeaves[i];
-// pCut->pIndices[k] = pCut->pIndices[i];
- pCut->uSign |= (1 << (pCut->pLeaves[i] & 31));
- k++;
+ pCut->pLeaves[k++] = pCut->pLeaves[i];
+ pCut->uSign |= Aig_ObjCutSign( pCut->pLeaves[i] );
}
assert( k == nLeaves );
pCut->nLeaves = nLeaves;
@@ -416,16 +504,13 @@ static inline int Dar_CutSuppMinimize( Dar_Cut_t * pCut )
SeeAlso []
***********************************************************************/
-void Dar_ObjSetupTrivial( Dar_Obj_t * pObj )
+void Dar_ManCutsFree( Dar_Man_t * p )
{
- Dar_Cut_t * pCut;
- pCut = pObj->pData;
- memset( pCut, 0, sizeof(Dar_Cut_t) );
- pCut->nLeaves = 1;
- pCut->pLeaves[0] = pObj->Id;
-// pCut->pIndices[0] = 0;
- pCut->uSign = (1 << (pObj->Id & 31));
- pCut->uTruth = 0xAAAA;
+ if ( p->pMemCuts == NULL )
+ return;
+ Aig_MmFixedStop( p->pMemCuts, 0 );
+ p->pMemCuts = NULL;
+// Aig_ManCleanData( p );
}
/**Function*************************************************************
@@ -439,16 +524,35 @@ void Dar_ObjSetupTrivial( Dar_Obj_t * pObj )
SeeAlso []
***********************************************************************/
-void Dar_ManSetupPis( Dar_Man_t * p )
+Dar_Cut_t * Dar_ObjPrepareCuts( Dar_Man_t * p, Aig_Obj_t * pObj )
{
- Dar_Obj_t * pObj;
+ Dar_Cut_t * pCutSet, * pCut;
int i;
- Dar_ManForEachPi( p, pObj, i )
+ assert( Dar_ObjCuts(pObj) == NULL );
+ pObj->nCuts = p->pPars->nCutsMax;
+ // create the cutset of the node
+ pCutSet = (Dar_Cut_t *)Aig_MmFixedEntryFetch( p->pMemCuts );
+ Dar_ObjSetCuts( pObj, pCutSet );
+ Dar_ObjForEachCut( pObj, pCut, i )
+ pCut->fUsed = 0;
+ // add unit cut if needed
+ pCut = pCutSet;
+ pCut->fUsed = 1;
+ if ( Aig_ObjIsConst1(pObj) )
{
- pObj->nCuts = 1;
- pObj->pData = (Dar_Cut_t *)Dar_MmFlexEntryFetch( p->pMemCuts, pObj->nCuts * sizeof(Dar_Cut_t) );
- Dar_ObjSetupTrivial( pObj );
+ pCut->nLeaves = 0;
+ pCut->uSign = 0;
+ pCut->uTruth = 0xFFFF;
}
+ else
+ {
+ pCut->nLeaves = 1;
+ pCut->pLeaves[0] = pObj->Id;
+ pCut->uSign = Aig_ObjCutSign( pObj->Id );
+ pCut->uTruth = 0xAAAA;
+ }
+ pCut->Value = Dar_CutFindValue( p, pCut );
+ return pCutSet;
}
/**Function*************************************************************
@@ -462,86 +566,75 @@ void Dar_ManSetupPis( Dar_Man_t * p )
SeeAlso []
***********************************************************************/
-void Dar_ManCutsFree( Dar_Man_t * p )
-{
-// Dar_ManCleanData( p );
- Dar_MmFlexStop( p->pMemCuts, 0 );
- p->pMemCuts = NULL;
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Cut_t * Dar_ObjComputeCuts( Dar_Man_t * p, Dar_Obj_t * pObj )
+Dar_Cut_t * Dar_ObjComputeCuts( Dar_Man_t * p, Aig_Obj_t * pObj )
{
- Dar_Obj_t * pFanin0 = Dar_ObjReal_rec( Dar_ObjChild0(pObj) );
- Dar_Obj_t * pFanin1 = Dar_ObjReal_rec( Dar_ObjChild1(pObj) );
- Dar_Cut_t * pStart0 = Dar_Regular(pFanin0)->pData;
- Dar_Cut_t * pStart1 = Dar_Regular(pFanin1)->pData;
- Dar_Cut_t * pStop0 = pStart0 + Dar_Regular(pFanin0)->nCuts;
- Dar_Cut_t * pStop1 = pStart1 + Dar_Regular(pFanin1)->nCuts;
- Dar_Cut_t * pCut0, * pCut1, * pCut;
- int i;
- assert( pObj->pData == NULL );
+ Aig_Obj_t * pFanin0 = Aig_ObjReal_rec( Aig_ObjChild0(pObj) );
+ Aig_Obj_t * pFanin1 = Aig_ObjReal_rec( Aig_ObjChild1(pObj) );
+ Aig_Obj_t * pFaninR0 = Aig_Regular(pFanin0);
+ Aig_Obj_t * pFaninR1 = Aig_Regular(pFanin1);
+ Dar_Cut_t * pCutSet, * pCut0, * pCut1, * pCut;
+ int i, k, RetValue;
+
+ assert( !Aig_IsComplement(pObj) );
+ assert( Aig_ObjIsNode(pObj) );
+ assert( Dar_ObjCuts(pObj) == NULL );
+ assert( Dar_ObjCuts(pFaninR0) != NULL );
+ assert( Dar_ObjCuts(pFaninR1) != NULL );
+
+ // set up the first cut
+ pCutSet = Dar_ObjPrepareCuts( p, pObj );
// make sure fanins cuts are computed
- p->nCutsUsed = 0;
- for ( pCut0 = pStart0; pCut0 < pStop0; pCut0++ )
- for ( pCut1 = pStart1; pCut1 < pStop1; pCut1++ )
+ Dar_ObjForEachCut( pFaninR0, pCut0, i )
+ Dar_ObjForEachCut( pFaninR1, pCut1, k )
{
- // get storage for the next cut
- if ( p->nCutsUsed == p->nBaseCuts )
- break;
- pCut = p->pBaseCuts[p->nCutsUsed];
+ p->nCutsAll++;
+ // make sure K-feasible cut exists
+ if ( Dar_WordCountOnes(pCut0->uSign | pCut1->uSign) > 4 )
+ continue;
+ // get the next cut of this node
+ pCut = Dar_CutFindFree( p, pObj );
// create the new cut
if ( !Dar_CutMerge( pCut, pCut0, pCut1 ) )
+ {
+ assert( !pCut->fUsed );
continue;
+ }
+ p->nCutsTried++;
// check dominance
- if ( Dar_CutFilter( p, pCut ) )
+ if ( Dar_CutFilter( pObj, pCut ) )
+ {
+ assert( !pCut->fUsed );
continue;
+ }
// compute truth table
- pCut->uTruth = 0xFFFF & Dar_CutTruth( pCut, pCut0, pCut1, Dar_IsComplement(pFanin0), Dar_IsComplement(pFanin1) );
+ pCut->uTruth = 0xFFFF & Dar_CutTruth( pCut, pCut0, pCut1, Aig_IsComplement(pFanin0), Aig_IsComplement(pFanin1) );
// minimize support of the cut
if ( Dar_CutSuppMinimize( pCut ) )
{
- if ( Dar_CutFilter( p, pCut ) )
- continue;
+ // if a simple cut is found return immediately
+ if ( pCut->nLeaves < 2 )
+ return pCutSet;
+ // otherwise, filter the cuts again
+ RetValue = Dar_CutFilter( pObj, pCut );
+ assert( !RetValue );
}
- // CNF mapping: assign the cut cost
- if ( p->pManCnf )
+ // assign the value of the cut
+ pCut->Value = Dar_CutFindValue( p, pCut );
+ // if the cut contains removed node, do not use it
+ if ( pCut->Value == 0 )
{
- extern void Cnf_CutAssignAreaFlow( void * pManCnf, Dar_Cut_t * pCut );
- Cnf_CutAssignAreaFlow( p->pManCnf, pCut );
+ p->nCutsSkipped++;
+ pCut->fUsed = 0;
}
-
- // increment the number of cuts
- p->nCutsUsed++;
- }
- // get memory for the cuts of this node
- pObj->nCuts = p->nCutsUsed + 1;
- pObj->pData = pCut = (Dar_Cut_t *)Dar_MmFlexEntryFetch( p->pMemCuts, pObj->nCuts * sizeof(Dar_Cut_t) );
- // create elementary cut
- Dar_ObjSetupTrivial( pObj );
- // copy non-elementary cuts
- for ( i = 0; i < p->nCutsUsed; i++ )
- *++pCut = *(p->pBaseCuts[i]);
-
- // CNF mapping: assign the best cut
- if ( p->pManCnf )
- {
- extern Dar_Cut_t * Cnf_ObjFindBestCut( Dar_Obj_t * pObj );
- Dar_ObjSetBestCut( Cnf_ObjFindBestCut(pObj) );
}
- return pObj->pData;
+ // count the number of nontrivial cuts cuts
+ Dar_ObjForEachCut( pObj, pCut, i )
+ p->nCutsUsed += pCut->fUsed;
+ // discount trivial cut
+ p->nCutsUsed--;
+ return pCutSet;
}
/**Function*************************************************************
@@ -555,14 +648,14 @@ Dar_Cut_t * Dar_ObjComputeCuts( Dar_Man_t * p, Dar_Obj_t * pObj )
SeeAlso []
***********************************************************************/
-Dar_Cut_t * Dar_ObjComputeCuts_rec( Dar_Man_t * p, Dar_Obj_t * pObj )
+Dar_Cut_t * Dar_ObjComputeCuts_rec( Dar_Man_t * p, Aig_Obj_t * pObj )
{
- if ( pObj->pData )
- return pObj->pData;
- if ( Dar_ObjIsBuf(pObj) )
- return Dar_ObjComputeCuts_rec( p, Dar_ObjFanin0(pObj) );
- Dar_ObjComputeCuts_rec( p, Dar_ObjFanin0(pObj) );
- Dar_ObjComputeCuts_rec( p, Dar_ObjFanin1(pObj) );
+ if ( Dar_ObjCuts(pObj) )
+ return Dar_ObjCuts(pObj);
+ if ( Aig_ObjIsBuf(pObj) )
+ return Dar_ObjComputeCuts_rec( p, Aig_ObjFanin0(pObj) );
+ Dar_ObjComputeCuts_rec( p, Aig_ObjFanin0(pObj) );
+ Dar_ObjComputeCuts_rec( p, Aig_ObjFanin1(pObj) );
return Dar_ObjComputeCuts( p, pObj );
}
diff --git a/src/aig/dar/darData.c b/src/aig/dar/darData.c
index 60fab63e..abf1d378 100644
--- a/src/aig/dar/darData.c
+++ b/src/aig/dar/darData.c
@@ -18,7 +18,7 @@
***********************************************************************/
-#include "dar.h"
+#include "darInt.h"
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
@@ -9419,6 +9419,1665 @@ unsigned int s_Data2[24772] = {
15235,15234,27897,27488
};
+
+const int s_nDataSize3 = 24772;
+unsigned int s_Data3[24772] = {
+//Output priorities (total = 24772):
+10, 9, 12, 6, 11, 14, 4, 1, 7, 5, 2, 3, 13, 8, 0,
+0, 1, 2, 219, 218, 76, 217, 216, 77, 1, 0, 74, 78, 79, 75,
+70, 71, 72, 68, 73, 69, 310, 299, 296, 331, 297, 332, 114, 26, 298,
+340, 330, 336, 338, 339, 62, 112, 328, 334, 329, 335, 113, 337, 327, 333,
+115, 60, 27, 61, 63, 273, 215, 36, 213, 31, 35, 39, 319, 312, 320,
+323, 324, 343, 157, 345, 28, 178, 32, 59, 269, 58, 309, 305, 275, 271,
+308, 304, 34, 117, 181, 129, 154, 211, 30, 38, 177, 193, 55, 130, 268,
+33, 303, 174, 29, 37, 119, 212, 143, 188, 66, 270, 141, 183, 194, 179,
+126, 261, 190, 267, 344, 346, 272, 189, 173, 274, 51, 322, 321, 342, 315,
+214, 311, 14, 57, 223, 348, 125, 176, 192, 317, 280, 314, 165, 160, 175,
+326, 127, 17, 247, 172, 262, 5, 231, 99, 138, 124, 54, 301, 325, 167,
+15, 43, 205, 47, 122, 147, 292, 295, 83, 106, 86, 87, 220, 131, 347,
+293, 150, 209, 233, 67, 116, 148, 156, 171, 180, 191, 256, 195, 341, 128,
+277, 291, 281, 289, 294, 313, 102, 46, 103, 207, 229, 236, 240, 224, 227,
+249, 170, 49, 251, 258, 318, 133, 197, 278, 2, 56, 252, 265, 254, 20,
+142, 151, 316, 164, 121, 162, 41, 107, 139, 203, 288, 302, 48, 52, 110,
+53, 64, 4, 16, 284, 135, 307, 3, 40, 155, 202, 23, 93, 22, 92,
+290, 65, 210, 50, 98, 208, 94, 123, 137, 187, 225, 7, 10, 120, 109,
+263, 287, 186, 108, 152, 264, 90, 253, 96, 97, 136, 200, 118, 140, 300,
+306, 185, 6, 11, 89, 259, 85, 101, 132, 196, 24, 45, 260, 244, 91,
+18, 104, 232, 19, 44, 105, 184, 21, 84, 226, 250, 283, 279, 286, 158,
+248, 257, 255, 80, 169, 13, 100, 81, 168, 199, 238, 9, 12, 82, 182,
+201, 266, 146, 204, 230, 239, 241, 159, 221, 285, 134, 88, 242, 246, 8,
+144, 222, 149, 161, 228, 237, 276, 95, 206, 282, 163, 198, 243, 235, 245,
+42, 166, 25, 111, 145, 153, 234, 13, 0, 1, 8, 3, 11, 7, 9,
+2, 12, 4, 6, 5, 10, 0, 61, 62, 0, 2, 3, 5, 6, 8,
+15, 17, 1, 4, 7, 9, 10, 11, 12, 13, 14, 16, 18, 19, 20,
+21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 64, 65, 66, 67,
+68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 4, 5,
+2, 0, 1, 3, 7, 10, 8, 11, 6, 9, 97, 100, 22, 123, 124,
+125, 98, 101, 40, 39, 66, 72, 75, 69, 68, 74, 21, 41, 67, 73,
+77, 30, 71, 23, 106, 36, 54, 55, 63, 96, 32, 99, 58, 59, 65,
+38, 107, 27, 17, 56, 57, 64, 70, 76, 29, 15, 31, 122, 102, 25,
+48, 49, 50, 51, 52, 53, 26, 28, 103, 37, 127, 104, 120, 121, 24,
+33, 46, 47, 62, 112, 113, 116, 105, 20, 13, 126, 128, 35, 34, 19,
+42, 43, 44, 45, 60, 61, 18, 79, 84, 91, 16, 14, 82, 89, 94,
+85, 119, 83, 88, 95, 118, 78, 90, 81, 86, 93, 12, 80, 87, 92,
+108, 109, 110, 111, 114, 115, 117, 148, 542, 149, 147, 303, 531, 555, 573,
+574, 532, 556, 150, 153, 155, 578, 304, 560, 536, 151, 154, 157, 534, 558,
+576, 533, 538, 557, 575, 547, 551, 570, 305, 568, 306, 540, 541, 544, 546,
+550, 553, 562, 564, 565, 571, 552, 554, 572, 535, 559, 577, 537, 561, 569,
+539, 543, 545, 548, 549, 563, 566, 567, 308, 307, 152, 156, 158, 382, 144,
+128, 145, 438, 446, 450, 458, 462, 470, 474, 482, 492, 500, 504, 510, 516,
+522, 530, 204, 394, 528, 381, 397, 480, 498, 396, 400, 436, 444, 448, 456,
+460, 468, 472, 490, 502, 508, 514, 520, 286, 388, 393, 294, 403, 273, 384,
+385, 387, 391, 399, 408, 313, 317, 347, 354, 414, 419, 426, 25, 88, 127,
+130, 198, 275, 336, 483, 126, 281, 283, 341, 432, 299, 325, 390, 402, 415,
+416, 417, 418, 427, 428, 116, 124, 134, 142, 221, 229, 298, 479, 486, 497,
+527, 24, 87, 227, 311, 315, 329, 353, 506, 512, 518, 30, 34, 41, 196,
+300, 484, 48, 104, 186, 191, 264, 335, 343, 363, 234, 276, 441, 443, 453,
+455, 465, 467, 477, 495, 525, 222, 269, 476, 494, 524, 395, 89, 140, 413,
+420, 425, 481, 499, 505, 511, 517, 529, 200, 257, 327, 398, 401, 440, 445,
+452, 457, 464, 469, 32, 36, 42, 47, 345, 365, 435, 442, 447, 454, 459,
+466, 471, 478, 489, 496, 501, 507, 513, 519, 526, 202, 323, 146, 170, 177,
+179, 248, 255, 368, 380, 206, 122, 132, 258, 279, 288, 296, 349, 375, 434,
+46, 114, 165, 180, 201, 219, 243, 250, 297, 405, 429, 33, 38, 43, 172,
+203, 208, 346, 392, 404, 410, 485, 488, 183, 216, 261, 348, 386, 430, 20,
+26, 65, 100, 131, 162, 167, 174, 182, 188, 189, 194, 210, 218, 240, 252,
+260, 266, 272, 284, 360, 372, 383, 423, 12, 17, 57, 92, 99, 129, 213,
+215, 230, 231, 278, 291, 293, 339, 389, 406, 411, 422, 15, 60, 62, 97,
+117, 119, 135, 199, 224, 225, 236, 245, 267, 302, 321, 326, 377, 407, 102,
+137, 175, 274, 431, 412, 421, 424, 173, 238, 246, 251, 253, 262, 270, 282,
+366, 370, 378, 437, 439, 449, 451, 461, 463, 473, 475, 491, 493, 503, 509,
+515, 521, 523, 0, 1, 81, 82, 106, 160, 168, 184, 185, 192, 193, 263,
+271, 277, 322, 358, 22, 28, 31, 40, 67, 98, 103, 105, 138, 254, 316,
+319, 355, 328, 10, 14, 49, 52, 59, 70, 73, 90, 112, 133, 220, 228,
+232, 233, 301, 309, 314, 331, 333, 337, 344, 351, 35, 37, 44, 163, 342,
+409, 433, 487, 259, 27, 29, 39, 50, 161, 164, 176, 178, 181, 187, 190,
+197, 205, 239, 241, 242, 324, 332, 359, 361, 362, 371, 373, 374, 6, 7,
+45, 55, 56, 75, 77, 79, 80, 108, 109, 159, 166, 169, 171, 195, 217,
+237, 247, 249, 256, 265, 268, 280, 334, 340, 350, 357, 367, 369, 379, 2,
+3, 9, 18, 19, 21, 23, 53, 63, 64, 66, 68, 72, 76, 83, 84,
+93, 95, 96, 101, 107, 111, 120, 121, 123, 125, 139, 141, 143, 212, 244,
+290, 295, 310, 312, 318, 320, 330, 338, 352, 356, 4, 5, 8, 11, 13,
+51, 54, 58, 61, 69, 71, 74, 78, 85, 86, 94, 110, 113, 115, 136,
+207, 209, 211, 214, 223, 226, 235, 285, 287, 289, 292, 364, 376, 16, 91,
+118, 0, 3, 19, 149, 96, 20, 150, 5, 1, 6, 4, 2, 147, 93,
+91, 145, 148, 95, 146, 85, 55, 66, 76, 59, 73, 81, 51, 61, 64,
+54, 58, 92, 94, 63, 173, 62, 86, 65, 75, 60, 74, 82, 56, 52,
+53, 57, 171, 167, 160, 159, 170, 72, 141, 162, 172, 28, 68, 29, 140,
+168, 27, 70, 126, 139, 69, 163, 89, 137, 166, 71, 169, 129, 142, 164,
+116, 135, 143, 90, 67, 113, 121, 165, 161, 131, 123, 125, 133, 30, 7,
+138, 10, 117, 119, 11, 120, 127, 134, 130, 132, 115, 124, 114, 136, 9,
+118, 33, 77, 157, 158, 8, 12, 88, 155, 156, 34, 78, 99, 97, 128,
+36, 44, 87, 35, 43, 15, 13, 17, 122, 21, 23, 25, 144, 37, 45,
+47, 103, 32, 42, 80, 39, 49, 83, 108, 40, 50, 84, 38, 46, 48,
+31, 41, 79, 18, 98, 22, 24, 26, 14, 16, 105, 107, 100, 152, 111,
+109, 104, 101, 110, 112, 106, 153, 102, 151, 154, 0, 1, 3, 4, 2,
+12, 13, 10, 11, 14, 9, 6, 5, 7, 8, 21, 24, 23, 22, 20,
+19, 15, 16, 17, 18, 0, 1, 3, 2, 108, 109, 139, 153, 122, 96,
+178, 97, 126, 95, 101, 100, 94, 174, 140, 172, 175, 173, 5, 36, 154,
+88, 83, 80, 35, 161, 151, 19, 11, 6, 147, 143, 34, 176, 123, 37,
+169, 170, 171, 163, 164, 165, 166, 167, 168, 155, 156, 157, 158, 159, 160,
+82, 162, 177, 152, 81, 111, 7, 12, 20, 128, 4, 93, 21, 64, 13,
+148, 60, 62, 118, 10, 18, 33, 144, 30, 48, 135, 149, 86, 114, 99,
+124, 129, 130, 131, 61, 63, 65, 8, 14, 16, 22, 24, 26, 28, 73,
+75, 77, 90, 56, 72, 74, 76, 78, 51, 53, 55, 57, 59, 67, 69,
+71, 79, 89, 91, 50, 52, 54, 58, 66, 68, 70, 92, 107, 39, 41,
+43, 45, 47, 110, 103, 105, 120, 145, 127, 38, 40, 42, 44, 46, 137,
+102, 104, 106, 31, 32, 49, 9, 15, 17, 23, 29, 87, 25, 27, 150,
+141, 142, 84, 85, 146, 98, 116, 119, 133, 115, 121, 136, 132, 125, 117,
+112, 113, 138, 134, 2, 0, 1, 3, 8, 6, 7, 4, 5, 9, 10,
+0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+15, 16, 2, 1, 4, 8, 7, 9, 6, 0, 5, 3, 10, 109, 107,
+108, 97, 105, 28, 30, 21, 81, 26, 32, 106, 20, 24, 35, 22, 34,
+96, 104, 62, 27, 111, 11, 18, 23, 36, 83, 37, 12, 95, 17, 46,
+56, 25, 40, 42, 87, 89, 14, 16, 13, 29, 103, 82, 110, 15, 19,
+31, 33, 102, 38, 66, 67, 68, 69, 70, 71, 72, 85, 41, 115, 117,
+91, 93, 94, 99, 101, 43, 73, 86, 88, 114, 116, 50, 52, 74, 76,
+77, 78, 79, 39, 113, 44, 45, 47, 48, 49, 51, 53, 54, 55, 57,
+58, 59, 60, 61, 63, 64, 65, 75, 80, 84, 90, 92, 98, 100, 112,
+0, 1, 20, 17, 18, 12, 19, 16, 21, 15, 23, 14, 22, 13, 0,
+6, 5, 11, 3, 9, 2, 8, 1, 7, 4, 10, 3, 4, 11, 14,
+17, 32, 0, 1, 2, 5, 6, 7, 8, 9, 10, 12, 13, 15, 16,
+18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33,
+34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 2, 3, 0, 1,
+15, 13, 17, 21, 77, 76, 33, 30, 34, 110, 105, 114, 118, 31, 32,
+35, 101, 100, 16, 131, 12, 14, 130, 135, 132, 112, 120, 116, 111, 115,
+119, 79, 117, 113, 121, 20, 133, 80, 134, 78, 81, 44, 109, 49, 47,
+124, 46, 28, 48, 126, 26, 87, 89, 90, 88, 6, 5, 7, 9, 11,
+19, 36, 38, 40, 42, 86, 91, 18, 4, 10, 39, 8, 37, 41, 43,
+45, 60, 127, 27, 61, 106, 129, 59, 108, 128, 53, 54, 57, 58, 62,
+50, 29, 56, 63, 52, 55, 107, 122, 123, 125, 51, 64, 65, 66, 67,
+68, 69, 70, 71, 72, 73, 74, 75, 82, 83, 84, 85, 92, 93, 94,
+95, 96, 97, 98, 99, 102, 103, 104, 23, 25, 24, 22, 175, 174, 176,
+162, 158, 165, 124, 166, 15, 155, 126, 160, 120, 121, 122, 123, 125, 127,
+128, 129, 153, 157, 171, 152, 163, 170, 96, 97, 108, 0, 3, 6, 9,
+12, 66, 69, 72, 75, 78, 81, 130, 131, 150, 151, 156, 159, 161, 168,
+169, 173, 177, 154, 164, 167, 172, 1, 2, 4, 5, 7, 8, 10, 11,
+13, 14, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
+44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
+59, 60, 61, 62, 63, 64, 65, 67, 68, 70, 71, 73, 74, 76, 77,
+79, 80, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
+95, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 109, 110, 111, 112,
+113, 114, 115, 116, 117, 118, 119, 132, 133, 134, 135, 136, 137, 138, 139,
+140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 178, 179, 0, 1, 2,
+8, 6, 7, 3, 5, 4, 0, 1305, 1308, 540, 545, 558, 563, 564, 569,
+570, 575, 576, 581, 582, 587, 588, 593, 594, 599, 600, 605, 606, 611, 612,
+617, 618, 623, 624, 629, 630, 635, 636, 641, 642, 647, 648, 653, 654, 657,
+662, 663, 668, 669, 672, 677, 678, 681, 684, 687, 690, 0, 1, 2, 3,
+4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
+34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
+79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
+94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
+109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
+124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
+139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153,
+154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168,
+169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183,
+184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198,
+199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
+214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228,
+229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243,
+244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258,
+259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
+274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288,
+289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303,
+304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318,
+319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333,
+334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348,
+349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363,
+364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378,
+379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393,
+394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408,
+409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423,
+424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438,
+439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453,
+454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468,
+469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483,
+484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498,
+499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513,
+514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528,
+529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 541, 542, 543, 544,
+546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 559, 560, 561,
+562, 565, 566, 567, 568, 571, 572, 573, 574, 577, 578, 579, 580, 583, 584,
+585, 586, 589, 590, 591, 592, 595, 596, 597, 598, 601, 602, 603, 604, 607,
+608, 609, 610, 613, 614, 615, 616, 619, 620, 621, 622, 625, 626, 627, 628,
+631, 632, 633, 634, 637, 638, 639, 640, 643, 644, 645, 646, 649, 650, 651,
+652, 655, 656, 658, 659, 660, 661, 664, 665, 666, 667, 670, 671, 673, 674,
+675, 676, 679, 680, 682, 683, 685, 686, 688, 689, 691, 692, 693, 694, 695,
+696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710,
+711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725,
+726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740,
+741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755,
+756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770,
+771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785,
+786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800,
+801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815,
+816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830,
+831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845,
+846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860,
+861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875,
+876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890,
+891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905,
+906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920,
+921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935,
+936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950,
+951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965,
+966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980,
+981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995,
+996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010,
+1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025,
+1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040,
+1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055,
+1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070,
+1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085,
+1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100,
+1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115,
+1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130,
+1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145,
+1146, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160,
+1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175,
+1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190,
+1191, 1192, 1193, 1194, 1195, 1196, 1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205,
+1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220,
+1221, 1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234, 1235,
+1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250,
+1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265,
+1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280,
+1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295,
+1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1306, 1307, 1309, 1310, 158, 161,
+164, 167, 170, 173, 74, 77, 86, 89, 0, 3, 12, 15, 24, 27, 36,
+39, 48, 51, 60, 63, 110, 113, 122, 125, 134, 137, 146, 149, 76, 88,
+156, 160, 162, 165, 169, 171, 2, 132, 175, 26, 38, 50, 62, 72, 83,
+84, 95, 108, 120, 78, 90, 96, 104, 174, 14, 144, 176, 9, 21, 33,
+45, 57, 69, 79, 81, 91, 93, 98, 106, 119, 131, 143, 155, 59, 71,
+157, 159, 163, 166, 168, 172, 99, 101, 103, 105, 11, 35, 47, 73, 75,
+80, 82, 85, 87, 92, 94, 97, 100, 102, 107, 117, 129, 141, 8, 20,
+23, 32, 44, 56, 68, 114, 126, 138, 150, 153, 179, 186, 191, 198, 180,
+192, 1, 4, 5, 6, 7, 10, 13, 16, 17, 18, 19, 22, 25, 28,
+29, 30, 31, 34, 37, 40, 41, 42, 43, 46, 49, 52, 53, 54, 55,
+58, 61, 64, 65, 66, 67, 70, 109, 111, 112, 115, 116, 118, 121, 123,
+124, 127, 128, 130, 133, 135, 136, 139, 140, 142, 145, 147, 148, 151, 152,
+154, 213, 214, 215, 216, 177, 189, 184, 196, 221, 222, 223, 224, 178, 181,
+182, 183, 185, 187, 188, 190, 193, 194, 195, 197, 199, 200, 201, 202, 203,
+204, 205, 206, 207, 208, 209, 210, 211, 212, 217, 218, 219, 220, 2, 4,
+6, 8, 10, 12, 32, 34, 36, 46, 48, 52, 54, 56, 58, 60, 62,
+64, 86, 87, 88, 105, 106, 107, 108, 109, 112, 113, 115, 117, 121, 1,
+3, 5, 7, 9, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23,
+25, 26, 27, 28, 29, 30, 31, 33, 35, 37, 38, 39, 40, 41, 42,
+43, 44, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 66, 67,
+68, 71, 73, 75, 76, 78, 79, 80, 82, 83, 84, 92, 93, 94, 96,
+97, 98, 99, 100, 101, 102, 103, 104, 110, 111, 114, 116, 118, 119, 120,
+122, 124, 126, 127, 129, 131, 141, 143, 145, 146, 148, 150, 152, 153, 156,
+166, 167, 170, 173, 174, 176, 180, 182, 184, 186, 0, 22, 24, 50, 69,
+70, 72, 74, 77, 81, 85, 89, 90, 91, 95, 123, 125, 128, 130, 132,
+133, 134, 135, 136, 137, 138, 139, 140, 142, 144, 147, 149, 151, 154, 155,
+157, 158, 159, 160, 161, 162, 163, 164, 165, 168, 169, 171, 172, 175, 177,
+178, 179, 181, 183, 185, 122, 85, 89, 92, 106, 118, 136, 148, 156, 164,
+27, 35, 37, 38, 52, 57, 62, 67, 71, 83, 55, 65, 68, 121, 26,
+53, 63, 66, 80, 82, 105, 114, 119, 123, 137, 143, 14, 25, 30, 31,
+100, 28, 117, 108, 134, 3, 12, 34, 36, 39, 40, 45, 46, 51, 59,
+60, 61, 73, 74, 75, 76, 77, 78, 84, 86, 87, 88, 90, 91, 93,
+94, 95, 110, 112, 115, 116, 120, 127, 128, 130, 132, 141, 142, 152, 175,
+58, 0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 16,
+17, 18, 19, 20, 21, 22, 23, 24, 29, 32, 33, 41, 42, 43, 44,
+47, 48, 49, 50, 54, 56, 64, 69, 70, 72, 79, 81, 96, 97, 98,
+99, 101, 102, 103, 104, 107, 109, 111, 113, 124, 125, 126, 129, 131, 133,
+135, 138, 139, 140, 144, 145, 146, 147, 149, 150, 151, 153, 154, 155, 157,
+158, 159, 160, 161, 162, 163, 165, 166, 167, 168, 169, 170, 171, 172, 173,
+174, 176, 177, 23, 29, 5, 24, 25, 26, 27, 28, 30, 31, 0, 1,
+2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+18, 19, 20, 21, 22, 32, 83, 84, 96, 99, 100, 16, 85, 98, 18,
+26, 27, 37, 40, 49, 52, 17, 51, 55, 57, 97, 8, 3, 19, 9,
+50, 56, 58, 10, 53, 72, 82, 87, 89, 91, 14, 118, 129, 12, 81,
+86, 88, 90, 130, 11, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31,
+32, 33, 34, 35, 36, 43, 67, 68, 69, 93, 95, 41, 45, 47, 4,
+5, 6, 13, 38, 117, 128, 71, 0, 1, 2, 15, 39, 92, 94, 65,
+70, 122, 123, 127, 7, 42, 44, 46, 48, 54, 59, 60, 61, 62, 63,
+64, 66, 105, 106, 109, 110, 111, 112, 113, 114, 121, 124, 126, 73, 74,
+75, 76, 77, 78, 79, 80, 101, 102, 103, 104, 107, 108, 115, 116, 119,
+120, 125, 18, 24, 5, 7, 9, 13, 0, 1, 2, 3, 4, 6, 8,
+10, 11, 12, 14, 15, 16, 17, 19, 20, 21, 22, 23, 25, 26, 27,
+28, 29, 30, 38, 37, 3, 2, 39, 4, 40, 5, 109, 110, 111, 99,
+107, 97, 105, 140, 141, 142, 0, 98, 106, 1, 100, 108, 34, 35, 36,
+10, 11, 42, 46, 50, 54, 58, 62, 66, 70, 13, 17, 21, 30, 6,
+88, 90, 96, 102, 113, 115, 121, 123, 125, 135, 137, 139, 9, 14, 18,
+22, 33, 44, 48, 52, 56, 60, 64, 68, 72, 116, 126, 130, 43, 47,
+51, 55, 59, 63, 67, 71, 85, 91, 93, 103, 80, 82, 83, 73, 75,
+76, 119, 129, 133, 12, 16, 20, 31, 7, 41, 45, 49, 53, 57, 61,
+65, 69, 117, 127, 131, 87, 89, 95, 101, 112, 114, 120, 122, 124, 134,
+136, 138, 86, 92, 94, 104, 118, 128, 132, 79, 81, 84, 74, 77, 78,
+8, 15, 19, 23, 32, 24, 25, 28, 26, 27, 29, 0, 1, 2, 3,
+4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
+34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
+79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
+94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
+109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
+124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
+139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153,
+154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 34, 5, 6, 7,
+8, 9, 10, 11, 12, 33, 47, 2, 4, 19, 20, 21, 36, 37, 38,
+40, 41, 0, 1, 3, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25,
+26, 27, 28, 29, 30, 31, 32, 35, 39, 42, 43, 44, 45, 46, 48,
+49, 50, 144, 145, 0, 141, 142, 143, 155, 154, 139, 140, 146, 147, 150,
+151, 76, 82, 83, 84, 85, 86, 87, 158, 131, 77, 132, 159, 23, 24,
+25, 26, 27, 28, 32, 33, 73, 79, 91, 95, 1, 3, 5, 12, 13,
+14, 15, 16, 17, 18, 19, 20, 21, 22, 29, 30, 31, 34, 102, 104,
+106, 108, 112, 113, 114, 115, 116, 117, 118, 119, 138, 37, 39, 41, 43,
+48, 50, 52, 54, 2, 4, 6, 7, 8, 9, 10, 11, 36, 38, 40,
+42, 44, 45, 46, 47, 56, 57, 58, 59, 60, 62, 64, 66, 68, 70,
+72, 74, 75, 78, 80, 81, 88, 89, 90, 92, 93, 94, 96, 97, 98,
+100, 103, 105, 107, 109, 137, 160, 161, 162, 35, 49, 51, 53, 55, 61,
+63, 65, 67, 69, 71, 99, 101, 110, 111, 120, 121, 122, 123, 124, 125,
+126, 127, 128, 129, 130, 133, 134, 135, 136, 148, 149, 152, 153, 156, 157,
+4, 11, 5, 6, 7, 8, 10, 9, 12, 17, 18, 19, 21, 2, 3,
+0, 1, 13, 14, 15, 16, 20, 28, 32, 34, 38, 40, 22, 23, 24,
+25, 26, 27, 29, 30, 31, 33, 35, 36, 37, 39, 41, 73, 69, 95,
+11, 72, 14, 12, 13, 93, 71, 74, 94, 87, 81, 86, 79, 60, 96,
+98, 88, 59, 82, 97, 44, 46, 54, 68, 92, 100, 45, 53, 67, 43,
+91, 99, 80, 89, 77, 1, 3, 9, 5, 6, 7, 8, 70, 28, 83,
+22, 34, 42, 49, 51, 57, 17, 23, 29, 37, 63, 19, 25, 31, 39,
+48, 50, 52, 56, 58, 62, 64, 66, 84, 76, 90, 78, 75, 85, 4,
+0, 2, 10, 20, 26, 32, 36, 40, 15, 61, 16, 18, 24, 30, 35,
+38, 47, 55, 65, 21, 27, 33, 41, 0, 1, 2, 3, 4, 5, 6,
+7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+22, 23, 24, 25, 26, 40, 42, 3, 1, 51, 5, 49, 48, 22, 24,
+4, 2, 52, 50, 76, 78, 80, 94, 96, 98, 23, 47, 26, 27, 63,
+64, 65, 70, 71, 21, 77, 79, 81, 17, 20, 33, 37, 41, 43, 57,
+55, 56, 58, 59, 60, 61, 62, 18, 19, 25, 32, 36, 95, 97, 99,
+0, 38, 39, 54, 67, 69, 73, 75, 85, 87, 91, 93, 53, 66, 84,
+86, 90, 89, 6, 7, 11, 12, 13, 82, 83, 68, 72, 74, 92, 8,
+9, 10, 14, 15, 16, 28, 29, 30, 31, 34, 35, 44, 45, 46, 88,
+0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
+75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
+90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
+120, 121, 122, 123, 124, 125, 0, 1, 2, 3, 4, 5, 6, 7, 8,
+9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
+69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
+84, 85, 86, 87, 88, 89, 90, 91, 92, 0, 1, 2, 3, 4, 5,
+6, 7, 8, 1, 3, 43, 0, 2, 4, 5, 6, 7, 8, 9, 10,
+11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+41, 42, 44, 45, 46, 89, 90, 0, 1, 2, 3, 4, 5, 6, 7,
+8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
+23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
+38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
+68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
+83, 84, 85, 86, 87, 88, 91, 92, 93, 94, 95, 96, 97, 98, 99,
+100, 101, 102, 103, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+26, 27, 28, 29, 30, 31, 0, 1, 2, 3, 4, 5, 6, 7, 8,
+9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
+69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 186, 189, 174,
+185, 179, 180, 177, 181, 188, 191, 60, 63, 175, 183, 176, 184, 64, 61,
+62, 65, 178, 182, 187, 190, 130, 142, 154, 166, 104, 110, 116, 13, 24,
+36, 78, 122, 136, 148, 160, 172, 7, 18, 30, 84, 102, 108, 114, 105,
+111, 117, 120, 123, 74, 86, 98, 107, 113, 119, 125, 1, 9, 20, 32,
+44, 45, 55, 75, 99, 103, 109, 115, 0, 6, 19, 31, 42, 43, 54,
+72, 73, 85, 96, 97, 137, 149, 161, 173, 2, 46, 47, 56, 76, 77,
+100, 101, 127, 133, 139, 145, 151, 157, 163, 169, 8, 21, 33, 87, 106,
+112, 118, 121, 124, 128, 129, 140, 141, 152, 153, 3, 4, 15, 26, 38,
+48, 49, 50, 51, 57, 58, 66, 67, 68, 69, 80, 90, 91, 92, 93,
+126, 131, 134, 138, 143, 146, 150, 155, 158, 162, 167, 170, 10, 11, 22,
+23, 34, 35, 88, 89, 135, 147, 159, 171, 5, 12, 14, 16, 17, 25,
+27, 28, 29, 37, 39, 40, 41, 52, 53, 59, 70, 71, 79, 81, 82,
+83, 94, 95, 132, 144, 156, 164, 165, 168, 756, 759, 761, 104, 105, 640,
+647, 700, 107, 757, 760, 102, 222, 224, 310, 420, 431, 441, 460, 468, 491,
+494, 501, 558, 571, 654, 666, 683, 722, 7, 10, 31, 34, 60, 65, 162,
+165, 178, 434, 467, 477, 480, 550, 569, 657, 671, 682, 718, 751, 13, 37,
+54, 175, 181, 262, 265, 313, 385, 465, 551, 563, 641, 645, 701, 719, 253,
+316, 333, 339, 364, 365, 369, 371, 436, 439, 461, 496, 499, 505, 514, 520,
+522, 577, 585, 588, 598, 601, 608, 617, 622, 685, 727, 733, 223, 240, 191,
+709, 92, 115, 144, 199, 248, 252, 290, 307, 338, 372, 382, 410, 475, 508,
+513, 515, 527, 547, 566, 567, 572, 580, 587, 590, 595, 604, 606, 615, 619,
+688, 716, 725, 730, 735, 739, 747, 11, 16, 22, 23, 35, 40, 46, 47,
+52, 53, 59, 64, 88, 89, 94, 103, 118, 121, 124, 138, 143, 149, 163,
+164, 179, 184, 190, 202, 205, 208, 225, 244, 245, 250, 259, 268, 280, 281,
+284, 285, 291, 322, 328, 332, 340, 373, 379, 388, 400, 401, 404, 405, 411,
+421, 426, 428, 429, 437, 442, 450, 455, 457, 469, 478, 481, 488, 497, 502,
+529, 530, 536, 537, 540, 553, 564, 570, 625, 626, 630, 635, 637, 643, 655,
+656, 668, 670, 678, 681, 691, 692, 699, 703, 704, 724, 738, 749, 750, 753,
+560, 574, 723, 85, 331, 470, 101, 217, 633, 642, 697, 742, 745, 754, 19,
+43, 48, 187, 324, 97, 218, 296, 416, 130, 137, 166, 226, 241, 271, 279,
+319, 327, 391, 399, 440, 482, 142, 283, 325, 403, 443, 453, 485, 758, 0,
+24, 67, 298, 336, 346, 464, 489, 504, 507, 510, 516, 518, 521, 523, 524,
+535, 552, 559, 573, 576, 579, 582, 583, 591, 592, 594, 599, 602, 603, 607,
+611, 614, 616, 620, 623, 632, 644, 649, 651, 661, 663, 667, 669, 684, 687,
+696, 708, 720, 726, 729, 732, 736, 1, 2, 3, 4, 5, 6, 8, 9,
+12, 14, 15, 17, 18, 20, 21, 25, 26, 27, 28, 29, 30, 32, 33,
+36, 38, 39, 41, 42, 44, 45, 49, 50, 51, 55, 56, 57, 58, 61,
+62, 63, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+80, 81, 82, 83, 84, 86, 87, 90, 91, 93, 95, 96, 98, 99, 100,
+106, 108, 109, 110, 111, 112, 113, 114, 116, 117, 119, 120, 122, 123, 125,
+126, 127, 128, 129, 131, 132, 133, 134, 135, 136, 139, 140, 141, 145, 146,
+147, 148, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 167,
+168, 169, 170, 171, 172, 173, 174, 176, 177, 180, 182, 183, 185, 186, 188,
+189, 192, 193, 194, 195, 196, 197, 198, 200, 201, 203, 204, 206, 207, 209,
+210, 211, 212, 213, 214, 215, 216, 219, 220, 221, 227, 228, 229, 230, 231,
+232, 233, 234, 235, 236, 237, 238, 239, 242, 243, 246, 247, 249, 251, 254,
+255, 256, 257, 258, 260, 261, 263, 264, 266, 267, 269, 270, 272, 273, 274,
+275, 276, 277, 278, 282, 286, 287, 288, 289, 292, 293, 294, 295, 297, 299,
+300, 301, 302, 303, 304, 305, 306, 308, 309, 311, 312, 314, 315, 317, 318,
+320, 321, 323, 326, 329, 330, 334, 335, 337, 341, 342, 343, 344, 345, 347,
+348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362,
+363, 366, 367, 368, 370, 374, 375, 376, 377, 378, 380, 381, 383, 384, 386,
+387, 389, 390, 392, 393, 394, 395, 396, 397, 398, 402, 406, 407, 408, 409,
+412, 413, 414, 415, 417, 418, 419, 422, 423, 424, 425, 427, 430, 432, 433,
+435, 438, 444, 445, 446, 447, 448, 449, 451, 452, 454, 456, 458, 459, 462,
+463, 466, 471, 472, 473, 474, 476, 479, 483, 484, 486, 487, 490, 492, 493,
+495, 498, 500, 503, 506, 509, 511, 512, 517, 519, 525, 526, 528, 531, 532,
+533, 534, 538, 539, 541, 542, 543, 544, 545, 546, 548, 549, 554, 555, 556,
+557, 561, 562, 565, 568, 575, 578, 581, 584, 586, 589, 593, 596, 597, 600,
+605, 609, 610, 612, 613, 618, 621, 624, 627, 628, 629, 631, 634, 636, 638,
+639, 646, 648, 650, 652, 653, 658, 659, 660, 662, 664, 665, 672, 673, 674,
+675, 676, 677, 679, 680, 686, 689, 690, 693, 694, 695, 698, 702, 705, 706,
+707, 710, 711, 712, 713, 714, 715, 717, 721, 728, 731, 734, 737, 740, 741,
+743, 744, 746, 748, 752, 755, 325, 326, 324, 15, 258, 103, 123, 3, 9,
+124, 331, 14, 259, 16, 2, 8, 337, 102, 335, 340, 4, 10, 17, 120,
+246, 247, 276, 333, 334, 33, 72, 128, 338, 5, 11, 76, 105, 127, 0,
+13, 74, 73, 122, 1, 75, 7, 300, 336, 364, 6, 12, 228, 235, 263,
+265, 270, 280, 291, 106, 297, 77, 135, 162, 169, 192, 199, 201, 214, 216,
+225, 260, 262, 104, 306, 316, 339, 170, 200, 223, 341, 137, 160, 190, 203,
+215, 218, 141, 150, 157, 171, 180, 187, 312, 313, 317, 39, 125, 143, 148,
+158, 173, 178, 188, 308, 318, 107, 322, 362, 35, 91, 97, 109, 299, 230,
+272, 293, 244, 256, 289, 323, 367, 38, 121, 302, 303, 311, 327, 245, 257,
+261, 290, 305, 234, 264, 279, 34, 36, 79, 85, 115, 126, 298, 307, 309,
+319, 328, 57, 63, 69, 198, 229, 271, 292, 82, 88, 90, 96, 108, 118,
+304, 320, 329, 37, 41, 80, 86, 116, 301, 332, 139, 159, 164, 168, 189,
+194, 205, 213, 217, 220, 222, 40, 136, 145, 167, 177, 197, 202, 212, 227,
+18, 27, 48, 363, 237, 267, 282, 196, 240, 241, 252, 253, 285, 286, 142,
+147, 152, 155, 156, 172, 175, 182, 185, 186, 310, 321, 330, 346, 347, 348,
+355, 138, 163, 165, 193, 195, 204, 210, 219, 226, 131, 132, 208, 250, 251,
+278, 314, 315, 357, 365, 140, 146, 179, 206, 211, 20, 29, 50, 161, 166,
+191, 221, 224, 269, 368, 26, 44, 47, 58, 64, 70, 81, 87, 117, 144,
+151, 153, 174, 181, 183, 93, 99, 111, 232, 274, 295, 59, 65, 71, 133,
+134, 149, 154, 176, 184, 209, 350, 361, 239, 242, 254, 284, 287, 268, 56,
+62, 68, 78, 84, 94, 100, 112, 114, 92, 98, 110, 238, 283, 55, 61,
+67, 349, 236, 243, 255, 266, 281, 288, 19, 24, 28, 42, 45, 49, 129,
+130, 207, 248, 249, 277, 354, 359, 360, 233, 275, 296, 352, 353, 22, 31,
+52, 54, 60, 66, 83, 89, 95, 101, 113, 119, 342, 345, 366, 231, 273,
+294, 25, 43, 46, 23, 32, 53, 343, 351, 358, 21, 30, 51, 344, 356,
+0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
+75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
+90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
+120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
+135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
+150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
+165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
+180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
+195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
+210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
+225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
+240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
+255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269,
+270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
+285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
+300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
+315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329,
+330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
+345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359,
+360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
+375, 376, 377, 19, 29, 33, 45, 86, 88, 90, 92, 18, 27, 31, 47,
+82, 103, 37, 41, 55, 87, 11, 35, 39, 43, 49, 51, 53, 57, 61,
+63, 89, 91, 105, 109, 114, 20, 9, 13, 107, 28, 30, 32, 34, 46,
+48, 78, 84, 133, 135, 93, 112, 134, 136, 36, 40, 62, 66, 80, 38,
+42, 44, 50, 52, 54, 56, 58, 64, 127, 131, 137, 1, 15, 16, 21,
+22, 102, 111, 113, 128, 132, 138, 23, 25, 59, 68, 70, 94, 69, 3,
+4, 6, 7, 10, 104, 106, 108, 110, 121, 123, 67, 24, 26, 60, 122,
+124, 72, 76, 81, 96, 85, 74, 98, 129, 83, 125, 0, 2, 5, 8,
+12, 14, 17, 71, 73, 75, 77, 79, 95, 97, 99, 100, 126, 65, 130,
+101, 118, 116, 120, 115, 117, 119, 219, 220, 221, 127, 131, 135, 139, 228,
+229, 230, 231, 232, 233, 234, 235, 222, 223, 224, 225, 226, 227, 236, 237,
+238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252,
+253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 275,
+276, 277, 278, 9, 13, 17, 21, 25, 29, 36, 40, 44, 48, 49, 56,
+60, 64, 68, 72, 76, 80, 84, 171, 176, 180, 184, 0, 1, 2, 3,
+4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 16, 18, 19, 20, 22,
+23, 24, 26, 27, 28, 30, 31, 32, 33, 34, 35, 37, 38, 39, 41,
+42, 43, 45, 46, 47, 50, 51, 52, 53, 54, 55, 57, 58, 59, 61,
+62, 63, 65, 66, 67, 69, 70, 71, 73, 74, 75, 77, 78, 79, 81,
+82, 83, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
+98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
+113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 128,
+129, 130, 132, 133, 134, 136, 137, 138, 140, 141, 142, 143, 144, 145, 146,
+147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161,
+162, 163, 164, 165, 166, 167, 168, 169, 170, 172, 173, 174, 175, 177, 178,
+179, 181, 182, 183, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195,
+196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210,
+211, 212, 213, 214, 215, 216, 217, 218, 267, 268, 269, 270, 271, 272, 273,
+274, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 1, 2,
+3, 4, 0, 8, 12, 11, 102, 127, 6, 5, 101, 7, 128, 4, 3,
+10, 1, 2, 0, 9, 92, 90, 97, 114, 94, 95, 99, 112, 111, 123,
+116, 118, 120, 121, 125, 98, 89, 91, 96, 93, 100, 113, 24, 34, 16,
+36, 14, 22, 13, 21, 33, 18, 26, 30, 115, 117, 124, 119, 122, 126,
+17, 25, 29, 104, 19, 27, 31, 106, 28, 20, 32, 15, 23, 35, 54,
+56, 110, 51, 72, 88, 38, 40, 49, 58, 60, 64, 66, 74, 81, 105,
+107, 37, 39, 50, 52, 57, 59, 63, 65, 71, 73, 82, 87, 42, 43,
+45, 48, 61, 67, 70, 76, 77, 79, 83, 86, 53, 55, 41, 44, 46,
+47, 62, 68, 69, 75, 78, 80, 84, 85, 109, 103, 108, 7, 8, 6,
+9, 17, 10, 28, 26, 24, 50, 68, 4, 34, 5, 0, 23, 46, 2,
+18, 33, 1, 85, 19, 58, 62, 70, 29, 31, 35, 3, 25, 27, 47,
+48, 49, 51, 11, 90, 30, 32, 36, 40, 41, 42, 43, 44, 45, 12,
+13, 14, 15, 16, 20, 21, 22, 37, 38, 39, 52, 53, 54, 55, 56,
+57, 59, 60, 61, 63, 64, 65, 66, 67, 69, 71, 72, 73, 74, 75,
+76, 77, 78, 79, 80, 81, 82, 83, 84, 86, 87, 88, 89, 88, 125,
+101, 103, 124, 127, 134, 135, 25, 29, 37, 45, 165, 177, 163, 180, 138,
+142, 113, 24, 28, 36, 40, 41, 44, 48, 49, 58, 59, 60, 61, 66,
+67, 68, 69, 70, 71, 72, 73, 89, 92, 93, 145, 148, 149, 94, 105,
+109, 151, 154, 161, 173, 96, 99, 100, 102, 104, 107, 108, 111, 114, 115,
+116, 118, 119, 120, 122, 123, 126, 132, 133, 136, 137, 140, 141, 155, 156,
+159, 160, 164, 169, 171, 172, 175, 176, 179, 181, 182, 183, 0, 1, 2,
+3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+18, 19, 20, 21, 22, 23, 26, 27, 30, 31, 32, 33, 34, 35, 38,
+39, 42, 43, 46, 47, 50, 51, 52, 53, 54, 55, 56, 57, 62, 63,
+64, 65, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
+87, 90, 91, 95, 97, 98, 106, 110, 112, 117, 121, 128, 129, 130, 131,
+139, 143, 144, 146, 147, 150, 152, 153, 157, 158, 162, 166, 167, 168, 170,
+174, 178, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
+28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 0, 1, 2, 3,
+4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
+34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
+79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
+94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
+109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
+124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
+139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153,
+154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168,
+169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183,
+184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198,
+199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
+214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228,
+229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243,
+244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258,
+259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
+274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288,
+289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303,
+304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318,
+319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333,
+334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348,
+349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363,
+364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378,
+379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393,
+394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408,
+409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423,
+424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438,
+439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453,
+454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468,
+469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483,
+484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498,
+499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513,
+514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528,
+529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543,
+544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558,
+559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573,
+574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588,
+589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603,
+604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618,
+619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633,
+634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648,
+649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663,
+664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678,
+679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693,
+694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708,
+709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723,
+724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738,
+739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753,
+754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768,
+769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783,
+784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798,
+799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813,
+814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828,
+829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843,
+844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858,
+859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873,
+874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888,
+889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903,
+904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918,
+919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933,
+934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948,
+949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963,
+964, 965, 966, 967, 968, 969, 970, 971, 306, 146, 158, 174, 216, 233, 27,
+29, 121, 123, 125, 127, 144, 150, 152, 173, 188, 218, 295, 299, 307, 0,
+1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 28, 30, 31, 32,
+33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
+78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
+93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
+108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 122, 124,
+126, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141,
+142, 143, 145, 147, 148, 149, 151, 153, 154, 155, 156, 157, 159, 160, 161,
+162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 175, 176, 177, 178,
+179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 190, 191, 192, 193, 194,
+195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
+210, 211, 212, 213, 214, 215, 217, 219, 220, 221, 222, 223, 224, 225, 226,
+227, 228, 229, 230, 231, 232, 234, 235, 236, 237, 238, 239, 240, 241, 242,
+243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257,
+258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
+273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287,
+288, 289, 290, 291, 292, 293, 294, 296, 297, 298, 300, 301, 302, 303, 304,
+305, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321,
+322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336,
+337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351,
+352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366,
+367, 368, 369, 370, 371, 372, 373, 374, 76, 106, 77, 107, 125, 115, 126,
+60, 61, 71, 59, 96, 99, 110, 89, 70, 58, 25, 27, 33, 35, 86,
+87, 72, 75, 79, 94, 112, 95, 100, 73, 74, 78, 101, 102, 105, 109,
+88, 26, 32, 34, 103, 104, 108, 24, 97, 98, 113, 114, 44, 64, 69,
+36, 38, 41, 43, 47, 54, 57, 63, 66, 111, 37, 39, 40, 42, 45,
+46, 55, 56, 62, 65, 67, 68, 90, 92, 5, 11, 9, 84, 8, 4,
+10, 2, 48, 50, 52, 81, 82, 0, 6, 12, 14, 85, 80, 83, 49,
+51, 53, 91, 93, 118, 121, 124, 3, 17, 18, 21, 22, 29, 30, 1,
+7, 13, 15, 116, 119, 122, 129, 16, 19, 20, 23, 28, 31, 117, 120,
+123, 127, 128, 130, 3, 4, 5, 6, 25, 26, 27, 28, 29, 33, 41,
+54, 61, 62, 99, 101, 105, 106, 107, 108, 133, 134, 0, 7, 30, 83,
+86, 87, 88, 90, 91, 92, 93, 135, 136, 137, 1, 2, 31, 32, 34,
+100, 102, 103, 104, 119, 132, 138, 139, 140, 16, 21, 22, 23, 24, 44,
+51, 64, 65, 66, 67, 69, 71, 72, 73, 74, 75, 76, 8, 9, 10,
+11, 12, 13, 14, 15, 35, 36, 42, 43, 46, 48, 49, 50, 52, 60,
+63, 77, 78, 79, 80, 81, 82, 85, 89, 94, 95, 96, 97, 98, 109,
+110, 111, 112, 113, 114, 115, 120, 121, 17, 18, 19, 20, 37, 38, 39,
+40, 45, 47, 53, 55, 56, 57, 58, 59, 68, 70, 84, 116, 117, 118,
+122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 141, 142, 143, 144, 145,
+146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160,
+161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
+176, 177, 178, 179, 180, 181, 182, 49, 18, 16, 17, 42, 45, 15, 8,
+46, 39, 6, 48, 7, 9, 10, 41, 44, 5, 40, 43, 30, 47, 51,
+52, 25, 19, 20, 21, 22, 23, 24, 3, 4, 29, 31, 32, 33, 34,
+35, 36, 37, 38, 71, 73, 11, 12, 13, 14, 50, 70, 0, 1, 2,
+26, 27, 28, 60, 62, 69, 61, 63, 64, 65, 72, 75, 76, 54, 55,
+56, 57, 58, 59, 66, 68, 81, 82, 83, 84, 86, 74, 53, 67, 77,
+78, 79, 80, 85, 87, 88, 0, 1, 2, 3, 4, 5, 6, 7, 8,
+9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
+69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
+84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
+99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
+114, 115, 116, 117, 118, 119, 120, 121, 122, 0, 1, 2, 3, 4, 5,
+6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+21, 100, 31, 35, 41, 33, 30, 34, 40, 82, 81, 103, 47, 32, 15,
+99, 46, 9, 21, 8, 69, 65, 67, 14, 62, 57, 58, 60, 80, 56,
+20, 11, 97, 10, 85, 86, 1, 22, 26, 36, 16, 17, 78, 79, 105,
+108, 5, 24, 28, 38, 44, 45, 59, 61, 63, 70, 109, 111, 0, 4,
+25, 29, 39, 50, 51, 54, 55, 71, 72, 73, 74, 75, 76, 77, 95,
+96, 101, 102, 104, 110, 98, 18, 19, 83, 84, 89, 23, 27, 37, 42,
+43, 48, 113, 2, 3, 6, 7, 12, 13, 49, 52, 53, 87, 88, 90,
+91, 92, 93, 94, 106, 107, 112, 64, 66, 68, 5, 4, 0, 39, 48,
+17, 8, 6, 7, 77, 78, 75, 76, 79, 80, 16, 15, 73, 56, 55,
+74, 40, 41, 42, 60, 9, 10, 11, 12, 13, 14, 59, 43, 62, 1,
+2, 3, 44, 61, 58, 68, 22, 23, 28, 35, 36, 45, 46, 47, 57,
+67, 69, 70, 71, 19, 18, 20, 21, 24, 25, 26, 27, 29, 30, 31,
+32, 33, 34, 37, 38, 49, 50, 51, 52, 53, 54, 63, 64, 65, 66,
+72, 81, 82, 83, 84, 34, 44, 71, 32, 43, 30, 35, 72, 33, 11,
+10, 39, 37, 13, 38, 42, 36, 12, 41, 31, 8, 9, 40, 50, 69,
+55, 20, 24, 28, 135, 1, 5, 15, 136, 70, 46, 51, 114, 115, 45,
+3, 7, 17, 113, 116, 54, 128, 129, 134, 138, 0, 4, 14, 26, 19,
+23, 27, 48, 62, 63, 68, 123, 124, 125, 126, 131, 132, 29, 49, 59,
+60, 66, 127, 130, 133, 86, 110, 119, 57, 58, 65, 83, 87, 103, 111,
+122, 18, 22, 82, 102, 61, 64, 67, 21, 25, 52, 2, 6, 16, 75,
+76, 85, 90, 95, 99, 100, 109, 120, 56, 73, 74, 77, 78, 79, 80,
+81, 84, 88, 89, 91, 92, 93, 94, 96, 97, 98, 101, 104, 105, 106,
+107, 108, 112, 117, 118, 121, 137, 47, 53, 4, 5, 0, 1, 2, 3,
+7, 8, 6, 9, 10, 20, 25, 27, 18, 19, 21, 23, 24, 26, 28,
+0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+15, 16, 17, 22, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+40, 41, 76, 96, 112, 109, 110, 94, 95, 49, 73, 56, 61, 65, 68,
+102, 30, 37, 38, 40, 41, 44, 45, 47, 48, 55, 57, 59, 60, 79,
+82, 88, 89, 90, 91, 92, 98, 100, 105, 108, 111, 0, 1, 2, 3,
+4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34,
+35, 36, 39, 42, 43, 46, 50, 51, 52, 53, 54, 58, 62, 63, 64,
+66, 67, 69, 70, 71, 72, 74, 75, 77, 78, 80, 81, 83, 84, 85,
+86, 87, 93, 97, 99, 101, 103, 104, 106, 107, 113, 91, 42, 46, 77,
+26, 8, 78, 41, 43, 44, 47, 68, 5, 30, 45, 89, 90, 48, 49,
+50, 51, 25, 76, 93, 14, 70, 88, 4, 23, 24, 29, 59, 63, 75,
+79, 92, 97, 0, 1, 2, 6, 7, 15, 16, 17, 20, 21, 27, 31,
+32, 33, 34, 35, 36, 62, 64, 67, 72, 61, 66, 71, 86, 94, 12,
+74, 55, 58, 60, 81, 83, 3, 9, 10, 11, 13, 18, 19, 22, 28,
+37, 38, 39, 40, 53, 56, 65, 69, 73, 82, 84, 85, 52, 54, 57,
+80, 87, 95, 96, 1, 8, 10, 13, 12, 6, 2, 0, 11, 9, 5,
+25, 7, 19, 43, 44, 45, 32, 33, 34, 50, 51, 52, 26, 22, 23,
+3, 4, 28, 15, 36, 37, 49, 30, 31, 29, 14, 20, 21, 24, 27,
+17, 39, 46, 16, 35, 53, 38, 40, 41, 42, 18, 47, 48, 0, 1,
+2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
+47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
+62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
+77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
+92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
+107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
+122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
+0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 49, 310, 312,
+314, 269, 271, 273, 275, 277, 279, 281, 297, 299, 0, 1, 2, 3, 4,
+5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50,
+51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
+66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
+81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
+111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
+126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140,
+141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155,
+156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170,
+171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185,
+186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
+201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215,
+216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230,
+231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245,
+246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260,
+261, 262, 263, 264, 265, 266, 267, 268, 270, 272, 274, 276, 278, 280, 282,
+283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 298,
+300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 311, 313, 315, 316, 317,
+318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332,
+333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347,
+348, 349, 350, 351, 352, 353, 354, 355, 179, 200, 161, 175, 243, 100, 104,
+196, 198, 223, 227, 176, 203, 212, 215, 162, 163, 247, 160, 174, 216, 218,
+158, 172, 96, 157, 166, 170, 197, 199, 217, 219, 159, 173, 178, 201, 99,
+101, 103, 105, 177, 202, 213, 214, 98, 102, 92, 108, 112, 116, 120, 124,
+128, 132, 184, 192, 208, 180, 188, 204, 239, 249, 221, 225, 154, 165, 169,
+51, 53, 55, 57, 59, 63, 67, 71, 75, 79, 83, 87, 95, 119, 123,
+127, 131, 138, 142, 146, 150, 183, 191, 207, 236, 241, 245, 250, 61, 65,
+69, 73, 77, 81, 85, 89, 93, 109, 113, 117, 140, 144, 148, 152, 8,
+9, 14, 15, 20, 21, 50, 52, 54, 56, 91, 107, 111, 115, 121, 125,
+129, 133, 134, 135, 136, 137, 141, 145, 149, 153, 155, 164, 168, 181, 187,
+189, 195, 205, 211, 58, 62, 66, 70, 74, 78, 82, 86, 118, 122, 126,
+130, 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 16, 17,
+18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+60, 64, 68, 72, 76, 80, 84, 88, 139, 143, 147, 151, 186, 194, 210,
+222, 226, 238, 242, 246, 248, 94, 97, 156, 167, 171, 228, 230, 90, 106,
+110, 114, 220, 224, 237, 240, 244, 251, 182, 185, 190, 193, 206, 209, 229,
+231, 232, 233, 234, 235, 24, 51, 54, 111, 25, 52, 55, 112, 13, 31,
+34, 37, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 26, 27, 28, 29, 30,
+32, 33, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+49, 50, 53, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
+68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
+83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
+98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 113, 114,
+115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
+130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 0,
+1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+16, 17, 8, 16, 18, 7, 26, 30, 34, 104, 14, 15, 17, 19, 22,
+48, 68, 73, 75, 79, 11, 1, 6, 20, 28, 32, 36, 38, 40, 44,
+98, 102, 103, 105, 106, 115, 2, 13, 21, 23, 49, 53, 54, 55, 56,
+57, 58, 60, 61, 64, 66, 67, 69, 76, 83, 85, 95, 100, 10, 0,
+3, 4, 5, 9, 12, 24, 25, 27, 29, 31, 33, 35, 37, 39, 41,
+42, 43, 45, 46, 47, 50, 51, 52, 59, 62, 63, 65, 70, 71, 72,
+74, 77, 78, 80, 81, 82, 84, 86, 87, 88, 89, 90, 91, 92, 93,
+94, 96, 97, 99, 101, 107, 108, 109, 110, 111, 112, 113, 114, 116, 117,
+118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 121, 120, 103, 101, 102,
+86, 111, 124, 27, 44, 100, 10, 13, 82, 92, 98, 78, 88, 94, 42,
+40, 9, 11, 12, 14, 80, 84, 90, 96, 45, 119, 122, 46, 48, 50,
+52, 104, 106, 109, 110, 1, 4, 18, 25, 29, 32, 19, 34, 22, 5,
+8, 38, 107, 39, 16, 17, 21, 26, 30, 33, 43, 87, 125, 41, 83,
+93, 99, 2, 24, 28, 31, 35, 53, 55, 81, 91, 97, 105, 0, 3,
+7, 6, 15, 20, 23, 36, 37, 47, 49, 51, 54, 56, 57, 58, 59,
+60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
+75, 76, 77, 79, 85, 89, 95, 108, 112, 113, 114, 115, 116, 117, 118,
+123, 161, 57, 60, 95, 169, 165, 171, 0, 160, 40, 168, 164, 39, 58,
+59, 96, 1, 2, 50, 55, 64, 75, 85, 92, 97, 71, 77, 81, 87,
+6, 16, 30, 44, 181, 170, 49, 56, 63, 76, 86, 91, 98, 174, 180,
+5, 15, 29, 43, 72, 78, 82, 88, 113, 126, 194, 195, 198, 158, 159,
+162, 163, 114, 125, 144, 145, 166, 167, 192, 193, 156, 47, 48, 51, 52,
+53, 54, 61, 62, 65, 66, 83, 84, 89, 90, 93, 94, 99, 100, 101,
+102, 103, 104, 130, 131, 132, 133, 134, 135, 152, 175, 176, 177, 67, 69,
+73, 79, 105, 3, 4, 7, 8, 13, 14, 17, 18, 19, 20, 25, 26,
+27, 28, 31, 32, 33, 34, 37, 38, 41, 42, 45, 46, 68, 70, 74,
+80, 106, 117, 118, 142, 143, 178, 179, 138, 9, 140, 147, 148, 107, 109,
+111, 139, 141, 146, 149, 182, 183, 184, 185, 190, 191, 115, 119, 121, 123,
+137, 155, 157, 187, 189, 197, 10, 11, 12, 21, 22, 23, 24, 35, 36,
+108, 110, 112, 116, 120, 122, 124, 127, 128, 129, 136, 150, 151, 153, 154,
+173, 186, 188, 196, 172, 37, 36, 33, 32, 35, 34, 4, 2, 6, 0,
+44, 45, 47, 46, 42, 43, 39, 41, 40, 38, 5, 7, 3, 1, 51,
+17, 11, 15, 19, 9, 13, 10, 14, 18, 16, 23, 24, 27, 28, 31,
+8, 12, 20, 22, 21, 25, 26, 29, 30, 49, 48, 50, 179, 176, 165,
+178, 171, 175, 174, 177, 162, 168, 190, 188, 202, 200, 33, 75, 93, 51,
+81, 87, 173, 164, 157, 114, 3, 6, 156, 15, 21, 27, 170, 167, 123,
+63, 69, 39, 45, 57, 199, 211, 172, 208, 205, 214, 181, 184, 203, 196,
+169, 198, 201, 160, 161, 137, 163, 125, 209, 119, 183, 215, 166, 207, 204,
+213, 197, 191, 206, 210, 182, 212, 187, 185, 53, 83, 89, 192, 186, 193,
+136, 180, 194, 130, 142, 154, 155, 148, 149, 131, 143, 116, 32, 74, 92,
+122, 101, 107, 110, 113, 98, 104, 71, 65, 41, 47, 59, 2, 11, 14,
+20, 26, 195, 189, 147, 150, 151, 145, 133, 127, 139, 126, 138, 132, 144,
+117, 159, 52, 82, 88, 158, 120, 96, 102, 108, 99, 105, 111, 30, 72,
+90, 8, 5, 9, 0, 124, 97, 103, 109, 12, 18, 24, 48, 78, 84,
+66, 60, 70, 62, 35, 77, 95, 68, 42, 50, 80, 86, 17, 23, 29,
+36, 54, 38, 44, 56, 152, 153, 64, 40, 58, 46, 128, 140, 129, 134,
+135, 141, 146, 106, 100, 112, 121, 7, 4, 115, 118, 34, 61, 76, 94,
+16, 22, 28, 37, 43, 55, 49, 79, 85, 67, 1, 13, 19, 25, 31,
+73, 91, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
+57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
+72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
+87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
+102, 103, 104, 105, 106, 107, 108, 109, 110, 2, 5, 8, 11, 14, 17,
+20, 23, 26, 29, 32, 35, 38, 41, 44, 47, 50, 53, 56, 59, 62,
+65, 68, 0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 15, 16, 18,
+19, 21, 22, 24, 25, 27, 28, 30, 31, 33, 34, 36, 37, 39, 40,
+42, 43, 45, 46, 48, 49, 51, 52, 54, 55, 57, 58, 60, 61, 63,
+64, 66, 67, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+53, 52, 72, 71, 73, 70, 97, 98, 96, 99, 68, 80, 82, 74, 77,
+78, 5, 22, 25, 41, 49, 1, 9, 17, 95, 103, 102, 104, 75, 76,
+79, 66, 69, 93, 67, 94, 81, 83, 84, 85, 86, 87, 88, 89, 90,
+91, 106, 107, 92, 100, 101, 105, 32, 34, 38, 12, 15, 54, 58, 62,
+39, 14, 36, 57, 61, 65, 31, 35, 47, 29, 45, 42, 28, 44, 30,
+46, 18, 16, 55, 59, 63, 40, 21, 26, 50, 3, 7, 11, 19, 0,
+4, 8, 33, 37, 20, 23, 24, 27, 43, 48, 51, 2, 6, 10, 13,
+56, 60, 64, 0, 2, 1, 11, 5, 6, 12, 3, 4, 9, 10, 14,
+7, 8, 13, 21, 36, 18, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+32, 33, 34, 35, 37, 15, 16, 22, 17, 19, 20, 0, 1, 0, 1,
+2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 48, 5, 34, 63,
+4, 62, 50, 47, 49, 33, 35, 36, 29, 3, 6, 61, 64, 54, 58,
+45, 32, 51, 56, 60, 70, 57, 40, 46, 11, 55, 59, 44, 53, 65,
+72, 14, 15, 17, 20, 22, 27, 66, 68, 69, 71, 26, 19, 67, 1,
+9, 12, 7, 25, 24, 28, 30, 31, 10, 8, 16, 18, 21, 23, 52,
+0, 2, 41, 42, 43, 13, 37, 38, 39, 107, 15, 97, 100, 101, 105,
+99, 33, 81, 79, 80, 34, 92, 95, 86, 48, 118, 41, 43, 119, 35,
+36, 37, 75, 102, 103, 104, 23, 24, 25, 26, 31, 4, 17, 19, 21,
+22, 27, 38, 39, 52, 56, 58, 64, 70, 72, 82, 47, 87, 51, 55,
+57, 77, 78, 98, 116, 117, 28, 29, 30, 32, 40, 42, 5, 7, 9,
+93, 96, 1, 2, 3, 6, 8, 10, 12, 54, 59, 65, 66, 68, 69,
+71, 73, 74, 76, 83, 84, 89, 90, 106, 109, 111, 112, 114, 44, 45,
+46, 49, 50, 11, 53, 16, 18, 20, 0, 13, 14, 60, 61, 62, 63,
+67, 85, 88, 91, 94, 108, 110, 113, 115, 13, 4, 46, 47, 2, 6,
+37, 38, 43, 51, 54, 55, 58, 67, 69, 0, 1, 3, 5, 7, 8,
+9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 39, 40, 41,
+42, 44, 45, 48, 49, 50, 52, 53, 56, 57, 59, 60, 61, 62, 63,
+64, 65, 66, 68, 70, 71, 72, 73, 74, 75, 7, 4, 6, 5, 2,
+3, 9, 8, 0, 1, 23, 22, 24, 25, 14, 26, 30, 34, 10, 11,
+12, 13, 15, 16, 17, 18, 19, 20, 21, 27, 28, 29, 31, 32, 33,
+35, 36, 37, 0, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+25, 26, 27, 28, 29, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
+70, 71, 72, 73, 0, 1, 2, 3, 4, 4, 0, 1, 2, 3, 5,
+6, 7, 8, 0, 1, 2, 3, 4, 5, 323, 139, 149, 165, 207, 234,
+320, 296, 300, 20, 44, 45, 52, 138, 147, 189, 191, 192, 193, 210, 213,
+215, 217, 226, 232, 236, 238, 293, 322, 325, 74, 122, 306, 150, 264, 4,
+5, 197, 201, 117, 172, 188, 195, 203, 222, 244, 245, 265, 271, 291, 292,
+332, 2, 18, 19, 22, 34, 46, 57, 82, 84, 85, 88, 89, 120, 130,
+133, 134, 136, 137, 140, 142, 143, 145, 146, 148, 153, 159, 160, 161, 162,
+166, 169, 173, 184, 185, 209, 211, 219, 228, 229, 231, 237, 240, 242, 243,
+246, 247, 248, 251, 253, 254, 257, 286, 294, 298, 324, 335, 33, 98, 118,
+200, 204, 303, 305, 327, 100, 196, 205, 275, 123, 126, 282, 0, 1, 3,
+6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 21, 23, 24,
+25, 26, 27, 28, 29, 30, 31, 32, 35, 36, 37, 38, 39, 40, 41,
+42, 43, 47, 48, 49, 50, 51, 53, 54, 55, 56, 58, 59, 60, 61,
+62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 75, 76, 77,
+78, 79, 80, 81, 83, 86, 87, 90, 91, 92, 93, 94, 95, 96, 97,
+99, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
+115, 116, 119, 121, 124, 125, 127, 128, 129, 131, 132, 135, 141, 144, 151,
+152, 154, 155, 156, 157, 158, 163, 164, 167, 168, 170, 171, 174, 175, 176,
+177, 178, 179, 180, 181, 182, 183, 186, 187, 190, 194, 198, 199, 202, 206,
+208, 212, 214, 216, 218, 220, 221, 223, 224, 225, 227, 230, 233, 235, 239,
+241, 249, 250, 252, 255, 256, 258, 259, 260, 261, 262, 263, 266, 267, 268,
+269, 270, 272, 273, 274, 276, 277, 278, 279, 280, 281, 283, 284, 285, 287,
+288, 289, 290, 295, 297, 299, 301, 302, 304, 307, 308, 309, 310, 311, 312,
+313, 314, 315, 316, 317, 318, 319, 321, 326, 328, 329, 330, 331, 333, 334,
+336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350,
+351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 0, 1,
+2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
+47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
+62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
+77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
+92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
+107, 108, 109, 4, 5, 18, 20, 0, 1, 2, 3, 6, 7, 8, 9,
+10, 11, 12, 13, 14, 15, 16, 17, 19, 21, 22, 23, 24, 25, 26,
+0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
+70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
+85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
+100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
+115, 116, 117, 118, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
+71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
+86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
+101, 102, 103, 104, 105, 106, 107, 38, 40, 39, 65, 63, 66, 26, 28,
+11, 20, 24, 32, 108, 8, 47, 45, 48, 49, 105, 109, 139, 75, 124,
+18, 22, 30, 34, 111, 102, 114, 118, 77, 123, 133, 1, 5, 17, 46,
+69, 73, 81, 29, 78, 101, 37, 50, 64, 9, 51, 55, 61, 76, 68,
+72, 84, 2, 6, 14, 19, 23, 35, 67, 71, 79, 83, 107, 113, 115,
+117, 137, 147, 36, 10, 27, 53, 57, 59, 135, 13, 103, 104, 126, 3,
+7, 15, 41, 44, 54, 58, 60, 70, 74, 80, 82, 0, 4, 12, 16,
+21, 25, 31, 33, 42, 43, 52, 56, 62, 85, 88, 91, 94, 106, 110,
+112, 116, 119, 120, 121, 122, 125, 127, 128, 129, 130, 131, 132, 134, 136,
+138, 140, 141, 142, 143, 144, 145, 146, 148, 89, 86, 87, 90, 92, 93,
+95, 96, 97, 98, 99, 100, 0, 1, 2, 3, 4, 5, 6, 7, 8,
+9, 10, 11, 12, 1, 2, 4, 32, 36, 38, 3, 34, 28, 31, 35,
+37, 6, 12, 14, 19, 20, 22, 33, 39, 43, 53, 54, 55, 56, 57,
+61, 67, 69, 70, 71, 30, 0, 5, 7, 8, 9, 10, 11, 13, 15,
+16, 17, 18, 21, 23, 24, 25, 26, 27, 29, 40, 41, 42, 44, 45,
+46, 47, 48, 49, 50, 51, 52, 58, 59, 60, 62, 63, 64, 65, 66,
+68, 72, 16, 28, 34, 38, 42, 2, 14, 15, 18, 19, 26, 29, 30,
+31, 32, 33, 40, 43, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10,
+11, 12, 13, 17, 20, 21, 22, 23, 24, 25, 27, 35, 36, 37, 39,
+41, 2, 0, 7, 1, 86, 5, 74, 21, 89, 85, 88, 3, 4, 6,
+51, 23, 111, 70, 56, 90, 98, 27, 78, 53, 68, 80, 87, 116, 12,
+25, 109, 114, 103, 108, 110, 9, 57, 62, 65, 91, 96, 99, 69, 71,
+72, 73, 81, 49, 50, 52, 93, 101, 36, 55, 64, 125, 19, 20, 22,
+106, 41, 8, 11, 13, 29, 34, 37, 54, 102, 107, 118, 123, 126, 14,
+15, 16, 18, 82, 83, 84, 92, 97, 100, 104, 112, 17, 32, 121, 94,
+24, 113, 76, 77, 79, 10, 61, 95, 26, 28, 30, 31, 35, 38, 39,
+40, 46, 58, 59, 60, 63, 66, 67, 75, 105, 115, 117, 119, 120, 124,
+127, 128, 33, 42, 43, 44, 45, 47, 48, 122, 0, 1, 2, 3, 4,
+5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 2, 0, 1, 3, 4,
+5, 6, 7, 8, 82, 11, 26, 19, 75, 6, 9, 47, 54, 66, 73,
+80, 87, 0, 3, 4, 5, 18, 23, 24, 25, 44, 53, 62, 63, 65,
+67, 68, 69, 70, 72, 76, 77, 86, 88, 89, 90, 91, 92, 93, 22,
+10, 15, 21, 49, 58, 50, 59, 83, 1, 2, 7, 8, 12, 13, 14,
+16, 17, 20, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+39, 40, 41, 42, 43, 45, 46, 48, 51, 52, 55, 56, 57, 60, 61,
+64, 71, 74, 78, 79, 81, 84, 85, 0, 1, 0, 1, 34, 2, 12,
+13, 32, 37, 76, 3, 10, 11, 19, 20, 21, 22, 23, 27, 28, 29,
+30, 35, 53, 55, 78, 4, 16, 17, 5, 6, 7, 8, 9, 14, 15,
+18, 24, 25, 26, 31, 33, 36, 38, 39, 40, 41, 42, 43, 44, 45,
+46, 47, 48, 49, 50, 51, 52, 54, 56, 57, 58, 59, 60, 61, 62,
+63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 77, 79,
+80, 81, 82, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+12, 13, 14, 15, 5, 30, 31, 0, 1, 2, 3, 4, 6, 7, 8,
+9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+24, 25, 26, 27, 28, 29, 32, 33, 34, 35, 36, 37, 59, 0, 1,
+2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, 61, 62, 63,
+64, 65, 36, 61, 20, 1, 19, 126, 127, 60, 56, 33, 34, 35, 21,
+22, 52, 59, 67, 71, 72, 63, 65, 66, 32, 45, 57, 84, 91, 114,
+125, 64, 0, 2, 3, 68, 70, 73, 26, 46, 53, 54, 55, 58, 115,
+131, 74, 12, 96, 97, 99, 41, 42, 44, 49, 50, 75, 80, 83, 85,
+103, 106, 107, 108, 109, 110, 111, 112, 113, 116, 117, 118, 119, 120, 124,
+13, 62, 76, 77, 78, 86, 128, 129, 94, 23, 24, 25, 27, 28, 29,
+30, 31, 37, 38, 39, 40, 43, 47, 48, 51, 4, 5, 6, 7, 8,
+9, 10, 11, 14, 15, 16, 17, 18, 69, 79, 81, 82, 87, 88, 89,
+90, 92, 93, 95, 98, 100, 101, 102, 104, 105, 121, 122, 123, 130, 132,
+3, 2, 10, 11, 1, 4, 6, 8, 5, 7, 9, 0, 31, 30, 15,
+43, 49, 53, 57, 45, 12, 13, 16, 18, 32, 34, 36, 14, 33, 35,
+37, 21, 23, 17, 19, 20, 22, 24, 25, 26, 27, 28, 29, 42, 48,
+52, 56, 38, 41, 44, 46, 50, 54, 39, 40, 47, 51, 55, 35, 36,
+3, 5, 7, 9, 11, 2, 17, 30, 34, 14, 20, 23, 4, 6, 13,
+16, 18, 19, 22, 24, 25, 31, 32, 33, 8, 10, 12, 15, 21, 0,
+1, 26, 27, 28, 29, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+40, 41, 42, 43, 44, 45, 46, 47, 5, 4, 6, 21, 0, 3, 18,
+16, 15, 17, 9, 12, 20, 7, 14, 19, 8, 10, 11, 13, 1, 2,
+167, 168, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
+28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
+43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
+58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
+73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
+88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
+103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
+118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
+133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147,
+148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
+163, 164, 165, 166, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1,
+2, 3, 7, 6, 8, 9, 16, 2, 18, 19, 28, 27, 24, 25, 26,
+17, 3, 20, 22, 21, 23, 13, 0, 4, 14, 1, 5, 12, 10, 11,
+15, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6, 7, 12, 13,
+14, 15, 16, 17, 18, 19, 0, 1, 2, 3, 4, 5, 6, 7, 8,
+9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
+69, 70, 71, 72, 73, 18, 22, 28, 35, 53, 54, 57, 59, 0, 1,
+2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+17, 19, 20, 21, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34,
+36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+51, 52, 55, 56, 58, 9, 13, 4, 6, 11, 15, 8, 12, 5, 7,
+10, 14, 2, 3, 0, 1, 0, 3, 4, 7, 1, 2, 5, 6, 8,
+9, 10, 0, 1, 2, 65, 64, 66, 52, 46, 49, 53, 59, 44, 48,
+45, 57, 34, 25, 26, 27, 36, 56, 24, 43, 47, 0, 1, 2, 3,
+4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+19, 20, 21, 22, 23, 28, 29, 30, 31, 32, 33, 35, 37, 38, 39,
+40, 41, 42, 50, 51, 54, 55, 58, 60, 61, 62, 63, 0, 1, 2,
+3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
+78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
+93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
+108, 109, 110, 111, 112, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+40, 41, 42, 43, 44, 45, 46, 47, 48, 0, 1, 2, 3, 4, 5,
+6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+21, 22, 23, 24, 25, 26, 0, 1, 2, 3, 4, 5, 6, 7, 8,
+9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
+69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
+84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
+99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
+114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
+129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
+144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158,
+159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173,
+174, 175, 84, 86, 5, 16, 18, 21, 81, 82, 3, 6, 10, 12, 14,
+22, 24, 26, 29, 39, 41, 42, 54, 56, 58, 60, 62, 75, 0, 1,
+2, 4, 7, 8, 9, 11, 13, 15, 17, 19, 20, 23, 25, 27, 28,
+30, 31, 32, 33, 34, 35, 36, 37, 38, 40, 43, 44, 45, 46, 47,
+48, 49, 50, 51, 52, 53, 55, 57, 59, 61, 63, 64, 65, 66, 67,
+68, 69, 70, 71, 72, 73, 74, 76, 77, 78, 79, 80, 83, 85, 0,
+2, 4, 6, 14, 16, 18, 20, 8, 31, 10, 11, 24, 25, 28, 29,
+32, 33, 36, 38, 40, 41, 44, 45, 9, 30, 1, 3, 5, 7, 12,
+13, 15, 17, 19, 21, 22, 23, 26, 27, 34, 35, 37, 39, 42, 43,
+46, 47, 27, 28, 35, 36, 45, 46, 13, 14, 59, 60, 0, 1, 2,
+3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 15, 16, 17, 18, 19,
+20, 21, 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 37, 38,
+39, 40, 41, 42, 43, 44, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+56, 57, 58, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
+73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
+88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
+103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
+118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
+133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147,
+148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
+163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
+178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
+193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
+208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222,
+223, 224, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+13, 14, 15, 16, 17, 0, 4, 1, 2, 3, 7, 5, 9, 6, 8,
+0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+30, 31, 32, 33, 34, 35, 36, 37, 8, 11, 9, 10, 0, 1, 4,
+5, 2, 3, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+10, 11, 12, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
+57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
+72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
+87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
+102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
+117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
+132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
+147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161,
+162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176,
+177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
+192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206,
+207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221,
+222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236,
+237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251,
+252, 253, 254, 255, 256, 257, 0, 1, 2, 3, 4, 5, 6, 7, 8,
+9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+35, 1, 2, 20, 29, 32, 33, 34, 0, 3, 4, 5, 6, 7, 8,
+9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24,
+25, 26, 27, 28, 30, 31, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+45, 46, 47, 48, 49, 50, 51, 52, 53, 0, 1, 2, 3, 4, 5,
+6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+36, 37, 38, 39, 40, 0, 1, 0, 1, 2, 3, 4, 5, 0, 1,
+2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
+47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
+62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
+77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
+92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
+107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
+122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
+137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151,
+152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166,
+167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181,
+182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196,
+197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
+212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226,
+227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241,
+242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256,
+257, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+29, 0, 1, 4, 27, 19, 21, 5, 18, 6, 8, 10, 11, 12, 14,
+15, 16, 17, 20, 0, 1, 2, 3, 7, 9, 13, 22, 23, 24, 25,
+26, 28, 29, 30, 31, 32, 33, 34, 35, 0, 1, 2, 3, 4, 0,
+1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+16, 17, 18, 19, 112, 110, 113, 111, 29, 37, 18, 93, 96, 97, 99,
+98, 92, 100, 104, 105, 108, 101, 61, 62, 69, 77, 86, 70, 78, 85,
+68, 76, 87, 60, 54, 55, 59, 30, 38, 73, 81, 90, 94, 19, 14,
+16, 71, 79, 84, 50, 51, 57, 0, 2, 4, 6, 8, 10, 12, 20,
+26, 34, 44, 64, 72, 80, 91, 40, 63, 13, 5, 7, 9, 11, 15,
+1, 3, 39, 21, 48, 49, 56, 95, 74, 82, 89, 31, 25, 33, 45,
+65, 43, 103, 106, 107, 109, 17, 52, 53, 58, 28, 36, 41, 23, 27,
+35, 47, 42, 66, 22, 24, 32, 46, 67, 75, 83, 88, 102, 6, 7,
+0, 1, 3, 5, 2, 4, 50, 48, 52, 54, 56, 2, 6, 14, 18,
+22, 26, 30, 34, 49, 53, 55, 57, 58, 59, 60, 0, 1, 3, 4,
+5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 19, 20, 21, 23,
+24, 25, 27, 28, 29, 31, 32, 33, 35, 36, 37, 38, 39, 40, 41,
+42, 43, 44, 45, 46, 47, 51, 23, 24, 25, 26, 16, 18, 20, 22,
+15, 17, 19, 21, 6, 8, 10, 12, 14, 0, 2, 1, 3, 4, 5,
+11, 7, 9, 13, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
+71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
+86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
+101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
+116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
+131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 1, 0,
+2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 1,
+2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
+47, 48, 49, 50, 51, 52, 53, 54, 55, 0, 1, 2, 3, 4, 5,
+6, 7, 8, 9, 10, 11, 12, 0, 1, 2, 112, 114, 19, 61, 70,
+18, 111, 3, 5, 6, 66, 82, 109, 110, 113, 58, 102, 104, 31, 35,
+36, 37, 38, 71, 77, 86, 93, 95, 96, 108, 47, 25, 45, 46, 53,
+55, 75, 40, 41, 42, 52, 60, 83, 84, 24, 26, 11, 12, 22, 23,
+28, 30, 57, 63, 65, 69, 81, 90, 106, 32, 33, 34, 49, 50, 51,
+72, 73, 78, 79, 87, 88, 94, 4, 7, 8, 9, 10, 20, 21, 29,
+39, 43, 44, 48, 54, 56, 59, 62, 64, 67, 68, 74, 76, 80, 89,
+91, 92, 100, 101, 115, 116, 16, 99, 13, 14, 15, 17, 27, 85, 97,
+98, 103, 105, 107, 117, 7, 10, 19, 0, 1, 2, 3, 4, 5, 6,
+8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 0, 1, 2, 3, 4,
+5, 7, 17, 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12,
+13, 14, 15, 16, 18, 19, 20, 21, 22, 23, 0, 1, 0, 7, 11,
+5, 6, 10, 3, 4, 1, 2, 8, 9, 12, 0, 1, 2, 3, 4,
+0, 1, 2, 3, 4, 1, 3, 0, 2, 4, 5, 6, 7, 8, 9,
+10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 1, 2, 3, 4,
+5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+35, 36, 0, 1, 75, 78, 76, 15, 79, 77, 8, 85, 14, 0, 4,
+10, 81, 83, 84, 87, 12, 80, 82, 11, 9, 2, 6, 86, 36, 38,
+37, 13, 1, 5, 3, 7, 49, 22, 24, 28, 32, 50, 58, 63, 66,
+71, 23, 25, 29, 33, 47, 48, 51, 52, 53, 54, 46, 17, 19, 16,
+20, 21, 26, 27, 30, 31, 34, 35, 39, 40, 41, 42, 43, 44, 45,
+55, 56, 57, 59, 60, 61, 62, 64, 65, 67, 68, 69, 70, 72, 73,
+74, 18, 11, 22, 1, 3, 5, 7, 9, 10, 13, 15, 16, 18, 20,
+26, 28, 0, 2, 4, 6, 8, 12, 14, 17, 19, 21, 23, 24, 25,
+27, 29, 47, 45, 43, 48, 42, 44, 49, 46, 33, 11, 27, 31, 37,
+38, 63, 17, 18, 21, 23, 25, 29, 32, 35, 77, 83, 97, 0, 5,
+9, 15, 16, 19, 39, 41, 53, 69, 20, 22, 24, 26, 28, 30, 34,
+36, 76, 82, 96, 102, 103, 1, 3, 7, 13, 40, 51, 57, 61, 67,
+71, 73, 75, 81, 87, 95, 101, 106, 107, 70, 2, 4, 6, 8, 10,
+12, 14, 50, 52, 54, 55, 56, 58, 59, 60, 62, 64, 65, 66, 68,
+72, 74, 78, 79, 80, 84, 85, 86, 88, 89, 90, 91, 92, 93, 94,
+98, 99, 100, 104, 105, 108, 109, 0, 1, 46, 43, 47, 42, 3, 44,
+5, 20, 4, 18, 24, 26, 30, 38, 34, 36, 7, 9, 22, 2, 45,
+21, 40, 19, 35, 37, 39, 32, 12, 14, 28, 10, 16, 41, 25, 27,
+31, 6, 8, 23, 33, 11, 17, 13, 15, 29, 52, 50, 53, 48, 49,
+51, 0, 1, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5,
+6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
+66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
+81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
+111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
+126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140,
+141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155,
+156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170,
+171, 172, 173, 174, 175, 176, 177, 178, 179, 0, 1, 2, 3, 4, 5,
+6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
+66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
+81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
+111, 112, 113, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+27, 28, 29, 30, 31, 32, 33, 34, 35, 5, 15, 19, 27, 31, 35,
+39, 43, 96, 104, 120, 121, 131, 0, 1, 2, 10, 12, 24, 25, 46,
+47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 76, 77, 78, 79, 80,
+81, 82, 83, 84, 85, 86, 87, 88, 90, 91, 93, 95, 97, 99, 101,
+103, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
+119, 122, 123, 124, 125, 126, 127, 128, 129, 130, 132, 133, 134, 135, 136,
+137, 138, 140, 144, 148, 152, 156, 160, 164, 3, 4, 6, 7, 8, 9,
+11, 13, 14, 16, 17, 18, 20, 21, 22, 23, 26, 28, 29, 30, 32,
+33, 34, 36, 37, 38, 40, 41, 42, 44, 45, 57, 58, 59, 60, 61,
+62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 89,
+92, 94, 98, 100, 102, 139, 141, 142, 143, 145, 146, 147, 149, 150, 151,
+153, 154, 155, 157, 158, 159, 161, 162, 163, 165, 166, 36, 57, 60, 65,
+68, 114, 135, 156, 161, 162, 165, 170, 176, 179, 182, 183, 188, 191, 194,
+197, 198, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
+28, 29, 30, 31, 32, 33, 34, 35, 37, 38, 39, 40, 41, 42, 43,
+44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 58, 59,
+61, 62, 63, 64, 66, 67, 69, 70, 71, 72, 73, 74, 75, 76, 77,
+78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
+93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
+108, 109, 110, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 122, 123,
+124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 136, 137, 138, 139,
+140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
+155, 157, 158, 159, 160, 163, 164, 166, 167, 168, 169, 171, 172, 173, 174,
+175, 177, 178, 180, 181, 184, 185, 186, 187, 189, 190, 192, 193, 195, 196,
+199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
+214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228,
+229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243,
+244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258,
+259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
+274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288,
+289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303,
+304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318,
+319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333,
+334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348,
+349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363,
+364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378,
+379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393,
+394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408,
+409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423,
+424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438,
+439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453,
+454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468,
+469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483,
+484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498,
+499, 500, 501, 502, 503, 504, 505, 506, 0, 1, 2, 3, 4, 5, 6,
+7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
+70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
+85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
+100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
+115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
+130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
+145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
+160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174,
+175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
+190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204,
+205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
+220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234,
+235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
+250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264,
+265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
+280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
+295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309,
+310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
+325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339,
+340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
+355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369,
+370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
+385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399,
+400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414,
+415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429,
+430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444,
+445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459,
+460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474,
+475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489,
+490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504,
+505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519,
+520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534,
+535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549,
+550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564,
+565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579,
+580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594,
+595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609,
+610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624,
+625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639,
+640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654,
+655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669,
+0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+15, 16, 17, 18, 19, 20, 21, 0, 1, 2, 3, 4, 5, 6, 7,
+8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
+23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
+38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
+68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
+83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
+98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
+113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
+128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
+143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157,
+158, 159, 160, 161, 162, 163, 164, 165, 166, 0, 1, 2, 3, 4, 5,
+6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5,
+0, 3, 5, 10, 16, 18, 94, 4, 6, 7, 8, 17, 37, 44, 48,
+51, 56, 66, 69, 75, 79, 82, 84, 88, 98, 99, 102, 1, 2, 9,
+11, 12, 13, 14, 15, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 45,
+46, 47, 49, 50, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63,
+64, 65, 67, 68, 70, 71, 72, 73, 74, 76, 77, 78, 80, 81, 83,
+85, 86, 87, 89, 90, 91, 92, 93, 95, 96, 97, 100, 101, 103, 104,
+105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
+120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
+135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
+150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
+165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
+180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
+81, 18, 24, 33, 69, 83, 19, 25, 35, 71, 0, 1, 2, 3, 4,
+5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21,
+22, 23, 26, 27, 28, 29, 30, 31, 32, 34, 36, 37, 38, 39, 40,
+41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 72,
+73, 74, 75, 76, 77, 78, 79, 80, 82, 84, 85, 86, 87, 88, 89,
+90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
+120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
+135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
+150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
+165, 166, 167, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+12, 13, 14, 15, 16, 17, 4, 5, 6, 31, 32, 39, 40, 41, 0,
+1, 2, 3, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35,
+36, 37, 38, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
+69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
+84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
+99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
+114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
+129, 130, 131, 132, 133, 134, 135, 136, 0, 1, 3, 22, 23, 26, 34,
+0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+16, 17, 18, 19, 20, 21, 24, 25, 27, 28, 29, 30, 31, 32, 33,
+35, 36, 37, 38, 39, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0,
+1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
+46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+61, 62, 63, 64, 65, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+25, 26, 27, 28, 29, 30, 31, 32, 33, 51, 0, 1, 2, 3, 4,
+5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+50, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
+66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 0, 1, 2,
+3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+18, 19, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
+28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 0, 1,
+2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
+47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
+62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
+77, 74, 75, 92, 93, 116, 143, 144, 149, 14, 15, 34, 35, 36, 37,
+68, 69, 98, 99, 104, 105, 110, 111, 154, 155, 156, 157, 166, 167, 168,
+169, 178, 179, 180, 181, 4, 5, 6, 7, 22, 23, 24, 25, 46, 47,
+50, 51, 56, 57, 60, 61, 80, 82, 85, 87, 121, 122, 123, 124, 133,
+134, 135, 136, 190, 191, 194, 197, 202, 203, 206, 207, 212, 213, 216, 217,
+0, 1, 2, 3, 8, 9, 10, 11, 12, 13, 16, 17, 18, 19, 20,
+21, 26, 27, 28, 29, 30, 31, 32, 33, 38, 39, 40, 41, 42, 43,
+44, 45, 48, 49, 52, 53, 54, 55, 58, 59, 62, 63, 64, 65, 66,
+67, 70, 71, 72, 73, 76, 77, 78, 79, 81, 83, 84, 86, 88, 89,
+90, 91, 94, 95, 96, 97, 100, 101, 102, 103, 106, 107, 108, 109, 112,
+113, 114, 115, 117, 118, 119, 120, 125, 126, 127, 128, 129, 130, 131, 132,
+137, 138, 139, 140, 141, 142, 145, 146, 147, 148, 150, 151, 152, 153, 158,
+159, 160, 161, 162, 163, 164, 165, 170, 171, 172, 173, 174, 175, 176, 177,
+182, 183, 184, 185, 186, 187, 188, 189, 192, 193, 195, 196, 198, 199, 200,
+201, 204, 205, 208, 209, 210, 211, 214, 215, 218, 219, 220, 221, 0, 1,
+2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 0, 1, 2,
+3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
+78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
+93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
+108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
+123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
+138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
+153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,
+168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
+183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197,
+198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
+213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227,
+228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242,
+243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257,
+258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
+273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287,
+288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302,
+303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317,
+318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332,
+333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347,
+348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362,
+363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377,
+0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 0, 1, 2, 3,
+4, 5, 6, 7, 0, 1, 14, 15, 16, 17, 2, 3, 4, 5, 8,
+9, 10, 11, 12, 13, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
+28, 29, 30, 31, 32, 33, 11, 2, 5, 10, 8, 4, 9, 1, 7,
+3, 0, 6, 42, 45, 36, 39, 12, 16, 18, 22, 38, 41, 44, 47,
+37, 40, 43, 46, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+11, 13, 14, 15, 17, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29,
+30, 31, 32, 33, 34, 35, 0, 1, 2, 3, 4, 5, 6, 7, 8,
+9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
+69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
+84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
+99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
+114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
+129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
+144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158,
+159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173,
+174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
+189, 190, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
+28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
+43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
+58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
+73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
+88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
+103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 4, 5,
+6, 8, 1, 3, 0, 2, 7, 9, 0, 1, 2, 3, 4, 5, 6,
+7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
+37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
+67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
+82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
+97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
+112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
+127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141,
+142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156,
+157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171,
+172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
+187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201,
+202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
+217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231,
+232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246,
+247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261,
+262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
+277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291,
+292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306,
+307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321,
+322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336,
+337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351,
+352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366,
+367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381,
+382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396,
+397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411,
+412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426,
+427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441,
+442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456,
+457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471,
+472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486,
+487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501,
+502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516,
+517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531,
+532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546,
+547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561,
+562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576,
+577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591,
+592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606,
+607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621,
+622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636,
+637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651,
+652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666,
+667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681,
+682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696,
+697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711,
+712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726,
+727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741,
+742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756,
+757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771,
+772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786,
+787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801,
+802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816,
+817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831,
+832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846,
+847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861,
+862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876,
+877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891,
+892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906,
+907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921,
+922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936,
+937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951,
+952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966,
+967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981,
+982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996,
+997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011,
+1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026,
+1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041,
+1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056,
+1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071,
+1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086,
+1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101,
+1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116,
+1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131,
+1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1146,
+1147, 1148, 1149, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161,
+1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176,
+1177, 1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191,
+1192, 1193, 1194, 1195, 1196, 1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206,
+1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221,
+1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234, 1235, 1236,
+1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251,
+1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266,
+1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281,
+1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296,
+1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311,
+1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326,
+1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341,
+1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356,
+1357, 1358, 1359, 1360, 1361, 1362, 1363, 1364, 1365, 1366, 1367, 1368, 1369, 1370, 1371,
+1372, 1373, 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1386,
+1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 1399, 1400, 1401,
+1402, 1403, 1404, 1405, 1406, 1407, 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416,
+1417, 1418, 1419, 1420, 1421, 1422, 1423, 1424, 1425, 1426, 1427, 1428, 1429, 1430, 1431,
+1432, 1433, 1434, 1435, 1436, 1437, 1438, 1439, 1440, 1441, 1442, 1443, 1444, 1445, 1446,
+1447, 1448, 1449, 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, 1459, 1460, 1461,
+1462, 1463, 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1471, 1472, 1473, 1474, 1475, 1476,
+1477, 1478, 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, 1491,
+1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, 1506,
+1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519, 1520, 1521,
+1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535, 1536,
+1537, 1538, 1539, 1540, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1549, 1550, 1551,
+1552, 1553, 1554, 1555, 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 1566,
+1567, 1568, 1569, 1570, 1571, 1572, 1573, 1574, 1575, 1576, 1577, 1578, 1579, 1580, 1581,
+1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, 1595, 1596,
+1597, 1598, 1599, 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611,
+1612, 1613, 1614, 1615, 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1626,
+1627, 1628, 1629, 1630, 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639, 1640, 1641,
+1642, 1643, 1644, 1645, 1646, 1647, 1648, 1649, 1650, 1651, 1652, 1653, 1654, 1655, 1656,
+1657, 1658, 1659, 1660, 1661, 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669, 1670, 1671,
+1672, 1673, 1674, 1675, 1676, 1677, 1678, 1679, 1680, 1681, 1682, 1683, 1684, 1685, 1686,
+1687, 1688, 1689, 1690, 1691, 1692, 1693, 1694, 1695, 1696, 1697, 1698, 1699, 1700, 1701,
+1702, 1703, 1704, 1705, 1706, 1707, 1708, 1709, 1710, 1711, 1712, 1713, 1714, 1715, 1716,
+1717, 1718, 1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728, 1729, 1730, 1731,
+1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, 1741, 1742, 1743, 1744, 1745, 1746,
+1747, 1748, 1749, 1750, 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, 1760, 1761,
+1762, 1763, 1764, 1765, 1766, 1767, 1768, 1769, 1770, 1771, 1772, 1773, 1774, 1775, 1776,
+1777, 1778, 1779, 1780, 1781, 1782, 1783, 1784, 1785, 1786, 1787, 1788, 1789, 1790, 1791,
+1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1800, 1801, 1802, 1803, 1804, 1805, 1806,
+1807, 1808, 1809, 1810, 1811, 1812, 1813, 1814, 1815, 1816, 1817, 1818, 1819, 1820, 1821,
+1822, 1823, 1824, 1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832, 1833, 1834, 1835, 1836,
+1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851,
+1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866,
+1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881,
+1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896,
+1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911,
+1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926,
+1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941,
+1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956,
+1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971,
+1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986,
+1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016,
+2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031,
+2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046,
+2047, 2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061,
+2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, 2076,
+2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091,
+2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106,
+2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121,
+2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136,
+2137, 2138, 2139, 2140, 2141, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151,
+2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166,
+2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181,
+2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196,
+2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211,
+2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226,
+2227, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241,
+2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256,
+2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271,
+2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286,
+2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, 2301,
+2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316,
+2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331,
+2332, 2333, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346,
+2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2361,
+2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 2375, 2376,
+2377, 2378, 2379, 2380, 2381, 2382, 2383, 2384, 2385, 2386, 2387, 2388, 2389, 2390, 2391,
+2392, 2393, 2394, 2395, 2396, 2397, 2398, 2399, 2400, 2401, 2402, 2403, 2404, 2405, 2406,
+2407, 2408, 2409, 2410, 2411, 2412, 2413, 2414, 2415, 2416, 2417, 2418, 2419, 2420, 2421,
+2422, 2423, 2424, 2425, 2426, 2427, 2428, 2429, 2430, 2431, 2432, 2433, 2434, 2435, 2436,
+2437, 2438, 2439, 2440, 2441, 2442, 2443, 2444, 2445, 2446, 2447, 2448, 2449, 2450, 2451,
+2452, 2453, 2454, 2455, 2456, 2457, 2458, 2459, 2460, 2461, 2462, 2463, 2464, 2465, 2466,
+2467, 2468, 2469, 2470, 2471, 2472, 2473, 2474, 2475, 2476, 2477, 2478, 2479, 2480, 2481,
+2482, 2483, 2484, 2485, 2486, 2487, 2488, 2489, 2490, 2491, 2492, 2493, 2494, 2495, 2496,
+2497, 2498, 2499, 2500, 2501, 2502, 2503, 2504, 2505, 2506, 2507, 2508, 2509, 2510, 2511,
+2512, 2513, 2514, 2515, 2516, 2517, 2518, 2519, 2520, 2521, 2522, 2523, 2524, 2525, 2526,
+2527, 2528, 2529, 2530, 2531, 2532, 2533, 2534, 2535, 2536, 2537, 2538, 2539, 2540, 2541,
+2542, 2543, 2544, 2545, 2546, 2547, 2548, 2549, 2550, 2551, 2552, 2553, 2554, 2555, 2556,
+2557, 2558, 2559, 2560, 2561, 2562, 2563, 2564, 2565, 2566, 2567, 2568, 2569, 2570, 2571,
+2572, 2573, 2574, 2575, 2576, 2577, 2578, 2579, 2580, 2581, 2582, 2583, 2584, 2585, 2586,
+2587, 2588, 2589, 2590, 2591, 2592, 2593, 2594, 2595, 2596, 2597, 2598, 2599, 2600, 2601,
+2602, 2603, 2604, 2605, 2606, 2607, 2608, 2609, 2610, 2611, 2612, 2613, 2614, 2615, 2616,
+2617, 2618, 2619, 2620, 2621, 2622, 2623, 2624, 2625, 2626, 2627, 2628, 2629, 2630, 2631,
+2632, 2633, 2634, 2635, 2636, 2637, 2638, 2639, 2640, 2641, 2642, 2643, 2644, 2645, 2646,
+2647, 2648, 2649, 2650, 2651, 2652, 2653, 2654, 2655, 2656, 2657, 2658, 2659, 2660, 2661,
+2662, 2663, 2664, 2665, 2666, 2667, 2668, 2669, 2670, 2671, 2672, 2673, 2674, 2675, 2676,
+2677, 2678, 2679, 2680, 2681, 2682, 2683, 2684, 2685, 2686, 2687, 2688, 2689, 2690, 2691,
+2692, 2693, 2694, 2695, 2696, 2697, 2698, 2699, 2700, 2701, 2702, 2703, 2704, 2705, 2706,
+2707, 2708, 2709, 2710, 2711, 2712, 2713, 2714, 2715, 2716, 2717, 2718, 2719, 2720, 2721,
+2722, 2723, 2724, 2725, 2726, 2727, 2728, 2729, 2730, 2731, 2732, 2733, 2734, 2735, 2736,
+2737, 2738, 2739, 2740, 2741, 2742, 2743, 2744, 2745, 2746, 2747, 2748, 2749, 2750, 2751,
+2752, 2753, 2754, 2755, 2756, 2757, 2758, 2759, 2760, 2761, 2762, 2763, 2764, 2765, 2766,
+2767, 2768, 2769, 2770, 2771, 2772, 2773, 2774, 2775, 2776, 2777, 2778, 2779, 2780, 2781,
+2782, 2783, 2784, 2785, 2786, 2787, 2788, 2789, 2790, 2791, 2792, 2793, 2794, 2795, 2796,
+2797, 2798, 2799, 2800, 2801, 2802, 2803, 2804, 2805, 2806, 2807, 2808, 2809, 2810, 2811,
+2812, 2813, 2814, 2815, 2816, 2817, 2818, 2819, 2820, 2821, 2822, 2823, 2824, 2825, 2826,
+2827, 2828, 2829, 2830, 2831, 2832, 2833, 2834, 2835, 2836, 2837, 2838, 2839, 2840, 2841,
+2842, 2843, 2844, 2845, 2846, 2847, 2848, 2849, 2850, 2851, 2852, 2853, 2854, 2855, 2856,
+2857, 2858, 2859, 2860, 2861, 2862, 2863, 9, 11, 6, 7, 8, 10, 4, 5,
+0, 1, 2, 3, 0, 2, 10, 3, 6, 1, 9, 11, 4, 8, 7,
+5, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+29, 30, 31, 32, 33, 34, 35, 68, 116, 22, 10, 97, 117, 52, 110,
+7, 19, 111, 115, 6, 18, 0, 74, 88, 12, 48, 108, 99, 109, 38,
+104, 4, 16, 24, 96, 15, 3, 50, 84, 71, 85, 36, 102, 103, 119,
+54, 86, 100, 30, 25, 105, 113, 69, 53, 63, 98, 87, 93, 89, 95,
+9, 21, 62, 114, 5, 17, 26, 55, 2, 14, 65, 8, 20, 64, 92,
+42, 106, 11, 23, 46, 66, 34, 101, 107, 56, 35, 47, 57, 67, 76,
+118, 75, 83, 82, 94, 37, 77, 29, 51, 1, 13, 27, 49, 58, 112,
+39, 59, 28, 70, 44, 73, 80, 81, 32, 72, 31, 43, 33, 40, 41,
+45, 60, 61, 78, 79, 90, 91
+};
+
+
/**Function*************************************************************
Synopsis [Reads library from array.]
@@ -9461,6 +11120,27 @@ Vec_Int_t * Dar_LibReadOuts()
return vResult;
}
+/**Function*************************************************************
+
+ Synopsis [Reads library from array.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+Vec_Int_t * Dar_LibReadPrios()
+{
+ Vec_Int_t * vResult;
+ int i;
+ vResult = Vec_IntAlloc( s_nDataSize3 );
+ for ( i = 0; i < s_nDataSize3; i++ )
+ Vec_IntPush( vResult, s_Data3[i] );
+ return vResult;
+}
+
//#if 0
#include "abc.h"
@@ -9476,7 +11156,7 @@ Vec_Int_t * Dar_LibReadOuts()
SeeAlso []
***********************************************************************/
-void Dar_NtkGenerateArrays( Abc_Ntk_t * pNtk )
+void Aig_NtkGenerateArrays( Abc_Ntk_t * pNtk )
{
extern int Io_WriteAigerEncode( char * pBuffer, int Pos, unsigned x );
diff --git a/src/aig/dar/darDfs.c b/src/aig/dar/darDfs.c
deleted file mode 100644
index 116f428c..00000000
--- a/src/aig/dar/darDfs.c
+++ /dev/null
@@ -1,381 +0,0 @@
-/**CFile****************************************************************
-
- FileName [darDfs.c]
-
- SystemName [ABC: Logic synthesis and verification system.]
-
- PackageName [DAG-aware AIG rewriting.]
-
- Synopsis [DFS traversal procedures.]
-
- Author [Alan Mishchenko]
-
- Affiliation [UC Berkeley]
-
- Date [Ver. 1.0. Started - April 28, 2007.]
-
- Revision [$Id: darDfs.c,v 1.00 2007/04/28 00:00:00 alanmi Exp $]
-
-***********************************************************************/
-
-#include "dar.h"
-
-////////////////////////////////////////////////////////////////////////
-/// DECLARATIONS ///
-////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////
-/// FUNCTION DEFINITIONS ///
-////////////////////////////////////////////////////////////////////////
-
-/**Function*************************************************************
-
- Synopsis [Collects internal nodes in the DFS order.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ManDfs_rec( Dar_Man_t * p, Dar_Obj_t * pObj, Vec_Ptr_t * vNodes )
-{
- assert( !Dar_IsComplement(pObj) );
- if ( pObj == NULL )
- return;
- if ( Dar_ObjIsTravIdCurrent(p, pObj) )
- return;
- assert( Dar_ObjIsNode(pObj) || Dar_ObjIsBuf(pObj) );
- Dar_ManDfs_rec( p, Dar_ObjFanin0(pObj), vNodes );
- Dar_ManDfs_rec( p, Dar_ObjFanin1(pObj), vNodes );
- assert( !Dar_ObjIsTravIdCurrent(p, pObj) ); // loop detection
- Dar_ObjSetTravIdCurrent(p, pObj);
- Vec_PtrPush( vNodes, pObj );
-}
-
-/**Function*************************************************************
-
- Synopsis [Collects internal nodes in the DFS order.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Vec_Ptr_t * Dar_ManDfs( Dar_Man_t * p )
-{
- Vec_Ptr_t * vNodes;
- Dar_Obj_t * pObj;
- int i;
- Dar_ManIncrementTravId( p );
- // mark constant and PIs
- Dar_ObjSetTravIdCurrent( p, Dar_ManConst1(p) );
- Dar_ManForEachPi( p, pObj, i )
- Dar_ObjSetTravIdCurrent( p, pObj );
- // if there are latches, mark them
- if ( Dar_ManLatchNum(p) > 0 )
- Dar_ManForEachObj( p, pObj, i )
- if ( Dar_ObjIsLatch(pObj) )
- Dar_ObjSetTravIdCurrent( p, pObj );
- // go through the nodes
- vNodes = Vec_PtrAlloc( Dar_ManNodeNum(p) );
- Dar_ManForEachObj( p, pObj, i )
- if ( Dar_ObjIsNode(pObj) || Dar_ObjIsBuf(pObj) )
- Dar_ManDfs_rec( p, pObj, vNodes );
- return vNodes;
-}
-
-/**Function*************************************************************
-
- Synopsis [Collects internal nodes in the DFS order.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Vec_Ptr_t * Dar_ManDfsNodes( Dar_Man_t * p, Dar_Obj_t ** ppNodes, int nNodes )
-{
- Vec_Ptr_t * vNodes;
- Dar_Obj_t * pObj;
- int i;
- assert( Dar_ManLatchNum(p) == 0 );
- Dar_ManIncrementTravId( p );
- // mark constant and PIs
- Dar_ObjSetTravIdCurrent( p, Dar_ManConst1(p) );
- Dar_ManForEachPi( p, pObj, i )
- Dar_ObjSetTravIdCurrent( p, pObj );
- // go through the nodes
- vNodes = Vec_PtrAlloc( Dar_ManNodeNum(p) );
- for ( i = 0; i < nNodes; i++ )
- Dar_ManDfs_rec( p, ppNodes[i], vNodes );
- return vNodes;
-}
-
-/**Function*************************************************************
-
- Synopsis [Computes the max number of levels in the manager.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Dar_ManCountLevels( Dar_Man_t * p )
-{
- Vec_Ptr_t * vNodes;
- Dar_Obj_t * pObj;
- int i, LevelsMax, Level0, Level1;
- // initialize the levels
- Dar_ManConst1(p)->pData = NULL;
- Dar_ManForEachPi( p, pObj, i )
- pObj->pData = NULL;
- // compute levels in a DFS order
- vNodes = Dar_ManDfs( p );
- Vec_PtrForEachEntry( vNodes, pObj, i )
- {
- Level0 = (int)Dar_ObjFanin0(pObj)->pData;
- Level1 = (int)Dar_ObjFanin1(pObj)->pData;
- pObj->pData = (void *)(1 + Dar_ObjIsExor(pObj) + DAR_MAX(Level0, Level1));
- }
- Vec_PtrFree( vNodes );
- // get levels of the POs
- LevelsMax = 0;
- Dar_ManForEachPo( p, pObj, i )
- LevelsMax = DAR_MAX( LevelsMax, (int)Dar_ObjFanin0(pObj)->pData );
- return LevelsMax;
-}
-
-/**Function*************************************************************
-
- Synopsis [Counts the number of AIG nodes rooted at this cone.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ConeMark_rec( Dar_Obj_t * pObj )
-{
- assert( !Dar_IsComplement(pObj) );
- if ( !Dar_ObjIsNode(pObj) || Dar_ObjIsMarkA(pObj) )
- return;
- Dar_ConeMark_rec( Dar_ObjFanin0(pObj) );
- Dar_ConeMark_rec( Dar_ObjFanin1(pObj) );
- assert( !Dar_ObjIsMarkA(pObj) ); // loop detection
- Dar_ObjSetMarkA( pObj );
-}
-
-/**Function*************************************************************
-
- Synopsis [Counts the number of AIG nodes rooted at this cone.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ConeCleanAndMark_rec( Dar_Obj_t * pObj )
-{
- assert( !Dar_IsComplement(pObj) );
- if ( !Dar_ObjIsNode(pObj) || Dar_ObjIsMarkA(pObj) )
- return;
- Dar_ConeCleanAndMark_rec( Dar_ObjFanin0(pObj) );
- Dar_ConeCleanAndMark_rec( Dar_ObjFanin1(pObj) );
- assert( !Dar_ObjIsMarkA(pObj) ); // loop detection
- Dar_ObjSetMarkA( pObj );
- pObj->pData = NULL;
-}
-
-/**Function*************************************************************
-
- Synopsis [Counts the number of AIG nodes rooted at this cone.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Dar_ConeCountAndMark_rec( Dar_Obj_t * pObj )
-{
- int Counter;
- assert( !Dar_IsComplement(pObj) );
- if ( !Dar_ObjIsNode(pObj) || Dar_ObjIsMarkA(pObj) )
- return 0;
- Counter = 1 + Dar_ConeCountAndMark_rec( Dar_ObjFanin0(pObj) ) +
- Dar_ConeCountAndMark_rec( Dar_ObjFanin1(pObj) );
- assert( !Dar_ObjIsMarkA(pObj) ); // loop detection
- Dar_ObjSetMarkA( pObj );
- return Counter;
-}
-
-/**Function*************************************************************
-
- Synopsis [Counts the number of AIG nodes rooted at this cone.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ConeUnmark_rec( Dar_Obj_t * pObj )
-{
- assert( !Dar_IsComplement(pObj) );
- if ( !Dar_ObjIsNode(pObj) || !Dar_ObjIsMarkA(pObj) )
- return;
- Dar_ConeUnmark_rec( Dar_ObjFanin0(pObj) );
- Dar_ConeUnmark_rec( Dar_ObjFanin1(pObj) );
- assert( Dar_ObjIsMarkA(pObj) ); // loop detection
- Dar_ObjClearMarkA( pObj );
-}
-
-/**Function*************************************************************
-
- Synopsis [Counts the number of AIG nodes rooted at this cone.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Dar_DagSize( Dar_Obj_t * pObj )
-{
- int Counter;
- Counter = Dar_ConeCountAndMark_rec( Dar_Regular(pObj) );
- Dar_ConeUnmark_rec( Dar_Regular(pObj) );
- return Counter;
-}
-
-/**Function*************************************************************
-
- Synopsis [Transfers the AIG from one manager into another.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_Transfer_rec( Dar_Man_t * pDest, Dar_Obj_t * pObj )
-{
- assert( !Dar_IsComplement(pObj) );
- if ( !Dar_ObjIsNode(pObj) || Dar_ObjIsMarkA(pObj) )
- return;
- Dar_Transfer_rec( pDest, Dar_ObjFanin0(pObj) );
- Dar_Transfer_rec( pDest, Dar_ObjFanin1(pObj) );
- pObj->pData = Dar_And( pDest, Dar_ObjChild0Copy(pObj), Dar_ObjChild1Copy(pObj) );
- assert( !Dar_ObjIsMarkA(pObj) ); // loop detection
- Dar_ObjSetMarkA( pObj );
-}
-
-/**Function*************************************************************
-
- Synopsis [Transfers the AIG from one manager into another.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_Transfer( Dar_Man_t * pSour, Dar_Man_t * pDest, Dar_Obj_t * pRoot, int nVars )
-{
- Dar_Obj_t * pObj;
- int i;
- // solve simple cases
- if ( pSour == pDest )
- return pRoot;
- if ( Dar_ObjIsConst1( Dar_Regular(pRoot) ) )
- return Dar_NotCond( Dar_ManConst1(pDest), Dar_IsComplement(pRoot) );
- // set the PI mapping
- Dar_ManForEachPi( pSour, pObj, i )
- {
- if ( i == nVars )
- break;
- pObj->pData = Dar_IthVar(pDest, i);
- }
- // transfer and set markings
- Dar_Transfer_rec( pDest, Dar_Regular(pRoot) );
- // clear the markings
- Dar_ConeUnmark_rec( Dar_Regular(pRoot) );
- return Dar_NotCond( Dar_Regular(pRoot)->pData, Dar_IsComplement(pRoot) );
-}
-
-/**Function*************************************************************
-
- Synopsis [Composes the AIG (pRoot) with the function (pFunc) using PI var (iVar).]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_Compose_rec( Dar_Man_t * p, Dar_Obj_t * pObj, Dar_Obj_t * pFunc, Dar_Obj_t * pVar )
-{
- assert( !Dar_IsComplement(pObj) );
- if ( Dar_ObjIsMarkA(pObj) )
- return;
- if ( Dar_ObjIsConst1(pObj) || Dar_ObjIsPi(pObj) )
- {
- pObj->pData = pObj == pVar ? pFunc : pObj;
- return;
- }
- Dar_Compose_rec( p, Dar_ObjFanin0(pObj), pFunc, pVar );
- Dar_Compose_rec( p, Dar_ObjFanin1(pObj), pFunc, pVar );
- pObj->pData = Dar_And( p, Dar_ObjChild0Copy(pObj), Dar_ObjChild1Copy(pObj) );
- assert( !Dar_ObjIsMarkA(pObj) ); // loop detection
- Dar_ObjSetMarkA( pObj );
-}
-
-/**Function*************************************************************
-
- Synopsis [Composes the AIG (pRoot) with the function (pFunc) using PI var (iVar).]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_Compose( Dar_Man_t * p, Dar_Obj_t * pRoot, Dar_Obj_t * pFunc, int iVar )
-{
- // quit if the PI variable is not defined
- if ( iVar >= Dar_ManPiNum(p) )
- {
- printf( "Dar_Compose(): The PI variable %d is not defined.\n", iVar );
- return NULL;
- }
- // recursively perform composition
- Dar_Compose_rec( p, Dar_Regular(pRoot), pFunc, Dar_ManPi(p, iVar) );
- // clear the markings
- Dar_ConeUnmark_rec( Dar_Regular(pRoot) );
- return Dar_NotCond( Dar_Regular(pRoot)->pData, Dar_IsComplement(pRoot) );
-}
-
-////////////////////////////////////////////////////////////////////////
-/// END OF FILE ///
-////////////////////////////////////////////////////////////////////////
-
-
diff --git a/src/aig/dar/darInt.h b/src/aig/dar/darInt.h
new file mode 100644
index 00000000..0eb8f9fe
--- /dev/null
+++ b/src/aig/dar/darInt.h
@@ -0,0 +1,158 @@
+/**CFile****************************************************************
+
+ FileName [darInt.h]
+
+ SystemName [ABC: Logic synthesis and verification system.]
+
+ PackageName [DAG-aware AIG rewriting.]
+
+ Synopsis [Internal declarations.]
+
+ Author [Alan Mishchenko]
+
+ Affiliation [UC Berkeley]
+
+ Date [Ver. 1.0. Started - April 28, 2007.]
+
+ Revision [$Id: darInt.h,v 1.00 2007/04/28 00:00:00 alanmi Exp $]
+
+***********************************************************************/
+
+#ifndef __DAR_INT_H__
+#define __DAR_INT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+////////////////////////////////////////////////////////////////////////
+/// INCLUDES ///
+////////////////////////////////////////////////////////////////////////
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <time.h>
+
+#include "vec.h"
+#include "aig.h"
+#include "dar.h"
+
+////////////////////////////////////////////////////////////////////////
+/// PARAMETERS ///
+////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////
+/// BASIC TYPES ///
+////////////////////////////////////////////////////////////////////////
+
+typedef struct Dar_Man_t_ Dar_Man_t;
+typedef struct Dar_Cut_t_ Dar_Cut_t;
+
+// the AIG 4-cut
+struct Dar_Cut_t_ // 6 words
+{
+ unsigned uSign; // cut signature
+ unsigned uTruth : 16; // the truth table of the cut function
+ unsigned Value : 12; // the value of the cut
+ unsigned fUsed : 1; // marks the cut currently in use
+ unsigned nLeaves : 3; // the number of leaves
+ int pLeaves[4]; // the array of leaves
+};
+
+// the AIG manager
+struct Dar_Man_t_
+{
+ // input data;
+ Dar_Par_t * pPars; // rewriting parameters
+ Aig_Man_t * pAig; // AIG manager
+ // various data members
+ Aig_MmFixed_t * pMemCuts; // memory manager for cuts
+ void * pManCnf; // CNF managers
+ // current rewriting step
+ Vec_Ptr_t * vLeavesBest; // the best set of leaves
+ int OutBest; // the best output (in the library)
+ int OutNumBest; // the best number of the output
+ int GainBest; // the best gain
+ int LevelBest; // the level of node with the best gain
+ int ClassBest; // the equivalence class of the best replacement
+ // function statistics
+ int nTotalSubgs; // the total number of subgraphs tried
+ int ClassTimes[222];// the runtimes for each class
+ int ClassGains[222];// the gains for each class
+ int ClassSubgs[222];// the graphs for each class
+ int nCutMemUsed; // memory used for cuts
+ // rewriting statistics
+ int nNodesInit; // the original number of nodes
+ int nCutsAll; // all cut pairs
+ int nCutsTried; // computed cuts
+ int nCutsUsed; // used cuts
+ int nCutsBad; // bad cuts due to absent fanin
+ int nCutsGood; // good cuts
+ int nCutsSkipped; // skipped bad cuts
+ // timing statistics
+ int timeCuts;
+ int timeEval;
+ int timeOther;
+ int timeTotal;
+ int time1;
+ int time2;
+};
+
+static inline Dar_Cut_t * Dar_ObjCuts( Aig_Obj_t * pObj ) { return pObj->pData; }
+static inline void Dar_ObjSetCuts( Aig_Obj_t * pObj, Dar_Cut_t * pCuts ) { pObj->pData = pCuts; }
+
+////////////////////////////////////////////////////////////////////////
+/// MACRO DEFINITIONS ///
+////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////
+/// ITERATORS ///
+////////////////////////////////////////////////////////////////////////
+
+// iterator over all cuts of the node
+#define Dar_ObjForEachCutAll( pObj, pCut, i ) \
+ for ( (pCut) = Dar_ObjCuts(pObj), i = 0; i < (int)(pObj)->nCuts; i++, pCut++ )
+#define Dar_ObjForEachCut( pObj, pCut, i ) \
+ for ( (pCut) = Dar_ObjCuts(pObj), i = 0; i < (int)(pObj)->nCuts; i++, pCut++ ) if ( (pCut)->fUsed==0 ) {} else
+// iterator over leaves of the cut
+#define Dar_CutForEachLeaf( p, pCut, pLeaf, i ) \
+ for ( i = 0; (i < (int)(pCut)->nLeaves) && (((pLeaf) = Aig_ManObj(p, (pCut)->pLeaves[i])), 1); i++ )
+
+////////////////////////////////////////////////////////////////////////
+/// FUNCTION DECLARATIONS ///
+////////////////////////////////////////////////////////////////////////
+
+/*=== darBalance.c ========================================================*/
+extern Aig_Man_t * Dar_ManBalance( Aig_Man_t * p, int fUpdateLevel );
+/*=== darCore.c ========================================================*/
+/*=== darCut.c ========================================================*/
+extern Dar_Cut_t * Dar_ObjPrepareCuts( Dar_Man_t * p, Aig_Obj_t * pObj );
+extern void Dar_ManCutsFree( Dar_Man_t * p );
+extern Dar_Cut_t * Dar_ObjComputeCuts_rec( Dar_Man_t * p, Aig_Obj_t * pObj );
+extern Dar_Cut_t * Dar_ObjComputeCuts( Dar_Man_t * p, Aig_Obj_t * pObj );
+/*=== darData.c ========================================================*/
+extern Vec_Int_t * Dar_LibReadNodes();
+extern Vec_Int_t * Dar_LibReadOuts();
+extern Vec_Int_t * Dar_LibReadPrios();
+/*=== darLib.c ==========================================================*/
+extern void Dar_LibStart();
+extern void Dar_LibStop();
+extern void Dar_LibEval( Dar_Man_t * p, Aig_Obj_t * pRoot, Dar_Cut_t * pCut, int Required );
+extern Aig_Obj_t * Dar_LibBuildBest( Dar_Man_t * p );
+/*=== darMan.c ==========================================================*/
+extern Dar_Man_t * Dar_ManStart( Aig_Man_t * pAig, Dar_Par_t * pPars );
+extern void Dar_ManStop( Dar_Man_t * p );
+extern void Dar_ManPrintStats( Dar_Man_t * p );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+////////////////////////////////////////////////////////////////////////
+/// END OF FILE ///
+////////////////////////////////////////////////////////////////////////
+
diff --git a/src/aig/dar/darLib.c b/src/aig/dar/darLib.c
index 89ce2f0b..fce6155b 100644
--- a/src/aig/dar/darLib.c
+++ b/src/aig/dar/darLib.c
@@ -18,7 +18,7 @@
***********************************************************************/
-#include "dar.h"
+#include "darInt.h"
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
@@ -41,7 +41,7 @@ struct Dar_LibObj_t_ // library object (2 words)
struct Dar_LibDat_t_ // library object data
{
- Dar_Obj_t * pFunc; // the corresponding AIG node if it exists
+ Aig_Obj_t * pFunc; // the corresponding AIG node if it exists
int Level; // level of this node after it is constructured
int TravId; // traversal ID of the library object data
unsigned char Area; // area of the node
@@ -61,7 +61,16 @@ struct Dar_Lib_t_ // library
int nSubgr[222]; // the number of subgraphs by class
int * pSubgr[222]; // the subgraphs for each class
int * pSubgrMem; // memory for subgraph pointers
- int pSubgrTotal; // the total number of subgraph
+ int nSubgrTotal; // the total number of subgraph
+ // structure priorities
+ int * pPriosMem; // memory for priority of structures
+ int * pPrios[222]; // pointers to the priority numbers
+ // structure places in the priorities
+ int * pPlaceMem; // memory for places of structures in the priority lists
+ int * pPlace[222]; // pointers to the places numbers
+ // structure scores
+ int * pScoreMem; // memory for scores of structures
+ int * pScore[222]; // pointers to the scores numbers
// nodes by class
int nNodes[222]; // the number of nodes by class
int * pNodes[222]; // the nodes for each class
@@ -141,6 +150,9 @@ void Dar_LibFree( Dar_Lib_t * p )
free( p->pDatas );
free( p->pNodesMem );
free( p->pSubgrMem );
+ free( p->pPriosMem );
+ FREE( p->pPlaceMem );
+ FREE( p->pScoreMem );
free( p->pPerms4 );
free( p->puCanons );
free( p->pPhases );
@@ -208,8 +220,9 @@ void Dar_LibSetup_rec( Dar_Lib_t * p, Dar_LibObj_t * pObj, int Class )
SeeAlso []
***********************************************************************/
-void Dar_LibSetup( Dar_Lib_t * p, Vec_Int_t * vOuts )
+void Dar_LibSetup( Dar_Lib_t * p, Vec_Int_t * vOuts, Vec_Int_t * vPrios )
{
+ int fTraining = 0;
Dar_LibObj_t * pObj;
int nNodesTotal, uTruth, Class, Out, i, k;
assert( p->iObj == p->nObjs );
@@ -226,14 +239,14 @@ void Dar_LibSetup( Dar_Lib_t * p, Vec_Int_t * vOuts )
}
// allocate memory for the roots of each class
p->pSubgrMem = ALLOC( int, Vec_IntSize(vOuts) );
- p->pSubgrTotal = 0;
+ p->nSubgrTotal = 0;
for ( i = 0; i < 222; i++ )
{
- p->pSubgr[i] = p->pSubgrMem + p->pSubgrTotal;
- p->pSubgrTotal += p->nSubgr[i];
+ p->pSubgr[i] = p->pSubgrMem + p->nSubgrTotal;
+ p->nSubgrTotal += p->nSubgr[i];
p->nSubgr[i] = 0;
}
- assert( p->pSubgrTotal == Vec_IntSize(vOuts) );
+ assert( p->nSubgrTotal == Vec_IntSize(vOuts) );
// add the outputs to storage
Vec_IntForEachEntry( vOuts, Out, i )
{
@@ -243,6 +256,65 @@ void Dar_LibSetup( Dar_Lib_t * p, Vec_Int_t * vOuts )
p->pSubgr[Class][ p->nSubgr[Class]++ ] = Out;
}
+ if ( fTraining )
+ {
+ // allocate memory for the priority of roots of each class
+ p->pPriosMem = ALLOC( int, Vec_IntSize(vOuts) );
+ p->nSubgrTotal = 0;
+ for ( i = 0; i < 222; i++ )
+ {
+ p->pPrios[i] = p->pPriosMem + p->nSubgrTotal;
+ p->nSubgrTotal += p->nSubgr[i];
+ for ( k = 0; k < p->nSubgr[i]; k++ )
+ p->pPrios[i][k] = k;
+
+ }
+ assert( p->nSubgrTotal == Vec_IntSize(vOuts) );
+
+ // allocate memory for the priority of roots of each class
+ p->pPlaceMem = ALLOC( int, Vec_IntSize(vOuts) );
+ p->nSubgrTotal = 0;
+ for ( i = 0; i < 222; i++ )
+ {
+ p->pPlace[i] = p->pPlaceMem + p->nSubgrTotal;
+ p->nSubgrTotal += p->nSubgr[i];
+ for ( k = 0; k < p->nSubgr[i]; k++ )
+ p->pPlace[i][k] = k;
+
+ }
+ assert( p->nSubgrTotal == Vec_IntSize(vOuts) );
+
+ // allocate memory for the priority of roots of each class
+ p->pScoreMem = ALLOC( int, Vec_IntSize(vOuts) );
+ p->nSubgrTotal = 0;
+ for ( i = 0; i < 222; i++ )
+ {
+ p->pScore[i] = p->pScoreMem + p->nSubgrTotal;
+ p->nSubgrTotal += p->nSubgr[i];
+ for ( k = 0; k < p->nSubgr[i]; k++ )
+ p->pScore[i][k] = 0;
+
+ }
+ assert( p->nSubgrTotal == Vec_IntSize(vOuts) );
+ }
+ else
+ {
+ int Counter = 0;
+ // allocate memory for the priority of roots of each class
+ p->pPriosMem = ALLOC( int, Vec_IntSize(vOuts) );
+ p->nSubgrTotal = 0;
+ for ( i = 0; i < 222; i++ )
+ {
+ p->pPrios[i] = p->pPriosMem + p->nSubgrTotal;
+ p->nSubgrTotal += p->nSubgr[i];
+ for ( k = 0; k < p->nSubgr[i]; k++ )
+ p->pPrios[i][k] = Vec_IntEntry(vPrios, Counter++);
+
+ }
+ assert( p->nSubgrTotal == Vec_IntSize(vOuts) );
+ assert( Counter == Vec_IntSize(vPrios) );
+ }
+
// create traversal IDs
for ( i = 0; i < p->iObj; i++ )
Dar_LibObj(p, i)->Num = 0xff;
@@ -294,12 +366,13 @@ void Dar_LibSetup( Dar_Lib_t * p, Vec_Int_t * vOuts )
***********************************************************************/
Dar_Lib_t * Dar_LibRead()
{
- Vec_Int_t * vObjs, * vOuts;
+ Vec_Int_t * vObjs, * vOuts, * vPrios;
Dar_Lib_t * p;
int i;
// read nodes and outputs
- vObjs = Dar_LibReadNodes();
- vOuts = Dar_LibReadOuts();
+ vObjs = Dar_LibReadNodes();
+ vOuts = Dar_LibReadOuts();
+ vPrios = Dar_LibReadPrios();
// create library
p = Dar_LibAlloc( Vec_IntSize(vObjs)/2 + 4, 6000 );
// create nodes
@@ -307,7 +380,7 @@ Dar_Lib_t * Dar_LibRead()
Dar_LibAddNode( p, vObjs->pArray[i] >> 1, vObjs->pArray[i+1] >> 1,
vObjs->pArray[i] & 1, vObjs->pArray[i+1] & 1 );
// create outputs
- Dar_LibSetup( p, vOuts );
+ Dar_LibSetup( p, vOuts, vPrios );
Vec_IntFree( vObjs );
Vec_IntFree( vOuts );
return p;
@@ -329,7 +402,7 @@ void Dar_LibStart()
int clk = clock();
assert( s_DarLib == NULL );
s_DarLib = Dar_LibRead();
- printf( "The 4-input library started with %d nodes and %d subgraphs. ", s_DarLib->nObjs - 4, s_DarLib->pSubgrTotal );
+ printf( "The 4-input library started with %d nodes and %d subgraphs. ", s_DarLib->nObjs - 4, s_DarLib->nSubgrTotal );
PRT( "Time", clock() - clk );
}
@@ -351,6 +424,77 @@ void Dar_LibStop()
s_DarLib = NULL;
}
+/**Function*************************************************************
+
+ Synopsis [Updates the score of the class and adjusts the priority of this class.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Dar_LibIncrementScore( int Class, int Out, int Gain )
+{
+ int * pPrios = s_DarLib->pPrios[Class]; // pPrios[i] = Out
+ int * pPlace = s_DarLib->pPlace[Class]; // pPlace[Out] = i
+ int * pScore = s_DarLib->pScore[Class]; // score of Out
+ int Out2;
+ assert( Class >= 0 && Class < 222 );
+ assert( Out >= 0 && Out < s_DarLib->nSubgr[Class] );
+ assert( pPlace[pPrios[Out]] == Out );
+ // increment the score
+ pScore[Out] += Gain;
+ // move the out in the order
+ while ( pPlace[Out] > 0 && pScore[Out] > pScore[ pPrios[pPlace[Out]-1] ] )
+ {
+ // get the previous output in the priority list
+ Out2 = pPrios[pPlace[Out]-1];
+ // swap Out and Out2
+ pPlace[Out]--;
+ pPlace[Out2]++;
+ pPrios[pPlace[Out]] = Out;
+ pPrios[pPlace[Out2]] = Out2;
+ }
+}
+
+/**Function*************************************************************
+
+ Synopsis [Prints out the priorities into the file.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Dar_LibDumpPriorities()
+{
+ int i, k, Out, Out2, Counter = 0, Printed = 0;
+ printf( "\nOutput priorities (total = %d):\n", s_DarLib->nSubgrTotal );
+ for ( i = 0; i < 222; i++ )
+ {
+// printf( "Class%d: ", i );
+ for ( k = 0; k < s_DarLib->nSubgr[i]; k++ )
+ {
+ Out = s_DarLib->pPrios[i][k];
+ Out2 = k == 0 ? Out : s_DarLib->pPrios[i][k-1];
+ assert( s_DarLib->pScore[i][Out2] >= s_DarLib->pScore[i][Out] );
+// printf( "%d(%d), ", Out, s_DarLib->pScore[i][Out] );
+ printf( "%d, ", Out );
+ Printed++;
+ if ( ++Counter == 15 )
+ {
+ printf( "\n" );
+ Counter = 0;
+ }
+ }
+ }
+ printf( "\n" );
+ assert( Printed == s_DarLib->nSubgrTotal );
+}
/**Function*************************************************************
@@ -366,7 +510,7 @@ void Dar_LibStop()
***********************************************************************/
int Dar_LibCutMatch( Dar_Man_t * p, Dar_Cut_t * pCut )
{
- Dar_Obj_t * pFanin;
+ Aig_Obj_t * pFanin;
unsigned uPhase;
char * pPerm;
int i;
@@ -377,16 +521,15 @@ int Dar_LibCutMatch( Dar_Man_t * p, Dar_Cut_t * pCut )
// collect fanins with the corresponding permutation/phase
for ( i = 0; i < (int)pCut->nLeaves; i++ )
{
- pFanin = Dar_ManObj( p, pCut->pLeaves[pPerm[i]] );
+ pFanin = Aig_ManObj( p->pAig, pCut->pLeaves[pPerm[i]] );
if ( pFanin == NULL )
{
p->nCutsBad++;
return 0;
}
- pFanin = Dar_NotCond(pFanin, ((uPhase >> i) & 1) );
-// Vec_PtrWriteEntry( p->vFaninsCur, i, pFanin );
+ pFanin = Aig_NotCond(pFanin, ((uPhase >> i) & 1) );
s_DarLib->pDatas[i].pFunc = pFanin;
- s_DarLib->pDatas[i].Level = Dar_Regular(pFanin)->Level;
+ s_DarLib->pDatas[i].Level = Aig_Regular(pFanin)->Level;
}
p->nCutsGood++;
return 1;
@@ -405,22 +548,22 @@ int Dar_LibCutMatch( Dar_Man_t * p, Dar_Cut_t * pCut )
SeeAlso []
***********************************************************************/
-int Dar_NodeDeref_rec( Dar_Man_t * p, Dar_Obj_t * pNode )
+int Aig_NodeDeref_rec( Aig_Man_t * p, Aig_Obj_t * pNode )
{
- Dar_Obj_t * pFanin;
+ Aig_Obj_t * pFanin;
int Counter = 0;
- if ( Dar_ObjIsPi(pNode) )
+ if ( Aig_ObjIsPi(pNode) )
return Counter;
- pFanin = Dar_ObjFanin0( pNode );
+ pFanin = Aig_ObjFanin0( pNode );
assert( pFanin->nRefs > 0 );
if ( --pFanin->nRefs == 0 )
- Counter += Dar_NodeDeref_rec( p, pFanin );
- if ( Dar_ObjIsBuf(pNode) )
+ Counter += Aig_NodeDeref_rec( p, pFanin );
+ if ( Aig_ObjIsBuf(pNode) )
return Counter;
- pFanin = Dar_ObjFanin1( pNode );
+ pFanin = Aig_ObjFanin1( pNode );
assert( pFanin->nRefs > 0 );
if ( --pFanin->nRefs == 0 )
- Counter += Dar_NodeDeref_rec( p, pFanin );
+ Counter += Aig_NodeDeref_rec( p, pFanin );
return 1 + Counter;
}
@@ -435,21 +578,21 @@ int Dar_NodeDeref_rec( Dar_Man_t * p, Dar_Obj_t * pNode )
SeeAlso []
***********************************************************************/
-int Dar_NodeRef_rec( Dar_Man_t * p, Dar_Obj_t * pNode )
+int Aig_NodeRef_rec( Aig_Man_t * p, Aig_Obj_t * pNode )
{
- Dar_Obj_t * pFanin;
+ Aig_Obj_t * pFanin;
int Counter = 0;
- if ( Dar_ObjIsPi(pNode) )
+ if ( Aig_ObjIsPi(pNode) )
return Counter;
- Dar_ObjSetTravIdCurrent( p, pNode );
- pFanin = Dar_ObjFanin0( pNode );
+ Aig_ObjSetTravIdCurrent( p, pNode );
+ pFanin = Aig_ObjFanin0( pNode );
if ( pFanin->nRefs++ == 0 )
- Counter += Dar_NodeRef_rec( p, pFanin );
- if ( Dar_ObjIsBuf(pNode) )
+ Counter += Aig_NodeRef_rec( p, pFanin );
+ if ( Aig_ObjIsBuf(pNode) )
return Counter;
- pFanin = Dar_ObjFanin1( pNode );
+ pFanin = Aig_ObjFanin1( pNode );
if ( pFanin->nRefs++ == 0 )
- Counter += Dar_NodeRef_rec( p, pFanin );
+ Counter += Aig_NodeRef_rec( p, pFanin );
return 1 + Counter;
}
@@ -464,20 +607,20 @@ int Dar_NodeRef_rec( Dar_Man_t * p, Dar_Obj_t * pNode )
SeeAlso []
***********************************************************************/
-int Dar_LibCutMarkMffc( Dar_Man_t * p, Dar_Obj_t * pRoot )
+int Dar_LibCutMarkMffc( Aig_Man_t * p, Aig_Obj_t * pRoot, int nLeaves )
{
int i, nNodes1, nNodes2;
// mark the cut leaves
- for ( i = 0; i < 4; i++ )
- Dar_Regular(s_DarLib->pDatas[i].pFunc)->nRefs++;
+ for ( i = 0; i < nLeaves; i++ )
+ Aig_Regular(s_DarLib->pDatas[i].pFunc)->nRefs++;
// label MFFC with current ID
- Dar_ManIncrementTravId( p );
- nNodes1 = Dar_NodeDeref_rec( p, pRoot );
- nNodes2 = Dar_NodeRef_rec( p, pRoot );
+ Aig_ManIncrementTravId( p );
+ nNodes1 = Aig_NodeDeref_rec( p, pRoot );
+ nNodes2 = Aig_NodeRef_rec( p, pRoot );
assert( nNodes1 == nNodes2 );
// unmark the cut leaves
- for ( i = 0; i < 4; i++ )
- Dar_Regular(s_DarLib->pDatas[i].pFunc)->nRefs--;
+ for ( i = 0; i < nLeaves; i++ )
+ Aig_Regular(s_DarLib->pDatas[i].pFunc)->nRefs--;
return nNodes1;
}
@@ -525,7 +668,7 @@ void Dar_LibEvalAssignNums( Dar_Man_t * p, int Class )
{
Dar_LibObj_t * pObj;
Dar_LibDat_t * pData, * pData0, * pData1;
- Dar_Obj_t * pGhost, * pFanin0, * pFanin1;
+ Aig_Obj_t * pGhost, * pFanin0, * pFanin1;
int i;
for ( i = 0; i < s_DarLib->nNodes[Class]; i++ )
{
@@ -538,15 +681,29 @@ void Dar_LibEvalAssignNums( Dar_Man_t * p, int Class )
// explore the fanins
pData0 = s_DarLib->pDatas + Dar_LibObj(s_DarLib, pObj->Fan0)->Num;
pData1 = s_DarLib->pDatas + Dar_LibObj(s_DarLib, pObj->Fan1)->Num;
- pData->Level = 1 + DAR_MAX(pData0->Level, pData1->Level);
+ pData->Level = 1 + AIG_MAX(pData0->Level, pData1->Level);
if ( pData0->pFunc == NULL || pData1->pFunc == NULL )
continue;
- pFanin0 = Dar_NotCond( pData0->pFunc, pObj->fCompl0 );
- pFanin1 = Dar_NotCond( pData1->pFunc, pObj->fCompl1 );
- pGhost = Dar_ObjCreateGhost( p, pFanin0, pFanin1, DAR_AIG_AND );
- pData->pFunc = Dar_TableLookup( p, pGhost );
+ pFanin0 = Aig_NotCond( pData0->pFunc, pObj->fCompl0 );
+ pFanin1 = Aig_NotCond( pData1->pFunc, pObj->fCompl1 );
+
+ // consider simple cases
+ if ( pFanin0 == pFanin1 )
+ pData->pFunc = pFanin0;
+ else if ( pFanin0 == Aig_Not(pFanin1) )
+ pData->pFunc = Aig_ManConst0(p->pAig);
+ else if ( Aig_Regular(pFanin0) == Aig_ManConst1(p->pAig) )
+ pData->pFunc = pFanin0 == Aig_ManConst1(p->pAig) ? pFanin1 : Aig_ManConst0(p->pAig);
+ else if ( Aig_Regular(pFanin1) == Aig_ManConst1(p->pAig) )
+ pData->pFunc = pFanin1 == Aig_ManConst1(p->pAig) ? pFanin0 : Aig_ManConst0(p->pAig);
+ else
+ {
+ pGhost = Aig_ObjCreateGhost( p->pAig, pFanin0, pFanin1, AIG_OBJ_AND );
+ pData->pFunc = Aig_TableLookup( p->pAig, pGhost );
+ }
+
// clear the node if it is part of MFFC
- if ( pData->pFunc != NULL && Dar_ObjIsTravIdCurrent(p, pData->pFunc) )
+ if ( pData->pFunc != NULL && Aig_ObjIsTravIdCurrent(p->pAig, pData->pFunc) )
pData->pFunc = NULL;
//if ( Class == 7 )
//printf( "Evaling node %d at data %d\n", pData->pFunc? pData->pFunc->Id : -1, pObj->Num );
@@ -599,44 +756,32 @@ int Dar_LibEval_rec( Dar_LibObj_t * pObj, int Out, int nNodesSaved, int Required
SeeAlso []
***********************************************************************/
-void Dar_LibEval( Dar_Man_t * p, Dar_Obj_t * pRoot, Dar_Cut_t * pCut, int Required )
+void Dar_LibEval( Dar_Man_t * p, Aig_Obj_t * pRoot, Dar_Cut_t * pCut, int Required )
{
+ int fTraining = 0;
Dar_LibObj_t * pObj;
- int i, k, Class, nNodesSaved, nNodesAdded, nNodesGained, clk;
+ int Out, k, Class, nNodesSaved, nNodesAdded, nNodesGained, clk;
+ clk = clock();
if ( pCut->nLeaves != 4 )
return;
-// if ( s_DarLib->nSubgr[ s_DarLib->pMap[pCut->uTruth] ] > 100 )
-// return;
- clk = clock();
-/*
- for ( k = 0; k < 4; k++ )
- if ( pCut->pLeaves[k] > 4 )
- return;
-*/
- // check if the cut exits
+ // check if the cut exits and assigns leaves and their levels
if ( !Dar_LibCutMatch(p, pCut) )
return;
// mark MFFC of the node
- nNodesSaved = Dar_LibCutMarkMffc( p, pRoot );
+ nNodesSaved = Dar_LibCutMarkMffc( p->pAig, pRoot, pCut->nLeaves );
// evaluate the cut
Class = s_DarLib->pMap[pCut->uTruth];
Dar_LibEvalAssignNums( p, Class );
-
-//if ( pRoot->Id == 654 )
-//printf( "\n" );
// profile outputs by their savings
p->nTotalSubgs += s_DarLib->nSubgr[Class];
p->ClassSubgs[Class] += s_DarLib->nSubgr[Class];
- for ( i = 0; i < s_DarLib->nSubgr[Class]; i++ )
+ for ( Out = 0; Out < s_DarLib->nSubgr[Class]; Out++ )
{
- pObj = Dar_LibObj(s_DarLib, s_DarLib->pSubgr[Class][i]);
- if ( pRoot->Id == 654 )
- {
-// Dar_LibObjPrint_rec( pObj );
-// printf( "\n" );
- }
- nNodesAdded = Dar_LibEval_rec( pObj, i, nNodesSaved, Required );
+ pObj = Dar_LibObj(s_DarLib, s_DarLib->pSubgr[Class][Out]);
+ nNodesAdded = Dar_LibEval_rec( pObj, Out, nNodesSaved, Required );
nNodesGained = nNodesSaved - nNodesAdded;
+ if ( fTraining && nNodesGained >= 0 )
+ Dar_LibIncrementScore( Class, Out, nNodesGained + 1 );
if ( nNodesGained <= 0 )
continue;
if ( nNodesGained < p->GainBest ||
@@ -644,10 +789,10 @@ void Dar_LibEval( Dar_Man_t * p, Dar_Obj_t * pRoot, Dar_Cut_t * pCut, int Requir
continue;
// remember this possibility
Vec_PtrClear( p->vLeavesBest );
- for ( k = 0; k < 4; k++ )
+ for ( k = 0; k < (int)pCut->nLeaves; k++ )
Vec_PtrPush( p->vLeavesBest, s_DarLib->pDatas[k].pFunc );
- p->OutBest = s_DarLib->pSubgr[Class][i];
- p->OutNumBest = i;
+ p->OutBest = s_DarLib->pSubgr[Class][Out];
+ p->OutNumBest = Out;
p->LevelBest = s_DarLib->pDatas[pObj->Num].Level;
p->GainBest = nNodesGained;
p->ClassBest = Class;
@@ -689,17 +834,17 @@ void Dar_LibBuildClear_rec( Dar_LibObj_t * pObj, int * pCounter )
SeeAlso []
***********************************************************************/
-Dar_Obj_t * Dar_LibBuildBest_rec( Dar_Man_t * p, Dar_LibObj_t * pObj )
+Aig_Obj_t * Dar_LibBuildBest_rec( Dar_Man_t * p, Dar_LibObj_t * pObj )
{
- Dar_Obj_t * pFanin0, * pFanin1;
+ Aig_Obj_t * pFanin0, * pFanin1;
Dar_LibDat_t * pData = s_DarLib->pDatas + pObj->Num;
if ( pData->pFunc )
return pData->pFunc;
pFanin0 = Dar_LibBuildBest_rec( p, Dar_LibObj(s_DarLib, pObj->Fan0) );
pFanin1 = Dar_LibBuildBest_rec( p, Dar_LibObj(s_DarLib, pObj->Fan1) );
- pFanin0 = Dar_NotCond( pFanin0, pObj->fCompl0 );
- pFanin1 = Dar_NotCond( pFanin1, pObj->fCompl1 );
- pData->pFunc = Dar_And( p, pFanin0, pFanin1 );
+ pFanin0 = Aig_NotCond( pFanin0, pObj->fCompl0 );
+ pFanin1 = Aig_NotCond( pFanin1, pObj->fCompl1 );
+ pData->pFunc = Aig_And( p->pAig, pFanin0, pFanin1 );
//printf( "Adding node %d for data %d\n", pData->pFunc->Id, pObj->Num );
return pData->pFunc;
}
@@ -715,15 +860,16 @@ Dar_Obj_t * Dar_LibBuildBest_rec( Dar_Man_t * p, Dar_LibObj_t * pObj )
SeeAlso []
***********************************************************************/
-Dar_Obj_t * Dar_LibBuildBest( Dar_Man_t * p )
+Aig_Obj_t * Dar_LibBuildBest( Dar_Man_t * p )
{
int i, Counter = 4;
- for ( i = 0; i < 4; i++ )
+ for ( i = 0; i < Vec_PtrSize(p->vLeavesBest); i++ )
s_DarLib->pDatas[i].pFunc = Vec_PtrEntry( p->vLeavesBest, i );
Dar_LibBuildClear_rec( Dar_LibObj(s_DarLib, p->OutBest), &Counter );
return Dar_LibBuildBest_rec( p, Dar_LibObj(s_DarLib, p->OutBest) );
}
+
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
diff --git a/src/aig/dar/darMan.c b/src/aig/dar/darMan.c
index 52df8890..a209503a 100644
--- a/src/aig/dar/darMan.c
+++ b/src/aig/dar/darMan.c
@@ -18,7 +18,7 @@
***********************************************************************/
-#include "dar.h"
+#include "darInt.h"
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
@@ -30,48 +30,25 @@
/**Function*************************************************************
- Synopsis [Starts the AIG manager.]
+ Synopsis [Starts the rewriting manager.]
- Description [The argument of this procedure is a soft limit on the
- the number of nodes, or 0 if the limit is unknown.]
+ Description []
SideEffects []
SeeAlso []
***********************************************************************/
-Dar_Man_t * Dar_ManStart( int nNodesMax )
+Dar_Man_t * Dar_ManStart( Aig_Man_t * pAig, Dar_Par_t * pPars )
{
Dar_Man_t * p;
- int i;
- if ( nNodesMax <= 0 )
- nNodesMax = 10007;
// start the manager
p = ALLOC( Dar_Man_t, 1 );
memset( p, 0, sizeof(Dar_Man_t) );
- // perform initializations
- p->nTravIds = 1;
- p->fCatchExor = 0;
- // allocate arrays for nodes
- p->vPis = Vec_PtrAlloc( 100 );
- p->vPos = Vec_PtrAlloc( 100 );
- p->vObjs = Vec_PtrAlloc( 1000 );
+ p->pPars = pPars;
+ p->pAig = pAig;
// prepare the internal memory manager
- p->pMemObjs = Dar_MmFixedStart( sizeof(Dar_Obj_t), nNodesMax );
- p->pMemCuts = Dar_MmFlexStart();
- // prepare storage for cuts
- p->nBaseCuts = DAR_CUT_BASE;
- for ( i = 0; i < p->nBaseCuts; i++ )
- p->pBaseCuts[i] = p->BaseCuts + i;
- // create the constant node
- p->pConst1 = Dar_ManFetchMemory( p );
- p->pConst1->Type = DAR_AIG_CONST1;
- p->pConst1->fPhase = 1;
- p->nObjs[DAR_AIG_CONST1]++;
- // start the table
- p->nTableSize = nNodesMax;
- p->pTable = ALLOC( Dar_Obj_t *, p->nTableSize );
- memset( p->pTable, 0, sizeof(Dar_Obj_t *) * p->nTableSize );
+ p->pMemCuts = Aig_MmFixedStart( p->pPars->nCutsMax * sizeof(Dar_Cut_t), 512 );
// other data
p->vLeavesBest = Vec_PtrAlloc( 4 );
return p;
@@ -79,69 +56,7 @@ Dar_Man_t * Dar_ManStart( int nNodesMax )
/**Function*************************************************************
- Synopsis [Duplicates the AIG manager.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Man_t * Dar_ManStartFrom( Dar_Man_t * p )
-{
- Dar_Man_t * pNew;
- Dar_Obj_t * pObj;
- int i;
- // create the new manager
- pNew = Dar_ManStart( Dar_ManObjIdMax(p) + 1 );
- // create the PIs
- Dar_ManConst1(p)->pData = Dar_ManConst1(pNew);
- Dar_ManForEachPi( p, pObj, i )
- pObj->pData = Dar_ObjCreatePi(pNew);
- return pNew;
-}
-
-/**Function*************************************************************
-
- Synopsis [Duplicates the AIG manager.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Man_t * Dar_ManDup( Dar_Man_t * p )
-{
- Dar_Man_t * pNew;
- Dar_Obj_t * pObj;
- int i;
- // create the new manager
- pNew = Dar_ManStart( Dar_ManObjIdMax(p) + 1 );
- // create the PIs
- Dar_ManConst1(p)->pData = Dar_ManConst1(pNew);
- Dar_ManForEachPi( p, pObj, i )
- pObj->pData = Dar_ObjCreatePi(pNew);
- // duplicate internal nodes
- Dar_ManForEachObj( p, pObj, i )
- if ( Dar_ObjIsBuf(pObj) )
- pObj->pData = Dar_ObjChild0Copy(pObj);
- else if ( Dar_ObjIsNode(pObj) )
- pObj->pData = Dar_And( pNew, Dar_ObjChild0Copy(pObj), Dar_ObjChild1Copy(pObj) );
- // add the POs
- Dar_ManForEachPo( p, pObj, i )
- Dar_ObjCreatePo( pNew, Dar_ObjChild0Copy(pObj) );
- // check the resulting network
- if ( !Dar_ManCheck(pNew) )
- printf( "Dar_ManDup(): The check has failed.\n" );
- return pNew;
-}
-
-/**Function*************************************************************
-
- Synopsis [Stops the AIG manager.]
+ Synopsis [Stops the rewriting manager.]
Description []
@@ -152,57 +67,17 @@ Dar_Man_t * Dar_ManDup( Dar_Man_t * p )
***********************************************************************/
void Dar_ManStop( Dar_Man_t * p )
{
- Dar_Obj_t * pObj;
- int i;
- // make sure the nodes have clean marks
- Dar_ManForEachObj( p, pObj, i )
- assert( !pObj->fMarkA && !pObj->fMarkB );
- // print time
- if ( p->time1 ) { PRT( "time1", p->time1 ); }
- if ( p->time2 ) { PRT( "time2", p->time2 ); }
-// Dar_TableProfile( p );
- Dar_MmFixedStop( p->pMemObjs, 0 );
- Dar_MmFlexStop( p->pMemCuts, 0 );
- if ( p->vPis ) Vec_PtrFree( p->vPis );
- if ( p->vPos ) Vec_PtrFree( p->vPos );
- if ( p->vObjs ) Vec_PtrFree( p->vObjs );
- if ( p->vRequired ) Vec_IntFree( p->vRequired );
- if ( p->vLeavesBest ) Vec_PtrFree( p->vLeavesBest );
- free( p->pTable );
+ if ( p->pPars->fVerbose )
+ Dar_ManPrintStats( p );
+ if ( p->pMemCuts )
+ Aig_MmFixedStop( p->pMemCuts, 0 );
+ if ( p->vLeavesBest )
+ Vec_PtrFree( p->vLeavesBest );
free( p );
}
/**Function*************************************************************
- Synopsis [Returns the number of dangling nodes removed.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Dar_ManCleanup( Dar_Man_t * p )
-{
- Vec_Ptr_t * vObjs;
- Dar_Obj_t * pNode;
- int i, nNodesOld;
- nNodesOld = Dar_ManNodeNum(p);
- // collect roots of dangling nodes
- vObjs = Vec_PtrAlloc( 100 );
- Dar_ManForEachObj( p, pNode, i )
- if ( Dar_ObjIsNode(pNode) && Dar_ObjRefs(pNode) == 0 )
- Vec_PtrPush( vObjs, pNode );
- // recursively remove dangling nodes
- Vec_PtrForEachEntry( vObjs, pNode, i )
- Dar_ObjDelete_rec( p, pNode, 1 );
- Vec_PtrFree( vObjs );
- return nNodesOld - Dar_ManNodeNum(p);
-}
-
-/**Function*************************************************************
-
Synopsis [Stops the AIG manager.]
Description []
@@ -214,39 +89,18 @@ int Dar_ManCleanup( Dar_Man_t * p )
***********************************************************************/
void Dar_ManPrintStats( Dar_Man_t * p )
{
- printf( "PI/PO/Lat = %5d/%5d/%5d ", Dar_ManPiNum(p), Dar_ManPoNum(p), Dar_ManLatchNum(p) );
- printf( "A = %6d. ", Dar_ManAndNum(p) );
- if ( Dar_ManExorNum(p) )
- printf( "X = %5d. ", Dar_ManExorNum(p) );
- if ( Dar_ManBufNum(p) )
- printf( "B = %3d. ", Dar_ManBufNum(p) );
- printf( "Cre = %6d. ", p->nCreated );
- printf( "Del = %6d. ", p->nDeleted );
-// printf( "Lev = %3d. ", Dar_ManCountLevels(p) );
- printf( "\n" );
-}
-
-/**Function*************************************************************
-
- Synopsis [Stops the AIG manager.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ManPrintRuntime( Dar_Man_t * p )
-{
int i, Gain;
- printf( "Good cuts = %d. Bad cuts = %d. Cut mem = %d Mb\n",
- p->nCutsGood, p->nCutsBad, p->nCutMemUsed );
+ Gain = p->nNodesInit - Aig_ManNodeNum(p->pAig);
+ printf( "NodesBeg = %8d. NodesEnd = %8d. Gain = %6d. (%6.2f %%). Cut mem = %d Mb\n",
+ p->nNodesInit, Aig_ManNodeNum(p->pAig), Gain, 100.0*Gain/p->nNodesInit, p->nCutMemUsed );
+ printf( "Cuts = %8d. Tried = %8d. Used = %8d. Bad = %5d. Skipped = %5d. Ave = %.2f.\n",
+ p->nCutsAll, p->nCutsTried, p->nCutsUsed, p->nCutsBad, p->nCutsSkipped,
+ (float)p->nCutsUsed/Aig_ManNodeNum(p->pAig) );
PRT( "Cuts ", p->timeCuts );
PRT( "Eval ", p->timeEval );
PRT( "Other ", p->timeOther );
PRT( "TOTAL ", p->timeTotal );
- Gain = p->nNodesInit - Dar_ManNodeNum(p);
+/*
for ( i = 0; i < 222; i++ )
{
if ( p->ClassGains[i] == 0 && p->ClassTimes[i] == 0 )
@@ -257,6 +111,7 @@ void Dar_ManPrintRuntime( Dar_Man_t * p )
printf( "R = %7d ", p->ClassGains[i]? p->ClassSubgs[i]/p->ClassGains[i] : 9999999 );
PRTP( "T", p->ClassTimes[i], p->timeEval );
}
+*/
}
diff --git a/src/aig/dar/darMem.c b/src/aig/dar/darMem.c
deleted file mode 100644
index c2626bb1..00000000
--- a/src/aig/dar/darMem.c
+++ /dev/null
@@ -1,601 +0,0 @@
-/**CFile****************************************************************
-
- FileName [darMem.c]
-
- SystemName [ABC: Logic synthesis and verification system.]
-
- PackageName [DAG-aware AIG rewriting.]
-
- Synopsis [Memory managers.]
-
- Author [Alan Mishchenko]
-
- Affiliation [UC Berkeley]
-
- Date [Ver. 1.0. Started - April 28, 2007.]
-
- Revision [$Id: darMem.c,v 1.00 2007/04/28 00:00:00 alanmi Exp $]
-
-***********************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include "dar.h"
-
-////////////////////////////////////////////////////////////////////////
-/// DECLARATIONS ///
-////////////////////////////////////////////////////////////////////////
-
-struct Dar_MmFixed_t_
-{
- // information about individual entries
- int nEntrySize; // the size of one entry
- int nEntriesAlloc; // the total number of entries allocated
- int nEntriesUsed; // the number of entries in use
- int nEntriesMax; // the max number of entries in use
- char * pEntriesFree; // the linked list of free entries
-
- // this is where the memory is stored
- int nChunkSize; // the size of one chunk
- int nChunksAlloc; // the maximum number of memory chunks
- int nChunks; // the current number of memory chunks
- char ** pChunks; // the allocated memory
-
- // statistics
- int nMemoryUsed; // memory used in the allocated entries
- int nMemoryAlloc; // memory allocated
-};
-
-struct Dar_MmFlex_t_
-{
- // information about individual entries
- int nEntriesUsed; // the number of entries allocated
- char * pCurrent; // the current pointer to free memory
- char * pEnd; // the first entry outside the free memory
-
- // this is where the memory is stored
- int nChunkSize; // the size of one chunk
- int nChunksAlloc; // the maximum number of memory chunks
- int nChunks; // the current number of memory chunks
- char ** pChunks; // the allocated memory
-
- // statistics
- int nMemoryUsed; // memory used in the allocated entries
- int nMemoryAlloc; // memory allocated
-};
-
-struct Dar_MmStep_t_
-{
- int nMems; // the number of fixed memory managers employed
- Dar_MmFixed_t ** pMems; // memory managers: 2^1 words, 2^2 words, etc
- int nMapSize; // the size of the memory array
- Dar_MmFixed_t ** pMap; // maps the number of bytes into its memory manager
-};
-
-#define ALLOC(type, num) ((type *) malloc(sizeof(type) * (num)))
-#define FREE(obj) ((obj) ? (free((char *) (obj)), (obj) = 0) : 0)
-#define REALLOC(type, obj, num) \
- ((obj) ? ((type *) realloc((char *)(obj), sizeof(type) * (num))) : \
- ((type *) malloc(sizeof(type) * (num))))
-
-////////////////////////////////////////////////////////////////////////
-/// FUNCTION DEFINITIONS ///
-////////////////////////////////////////////////////////////////////////
-
-/**Function*************************************************************
-
- Synopsis [Allocates memory pieces of fixed size.]
-
- Description [The size of the chunk is computed as the minimum of
- 1024 entries and 64K. Can only work with entry size at least 4 byte long.]
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_MmFixed_t * Dar_MmFixedStart( int nEntrySize, int nEntriesMax )
-{
- Dar_MmFixed_t * p;
-
- p = ALLOC( Dar_MmFixed_t, 1 );
- memset( p, 0, sizeof(Dar_MmFixed_t) );
-
- p->nEntrySize = nEntrySize;
- p->nEntriesAlloc = 0;
- p->nEntriesUsed = 0;
- p->pEntriesFree = NULL;
-
- p->nChunkSize = nEntriesMax / 8;
- if ( p->nChunkSize < 8 )
- p->nChunkSize = 8;
-
- p->nChunksAlloc = 64;
- p->nChunks = 0;
- p->pChunks = ALLOC( char *, p->nChunksAlloc );
-
- p->nMemoryUsed = 0;
- p->nMemoryAlloc = 0;
- return p;
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_MmFixedStop( Dar_MmFixed_t * p, int fVerbose )
-{
- int i;
- if ( p == NULL )
- return;
- if ( fVerbose )
- {
- printf( "Fixed memory manager: Entry = %5d. Chunk = %5d. Chunks used = %5d.\n",
- p->nEntrySize, p->nChunkSize, p->nChunks );
- printf( " Entries used = %8d. Entries peak = %8d. Memory used = %8d. Memory alloc = %8d.\n",
- p->nEntriesUsed, p->nEntriesMax, p->nEntrySize * p->nEntriesUsed, p->nMemoryAlloc );
- }
- for ( i = 0; i < p->nChunks; i++ )
- free( p->pChunks[i] );
- free( p->pChunks );
- free( p );
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-char * Dar_MmFixedEntryFetch( Dar_MmFixed_t * p )
-{
- char * pTemp;
- int i;
-
- // check if there are still free entries
- if ( p->nEntriesUsed == p->nEntriesAlloc )
- { // need to allocate more entries
- assert( p->pEntriesFree == NULL );
- if ( p->nChunks == p->nChunksAlloc )
- {
- p->nChunksAlloc *= 2;
- p->pChunks = REALLOC( char *, p->pChunks, p->nChunksAlloc );
- }
- p->pEntriesFree = ALLOC( char, p->nEntrySize * p->nChunkSize );
- p->nMemoryAlloc += p->nEntrySize * p->nChunkSize;
- // transform these entries into a linked list
- pTemp = p->pEntriesFree;
- for ( i = 1; i < p->nChunkSize; i++ )
- {
- *((char **)pTemp) = pTemp + p->nEntrySize;
- pTemp += p->nEntrySize;
- }
- // set the last link
- *((char **)pTemp) = NULL;
- // add the chunk to the chunk storage
- p->pChunks[ p->nChunks++ ] = p->pEntriesFree;
- // add to the number of entries allocated
- p->nEntriesAlloc += p->nChunkSize;
- }
- // incrememt the counter of used entries
- p->nEntriesUsed++;
- if ( p->nEntriesMax < p->nEntriesUsed )
- p->nEntriesMax = p->nEntriesUsed;
- // return the first entry in the free entry list
- pTemp = p->pEntriesFree;
- p->pEntriesFree = *((char **)pTemp);
- return pTemp;
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_MmFixedEntryRecycle( Dar_MmFixed_t * p, char * pEntry )
-{
- // decrement the counter of used entries
- p->nEntriesUsed--;
- // add the entry to the linked list of free entries
- *((char **)pEntry) = p->pEntriesFree;
- p->pEntriesFree = pEntry;
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description [Relocates all the memory except the first chunk.]
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_MmFixedRestart( Dar_MmFixed_t * p )
-{
- int i;
- char * pTemp;
-
- // deallocate all chunks except the first one
- for ( i = 1; i < p->nChunks; i++ )
- free( p->pChunks[i] );
- p->nChunks = 1;
- // transform these entries into a linked list
- pTemp = p->pChunks[0];
- for ( i = 1; i < p->nChunkSize; i++ )
- {
- *((char **)pTemp) = pTemp + p->nEntrySize;
- pTemp += p->nEntrySize;
- }
- // set the last link
- *((char **)pTemp) = NULL;
- // set the free entry list
- p->pEntriesFree = p->pChunks[0];
- // set the correct statistics
- p->nMemoryAlloc = p->nEntrySize * p->nChunkSize;
- p->nMemoryUsed = 0;
- p->nEntriesAlloc = p->nChunkSize;
- p->nEntriesUsed = 0;
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Dar_MmFixedReadMemUsage( Dar_MmFixed_t * p )
-{
- return p->nMemoryAlloc;
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Dar_MmFixedReadMaxEntriesUsed( Dar_MmFixed_t * p )
-{
- return p->nEntriesMax;
-}
-
-
-
-/**Function*************************************************************
-
- Synopsis [Allocates entries of flexible size.]
-
- Description [Can only work with entry size at least 4 byte long.]
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_MmFlex_t * Dar_MmFlexStart()
-{
- Dar_MmFlex_t * p;
-
- p = ALLOC( Dar_MmFlex_t, 1 );
- memset( p, 0, sizeof(Dar_MmFlex_t) );
-
- p->nEntriesUsed = 0;
- p->pCurrent = NULL;
- p->pEnd = NULL;
-
- p->nChunkSize = (1 << 18);
- p->nChunksAlloc = 64;
- p->nChunks = 0;
- p->pChunks = ALLOC( char *, p->nChunksAlloc );
-
- p->nMemoryUsed = 0;
- p->nMemoryAlloc = 0;
- return p;
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_MmFlexStop( Dar_MmFlex_t * p, int fVerbose )
-{
- int i;
- if ( p == NULL )
- return;
- if ( fVerbose )
- {
- printf( "Flexible memory manager: Chunk size = %d. Chunks used = %d.\n",
- p->nChunkSize, p->nChunks );
- printf( " Entries used = %d. Memory used = %d. Memory alloc = %d.\n",
- p->nEntriesUsed, p->nMemoryUsed, p->nMemoryAlloc );
- }
- for ( i = 0; i < p->nChunks; i++ )
- free( p->pChunks[i] );
- free( p->pChunks );
- free( p );
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-char * Dar_MmFlexEntryFetch( Dar_MmFlex_t * p, int nBytes )
-{
- char * pTemp;
- // check if there are still free entries
- if ( p->pCurrent == NULL || p->pCurrent + nBytes > p->pEnd )
- { // need to allocate more entries
- if ( p->nChunks == p->nChunksAlloc )
- {
- p->nChunksAlloc *= 2;
- p->pChunks = REALLOC( char *, p->pChunks, p->nChunksAlloc );
- }
- if ( nBytes > p->nChunkSize )
- {
- // resize the chunk size if more memory is requested than it can give
- // (ideally, this should never happen)
- p->nChunkSize = 2 * nBytes;
- }
- p->pCurrent = ALLOC( char, p->nChunkSize );
- p->pEnd = p->pCurrent + p->nChunkSize;
- p->nMemoryAlloc += p->nChunkSize;
- // add the chunk to the chunk storage
- p->pChunks[ p->nChunks++ ] = p->pCurrent;
- }
- assert( p->pCurrent + nBytes <= p->pEnd );
- // increment the counter of used entries
- p->nEntriesUsed++;
- // keep track of the memory used
- p->nMemoryUsed += nBytes;
- // return the next entry
- pTemp = p->pCurrent;
- p->pCurrent += nBytes;
- return pTemp;
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description [Relocates all the memory except the first chunk.]
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_MmFlexRestart( Dar_MmFlex_t * p )
-{
- int i;
- if ( p->nChunks == 0 )
- return;
- // deallocate all chunks except the first one
- for ( i = 1; i < p->nChunks; i++ )
- free( p->pChunks[i] );
- p->nChunks = 1;
- p->nMemoryAlloc = p->nChunkSize;
- // transform these entries into a linked list
- p->pCurrent = p->pChunks[0];
- p->pEnd = p->pCurrent + p->nChunkSize;
- p->nEntriesUsed = 0;
- p->nMemoryUsed = 0;
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Dar_MmFlexReadMemUsage( Dar_MmFlex_t * p )
-{
- return p->nMemoryUsed;
-}
-
-
-
-
-
-/**Function*************************************************************
-
- Synopsis [Starts the hierarchical memory manager.]
-
- Description [This manager can allocate entries of any size.
- Iternally they are mapped into the entries with the number of bytes
- equal to the power of 2. The smallest entry size is 8 bytes. The
- next one is 16 bytes etc. So, if the user requests 6 bytes, he gets
- 8 byte entry. If we asks for 25 bytes, he gets 32 byte entry etc.
- The input parameters "nSteps" says how many fixed memory managers
- are employed internally. Calling this procedure with nSteps equal
- to 10 results in 10 hierarchically arranged internal memory managers,
- which can allocate up to 4096 (1Kb) entries. Requests for larger
- entries are handed over to malloc() and then free()ed.]
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_MmStep_t * Dar_MmStepStart( int nSteps )
-{
- Dar_MmStep_t * p;
- int i, k;
- p = ALLOC( Dar_MmStep_t, 1 );
- memset( p, 0, sizeof(Dar_MmStep_t) );
- p->nMems = nSteps;
- // start the fixed memory managers
- p->pMems = ALLOC( Dar_MmFixed_t *, p->nMems );
- for ( i = 0; i < p->nMems; i++ )
- p->pMems[i] = Dar_MmFixedStart( (8<<i), (1<<13) );
- // set up the mapping of the required memory size into the corresponding manager
- p->nMapSize = (4<<p->nMems);
- p->pMap = ALLOC( Dar_MmFixed_t *, p->nMapSize+1 );
- p->pMap[0] = NULL;
- for ( k = 1; k <= 4; k++ )
- p->pMap[k] = p->pMems[0];
- for ( i = 0; i < p->nMems; i++ )
- for ( k = (4<<i)+1; k <= (8<<i); k++ )
- p->pMap[k] = p->pMems[i];
-//for ( i = 1; i < 100; i ++ )
-//printf( "%10d: size = %10d\n", i, p->pMap[i]->nEntrySize );
- return p;
-}
-
-/**Function*************************************************************
-
- Synopsis [Stops the memory manager.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_MmStepStop( Dar_MmStep_t * p, int fVerbose )
-{
- int i;
- for ( i = 0; i < p->nMems; i++ )
- Dar_MmFixedStop( p->pMems[i], fVerbose );
-// if ( p->pLargeChunks )
-// {
-// for ( i = 0; i < p->nLargeChunks; i++ )
-// free( p->pLargeChunks[i] );
-// free( p->pLargeChunks );
-// }
- free( p->pMems );
- free( p->pMap );
- free( p );
-}
-
-/**Function*************************************************************
-
- Synopsis [Creates the entry.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-char * Dar_MmStepEntryFetch( Dar_MmStep_t * p, int nBytes )
-{
- if ( nBytes == 0 )
- return NULL;
- if ( nBytes > p->nMapSize )
- {
-// printf( "Allocating %d bytes.\n", nBytes );
-/*
- if ( p->nLargeChunks == p->nLargeChunksAlloc )
- {
- if ( p->nLargeChunksAlloc == 0 )
- p->nLargeChunksAlloc = 5;
- p->nLargeChunksAlloc *= 2;
- p->pLargeChunks = REALLOC( char *, p->pLargeChunks, p->nLargeChunksAlloc );
- }
- p->pLargeChunks[ p->nLargeChunks++ ] = ALLOC( char, nBytes );
- return p->pLargeChunks[ p->nLargeChunks - 1 ];
-*/
- return ALLOC( char, nBytes );
- }
- return Dar_MmFixedEntryFetch( p->pMap[nBytes] );
-}
-
-
-/**Function*************************************************************
-
- Synopsis [Recycles the entry.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_MmStepEntryRecycle( Dar_MmStep_t * p, char * pEntry, int nBytes )
-{
- if ( nBytes == 0 )
- return;
- if ( nBytes > p->nMapSize )
- {
- free( pEntry );
- return;
- }
- Dar_MmFixedEntryRecycle( p->pMap[nBytes], pEntry );
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Dar_MmStepReadMemUsage( Dar_MmStep_t * p )
-{
- int i, nMemTotal = 0;
- for ( i = 0; i < p->nMems; i++ )
- nMemTotal += p->pMems[i]->nMemoryAlloc;
- return nMemTotal;
-}
-
-////////////////////////////////////////////////////////////////////////
-/// END OF FILE ///
-////////////////////////////////////////////////////////////////////////
diff --git a/src/aig/dar/darObj.c b/src/aig/dar/darObj.c
deleted file mode 100644
index 85b142e6..00000000
--- a/src/aig/dar/darObj.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/**CFile****************************************************************
-
- FileName [darObj.c]
-
- SystemName [ABC: Logic synthesis and verification system.]
-
- PackageName [DAG-aware AIG rewriting.]
-
- Synopsis [Adding/removing objects.]
-
- Author [Alan Mishchenko]
-
- Affiliation [UC Berkeley]
-
- Date [Ver. 1.0. Started - April 28, 2007.]
-
- Revision [$Id: darObj.c,v 1.00 2007/04/28 00:00:00 alanmi Exp $]
-
-***********************************************************************/
-
-#include "dar.h"
-
-////////////////////////////////////////////////////////////////////////
-/// DECLARATIONS ///
-////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////
-/// FUNCTION DEFINITIONS ///
-////////////////////////////////////////////////////////////////////////
-
-/**Function*************************************************************
-
- Synopsis [Creates primary input.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_ObjCreatePi( Dar_Man_t * p )
-{
- Dar_Obj_t * pObj;
- pObj = Dar_ManFetchMemory( p );
- pObj->Type = DAR_AIG_PI;
- Vec_PtrPush( p->vPis, pObj );
- p->nObjs[DAR_AIG_PI]++;
- return pObj;
-}
-
-/**Function*************************************************************
-
- Synopsis [Creates primary output with the given driver.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_ObjCreatePo( Dar_Man_t * p, Dar_Obj_t * pDriver )
-{
- Dar_Obj_t * pObj;
- pObj = Dar_ManFetchMemory( p );
- pObj->Type = DAR_AIG_PO;
- Vec_PtrPush( p->vPos, pObj );
- // add connections
- Dar_ObjConnect( p, pObj, pDriver, NULL );
- // update node counters of the manager
- p->nObjs[DAR_AIG_PO]++;
- return pObj;
-}
-
-
-/**Function*************************************************************
-
- Synopsis [Create the new node assuming it does not exist.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_ObjCreate( Dar_Man_t * p, Dar_Obj_t * pGhost )
-{
- Dar_Obj_t * pObj;
- assert( !Dar_IsComplement(pGhost) );
- assert( Dar_ObjIsHash(pGhost) );
- assert( pGhost == &p->Ghost );
- // get memory for the new object
- pObj = Dar_ManFetchMemory( p );
- pObj->Type = pGhost->Type;
- // add connections
- Dar_ObjConnect( p, pObj, pGhost->pFanin0, pGhost->pFanin1 );
- // update node counters of the manager
- p->nObjs[Dar_ObjType(pObj)]++;
- assert( pObj->pData == NULL );
- return pObj;
-}
-
-/**Function*************************************************************
-
- Synopsis [Connect the object to the fanin.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ObjConnect( Dar_Man_t * p, Dar_Obj_t * pObj, Dar_Obj_t * pFan0, Dar_Obj_t * pFan1 )
-{
- assert( !Dar_IsComplement(pObj) );
- assert( !Dar_ObjIsPi(pObj) );
- // add the first fanin
- pObj->pFanin0 = pFan0;
- pObj->pFanin1 = pFan1;
- // increment references of the fanins and add their fanouts
- if ( pFan0 != NULL )
- {
- assert( Dar_ObjFanin0(pObj)->Type > 0 );
- Dar_ObjRef( Dar_ObjFanin0(pObj) );
- }
- if ( pFan1 != NULL )
- {
- assert( Dar_ObjFanin1(pObj)->Type > 0 );
- Dar_ObjRef( Dar_ObjFanin1(pObj) );
- }
- // set level and phase
- if ( pFan1 != NULL )
- {
- pObj->Level = Dar_ObjLevelNew( pObj );
- pObj->fPhase = Dar_ObjFaninPhase(pFan0) & Dar_ObjFaninPhase(pFan1);
- }
- else
- {
- pObj->Level = pFan0->Level;
- pObj->fPhase = Dar_ObjFaninPhase(pFan0);
- }
- // add the node to the structural hash table
- if ( Dar_ObjIsHash(pObj) )
- Dar_TableInsert( p, pObj );
-}
-
-/**Function*************************************************************
-
- Synopsis [Disconnects the object from the fanins.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ObjDisconnect( Dar_Man_t * p, Dar_Obj_t * pObj )
-{
- assert( !Dar_IsComplement(pObj) );
- // remove connections
- if ( pObj->pFanin0 != NULL )
- Dar_ObjDeref(Dar_ObjFanin0(pObj));
- if ( pObj->pFanin1 != NULL )
- Dar_ObjDeref(Dar_ObjFanin1(pObj));
- // remove the node from the structural hash table
- if ( Dar_ObjIsHash(pObj) )
- Dar_TableDelete( p, pObj );
- // add the first fanin
- pObj->pFanin0 = NULL;
- pObj->pFanin1 = NULL;
-}
-
-/**Function*************************************************************
-
- Synopsis [Deletes the node.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ObjDelete( Dar_Man_t * p, Dar_Obj_t * pObj )
-{
- assert( !Dar_IsComplement(pObj) );
- assert( !Dar_ObjIsTerm(pObj) );
- assert( Dar_ObjRefs(pObj) == 0 );
- p->nObjs[pObj->Type]--;
- Vec_PtrWriteEntry( p->vObjs, pObj->Id, NULL );
- Dar_ManRecycleMemory( p, pObj );
-}
-
-/**Function*************************************************************
-
- Synopsis [Deletes the MFFC of the node.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ObjDelete_rec( Dar_Man_t * p, Dar_Obj_t * pObj, int fFreeTop )
-{
- Dar_Obj_t * pFanin0, * pFanin1;
- assert( !Dar_IsComplement(pObj) );
- if ( Dar_ObjIsConst1(pObj) || Dar_ObjIsPi(pObj) )
- return;
- assert( !Dar_ObjIsPo(pObj) );
- pFanin0 = Dar_ObjFanin0(pObj);
- pFanin1 = Dar_ObjFanin1(pObj);
- Dar_ObjDisconnect( p, pObj );
- if ( fFreeTop )
- Dar_ObjDelete( p, pObj );
- if ( pFanin0 && !Dar_ObjIsNone(pFanin0) && Dar_ObjRefs(pFanin0) == 0 )
- Dar_ObjDelete_rec( p, pFanin0, 1 );
- if ( pFanin1 && !Dar_ObjIsNone(pFanin1) && Dar_ObjRefs(pFanin1) == 0 )
- Dar_ObjDelete_rec( p, pFanin1, 1 );
-}
-
-/**Function*************************************************************
-
- Synopsis [Replaces the first fanin of the node by the new fanin.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ObjPatchFanin0( Dar_Man_t * p, Dar_Obj_t * pObj, Dar_Obj_t * pFaninNew )
-{
- Dar_Obj_t * pFaninOld;
- assert( !Dar_IsComplement(pObj) );
- pFaninOld = Dar_ObjFanin0(pObj);
- // decrement ref and remove fanout
- Dar_ObjDeref( pFaninOld );
- // update the fanin
- pObj->pFanin0 = pFaninNew;
- // increment ref and add fanout
- Dar_ObjRef( Dar_Regular(pFaninNew) );
- // get rid of old fanin
- if ( !Dar_ObjIsPi(pFaninOld) && !Dar_ObjIsConst1(pFaninOld) && Dar_ObjRefs(pFaninOld) == 0 )
- Dar_ObjDelete_rec( p, pFaninOld, 1 );
-}
-
-/**Function*************************************************************
-
- Synopsis [Replaces one object by another.]
-
- Description [Both objects are currently in the manager. The new object
- (pObjNew) should be used instead of the old object (pObjOld). If the
- new object is complemented or used, the buffer is added.]
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ObjReplace( Dar_Man_t * p, Dar_Obj_t * pObjOld, Dar_Obj_t * pObjNew, int fNodesOnly )
-{
- Dar_Obj_t * pObjNewR = Dar_Regular(pObjNew);
- // the object to be replaced cannot be complemented
- assert( !Dar_IsComplement(pObjOld) );
- // the object to be replaced cannot be a terminal
- assert( !Dar_ObjIsPi(pObjOld) && !Dar_ObjIsPo(pObjOld) );
- // the object to be used cannot be a buffer or a PO
- assert( !Dar_ObjIsBuf(pObjNewR) && !Dar_ObjIsPo(pObjNewR) );
- // the object cannot be the same
- assert( pObjOld != pObjNewR );
- // make sure object is not pointing to itself
- assert( pObjOld != Dar_ObjFanin0(pObjNewR) );
- assert( pObjOld != Dar_ObjFanin1(pObjNewR) );
- // recursively delete the old node - but leave the object there
- pObjNewR->nRefs++;
- Dar_ObjDelete_rec( p, pObjOld, 0 );
- pObjNewR->nRefs--;
- // if the new object is complemented or already used, create a buffer
- p->nObjs[pObjOld->Type]--;
- if ( Dar_IsComplement(pObjNew) || Dar_ObjRefs(pObjNew) > 0 || (fNodesOnly && !Dar_ObjIsNode(pObjNew)) )
- {
- pObjOld->Type = DAR_AIG_BUF;
- Dar_ObjConnect( p, pObjOld, pObjNew, NULL );
- }
- else
- {
- Dar_Obj_t * pFanin0 = pObjNew->pFanin0;
- Dar_Obj_t * pFanin1 = pObjNew->pFanin1;
- pObjOld->Type = pObjNew->Type;
- Dar_ObjDisconnect( p, pObjNew );
- Dar_ObjConnect( p, pObjOld, pFanin0, pFanin1 );
- Dar_ObjDelete( p, pObjNew );
- }
- p->nObjs[pObjOld->Type]++;
-}
-
-////////////////////////////////////////////////////////////////////////
-/// END OF FILE ///
-////////////////////////////////////////////////////////////////////////
-
-
diff --git a/src/aig/dar/darOper.c b/src/aig/dar/darOper.c
deleted file mode 100644
index cfb89e31..00000000
--- a/src/aig/dar/darOper.c
+++ /dev/null
@@ -1,429 +0,0 @@
-/**CFile****************************************************************
-
- FileName [darOper.c]
-
- SystemName [ABC: Logic synthesis and verification system.]
-
- PackageName [DAG-aware AIG rewriting.]
-
- Synopsis [AIG operations.]
-
- Author [Alan Mishchenko]
-
- Affiliation [UC Berkeley]
-
- Date [Ver. 1.0. Started - April 28, 2007.]
-
- Revision [$Id: darOper.c,v 1.00 2007/04/28 00:00:00 alanmi Exp $]
-
-***********************************************************************/
-
-#include "dar.h"
-
-////////////////////////////////////////////////////////////////////////
-/// DECLARATIONS ///
-////////////////////////////////////////////////////////////////////////
-
-// procedure to detect an EXOR gate
-static inline int Dar_ObjIsExorType( Dar_Obj_t * p0, Dar_Obj_t * p1, Dar_Obj_t ** ppFan0, Dar_Obj_t ** ppFan1 )
-{
- if ( !Dar_IsComplement(p0) || !Dar_IsComplement(p1) )
- return 0;
- p0 = Dar_Regular(p0);
- p1 = Dar_Regular(p1);
- if ( !Dar_ObjIsAnd(p0) || !Dar_ObjIsAnd(p1) )
- return 0;
- if ( Dar_ObjFanin0(p0) != Dar_ObjFanin0(p1) || Dar_ObjFanin1(p0) != Dar_ObjFanin1(p1) )
- return 0;
- if ( Dar_ObjFaninC0(p0) == Dar_ObjFaninC0(p1) || Dar_ObjFaninC1(p0) == Dar_ObjFaninC1(p1) )
- return 0;
- *ppFan0 = Dar_ObjChild0(p0);
- *ppFan1 = Dar_ObjChild1(p0);
- return 1;
-}
-
-////////////////////////////////////////////////////////////////////////
-/// FUNCTION DEFINITIONS ///
-////////////////////////////////////////////////////////////////////////
-
-/**Function*************************************************************
-
- Synopsis [Returns i-th elementary variable.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_IthVar( Dar_Man_t * p, int i )
-{
- int v;
- for ( v = Dar_ManPiNum(p); v <= i; v++ )
- Dar_ObjCreatePi( p );
- assert( i < Vec_PtrSize(p->vPis) );
- return Dar_ManPi( p, i );
-}
-
-/**Function*************************************************************
-
- Synopsis [Perform one operation.]
-
- Description [The argument nodes can be complemented.]
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_Oper( Dar_Man_t * p, Dar_Obj_t * p0, Dar_Obj_t * p1, Dar_Type_t Type )
-{
- if ( Type == DAR_AIG_AND )
- return Dar_And( p, p0, p1 );
- if ( Type == DAR_AIG_EXOR )
- return Dar_Exor( p, p0, p1 );
- assert( 0 );
- return NULL;
-}
-
-/**Function*************************************************************
-
- Synopsis [Creates the canonical form of the node.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_CanonPair_rec( Dar_Man_t * p, Dar_Obj_t * pGhost )
-{
- Dar_Obj_t * pResult, * pLat0, * pLat1;
- int fCompl0, fCompl1;
- Dar_Type_t Type;
- assert( Dar_ObjIsNode(pGhost) );
- // consider the case when the pair is canonical
- if ( !Dar_ObjIsLatch(Dar_ObjFanin0(pGhost)) || !Dar_ObjIsLatch(Dar_ObjFanin1(pGhost)) )
- {
- if ( pResult = Dar_TableLookup( p, pGhost ) )
- return pResult;
- return Dar_ObjCreate( p, pGhost );
- }
- /// remember the latches
- pLat0 = Dar_ObjFanin0(pGhost);
- pLat1 = Dar_ObjFanin1(pGhost);
- // remember type and compls
- Type = Dar_ObjType(pGhost);
- fCompl0 = Dar_ObjFaninC0(pGhost);
- fCompl1 = Dar_ObjFaninC1(pGhost);
- // call recursively
- pResult = Dar_Oper( p, Dar_NotCond(Dar_ObjChild0(pLat0), fCompl0), Dar_NotCond(Dar_ObjChild0(pLat1), fCompl1), Type );
- // build latch on top of this
- return Dar_Latch( p, pResult, (Type == DAR_AIG_AND)? fCompl0 & fCompl1 : fCompl0 ^ fCompl1 );
-}
-
-/**Function*************************************************************
-
- Synopsis [Performs canonicization step.]
-
- Description [The argument nodes can be complemented.]
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_And( Dar_Man_t * p, Dar_Obj_t * p0, Dar_Obj_t * p1 )
-{
- Dar_Obj_t * pGhost, * pResult;
-// Dar_Obj_t * pFan0, * pFan1;
- // check trivial cases
- if ( p0 == p1 )
- return p0;
- if ( p0 == Dar_Not(p1) )
- return Dar_Not(p->pConst1);
- if ( Dar_Regular(p0) == p->pConst1 )
- return p0 == p->pConst1 ? p1 : Dar_Not(p->pConst1);
- if ( Dar_Regular(p1) == p->pConst1 )
- return p1 == p->pConst1 ? p0 : Dar_Not(p->pConst1);
- // check if it can be an EXOR gate
-// if ( Dar_ObjIsExorType( p0, p1, &pFan0, &pFan1 ) )
-// return Dar_Exor( p, pFan0, pFan1 );
- pGhost = Dar_ObjCreateGhost( p, p0, p1, DAR_AIG_AND );
- pResult = Dar_CanonPair_rec( p, pGhost );
- return pResult;
-}
-
-/**Function*************************************************************
-
- Synopsis [Creates the canonical form of the node.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_Latch( Dar_Man_t * p, Dar_Obj_t * pObj, int fInitOne )
-{
- Dar_Obj_t * pGhost, * pResult;
- pGhost = Dar_ObjCreateGhost( p, Dar_NotCond(pObj, fInitOne), NULL, DAR_AIG_LATCH );
- pResult = Dar_TableLookup( p, pGhost );
- if ( pResult == NULL )
- pResult = Dar_ObjCreate( p, pGhost );
- return Dar_NotCond( pResult, fInitOne );
-}
-
-/**Function*************************************************************
-
- Synopsis [Performs canonicization step.]
-
- Description [The argument nodes can be complemented.]
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_Exor( Dar_Man_t * p, Dar_Obj_t * p0, Dar_Obj_t * p1 )
-{
-/*
- Dar_Obj_t * pGhost, * pResult;
- // check trivial cases
- if ( p0 == p1 )
- return Dar_Not(p->pConst1);
- if ( p0 == Dar_Not(p1) )
- return p->pConst1;
- if ( Dar_Regular(p0) == p->pConst1 )
- return Dar_NotCond( p1, p0 == p->pConst1 );
- if ( Dar_Regular(p1) == p->pConst1 )
- return Dar_NotCond( p0, p1 == p->pConst1 );
- // check the table
- pGhost = Dar_ObjCreateGhost( p, p0, p1, DAR_AIG_EXOR );
- if ( pResult = Dar_TableLookup( p, pGhost ) )
- return pResult;
- return Dar_ObjCreate( p, pGhost );
-*/
- return Dar_Or( p, Dar_And(p, p0, Dar_Not(p1)), Dar_And(p, Dar_Not(p0), p1) );
-}
-
-/**Function*************************************************************
-
- Synopsis [Implements Boolean OR.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_Or( Dar_Man_t * p, Dar_Obj_t * p0, Dar_Obj_t * p1 )
-{
- return Dar_Not( Dar_And( p, Dar_Not(p0), Dar_Not(p1) ) );
-}
-
-/**Function*************************************************************
-
- Synopsis [Implements ITE operation.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_Mux( Dar_Man_t * p, Dar_Obj_t * pC, Dar_Obj_t * p1, Dar_Obj_t * p0 )
-{
-/*
- Dar_Obj_t * pTempA1, * pTempA2, * pTempB1, * pTempB2, * pTemp;
- int Count0, Count1;
- // consider trivial cases
- if ( p0 == Dar_Not(p1) )
- return Dar_Exor( p, pC, p0 );
- // other cases can be added
- // implement the first MUX (F = C * x1 + C' * x0)
-
- // check for constants here!!!
-
- pTempA1 = Dar_TableLookup( p, Dar_ObjCreateGhost(p, pC, p1, DAR_AIG_AND) );
- pTempA2 = Dar_TableLookup( p, Dar_ObjCreateGhost(p, Dar_Not(pC), p0, DAR_AIG_AND) );
- if ( pTempA1 && pTempA2 )
- {
- pTemp = Dar_TableLookup( p, Dar_ObjCreateGhost(p, Dar_Not(pTempA1), Dar_Not(pTempA2), DAR_AIG_AND) );
- if ( pTemp ) return Dar_Not(pTemp);
- }
- Count0 = (pTempA1 != NULL) + (pTempA2 != NULL);
- // implement the second MUX (F' = C * x1' + C' * x0')
- pTempB1 = Dar_TableLookup( p, Dar_ObjCreateGhost(p, pC, Dar_Not(p1), DAR_AIG_AND) );
- pTempB2 = Dar_TableLookup( p, Dar_ObjCreateGhost(p, Dar_Not(pC), Dar_Not(p0), DAR_AIG_AND) );
- if ( pTempB1 && pTempB2 )
- {
- pTemp = Dar_TableLookup( p, Dar_ObjCreateGhost(p, Dar_Not(pTempB1), Dar_Not(pTempB2), DAR_AIG_AND) );
- if ( pTemp ) return pTemp;
- }
- Count1 = (pTempB1 != NULL) + (pTempB2 != NULL);
- // compare and decide which one to implement
- if ( Count0 >= Count1 )
- {
- pTempA1 = pTempA1? pTempA1 : Dar_And(p, pC, p1);
- pTempA2 = pTempA2? pTempA2 : Dar_And(p, Dar_Not(pC), p0);
- return Dar_Or( p, pTempA1, pTempA2 );
- }
- pTempB1 = pTempB1? pTempB1 : Dar_And(p, pC, Dar_Not(p1));
- pTempB2 = pTempB2? pTempB2 : Dar_And(p, Dar_Not(pC), Dar_Not(p0));
- return Dar_Not( Dar_Or( p, pTempB1, pTempB2 ) );
-*/
- return Dar_Or( p, Dar_And(p, pC, p1), Dar_And(p, Dar_Not(pC), p0) );
-}
-
-/**Function*************************************************************
-
- Synopsis [Implements ITE operation.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_Maj( Dar_Man_t * p, Dar_Obj_t * pA, Dar_Obj_t * pB, Dar_Obj_t * pC )
-{
- return Dar_Or( p, Dar_Or(p, Dar_And(p, pA, pB), Dar_And(p, pA, pC)), Dar_And(p, pB, pC) );
-}
-
-/**Function*************************************************************
-
- Synopsis [Constructs the well-balanced tree of gates.]
-
- Description [Disregards levels and possible logic sharing.]
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_Multi_rec( Dar_Man_t * p, Dar_Obj_t ** ppObjs, int nObjs, Dar_Type_t Type )
-{
- Dar_Obj_t * pObj1, * pObj2;
- if ( nObjs == 1 )
- return ppObjs[0];
- pObj1 = Dar_Multi_rec( p, ppObjs, nObjs/2, Type );
- pObj2 = Dar_Multi_rec( p, ppObjs + nObjs/2, nObjs - nObjs/2, Type );
- return Dar_Oper( p, pObj1, pObj2, Type );
-}
-
-/**Function*************************************************************
-
- Synopsis [Old code.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_Multi( Dar_Man_t * p, Dar_Obj_t ** pArgs, int nArgs, Dar_Type_t Type )
-{
- assert( Type == DAR_AIG_AND || Type == DAR_AIG_EXOR );
- assert( nArgs > 0 );
- return Dar_Multi_rec( p, pArgs, nArgs, Type );
-}
-
-/**Function*************************************************************
-
- Synopsis [Implements the miter.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_Miter( Dar_Man_t * p, Vec_Ptr_t * vPairs )
-{
- int i;
- assert( vPairs->nSize > 0 );
- assert( vPairs->nSize % 2 == 0 );
- // go through the cubes of the node's SOP
- for ( i = 0; i < vPairs->nSize; i += 2 )
- vPairs->pArray[i/2] = Dar_Not( Dar_Exor( p, vPairs->pArray[i], vPairs->pArray[i+1] ) );
- vPairs->nSize = vPairs->nSize/2;
- return Dar_Not( Dar_Multi_rec( p, (Dar_Obj_t **)vPairs->pArray, vPairs->nSize, DAR_AIG_AND ) );
-}
-
-/**Function*************************************************************
-
- Synopsis [Creates AND function with nVars inputs.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_CreateAnd( Dar_Man_t * p, int nVars )
-{
- Dar_Obj_t * pFunc;
- int i;
- pFunc = Dar_ManConst1( p );
- for ( i = 0; i < nVars; i++ )
- pFunc = Dar_And( p, pFunc, Dar_IthVar(p, i) );
- return pFunc;
-}
-
-/**Function*************************************************************
-
- Synopsis [Creates AND function with nVars inputs.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_CreateOr( Dar_Man_t * p, int nVars )
-{
- Dar_Obj_t * pFunc;
- int i;
- pFunc = Dar_ManConst0( p );
- for ( i = 0; i < nVars; i++ )
- pFunc = Dar_Or( p, pFunc, Dar_IthVar(p, i) );
- return pFunc;
-}
-
-/**Function*************************************************************
-
- Synopsis [Creates AND function with nVars inputs.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_CreateExor( Dar_Man_t * p, int nVars )
-{
- Dar_Obj_t * pFunc;
- int i;
- pFunc = Dar_ManConst0( p );
- for ( i = 0; i < nVars; i++ )
- pFunc = Dar_Exor( p, pFunc, Dar_IthVar(p, i) );
- return pFunc;
-}
-
-////////////////////////////////////////////////////////////////////////
-/// END OF FILE ///
-////////////////////////////////////////////////////////////////////////
-
-
diff --git a/src/aig/dar/darSeq.c b/src/aig/dar/darSeq.c
deleted file mode 100644
index 33f11f31..00000000
--- a/src/aig/dar/darSeq.c
+++ /dev/null
@@ -1,497 +0,0 @@
-/**CFile****************************************************************
-
- FileName [darSeq.c]
-
- SystemName [ABC: Logic synthesis and verification system.]
-
- PackageName [DAG-aware AIG rewriting.]
-
- Synopsis []
-
- Author [Alan Mishchenko]
-
- Affiliation [UC Berkeley]
-
- Date [Ver. 1.0. Started - April 28, 2007.]
-
- Revision [$Id: darSeq.c,v 1.00 2007/04/28 00:00:00 alanmi Exp $]
-
-***********************************************************************/
-
-#include "dar.h"
-
-////////////////////////////////////////////////////////////////////////
-/// DECLARATIONS ///
-////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////
-/// FUNCTION DEFINITIONS ///
-////////////////////////////////////////////////////////////////////////
-
-/**Function*************************************************************
-
- Synopsis [Converts combinational AIG manager into a sequential one.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ManSeqStrashConvert( Dar_Man_t * p, int nLatches, int * pInits )
-{
- Dar_Obj_t * pObjLi, * pObjLo, * pLatch;
- int i;
- // collect the POs to be converted into latches
- for ( i = 0; i < nLatches; i++ )
- {
- // get the corresponding PI/PO pair
- pObjLi = Dar_ManPo( p, Dar_ManPoNum(p) - nLatches + i );
- pObjLo = Dar_ManPi( p, Dar_ManPiNum(p) - nLatches + i );
- // create latch
- pLatch = Dar_Latch( p, Dar_ObjChild0(pObjLi), pInits? pInits[i] : 0 );
- // recycle the old PO object
- Dar_ObjDisconnect( p, pObjLi );
- Vec_PtrWriteEntry( p->vObjs, pObjLi->Id, NULL );
- Dar_ManRecycleMemory( p, pObjLi );
- // convert the corresponding PI to be a buffer and connect it to the latch
- pObjLo->Type = DAR_AIG_BUF;
- Dar_ObjConnect( p, pObjLo, pLatch, NULL );
- }
- // shrink the arrays
- Vec_PtrShrink( p->vPis, Dar_ManPiNum(p) - nLatches );
- Vec_PtrShrink( p->vPos, Dar_ManPoNum(p) - nLatches );
- // update the counters of different objects
- p->nObjs[DAR_AIG_PI] -= nLatches;
- p->nObjs[DAR_AIG_PO] -= nLatches;
- p->nObjs[DAR_AIG_BUF] += nLatches;
-}
-
-/**Function*************************************************************
-
- Synopsis [Collects internal nodes in the DFS order.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ManDfsSeq_rec( Dar_Man_t * p, Dar_Obj_t * pObj, Vec_Ptr_t * vNodes )
-{
- assert( !Dar_IsComplement(pObj) );
- if ( pObj == NULL )
- return;
- if ( Dar_ObjIsTravIdCurrent( p, pObj ) )
- return;
- Dar_ObjSetTravIdCurrent( p, pObj );
- if ( Dar_ObjIsPi(pObj) || Dar_ObjIsConst1(pObj) )
- return;
- Dar_ManDfsSeq_rec( p, Dar_ObjFanin0(pObj), vNodes );
- Dar_ManDfsSeq_rec( p, Dar_ObjFanin1(pObj), vNodes );
-// if ( (Dar_ObjFanin0(pObj) == NULL || Dar_ObjIsBuf(Dar_ObjFanin0(pObj))) &&
-// (Dar_ObjFanin1(pObj) == NULL || Dar_ObjIsBuf(Dar_ObjFanin1(pObj))) )
- Vec_PtrPush( vNodes, pObj );
-}
-
-/**Function*************************************************************
-
- Synopsis [Collects internal nodes in the DFS order.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Vec_Ptr_t * Dar_ManDfsSeq( Dar_Man_t * p )
-{
- Vec_Ptr_t * vNodes;
- Dar_Obj_t * pObj;
- int i;
- Dar_ManIncrementTravId( p );
- vNodes = Vec_PtrAlloc( Dar_ManNodeNum(p) );
- Dar_ManForEachPo( p, pObj, i )
- Dar_ManDfsSeq_rec( p, Dar_ObjFanin0(pObj), vNodes );
- return vNodes;
-}
-
-/**Function*************************************************************
-
- Synopsis [Collects internal nodes in the DFS order.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ManDfsUnreach_rec( Dar_Man_t * p, Dar_Obj_t * pObj, Vec_Ptr_t * vNodes )
-{
- assert( !Dar_IsComplement(pObj) );
- if ( pObj == NULL )
- return;
- if ( Dar_ObjIsTravIdPrevious(p, pObj) || Dar_ObjIsTravIdCurrent(p, pObj) )
- return;
- Dar_ObjSetTravIdPrevious( p, pObj ); // assume unknown
- Dar_ManDfsUnreach_rec( p, Dar_ObjFanin0(pObj), vNodes );
- Dar_ManDfsUnreach_rec( p, Dar_ObjFanin1(pObj), vNodes );
- if ( Dar_ObjIsTravIdPrevious(p, Dar_ObjFanin0(pObj)) &&
- (Dar_ObjFanin1(pObj) == NULL || Dar_ObjIsTravIdPrevious(p, Dar_ObjFanin1(pObj))) )
- Vec_PtrPush( vNodes, pObj );
- else
- Dar_ObjSetTravIdCurrent( p, pObj );
-}
-
-/**Function*************************************************************
-
- Synopsis [Collects internal nodes unreachable from PIs.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Vec_Ptr_t * Dar_ManDfsUnreach( Dar_Man_t * p )
-{
- Vec_Ptr_t * vNodes;
- Dar_Obj_t * pObj, * pFanin;
- int i, k;//, RetValue;
- // collect unreachable nodes
- Dar_ManIncrementTravId( p );
- Dar_ManIncrementTravId( p );
- // mark the constant and PIs
- Dar_ObjSetTravIdPrevious( p, Dar_ManConst1(p) );
- Dar_ManForEachPi( p, pObj, i )
- Dar_ObjSetTravIdCurrent( p, pObj );
- // curr marks visited nodes reachable from PIs
- // prev marks visited nodes unreachable or unknown
-
- // collect the unreachable nodes
- vNodes = Vec_PtrAlloc( 32 );
- Dar_ManForEachPo( p, pObj, i )
- Dar_ManDfsUnreach_rec( p, Dar_ObjFanin0(pObj), vNodes );
-
- // refine resulting nodes
- do
- {
- k = 0;
- Vec_PtrForEachEntry( vNodes, pObj, i )
- {
- assert( Dar_ObjIsTravIdPrevious(p, pObj) );
- if ( Dar_ObjIsLatch(pObj) || Dar_ObjIsBuf(pObj) )
- {
- pFanin = Dar_ObjFanin0(pObj);
- assert( Dar_ObjIsTravIdPrevious(p, pFanin) || Dar_ObjIsTravIdCurrent(p, pFanin) );
- if ( Dar_ObjIsTravIdCurrent(p, pFanin) )
- {
- Dar_ObjSetTravIdCurrent( p, pObj );
- continue;
- }
- }
- else // AND gate
- {
- assert( Dar_ObjIsNode(pObj) );
- pFanin = Dar_ObjFanin0(pObj);
- assert( Dar_ObjIsTravIdPrevious(p, pFanin) || Dar_ObjIsTravIdCurrent(p, pFanin) );
- if ( Dar_ObjIsTravIdCurrent(p, pFanin) )
- {
- Dar_ObjSetTravIdCurrent( p, pObj );
- continue;
- }
- pFanin = Dar_ObjFanin1(pObj);
- assert( Dar_ObjIsTravIdPrevious(p, pFanin) || Dar_ObjIsTravIdCurrent(p, pFanin) );
- if ( Dar_ObjIsTravIdCurrent(p, pFanin) )
- {
- Dar_ObjSetTravIdCurrent( p, pObj );
- continue;
- }
- }
- // write it back
- Vec_PtrWriteEntry( vNodes, k++, pObj );
- }
- Vec_PtrShrink( vNodes, k );
- }
- while ( k < i );
-
-// if ( Vec_PtrSize(vNodes) > 0 )
-// printf( "Found %d unreachable.\n", Vec_PtrSize(vNodes) );
- return vNodes;
-
-/*
- // the resulting array contains all unreachable nodes except const 1
- if ( Vec_PtrSize(vNodes) == 0 )
- {
- Vec_PtrFree( vNodes );
- return 0;
- }
- RetValue = Vec_PtrSize(vNodes);
-
- // mark these nodes
- Dar_ManIncrementTravId( p );
- Vec_PtrForEachEntry( vNodes, pObj, i )
- Dar_ObjSetTravIdCurrent( p, pObj );
- Vec_PtrFree( vNodes );
- return RetValue;
-*/
-}
-
-
-/**Function*************************************************************
-
- Synopsis [Removes nodes that do not fanout into POs.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Dar_ManRemoveUnmarked( Dar_Man_t * p )
-{
- Vec_Ptr_t * vNodes;
- Dar_Obj_t * pObj;
- int i, RetValue;
- // collect unmarked nodes
- vNodes = Vec_PtrAlloc( 100 );
- Dar_ManForEachObj( p, pObj, i )
- {
- if ( Dar_ObjIsTerm(pObj) )
- continue;
- if ( Dar_ObjIsTravIdCurrent(p, pObj) )
- continue;
-//Dar_ObjPrintVerbose( pObj, 0 );
- Dar_ObjDisconnect( p, pObj );
- Vec_PtrPush( vNodes, pObj );
- }
- if ( Vec_PtrSize(vNodes) == 0 )
- {
- Vec_PtrFree( vNodes );
- return 0;
- }
- // remove the dangling objects
- RetValue = Vec_PtrSize(vNodes);
- Vec_PtrForEachEntry( vNodes, pObj, i )
- Dar_ObjDelete( p, pObj );
-// printf( "Removed %d dangling.\n", Vec_PtrSize(vNodes) );
- Vec_PtrFree( vNodes );
- return RetValue;
-}
-
-/**Function*************************************************************
-
- Synopsis [Rehashes the nodes.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Dar_ManSeqRehashOne( Dar_Man_t * p, Vec_Ptr_t * vNodes, Vec_Ptr_t * vUnreach )
-{
- Dar_Obj_t * pObj, * pObjNew, * pFanin0, * pFanin1;
- int i, RetValue = 0, Counter = 0, Counter2 = 0;
-
- // mark the unreachable nodes
- Dar_ManIncrementTravId( p );
- Vec_PtrForEachEntry( vUnreach, pObj, i )
- Dar_ObjSetTravIdCurrent(p, pObj);
-/*
- // count the number of unreachable object connections
- // that is the number of unreachable objects connected to main objects
- Dar_ManForEachObj( p, pObj, i )
- {
- if ( Dar_ObjIsTravIdCurrent(p, pObj) )
- continue;
-
- pFanin0 = Dar_ObjFanin0(pObj);
- if ( pFanin0 == NULL )
- continue;
- if ( Dar_ObjIsTravIdCurrent(p, pFanin0) )
- pFanin0->fMarkA = 1;
-
- pFanin1 = Dar_ObjFanin1(pObj);
- if ( pFanin1 == NULL )
- continue;
- if ( Dar_ObjIsTravIdCurrent(p, pFanin1) )
- pFanin1->fMarkA = 1;
- }
-
- // count the objects
- Dar_ManForEachObj( p, pObj, i )
- Counter2 += pObj->fMarkA, pObj->fMarkA = 0;
- printf( "Connections = %d.\n", Counter2 );
-*/
-
- // go through the nodes while skipping unreachable
- Vec_PtrForEachEntry( vNodes, pObj, i )
- {
- // skip nodes unreachable from the PIs
- if ( Dar_ObjIsTravIdCurrent(p, pObj) )
- continue;
- // process the node
- if ( Dar_ObjIsPo(pObj) )
- {
- if ( !Dar_ObjIsBuf(Dar_ObjFanin0(pObj)) )
- continue;
- pFanin0 = Dar_ObjReal_rec( Dar_ObjChild0(pObj) );
- Dar_ObjPatchFanin0( p, pObj, pFanin0 );
- continue;
- }
- if ( Dar_ObjIsLatch(pObj) )
- {
- if ( !Dar_ObjIsBuf(Dar_ObjFanin0(pObj)) )
- continue;
- pObjNew = Dar_ObjReal_rec( Dar_ObjChild0(pObj) );
- pObjNew = Dar_Latch( p, pObjNew, 0 );
- Dar_ObjReplace( p, pObj, pObjNew, 1 );
- RetValue = 1;
- Counter++;
- continue;
- }
- if ( Dar_ObjIsNode(pObj) )
- {
- if ( !Dar_ObjIsBuf(Dar_ObjFanin0(pObj)) && !Dar_ObjIsBuf(Dar_ObjFanin1(pObj)) )
- continue;
- pFanin0 = Dar_ObjReal_rec( Dar_ObjChild0(pObj) );
- pFanin1 = Dar_ObjReal_rec( Dar_ObjChild1(pObj) );
- pObjNew = Dar_And( p, pFanin0, pFanin1 );
- Dar_ObjReplace( p, pObj, pObjNew, 1 );
- RetValue = 1;
- Counter++;
- continue;
- }
- }
-// printf( "Rehashings = %d.\n", Counter++ );
- return RetValue;
-}
-
-/**Function*************************************************************
-
- Synopsis [If AIG contains buffers, this procedure removes them.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ManRemoveBuffers( Dar_Man_t * p )
-{
- Dar_Obj_t * pObj, * pObjNew, * pFanin0, * pFanin1;
- int i;
- if ( Dar_ManBufNum(p) == 0 )
- return;
- Dar_ManForEachObj( p, pObj, i )
- {
- if ( Dar_ObjIsPo(pObj) )
- {
- if ( !Dar_ObjIsBuf(Dar_ObjFanin0(pObj)) )
- continue;
- pFanin0 = Dar_ObjReal_rec( Dar_ObjChild0(pObj) );
- Dar_ObjPatchFanin0( p, pObj, pFanin0 );
- }
- else if ( Dar_ObjIsLatch(pObj) )
- {
- if ( !Dar_ObjIsBuf(Dar_ObjFanin0(pObj)) )
- continue;
- pFanin0 = Dar_ObjReal_rec( Dar_ObjChild0(pObj) );
- pObjNew = Dar_Latch( p, pFanin0, 0 );
- Dar_ObjReplace( p, pObj, pObjNew, 0 );
- }
- else if ( Dar_ObjIsAnd(pObj) )
- {
- if ( !Dar_ObjIsBuf(Dar_ObjFanin0(pObj)) && !Dar_ObjIsBuf(Dar_ObjFanin1(pObj)) )
- continue;
- pFanin0 = Dar_ObjReal_rec( Dar_ObjChild0(pObj) );
- pFanin1 = Dar_ObjReal_rec( Dar_ObjChild1(pObj) );
- pObjNew = Dar_And( p, pFanin0, pFanin1 );
- Dar_ObjReplace( p, pObj, pObjNew, 0 );
- }
- }
- assert( Dar_ManBufNum(p) == 0 );
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Dar_ManSeqStrash( Dar_Man_t * p, int nLatches, int * pInits )
-{
- Vec_Ptr_t * vNodes, * vUnreach;
-// Dar_Obj_t * pObj, * pFanin;
-// int i;
- int Iter, RetValue = 1;
-
- // create latches out of the additional PI/PO pairs
- Dar_ManSeqStrashConvert( p, nLatches, pInits );
-
- // iteratively rehash the network
- for ( Iter = 0; RetValue; Iter++ )
- {
-// Dar_ManPrintStats( p );
-/*
- Dar_ManForEachObj( p, pObj, i )
- {
- assert( pObj->Type > 0 );
- pFanin = Dar_ObjFanin0(pObj);
- assert( pFanin == NULL || pFanin->Type > 0 );
- pFanin = Dar_ObjFanin1(pObj);
- assert( pFanin == NULL || pFanin->Type > 0 );
- }
-*/
- // mark nodes unreachable from the PIs
- vUnreach = Dar_ManDfsUnreach( p );
- if ( Iter == 0 && Vec_PtrSize(vUnreach) > 0 )
- printf( "Unreachable objects = %d.\n", Vec_PtrSize(vUnreach) );
- // collect nodes reachable from the POs
- vNodes = Dar_ManDfsSeq( p );
- // remove nodes unreachable from the POs
- if ( Iter == 0 )
- Dar_ManRemoveUnmarked( p );
- // continue rehashing as long as there are changes
- RetValue = Dar_ManSeqRehashOne( p, vNodes, vUnreach );
- Vec_PtrFree( vNodes );
- Vec_PtrFree( vUnreach );
- }
-
- // perform the final cleanup
- Dar_ManIncrementTravId( p );
- vNodes = Dar_ManDfsSeq( p );
- Dar_ManRemoveUnmarked( p );
- Vec_PtrFree( vNodes );
- // remove buffers if they are left
-// Dar_ManRemoveBuffers( p );
-
- // clean up
- if ( !Dar_ManCheck( p ) )
- {
- printf( "Dar_ManSeqStrash: The network check has failed.\n" );
- return 0;
- }
- return 1;
-
-}
-
-////////////////////////////////////////////////////////////////////////
-/// END OF FILE ///
-////////////////////////////////////////////////////////////////////////
-
-
diff --git a/src/aig/dar/darTable.c b/src/aig/dar/darTable.c
deleted file mode 100644
index af9956ec..00000000
--- a/src/aig/dar/darTable.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/**CFile****************************************************************
-
- FileName [darTable.c]
-
- SystemName [ABC: Logic synthesis and verification system.]
-
- PackageName [DAG-aware AIG rewriting.]
-
- Synopsis [Structural hashing table.]
-
- Author [Alan Mishchenko]
-
- Affiliation [UC Berkeley]
-
- Date [Ver. 1.0. Started - April 28, 2007.]
-
- Revision [$Id: darTable.c,v 1.00 2007/04/28 00:00:00 alanmi Exp $]
-
-***********************************************************************/
-
-#include "dar.h"
-
-////////////////////////////////////////////////////////////////////////
-/// DECLARATIONS ///
-////////////////////////////////////////////////////////////////////////
-
-// hashing the node
-static unsigned long Dar_Hash( Dar_Obj_t * pObj, int TableSize )
-{
- unsigned long Key = Dar_ObjIsExor(pObj) * 1699;
- Key ^= (long)Dar_ObjFanin0(pObj) * 7937;
- Key ^= (long)Dar_ObjFanin1(pObj) * 2971;
- Key ^= Dar_ObjFaninC0(pObj) * 911;
- Key ^= Dar_ObjFaninC1(pObj) * 353;
- return Key % TableSize;
-}
-
-// returns the place where this node is stored (or should be stored)
-static Dar_Obj_t ** Dar_TableFind( Dar_Man_t * p, Dar_Obj_t * pObj )
-{
- Dar_Obj_t ** ppEntry;
- if ( Dar_ObjIsLatch(pObj) )
- {
- assert( Dar_ObjChild0(pObj) && Dar_ObjChild1(pObj) == NULL );
- }
- else
- {
- assert( Dar_ObjChild0(pObj) && Dar_ObjChild1(pObj) );
- assert( Dar_ObjFanin0(pObj)->Id < Dar_ObjFanin1(pObj)->Id );
- }
- for ( ppEntry = p->pTable + Dar_Hash(pObj, p->nTableSize); *ppEntry; ppEntry = &(*ppEntry)->pNext )
- if ( *ppEntry == pObj )
- return ppEntry;
- assert( *ppEntry == NULL );
- return ppEntry;
-}
-
-static void Dar_TableResize( Dar_Man_t * p );
-static unsigned int Cudd_PrimeAig( unsigned int p );
-
-////////////////////////////////////////////////////////////////////////
-/// FUNCTION DEFINITIONS ///
-////////////////////////////////////////////////////////////////////////
-
-/**Function*************************************************************
-
- Synopsis [Checks if node with the given attributes is in the hash table.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_TableLookup( Dar_Man_t * p, Dar_Obj_t * pGhost )
-{
- Dar_Obj_t * pEntry;
- assert( !Dar_IsComplement(pGhost) );
- if ( pGhost->Type == DAR_AIG_LATCH )
- {
- assert( Dar_ObjChild0(pGhost) && Dar_ObjChild1(pGhost) == NULL );
- if ( !Dar_ObjRefs(Dar_ObjFanin0(pGhost)) )
- return NULL;
- }
- else
- {
- assert( pGhost->Type == DAR_AIG_AND );
- assert( Dar_ObjChild0(pGhost) && Dar_ObjChild1(pGhost) );
- assert( Dar_ObjFanin0(pGhost)->Id < Dar_ObjFanin1(pGhost)->Id );
- if ( !Dar_ObjRefs(Dar_ObjFanin0(pGhost)) || !Dar_ObjRefs(Dar_ObjFanin1(pGhost)) )
- return NULL;
- }
- for ( pEntry = p->pTable[Dar_Hash(pGhost, p->nTableSize)]; pEntry; pEntry = pEntry->pNext )
- {
- if ( Dar_ObjChild0(pEntry) == Dar_ObjChild0(pGhost) &&
- Dar_ObjChild1(pEntry) == Dar_ObjChild1(pGhost) &&
- Dar_ObjType(pEntry) == Dar_ObjType(pGhost) )
- return pEntry;
- }
- return NULL;
-}
-
-/**Function*************************************************************
-
- Synopsis [Adds the new node to the hash table.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_TableInsert( Dar_Man_t * p, Dar_Obj_t * pObj )
-{
- Dar_Obj_t ** ppPlace;
- assert( !Dar_IsComplement(pObj) );
- assert( Dar_TableLookup(p, pObj) == NULL );
- if ( (pObj->Id & 0xFF) == 0 && 2 * p->nTableSize < Dar_ManNodeNum(p) )
- Dar_TableResize( p );
- ppPlace = Dar_TableFind( p, pObj );
- assert( *ppPlace == NULL );
- *ppPlace = pObj;
-}
-
-/**Function*************************************************************
-
- Synopsis [Deletes the node from the hash table.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_TableDelete( Dar_Man_t * p, Dar_Obj_t * pObj )
-{
- Dar_Obj_t ** ppPlace;
- assert( !Dar_IsComplement(pObj) );
- ppPlace = Dar_TableFind( p, pObj );
- assert( *ppPlace == pObj ); // node should be in the table
- // remove the node
- *ppPlace = pObj->pNext;
- pObj->pNext = NULL;
-}
-
-/**Function*************************************************************
-
- Synopsis [Count the number of nodes in the table.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Dar_TableCountEntries( Dar_Man_t * p )
-{
- Dar_Obj_t * pEntry;
- int i, Counter = 0;
- for ( i = 0; i < p->nTableSize; i++ )
- for ( pEntry = p->pTable[i]; pEntry; pEntry = pEntry->pNext )
- Counter++;
- return Counter;
-}
-
-/**Function*************************************************************
-
- Synopsis [Resizes the table.]
-
- Description [Typically this procedure should not be called.]
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_TableResize( Dar_Man_t * p )
-{
- Dar_Obj_t * pEntry, * pNext;
- Dar_Obj_t ** pTableOld, ** ppPlace;
- int nTableSizeOld, Counter, nEntries, i, clk;
-clk = clock();
- // save the old table
- pTableOld = p->pTable;
- nTableSizeOld = p->nTableSize;
- // get the new table
- p->nTableSize = Cudd_PrimeAig( 2 * Dar_ManNodeNum(p) );
- p->pTable = ALLOC( Dar_Obj_t *, p->nTableSize );
- memset( p->pTable, 0, sizeof(Dar_Obj_t *) * p->nTableSize );
- // rehash the entries from the old table
- Counter = 0;
- for ( i = 0; i < nTableSizeOld; i++ )
- for ( pEntry = pTableOld[i], pNext = pEntry? pEntry->pNext : NULL; pEntry; pEntry = pNext, pNext = pEntry? pEntry->pNext : NULL )
- {
- // get the place where this entry goes in the table
- ppPlace = Dar_TableFind( p, pEntry );
- assert( *ppPlace == NULL ); // should not be there
- // add the entry to the list
- *ppPlace = pEntry;
- pEntry->pNext = NULL;
- Counter++;
- }
- nEntries = Dar_ManNodeNum(p);
- assert( Counter == nEntries );
- printf( "Increasing the structural table size from %6d to %6d. ", nTableSizeOld, p->nTableSize );
- PRT( "Time", clock() - clk );
- // replace the table and the parameters
- free( pTableOld );
-}
-
-/**Function********************************************************************
-
- Synopsis [Profiles the hash table.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-******************************************************************************/
-void Dar_TableProfile( Dar_Man_t * p )
-{
- Dar_Obj_t * pEntry;
- int i, Counter;
- for ( i = 0; i < p->nTableSize; i++ )
- {
- Counter = 0;
- for ( pEntry = p->pTable[i]; pEntry; pEntry = pEntry->pNext )
- Counter++;
- if ( Counter )
- printf( "%d ", Counter );
- }
-}
-
-/**Function********************************************************************
-
- Synopsis [Returns the next prime &gt;= p.]
-
- Description [Copied from CUDD, for stand-aloneness.]
-
- SideEffects [None]
-
- SeeAlso []
-
-******************************************************************************/
-unsigned int Cudd_PrimeAig( unsigned int p)
-{
- int i,pn;
- p--;
- do {
- p++;
- if (p&1) {
- pn = 1;
- i = 3;
- while ((unsigned) (i * i) <= p) {
- if (p % i == 0) {
- pn = 0;
- break;
- }
- i += 2;
- }
- } else {
- pn = 0;
- }
- } while (!pn);
- return(p);
-
-} /* end of Cudd_Prime */
-
-////////////////////////////////////////////////////////////////////////
-/// END OF FILE ///
-////////////////////////////////////////////////////////////////////////
-
-
diff --git a/src/aig/dar/darTruth.c b/src/aig/dar/darTruth.c
index 16b9f62a..7fd47787 100644
--- a/src/aig/dar/darTruth.c
+++ b/src/aig/dar/darTruth.c
@@ -18,7 +18,7 @@
***********************************************************************/
-#include "dar.h"
+#include "darInt.h"
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
@@ -28,6 +28,8 @@
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
+#if 0
+
/**Function*************************************************************
Synopsis [Computes truth table of the cut.]
@@ -39,14 +41,14 @@
SeeAlso []
***********************************************************************/
-void Dar_ManCollectCut_rec( Dar_Man_t * p, Dar_Obj_t * pNode, Vec_Int_t * vNodes )
+void Aig_ManCollectCut_rec( Aig_Man_t * p, Aig_Obj_t * pNode, Vec_Int_t * vNodes )
{
if ( pNode->fMarkA )
return;
pNode->fMarkA = 1;
- assert( Dar_ObjIsAnd(pNode) || Dar_ObjIsExor(pNode) );
- Dar_ManCollectCut_rec( p, Dar_ObjFanin0(pNode), vNodes );
- Dar_ManCollectCut_rec( p, Dar_ObjFanin1(pNode), vNodes );
+ assert( Aig_ObjIsAnd(pNode) || Aig_ObjIsExor(pNode) );
+ Aig_ManCollectCut_rec( p, Aig_ObjFanin0(pNode), vNodes );
+ Aig_ManCollectCut_rec( p, Aig_ObjFanin1(pNode), vNodes );
Vec_IntPush( vNodes, pNode->Id );
}
@@ -62,7 +64,7 @@ void Dar_ManCollectCut_rec( Dar_Man_t * p, Dar_Obj_t * pNode, Vec_Int_t * vNodes
SeeAlso []
***********************************************************************/
-void Dar_ManCollectCut( Dar_Man_t * p, Dar_Obj_t * pRoot, Vec_Int_t * vLeaves, Vec_Int_t * vNodes )
+void Aig_ManCollectCut( Aig_Man_t * p, Aig_Obj_t * pRoot, Vec_Int_t * vLeaves, Vec_Int_t * vNodes )
{
int i, Leaf;
// collect and mark the leaves
@@ -70,13 +72,13 @@ void Dar_ManCollectCut( Dar_Man_t * p, Dar_Obj_t * pRoot, Vec_Int_t * vLeaves, V
Vec_IntForEachEntry( vLeaves, Leaf, i )
{
Vec_IntPush( vNodes, Leaf );
- Dar_ManObj(p, Leaf)->fMarkA = 1;
+ Aig_ManObj(p, Leaf)->fMarkA = 1;
}
// collect and mark the nodes
- Dar_ManCollectCut_rec( p, pRoot, vNodes );
+ Aig_ManCollectCut_rec( p, pRoot, vNodes );
// clean the nodes
Vec_IntForEachEntry( vNodes, Leaf, i )
- Dar_ManObj(p, Leaf)->fMarkA = 0;
+ Aig_ManObj(p, Leaf)->fMarkA = 0;
}
/**Function*************************************************************
@@ -90,7 +92,7 @@ void Dar_ManCollectCut( Dar_Man_t * p, Dar_Obj_t * pRoot, Vec_Int_t * vLeaves, V
SeeAlso []
***********************************************************************/
-unsigned * Dar_ObjGetTruthStore( int ObjNum, Vec_Int_t * vTruth )
+unsigned * Aig_ObjGetTruthStore( int ObjNum, Vec_Int_t * vTruth )
{
return ((unsigned *)Vec_IntArray(vTruth)) + 8 * ObjNum;
}
@@ -106,26 +108,26 @@ unsigned * Dar_ObjGetTruthStore( int ObjNum, Vec_Int_t * vTruth )
SeeAlso []
***********************************************************************/
-void Dar_ManCutTruthOne( Dar_Man_t * p, Dar_Obj_t * pNode, Vec_Int_t * vTruth, int nWords )
+void Aig_ManCutTruthOne( Aig_Man_t * p, Aig_Obj_t * pNode, Vec_Int_t * vTruth, int nWords )
{
unsigned * pTruth, * pTruth0, * pTruth1;
int i;
- pTruth = Dar_ObjGetTruthStore( pNode->Level, vTruth );
- pTruth0 = Dar_ObjGetTruthStore( Dar_ObjFanin0(pNode)->Level, vTruth );
- pTruth1 = Dar_ObjGetTruthStore( Dar_ObjFanin1(pNode)->Level, vTruth );
- if ( Dar_ObjIsExor(pNode) )
+ pTruth = Aig_ObjGetTruthStore( pNode->Level, vTruth );
+ pTruth0 = Aig_ObjGetTruthStore( Aig_ObjFanin0(pNode)->Level, vTruth );
+ pTruth1 = Aig_ObjGetTruthStore( Aig_ObjFanin1(pNode)->Level, vTruth );
+ if ( Aig_ObjIsExor(pNode) )
for ( i = 0; i < nWords; i++ )
pTruth[i] = pTruth0[i] ^ pTruth1[i];
- else if ( !Dar_ObjFaninC0(pNode) && !Dar_ObjFaninC1(pNode) )
+ else if ( !Aig_ObjFaninC0(pNode) && !Aig_ObjFaninC1(pNode) )
for ( i = 0; i < nWords; i++ )
pTruth[i] = pTruth0[i] & pTruth1[i];
- else if ( !Dar_ObjFaninC0(pNode) && Dar_ObjFaninC1(pNode) )
+ else if ( !Aig_ObjFaninC0(pNode) && Aig_ObjFaninC1(pNode) )
for ( i = 0; i < nWords; i++ )
pTruth[i] = pTruth0[i] & ~pTruth1[i];
- else if ( Dar_ObjFaninC0(pNode) && !Dar_ObjFaninC1(pNode) )
+ else if ( Aig_ObjFaninC0(pNode) && !Aig_ObjFaninC1(pNode) )
for ( i = 0; i < nWords; i++ )
pTruth[i] = ~pTruth0[i] & pTruth1[i];
- else // if ( Dar_ObjFaninC0(pNode) && Dar_ObjFaninC1(pNode) )
+ else // if ( Aig_ObjFaninC0(pNode) && Aig_ObjFaninC1(pNode) )
for ( i = 0; i < nWords; i++ )
pTruth[i] = ~pTruth0[i] & ~pTruth1[i];
}
@@ -142,7 +144,7 @@ void Dar_ManCutTruthOne( Dar_Man_t * p, Dar_Obj_t * pNode, Vec_Int_t * vTruth, i
SeeAlso []
***********************************************************************/
-unsigned * Dar_ManCutTruth( Dar_Man_t * p, Dar_Obj_t * pRoot, Vec_Int_t * vLeaves, Vec_Int_t * vNodes, Vec_Int_t * vTruth )
+unsigned * Aig_ManCutTruth( Aig_Man_t * p, Aig_Obj_t * pRoot, Vec_Int_t * vLeaves, Vec_Int_t * vNodes, Vec_Int_t * vTruth )
{
static unsigned uTruths[8][8] = { // elementary truth tables
{ 0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA },
@@ -156,20 +158,20 @@ unsigned * Dar_ManCutTruth( Dar_Man_t * p, Dar_Obj_t * pRoot, Vec_Int_t * vLeave
};
int i, Leaf;
// collect the cut
-// Dar_ManCollectCut( p, pRoot, vLeaves, vNodes );
+// Aig_ManCollectCut( p, pRoot, vLeaves, vNodes );
// set the node numbers
Vec_IntForEachEntry( vNodes, Leaf, i )
- Dar_ManObj(p, Leaf)->Level = i;
+ Aig_ManObj(p, Leaf)->Level = i;
// alloc enough memory
Vec_IntClear( vTruth );
Vec_IntGrow( vTruth, 8 * Vec_IntSize(vNodes) );
// set the elementary truth tables
Vec_IntForEachEntry( vLeaves, Leaf, i )
- memcpy( Dar_ObjGetTruthStore(i, vTruth), uTruths[i], 8 * sizeof(unsigned) );
+ memcpy( Aig_ObjGetTruthStore(i, vTruth), uTruths[i], 8 * sizeof(unsigned) );
// compute truths for other nodes
Vec_IntForEachEntryStart( vNodes, Leaf, i, Vec_IntSize(vLeaves) )
- Dar_ManCutTruthOne( p, Dar_ManObj(p, Leaf), vTruth, 8 );
- return Dar_ObjGetTruthStore( pRoot->Level, vTruth );
+ Aig_ManCutTruthOne( p, Aig_ManObj(p, Leaf), vTruth, 8 );
+ return Aig_ObjGetTruthStore( pRoot->Level, vTruth );
}
static inline int Kit_TruthWordNum( int nVars ) { return nVars <= 5 ? 1 : (1 << (nVars - 5)); }
@@ -191,21 +193,21 @@ static inline void Kit_TruthNot( unsigned * pOut, unsigned * pIn, int nVars )
SeeAlso []
***********************************************************************/
-int Dar_ManLargeCutEvalIsop( unsigned * pTruth, int nVars, Vec_Int_t * vMemory )
+int Aig_ManLargeCutEvalIsop( unsigned * pTruth, int nVars, Vec_Int_t * vMemory )
{
extern int Kit_TruthIsop( unsigned * puTruth, int nVars, Vec_Int_t * vMemory, int fTryBoth );
int RetValue, nClauses;
// compute ISOP for the positive phase
RetValue = Kit_TruthIsop( pTruth, nVars, vMemory, 0 );
if ( RetValue == -1 )
- return DAR_INFINITY;
+ return AIG_INFINITY;
assert( RetValue == 0 || RetValue == 1 );
nClauses = Vec_IntSize( vMemory );
// compute ISOP for the negative phase
Kit_TruthNot( pTruth, pTruth, nVars );
RetValue = Kit_TruthIsop( pTruth, nVars, vMemory, 0 );
if ( RetValue == -1 )
- return DAR_INFINITY;
+ return AIG_INFINITY;
Kit_TruthNot( pTruth, pTruth, nVars );
assert( RetValue == 0 || RetValue == 1 );
nClauses += Vec_IntSize( vMemory );
@@ -223,21 +225,21 @@ int Dar_ManLargeCutEvalIsop( unsigned * pTruth, int nVars, Vec_Int_t * vMemory )
SeeAlso []
***********************************************************************/
-void Dar_ManLargeCutCollect_rec( Dar_Man_t * p, Dar_Obj_t * pNode, Vec_Int_t * vLeaves, Vec_Int_t * vNodes )
+void Aig_ManLargeCutCollect_rec( Aig_Man_t * p, Aig_Obj_t * pNode, Vec_Int_t * vLeaves, Vec_Int_t * vNodes )
{
- if ( Dar_ObjIsTravIdCurrent(p, pNode) )
+ if ( Aig_ObjIsTravIdCurrent(p, pNode) )
return;
- if ( Dar_ObjIsTravIdPrevious(p, pNode) )
+ if ( Aig_ObjIsTravIdPrevious(p, pNode) )
{
Vec_IntPush( vLeaves, pNode->Id );
// Vec_IntPush( vNodes, pNode->Id );
- Dar_ObjSetTravIdCurrent( p, pNode );
+ Aig_ObjSetTravIdCurrent( p, pNode );
return;
}
- assert( Dar_ObjIsAnd(pNode) || Dar_ObjIsExor(pNode) );
- Dar_ObjSetTravIdCurrent( p, pNode );
- Dar_ManLargeCutCollect_rec( p, Dar_ObjFanin0(pNode), vLeaves, vNodes );
- Dar_ManLargeCutCollect_rec( p, Dar_ObjFanin1(pNode), vLeaves, vNodes );
+ assert( Aig_ObjIsAnd(pNode) || Aig_ObjIsExor(pNode) );
+ Aig_ObjSetTravIdCurrent( p, pNode );
+ Aig_ManLargeCutCollect_rec( p, Aig_ObjFanin0(pNode), vLeaves, vNodes );
+ Aig_ManLargeCutCollect_rec( p, Aig_ObjFanin1(pNode), vLeaves, vNodes );
Vec_IntPush( vNodes, pNode->Id );
}
@@ -252,24 +254,24 @@ void Dar_ManLargeCutCollect_rec( Dar_Man_t * p, Dar_Obj_t * pNode, Vec_Int_t * v
SeeAlso []
***********************************************************************/
-void Dar_ManLargeCutCollect( Dar_Man_t * p, Dar_Obj_t * pRoot, Dar_Cut_t * pCutR, Dar_Cut_t * pCutL, int Leaf,
+void Aig_ManLargeCutCollect( Aig_Man_t * p, Aig_Obj_t * pRoot, Aig_Cut_t * pCutR, Aig_Cut_t * pCutL, int Leaf,
Vec_Int_t * vLeaves, Vec_Int_t * vNodes )
{
Vec_Int_t * vTemp;
- Dar_Obj_t * pObj;
+ Aig_Obj_t * pObj;
int Node, i;
- Dar_ManIncrementTravId( p );
- Dar_CutForEachLeaf( p, pCutR, pObj, i )
+ Aig_ManIncrementTravId( p );
+ Aig_CutForEachLeaf( p, pCutR, pObj, i )
if ( pObj->Id != Leaf )
- Dar_ObjSetTravIdCurrent( p, pObj );
- Dar_CutForEachLeaf( p, pCutL, pObj, i )
- Dar_ObjSetTravIdCurrent( p, pObj );
+ Aig_ObjSetTravIdCurrent( p, pObj );
+ Aig_CutForEachLeaf( p, pCutL, pObj, i )
+ Aig_ObjSetTravIdCurrent( p, pObj );
// collect the internal nodes and leaves
- Dar_ManIncrementTravId( p );
+ Aig_ManIncrementTravId( p );
vTemp = Vec_IntAlloc( 100 );
- Dar_ManLargeCutCollect_rec( p, pRoot, vLeaves, vTemp );
+ Aig_ManLargeCutCollect_rec( p, pRoot, vLeaves, vTemp );
Vec_IntForEachEntry( vLeaves, Node, i )
Vec_IntPush( vNodes, Node );
@@ -291,22 +293,22 @@ void Dar_ManLargeCutCollect( Dar_Man_t * p, Dar_Obj_t * pRoot, Dar_Cut_t * pCutR
SeeAlso []
***********************************************************************/
-int Dar_ManLargeCutEval( Dar_Man_t * p, Dar_Obj_t * pRoot, Dar_Cut_t * pCutR, Dar_Cut_t * pCutL, int Leaf )
+int Aig_ManLargeCutEval( Aig_Man_t * p, Aig_Obj_t * pRoot, Aig_Cut_t * pCutR, Aig_Cut_t * pCutL, int Leaf )
{
Vec_Int_t * vLeaves, * vNodes, * vTruth, * vMemory;
unsigned * pTruth;
int RetValue;
-// Dar_Obj_t * pObj;
+// Aig_Obj_t * pObj;
vMemory = Vec_IntAlloc( 1 << 16 );
vTruth = Vec_IntAlloc( 1 << 16 );
vLeaves = Vec_IntAlloc( 100 );
vNodes = Vec_IntAlloc( 100 );
- Dar_ManLargeCutCollect( p, pRoot, pCutR, pCutL, Leaf, vLeaves, vNodes );
+ Aig_ManLargeCutCollect( p, pRoot, pCutR, pCutL, Leaf, vLeaves, vNodes );
/*
// collect the nodes
- Dar_CutForEachLeaf( p, pCutR, pObj, i )
+ Aig_CutForEachLeaf( p, pCutR, pObj, i )
{
if ( pObj->Id == Leaf )
continue;
@@ -316,7 +318,7 @@ int Dar_ManLargeCutEval( Dar_Man_t * p, Dar_Obj_t * pRoot, Dar_Cut_t * pCutR, Da
Vec_IntPush( vLeaves, pObj->Id );
Vec_IntPush( vNodes, pObj->Id );
}
- Dar_CutForEachLeaf( p, pCutL, pObj, i )
+ Aig_CutForEachLeaf( p, pCutL, pObj, i )
{
if ( pObj->fMarkA )
continue;
@@ -325,14 +327,14 @@ int Dar_ManLargeCutEval( Dar_Man_t * p, Dar_Obj_t * pRoot, Dar_Cut_t * pCutR, Da
Vec_IntPush( vNodes, pObj->Id );
}
// collect and mark the nodes
- Dar_ManCollectCut_rec( p, pRoot, vNodes );
+ Aig_ManCollectCut_rec( p, pRoot, vNodes );
// clean the nodes
Vec_IntForEachEntry( vNodes, Leaf, i )
- Dar_ManObj(p, Leaf)->fMarkA = 0;
+ Aig_ManObj(p, Leaf)->fMarkA = 0;
*/
- pTruth = Dar_ManCutTruth( p, pRoot, vLeaves, vNodes, vTruth );
- RetValue = Dar_ManLargeCutEvalIsop( pTruth, Vec_IntSize(vLeaves), vMemory );
+ pTruth = Aig_ManCutTruth( p, pRoot, vLeaves, vNodes, vTruth );
+ RetValue = Aig_ManLargeCutEvalIsop( pTruth, Vec_IntSize(vLeaves), vMemory );
Vec_IntFree( vLeaves );
Vec_IntFree( vNodes );
@@ -342,6 +344,7 @@ int Dar_ManLargeCutEval( Dar_Man_t * p, Dar_Obj_t * pRoot, Dar_Cut_t * pCutR, Da
return RetValue;
}
+#endif
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
diff --git a/src/aig/dar/darUtil.c b/src/aig/dar/darUtil.c
deleted file mode 100644
index 052fad60..00000000
--- a/src/aig/dar/darUtil.c
+++ /dev/null
@@ -1,625 +0,0 @@
-/**CFile****************************************************************
-
- FileName [darUtil.c]
-
- SystemName [ABC: Logic synthesis and verification system.]
-
- PackageName [DAG-aware AIG rewriting.]
-
- Synopsis [Various procedures.]
-
- Author [Alan Mishchenko]
-
- Affiliation [UC Berkeley]
-
- Date [Ver. 1.0. Started - April 28, 2007.]
-
- Revision [$Id: darUtil.c,v 1.00 2007/04/28 00:00:00 alanmi Exp $]
-
-***********************************************************************/
-
-#include "dar.h"
-
-////////////////////////////////////////////////////////////////////////
-/// DECLARATIONS ///
-////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////
-/// FUNCTION DEFINITIONS ///
-////////////////////////////////////////////////////////////////////////
-
-/**Function*************************************************************
-
- Synopsis [Returns the structure with default assignment of parameters.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Par_t * Dar_ManDefaultParams()
-{
- Dar_Par_t * p;
- p = ALLOC( Dar_Par_t, 1 );
- memset( p, 0, sizeof(Dar_Par_t) );
- return p;
-}
-
-/**Function*************************************************************
-
- Synopsis [Increments the current traversal ID of the network.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ManIncrementTravId( Dar_Man_t * p )
-{
- if ( p->nTravIds >= (1<<30)-1 )
- Dar_ManCleanData( p );
- p->nTravIds++;
-}
-
-/**Function*************************************************************
-
- Synopsis [Collect the latches.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Dar_ManLevels( Dar_Man_t * p )
-{
- Dar_Obj_t * pObj;
- int i, LevelMax = 0;
- Dar_ManForEachPo( p, pObj, i )
- LevelMax = DAR_MAX( LevelMax, (int)Dar_ObjFanin0(pObj)->Level );
- return LevelMax;
-}
-
-/**Function*************************************************************
-
- Synopsis [Cleans the data pointers for the nodes.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ManCleanData( Dar_Man_t * p )
-{
- Dar_Obj_t * pObj;
- int i;
- Dar_ManForEachObj( p, pObj, i )
- pObj->pData = NULL;
-}
-
-/**Function*************************************************************
-
- Synopsis [Recursively cleans the data pointers in the cone of the node.]
-
- Description [Applicable to small AIGs only because no caching is performed.]
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ObjCleanData_rec( Dar_Obj_t * pObj )
-{
- assert( !Dar_IsComplement(pObj) );
- assert( !Dar_ObjIsPo(pObj) );
- if ( Dar_ObjIsAnd(pObj) )
- {
- Dar_ObjCleanData_rec( Dar_ObjFanin0(pObj) );
- Dar_ObjCleanData_rec( Dar_ObjFanin1(pObj) );
- }
- pObj->pData = NULL;
-}
-
-/**Function*************************************************************
-
- Synopsis [Detects multi-input gate rooted at this node.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ObjCollectMulti_rec( Dar_Obj_t * pRoot, Dar_Obj_t * pObj, Vec_Ptr_t * vSuper )
-{
- if ( pRoot != pObj && (Dar_IsComplement(pObj) || Dar_ObjIsPi(pObj) || Dar_ObjType(pRoot) != Dar_ObjType(pObj)) )
- {
- Vec_PtrPushUnique(vSuper, pObj);
- return;
- }
- Dar_ObjCollectMulti_rec( pRoot, Dar_ObjChild0(pObj), vSuper );
- Dar_ObjCollectMulti_rec( pRoot, Dar_ObjChild1(pObj), vSuper );
-}
-
-/**Function*************************************************************
-
- Synopsis [Detects multi-input gate rooted at this node.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ObjCollectMulti( Dar_Obj_t * pRoot, Vec_Ptr_t * vSuper )
-{
- assert( !Dar_IsComplement(pRoot) );
- Vec_PtrClear( vSuper );
- Dar_ObjCollectMulti_rec( pRoot, pRoot, vSuper );
-}
-
-/**Function*************************************************************
-
- Synopsis [Returns 1 if the node is the root of MUX or EXOR/NEXOR.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Dar_ObjIsMuxType( Dar_Obj_t * pNode )
-{
- Dar_Obj_t * pNode0, * pNode1;
- // check that the node is regular
- assert( !Dar_IsComplement(pNode) );
- // if the node is not AND, this is not MUX
- if ( !Dar_ObjIsAnd(pNode) )
- return 0;
- // if the children are not complemented, this is not MUX
- if ( !Dar_ObjFaninC0(pNode) || !Dar_ObjFaninC1(pNode) )
- return 0;
- // get children
- pNode0 = Dar_ObjFanin0(pNode);
- pNode1 = Dar_ObjFanin1(pNode);
- // if the children are not ANDs, this is not MUX
- if ( !Dar_ObjIsAnd(pNode0) || !Dar_ObjIsAnd(pNode1) )
- return 0;
- // otherwise the node is MUX iff it has a pair of equal grandchildren
- return (Dar_ObjFanin0(pNode0) == Dar_ObjFanin0(pNode1) && (Dar_ObjFaninC0(pNode0) ^ Dar_ObjFaninC0(pNode1))) ||
- (Dar_ObjFanin0(pNode0) == Dar_ObjFanin1(pNode1) && (Dar_ObjFaninC0(pNode0) ^ Dar_ObjFaninC1(pNode1))) ||
- (Dar_ObjFanin1(pNode0) == Dar_ObjFanin0(pNode1) && (Dar_ObjFaninC1(pNode0) ^ Dar_ObjFaninC0(pNode1))) ||
- (Dar_ObjFanin1(pNode0) == Dar_ObjFanin1(pNode1) && (Dar_ObjFaninC1(pNode0) ^ Dar_ObjFaninC1(pNode1)));
-}
-
-
-/**Function*************************************************************
-
- Synopsis [Recognizes what nodes are inputs of the EXOR.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Dar_ObjRecognizeExor( Dar_Obj_t * pObj, Dar_Obj_t ** ppFan0, Dar_Obj_t ** ppFan1 )
-{
- Dar_Obj_t * p0, * p1;
- assert( !Dar_IsComplement(pObj) );
- if ( !Dar_ObjIsNode(pObj) )
- return 0;
- if ( Dar_ObjIsExor(pObj) )
- {
- *ppFan0 = Dar_ObjChild0(pObj);
- *ppFan1 = Dar_ObjChild1(pObj);
- return 1;
- }
- assert( Dar_ObjIsAnd(pObj) );
- p0 = Dar_ObjChild0(pObj);
- p1 = Dar_ObjChild1(pObj);
- if ( !Dar_IsComplement(p0) || !Dar_IsComplement(p1) )
- return 0;
- p0 = Dar_Regular(p0);
- p1 = Dar_Regular(p1);
- if ( !Dar_ObjIsAnd(p0) || !Dar_ObjIsAnd(p1) )
- return 0;
- if ( Dar_ObjFanin0(p0) != Dar_ObjFanin0(p1) || Dar_ObjFanin1(p0) != Dar_ObjFanin1(p1) )
- return 0;
- if ( Dar_ObjFaninC0(p0) == Dar_ObjFaninC0(p1) || Dar_ObjFaninC1(p0) == Dar_ObjFaninC1(p1) )
- return 0;
- *ppFan0 = Dar_ObjChild0(p0);
- *ppFan1 = Dar_ObjChild1(p0);
- return 1;
-}
-
-/**Function*************************************************************
-
- Synopsis [Recognizes what nodes are control and data inputs of a MUX.]
-
- Description [If the node is a MUX, returns the control variable C.
- Assigns nodes T and E to be the then and else variables of the MUX.
- Node C is never complemented. Nodes T and E can be complemented.
- This function also recognizes EXOR/NEXOR gates as MUXes.]
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_ObjRecognizeMux( Dar_Obj_t * pNode, Dar_Obj_t ** ppNodeT, Dar_Obj_t ** ppNodeE )
-{
- Dar_Obj_t * pNode0, * pNode1;
- assert( !Dar_IsComplement(pNode) );
- assert( Dar_ObjIsMuxType(pNode) );
- // get children
- pNode0 = Dar_ObjFanin0(pNode);
- pNode1 = Dar_ObjFanin1(pNode);
-
- // find the control variable
- if ( Dar_ObjFanin1(pNode0) == Dar_ObjFanin1(pNode1) && (Dar_ObjFaninC1(pNode0) ^ Dar_ObjFaninC1(pNode1)) )
- {
-// if ( Fraig_IsComplement(pNode1->p2) )
- if ( Dar_ObjFaninC1(pNode0) )
- { // pNode2->p2 is positive phase of C
- *ppNodeT = Dar_Not(Dar_ObjChild0(pNode1));//pNode2->p1);
- *ppNodeE = Dar_Not(Dar_ObjChild0(pNode0));//pNode1->p1);
- return Dar_ObjChild1(pNode1);//pNode2->p2;
- }
- else
- { // pNode1->p2 is positive phase of C
- *ppNodeT = Dar_Not(Dar_ObjChild0(pNode0));//pNode1->p1);
- *ppNodeE = Dar_Not(Dar_ObjChild0(pNode1));//pNode2->p1);
- return Dar_ObjChild1(pNode0);//pNode1->p2;
- }
- }
- else if ( Dar_ObjFanin0(pNode0) == Dar_ObjFanin0(pNode1) && (Dar_ObjFaninC0(pNode0) ^ Dar_ObjFaninC0(pNode1)) )
- {
-// if ( Fraig_IsComplement(pNode1->p1) )
- if ( Dar_ObjFaninC0(pNode0) )
- { // pNode2->p1 is positive phase of C
- *ppNodeT = Dar_Not(Dar_ObjChild1(pNode1));//pNode2->p2);
- *ppNodeE = Dar_Not(Dar_ObjChild1(pNode0));//pNode1->p2);
- return Dar_ObjChild0(pNode1);//pNode2->p1;
- }
- else
- { // pNode1->p1 is positive phase of C
- *ppNodeT = Dar_Not(Dar_ObjChild1(pNode0));//pNode1->p2);
- *ppNodeE = Dar_Not(Dar_ObjChild1(pNode1));//pNode2->p2);
- return Dar_ObjChild0(pNode0);//pNode1->p1;
- }
- }
- else if ( Dar_ObjFanin0(pNode0) == Dar_ObjFanin1(pNode1) && (Dar_ObjFaninC0(pNode0) ^ Dar_ObjFaninC1(pNode1)) )
- {
-// if ( Fraig_IsComplement(pNode1->p1) )
- if ( Dar_ObjFaninC0(pNode0) )
- { // pNode2->p2 is positive phase of C
- *ppNodeT = Dar_Not(Dar_ObjChild0(pNode1));//pNode2->p1);
- *ppNodeE = Dar_Not(Dar_ObjChild1(pNode0));//pNode1->p2);
- return Dar_ObjChild1(pNode1);//pNode2->p2;
- }
- else
- { // pNode1->p1 is positive phase of C
- *ppNodeT = Dar_Not(Dar_ObjChild1(pNode0));//pNode1->p2);
- *ppNodeE = Dar_Not(Dar_ObjChild0(pNode1));//pNode2->p1);
- return Dar_ObjChild0(pNode0);//pNode1->p1;
- }
- }
- else if ( Dar_ObjFanin1(pNode0) == Dar_ObjFanin0(pNode1) && (Dar_ObjFaninC1(pNode0) ^ Dar_ObjFaninC0(pNode1)) )
- {
-// if ( Fraig_IsComplement(pNode1->p2) )
- if ( Dar_ObjFaninC1(pNode0) )
- { // pNode2->p1 is positive phase of C
- *ppNodeT = Dar_Not(Dar_ObjChild1(pNode1));//pNode2->p2);
- *ppNodeE = Dar_Not(Dar_ObjChild0(pNode0));//pNode1->p1);
- return Dar_ObjChild0(pNode1);//pNode2->p1;
- }
- else
- { // pNode1->p2 is positive phase of C
- *ppNodeT = Dar_Not(Dar_ObjChild0(pNode0));//pNode1->p1);
- *ppNodeE = Dar_Not(Dar_ObjChild1(pNode1));//pNode2->p2);
- return Dar_ObjChild1(pNode0);//pNode1->p2;
- }
- }
- assert( 0 ); // this is not MUX
- return NULL;
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Dar_Obj_t * Dar_ObjReal_rec( Dar_Obj_t * pObj )
-{
- Dar_Obj_t * pObjNew, * pObjR = Dar_Regular(pObj);
- if ( !Dar_ObjIsBuf(pObjR) )
- return pObj;
- pObjNew = Dar_ObjReal_rec( Dar_ObjChild0(pObjR) );
- return Dar_NotCond( pObjNew, Dar_IsComplement(pObj) );
-}
-
-
-/**Function*************************************************************
-
- Synopsis [Prints Eqn formula for the AIG rooted at this node.]
-
- Description [The formula is in terms of PIs, which should have
- their names assigned in pObj->pData fields.]
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ObjPrintEqn( FILE * pFile, Dar_Obj_t * pObj, Vec_Vec_t * vLevels, int Level )
-{
- Vec_Ptr_t * vSuper;
- Dar_Obj_t * pFanin;
- int fCompl, i;
- // store the complemented attribute
- fCompl = Dar_IsComplement(pObj);
- pObj = Dar_Regular(pObj);
- // constant case
- if ( Dar_ObjIsConst1(pObj) )
- {
- fprintf( pFile, "%d", !fCompl );
- return;
- }
- // PI case
- if ( Dar_ObjIsPi(pObj) )
- {
- fprintf( pFile, "%s%s", fCompl? "!" : "", pObj->pData );
- return;
- }
- // AND case
- Vec_VecExpand( vLevels, Level );
- vSuper = Vec_VecEntry(vLevels, Level);
- Dar_ObjCollectMulti( pObj, vSuper );
- fprintf( pFile, "%s", (Level==0? "" : "(") );
- Vec_PtrForEachEntry( vSuper, pFanin, i )
- {
- Dar_ObjPrintEqn( pFile, Dar_NotCond(pFanin, fCompl), vLevels, Level+1 );
- if ( i < Vec_PtrSize(vSuper) - 1 )
- fprintf( pFile, " %s ", fCompl? "+" : "*" );
- }
- fprintf( pFile, "%s", (Level==0? "" : ")") );
- return;
-}
-
-/**Function*************************************************************
-
- Synopsis [Prints Verilog formula for the AIG rooted at this node.]
-
- Description [The formula is in terms of PIs, which should have
- their names assigned in pObj->pData fields.]
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ObjPrintVerilog( FILE * pFile, Dar_Obj_t * pObj, Vec_Vec_t * vLevels, int Level )
-{
- Vec_Ptr_t * vSuper;
- Dar_Obj_t * pFanin, * pFanin0, * pFanin1, * pFaninC;
- int fCompl, i;
- // store the complemented attribute
- fCompl = Dar_IsComplement(pObj);
- pObj = Dar_Regular(pObj);
- // constant case
- if ( Dar_ObjIsConst1(pObj) )
- {
- fprintf( pFile, "1\'b%d", !fCompl );
- return;
- }
- // PI case
- if ( Dar_ObjIsPi(pObj) )
- {
- fprintf( pFile, "%s%s", fCompl? "~" : "", pObj->pData );
- return;
- }
- // EXOR case
- if ( Dar_ObjIsExor(pObj) )
- {
- Vec_VecExpand( vLevels, Level );
- vSuper = Vec_VecEntry( vLevels, Level );
- Dar_ObjCollectMulti( pObj, vSuper );
- fprintf( pFile, "%s", (Level==0? "" : "(") );
- Vec_PtrForEachEntry( vSuper, pFanin, i )
- {
- Dar_ObjPrintVerilog( pFile, Dar_NotCond(pFanin, (fCompl && i==0)), vLevels, Level+1 );
- if ( i < Vec_PtrSize(vSuper) - 1 )
- fprintf( pFile, " ^ " );
- }
- fprintf( pFile, "%s", (Level==0? "" : ")") );
- return;
- }
- // MUX case
- if ( Dar_ObjIsMuxType(pObj) )
- {
- if ( Dar_ObjRecognizeExor( pObj, &pFanin0, &pFanin1 ) )
- {
- fprintf( pFile, "%s", (Level==0? "" : "(") );
- Dar_ObjPrintVerilog( pFile, Dar_NotCond(pFanin0, fCompl), vLevels, Level+1 );
- fprintf( pFile, " ^ " );
- Dar_ObjPrintVerilog( pFile, pFanin1, vLevels, Level+1 );
- fprintf( pFile, "%s", (Level==0? "" : ")") );
- }
- else
- {
- pFaninC = Dar_ObjRecognizeMux( pObj, &pFanin1, &pFanin0 );
- fprintf( pFile, "%s", (Level==0? "" : "(") );
- Dar_ObjPrintVerilog( pFile, pFaninC, vLevels, Level+1 );
- fprintf( pFile, " ? " );
- Dar_ObjPrintVerilog( pFile, Dar_NotCond(pFanin1, fCompl), vLevels, Level+1 );
- fprintf( pFile, " : " );
- Dar_ObjPrintVerilog( pFile, Dar_NotCond(pFanin0, fCompl), vLevels, Level+1 );
- fprintf( pFile, "%s", (Level==0? "" : ")") );
- }
- return;
- }
- // AND case
- Vec_VecExpand( vLevels, Level );
- vSuper = Vec_VecEntry(vLevels, Level);
- Dar_ObjCollectMulti( pObj, vSuper );
- fprintf( pFile, "%s", (Level==0? "" : "(") );
- Vec_PtrForEachEntry( vSuper, pFanin, i )
- {
- Dar_ObjPrintVerilog( pFile, Dar_NotCond(pFanin, fCompl), vLevels, Level+1 );
- if ( i < Vec_PtrSize(vSuper) - 1 )
- fprintf( pFile, " %s ", fCompl? "|" : "&" );
- }
- fprintf( pFile, "%s", (Level==0? "" : ")") );
- return;
-}
-
-
-/**Function*************************************************************
-
- Synopsis [Prints node in HAIG.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ObjPrintVerbose( Dar_Obj_t * pObj, int fHaig )
-{
- assert( !Dar_IsComplement(pObj) );
- printf( "Node %p : ", pObj );
- if ( Dar_ObjIsConst1(pObj) )
- printf( "constant 1" );
- else if ( Dar_ObjIsPi(pObj) )
- printf( "PI" );
- else
- printf( "AND( %p%s, %p%s )",
- Dar_ObjFanin0(pObj), (Dar_ObjFaninC0(pObj)? "\'" : " "),
- Dar_ObjFanin1(pObj), (Dar_ObjFaninC1(pObj)? "\'" : " ") );
- printf( " (refs = %3d)", Dar_ObjRefs(pObj) );
-}
-
-/**Function*************************************************************
-
- Synopsis [Prints node in HAIG.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ManPrintVerbose( Dar_Man_t * p, int fHaig )
-{
- Vec_Ptr_t * vNodes;
- Dar_Obj_t * pObj;
- int i;
- printf( "PIs: " );
- Dar_ManForEachPi( p, pObj, i )
- printf( " %p", pObj );
- printf( "\n" );
- vNodes = Dar_ManDfs( p );
- Vec_PtrForEachEntry( vNodes, pObj, i )
- Dar_ObjPrintVerbose( pObj, fHaig ), printf( "\n" );
- printf( "\n" );
-}
-
-/**Function*************************************************************
-
- Synopsis [Writes the AIG into the BLIF file.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Dar_ManDumpBlif( Dar_Man_t * p, char * pFileName )
-{
- FILE * pFile;
- Vec_Ptr_t * vNodes;
- Dar_Obj_t * pObj, * pConst1 = NULL;
- int i, nDigits, Counter = 0;
- if ( Dar_ManPoNum(p) == 0 )
- {
- printf( "Dar_ManDumpBlif(): AIG manager does not have POs.\n" );
- return;
- }
- // collect nodes in the DFS order
- vNodes = Dar_ManDfs( p );
- // assign IDs to objects
- Dar_ManConst1(p)->pData = (void *)Counter++;
- Dar_ManForEachPi( p, pObj, i )
- pObj->pData = (void *)Counter++;
- Dar_ManForEachPo( p, pObj, i )
- pObj->pData = (void *)Counter++;
- Vec_PtrForEachEntry( vNodes, pObj, i )
- pObj->pData = (void *)Counter++;
- nDigits = Extra_Base10Log( Counter );
- // write the file
- pFile = fopen( pFileName, "w" );
- fprintf( pFile, "# BLIF file written by procedure Dar_ManDumpBlif() in ABC\n" );
- fprintf( pFile, "# http://www.eecs.berkeley.edu/~alanmi/abc/\n" );
- fprintf( pFile, ".model test\n" );
- // write PIs
- fprintf( pFile, ".inputs" );
- Dar_ManForEachPi( p, pObj, i )
- fprintf( pFile, " n%0*d", nDigits, (int)pObj->pData );
- fprintf( pFile, "\n" );
- // write POs
- fprintf( pFile, ".outputs" );
- Dar_ManForEachPo( p, pObj, i )
- fprintf( pFile, " n%0*d", nDigits, (int)pObj->pData );
- fprintf( pFile, "\n" );
- // write nodes
- Vec_PtrForEachEntry( vNodes, pObj, i )
- {
- fprintf( pFile, ".names n%0*d n%0*d n%0*d\n",
- nDigits, (int)Dar_ObjFanin0(pObj)->pData,
- nDigits, (int)Dar_ObjFanin1(pObj)->pData,
- nDigits, (int)pObj->pData );
- fprintf( pFile, "%d%d 1\n", !Dar_ObjFaninC0(pObj), !Dar_ObjFaninC1(pObj) );
- }
- // write POs
- Dar_ManForEachPo( p, pObj, i )
- {
- fprintf( pFile, ".names n%0*d n%0*d\n",
- nDigits, (int)Dar_ObjFanin0(pObj)->pData,
- nDigits, (int)pObj->pData );
- fprintf( pFile, "%d 1\n", !Dar_ObjFaninC0(pObj) );
- if ( Dar_ObjIsConst1(Dar_ObjFanin0(pObj)) )
- pConst1 = Dar_ManConst1(p);
- }
- if ( pConst1 )
- fprintf( pFile, ".names n%0*d\n 1\n", nDigits, (int)pConst1->pData );
- fprintf( pFile, ".end\n\n" );
- fclose( pFile );
- Vec_PtrFree( vNodes );
-}
-
-////////////////////////////////////////////////////////////////////////
-/// END OF FILE ///
-////////////////////////////////////////////////////////////////////////
-
-
diff --git a/src/aig/dar/module.make b/src/aig/dar/module.make
index 4bf473d4..bcf9a2e6 100644
--- a/src/aig/dar/module.make
+++ b/src/aig/dar/module.make
@@ -1,15 +1,7 @@
SRC += src/aig/dar/darBalance.c \
- src/aig/dar/darCheck.c \
src/aig/dar/darCore.c \
src/aig/dar/darCut.c \
src/aig/dar/darData.c \
- src/aig/dar/darDfs.c \
src/aig/dar/darLib.c \
src/aig/dar/darMan.c \
- src/aig/dar/darMem.c \
- src/aig/dar/darObj.c \
- src/aig/dar/darOper.c \
- src/aig/dar/darSeq.c \
- src/aig/dar/darTable.c \
- src/aig/dar/darTruth.c \
- src/aig/dar/darUtil.c
+ src/aig/dar/darTruth.c