55 printf(
"%6d : ", i+1 );
56 memset( pBuffer,
'-', nBits );
62 printf(
"%s\n", pBuffer );
84 int i, k = 0, Lit1, Lit2, LitRes;
112 int s, i1, i2, i3, i4, i5, nBits;
114 assert( kHot >= 1 && kHot <= 5 );
119 for ( i1 = 0; i1 < nStates; i1++ )
127 if ( nBits * (nBits-1) / 2 >= nStates )
131 for ( i1 = 0; i1 < nBits; i1++ )
132 for ( i2 = i1 + 1; i2 < nBits; i2++ )
136 if ( ++s == nStates )
143 if ( nBits * (nBits-1) * (nBits-2) / 6 >= nStates )
147 for ( i1 = 0; i1 < nBits; i1++ )
148 for ( i2 = i1 + 1; i2 < nBits; i2++ )
149 for ( i3 = i2 + 1; i3 < nBits; i3++ )
154 if ( ++s == nStates )
161 if ( nBits * (nBits-1) * (nBits-2) * (nBits-3) / 24 >= nStates )
165 for ( i1 = 0; i1 < nBits; i1++ )
166 for ( i2 = i1 + 1; i2 < nBits; i2++ )
167 for ( i3 = i2 + 1; i3 < nBits; i3++ )
168 for ( i4 = i3 + 1; i4 < nBits; i4++ )
174 if ( ++s == nStates )
181 if ( nBits * (nBits-1) * (nBits-2) * (nBits-3) * (nBits-4) / 120 >= nStates )
185 for ( i1 = 0; i1 < nBits; i1++ )
186 for ( i2 = i1 + 1; i2 < nBits; i2++ )
187 for ( i3 = i2 + 1; i3 < nBits; i3++ )
188 for ( i4 = i3 + 1; i4 < nBits; i4++ )
189 for ( i5 = i4 + 1; i5 < nBits; i5++ )
196 if ( ++s == nStates )
219 Vec_Vec_t * vLitsNext, * vLitsOuts, * vCodes;
220 int i, b, k, nBits, LitC, Lit;
232 for ( i = 0; i < nIns + nBits; i++ )
238 for ( i = 0; i < (1 << nIns); i++ )
240 for ( Lit = 1, b = 0; b < nIns; b++ )
252 assert( b >= 0 && b < nBits );
267 assert( iMint >= 0 && iMint < (1<<nIns) );
268 assert( iCur >= 0 && iCur < nStates );
269 assert( iNext >= 0 && iNext < nStates );
270 assert( iOut >= 0 && iOut < (1<<nOuts) );
279 for ( b = 0; b < nOuts; b++ )
280 if ( (iOut >> b) & 1 )
328 for ( i = 0; i < nIns + nStates; i++ )
334 for ( i = 0; i < (1 << nIns); i++ )
336 for ( Lit = 1, b = 0; b < nIns; b++ )
343 for ( i = 0; i < nStates; i++ )
355 assert( iMint >= 0 && iMint < (1<<nIns) );
356 assert( iCur >= 0 && iCur < nStates );
357 assert( iNext >= 0 && iNext < nStates );
358 assert( iOut >= 0 && iOut < (1<<nOuts) );
366 for ( b = 0; b < nOuts; b++ )
367 if ( (iOut >> b) & 1 )
417 assert( iMint >= 0 && iMint < (1<<nIns) );
418 assert( iCur >= 0 && iCur < nStates );
419 assert( iNext >= 0 && iNext < nStates );
420 assert( iOut >= 0 && iOut < (1<<nOuts) );
422 fprintf( pFile,
" %*d", nDigits,
Vec_IntEntry(vLines, i+1) );
423 fprintf( pFile,
" %*d ", nDigits,
Vec_IntEntry(vLines, i+2) );
425 fprintf( pFile,
"\n" );
445 int Number, nInputs = -1, nOutputs = -1, nStates = 1;
447 if ( !
strcmp(pFileName +
strlen(pFileName) - 3,
"aig") )
449 printf(
"Input file \"%s\" has extension \"%s\".\n", pFileName,
"aig" );
452 pFile = fopen( pFileName,
"rb" );
455 printf(
"Cannot open file \"%s\".\n", pFileName );
459 while ( fgets( pBuffer, 1000, pFile ) != NULL )
461 if ( pBuffer[0] ==
'.' || pBuffer[0] ==
'#' )
464 pToken =
strtok( pBuffer,
" \r\n" );
472 pToken =
strtok( NULL,
" \r\n" );
476 pToken =
strtok( NULL,
" \r\n" );
479 pToken =
strtok( NULL,
" \r\n" );
480 if ( nOutputs == -1 )
481 nOutputs =
strlen(pToken);
512 int nIns, nOuts, nStates;
514 if ( vLines == NULL )
517 p =
Gia_ManStgKHot( vLines, nIns, nOuts, nStates, kHot, fVerbose );
void Gia_ManStop(Gia_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Vec_Vec_t * Gia_ManAssignCodes(int kHot, int nStates, int *pnBits)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
#define Vec_VecForEachLevelInt(vGlob, vVec, i)
static int Gia_ManAppendCi(Gia_Man_t *p)
static int Abc_Var2Lit(int Var, int fCompl)
#define ABC_ALLOC(type, num)
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
static int Abc_MaxInt(int a, int b)
static void Vec_VecFree(Vec_Vec_t *p)
static int Abc_LitNotCond(int Lit, int c)
ABC_NAMESPACE_IMPL_START void Gia_ManPrintStateEncoding(Vec_Vec_t *vCodes, int nBits)
DECLARATIONS ///.
int Gia_ManHasDangling(Gia_Man_t *p)
void Gia_ManStgPrint(FILE *pFile, Vec_Int_t *vLines, int nIns, int nOuts, int nStates)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
static void Vec_VecPushInt(Vec_Vec_t *p, int Level, int Entry)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static int Vec_IntEntry(Vec_Int_t *p, int i)
static int Abc_Base10Log(unsigned n)
#define ABC_NAMESPACE_IMPL_END
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
static void Vec_IntPush(Vec_Int_t *p, int Entry)
int Gia_ManCreateOrGate(Gia_Man_t *p, Vec_Int_t *vLits)
Gia_Man_t * Gia_ManStgRead(char *pFileName, int kHot, int fVerbose)
static Vec_Vec_t * Vec_VecStart(int nSize)
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
static Vec_Int_t * Vec_VecEntryInt(Vec_Vec_t *p, int i)
#define ABC_NAMESPACE_IMPL_START
static int Vec_IntEntryLast(Vec_Int_t *p)
static int Vec_IntSize(Vec_Int_t *p)
Gia_Man_t * Gia_ManStgKHot(Vec_Int_t *vLines, int nIns, int nOuts, int nStates, int kHot, int fVerbose)
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
static int Vec_VecSize(Vec_Vec_t *p)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
static int * Vec_IntEntryP(Vec_Int_t *p, int i)
Gia_Man_t * Gia_ManStgOneHot(Vec_Int_t *vLines, int nIns, int nOuts, int nStates)
void Gia_ManHashAlloc(Gia_Man_t *p)
static void Vec_IntFree(Vec_Int_t *p)
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Vec_Int_t * Gia_ManStgReadLines(char *pFileName, int *pnIns, int *pnOuts, int *pnStates)
char * Abc_UtilStrsav(char *s)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
int Gia_ManHashOr(Gia_Man_t *p, int iLit0, int iLit1)
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
void Gia_ManHashStop(Gia_Man_t *p)