/**Function************************************************************* Synopsis [Create the mapping manager.] Description [The number of inputs and outputs is assumed to be known is advance. It is much simpler to have them fixed upfront. When it comes to representing the object graph in the form of AIG, the resulting manager is similar to the regular AIG manager, except that it does not use reference counting (and therefore does not have garbage collections). It does have table resizing. The data structure is more flexible to represent additional information needed for mapping.] SideEffects [] SeeAlso [] ***********************************************************************/ Map_Man_t * Map_ManCreate( int nInputs, int nOutputs, int fVerbose ) { Map_Man_t * p; int i; // derive the supergate library if ( Abc_FrameReadLibSuper() == NULL ) { printf( "The supergate library is not specified. Use \"read_super\".\n" ); return NULL; } // start the manager p = ABC_ALLOC( Map_Man_t, 1 ); memset( p, 0, sizeof(Map_Man_t) ); p->pSuperLib = (Map_SuperLib_t *)Abc_FrameReadLibSuper(); p->nVarsMax = p->pSuperLib->nVarsMax; p->fVerbose = fVerbose; p->fEpsilon = (float)0.001; assert( p->nVarsMax > 0 ); if ( p->nVarsMax == 5 ) Extra_Truth4VarN( &p->uCanons, &p->uPhases, &p->pCounters, 8 ); // start various data structures Map_TableCreate( p ); Map_MappingSetupTruthTables( p->uTruths ); Map_MappingSetupTruthTablesLarge( p->uTruthsLarge ); // printf( "Node = %d bytes. Cut = %d bytes. Super = %d bytes.\n", sizeof(Map_Node_t), sizeof(Map_Cut_t), sizeof(Map_Super_t) ); p->mmNodes = Extra_MmFixedStart( sizeof(Map_Node_t) ); p->mmCuts = Extra_MmFixedStart( sizeof(Map_Cut_t) ); // make sure the constant node will get index -1 p->nNodes = -1; // create the constant node p->pConst1 = Map_NodeCreate( p, NULL, NULL ); p->vNodesAll = Map_NodeVecAlloc( 100 ); p->vNodesTemp = Map_NodeVecAlloc( 100 ); p->vMapping = Map_NodeVecAlloc( 100 ); p->vVisited = Map_NodeVecAlloc( 100 ); // create the PI nodes p->nInputs = nInputs; p->pInputs = ABC_ALLOC( Map_Node_t *, nInputs ); for ( i = 0; i < nInputs; i++ ) p->pInputs[i] = Map_NodeCreate( p, NULL, NULL ); // create the place for the output nodes p->nOutputs = nOutputs; p->pOutputs = ABC_ALLOC( Map_Node_t *, nOutputs ); memset( p->pOutputs, 0, sizeof(Map_Node_t *) * nOutputs ); return p; }
/**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Map_Var4Test() { extern void Extra_Truth4VarN( unsigned short ** puCanons, char *** puPhases, char ** ppCounters, int PhaseMax ); unsigned short * uCanons; char ** uPhases; char * pCounters; int i; unsigned * ptRes; char * pfRes; unsigned uTruth; int Count; Extra_Truth4VarN( &uCanons, &uPhases, &pCounters, 16 ); for ( i = 0; i < 256*256; i++ ) { uTruth = i; Count = Extra_TruthCanonFastN( 5, 4, &uTruth, &ptRes, &pfRes ); } }