21 #ifndef MINI_AIG__mini_aig_h
22 #define MINI_AIG__mini_aig_h
37 #define MINI_AIG_NULL (0x7FFFFFFF)
38 #define MINI_AIG_START_SIZE (0x000000FF)
58 #define MINI_AIG_ALLOC(type, num) ((type *) malloc(sizeof(type) * (num)))
59 #define MINI_AIG_CALLOC(type, num) ((type *) calloc((num), sizeof(type)))
60 #define MINI_AIG_FALLOC(type, num) ((type *) memset(malloc(sizeof(type) * (num)), 0xff, sizeof(type) * (num)))
61 #define MINI_AIG_FREE(obj) ((obj) ? (free((char *) (obj)), (obj) = 0) : 0)
62 #define MINI_AIG_REALLOC(type, obj, num) \
63 ((obj) ? ((type *) realloc((char *)(obj), sizeof(type) * (num))) : \
64 ((type *) malloc(sizeof(type) * (num))))
69 if ( p->
nCap >= nCapMin )
91 assert( Id >= 0 && 2*Id < p->nSize );
96 assert( Id >= 0 && 2*Id < p->nSize );
125 #define Mini_AigForEachPi( p, i ) for (i = 1; i < Mini_AigNodeNum(p); i++) if ( !Mini_AigNodeIsPi(p, i) ) {} else
126 #define Mini_AigForEachPo( p, i ) for (i = 1; i < Mini_AigNodeNum(p); i++) if ( !Mini_AigNodeIsPo(p, i) ) {} else
127 #define Mini_AigForEachAnd( p, i ) for (i = 1; i < Mini_AigNodeNum(p); i++) if ( !Mini_AigNodeIsAnd(p, i) ) {} else
147 int i, nPis, nPos, nNodes;
157 printf(
"PI = %d. PO = %d. Node = %d.\n", nPis, nPos, nNodes );
165 pFile = fopen( pFileName,
"wb" );
168 printf(
"Cannot open file for writing \"%s\".\n", pFileName );
171 RetValue = fwrite( &p->
nSize,
sizeof(
int), 1, pFile );
172 RetValue = fwrite( &p->
nRegs,
sizeof(
int), 1, pFile );
173 RetValue = fwrite( p->
pArray,
sizeof(
int), p->
nSize, pFile );
181 pFile = fopen( pFileName,
"rb" );
184 printf(
"Cannot open file for reading \"%s\".\n", pFileName );
187 RetValue = fread( &nSize,
sizeof(
int), 1, pFile );
191 RetValue = fread( &p->
nRegs,
sizeof(
int), 1, pFile );
192 RetValue = fread( p->
pArray,
sizeof(
int), p->
nSize, pFile );
209 assert( Lit0 >= 0 && Lit0 < Lit );
218 assert( Lit0 >= 0 && Lit0 < Lit );
219 assert( Lit1 >= 0 && Lit1 < Lit );
242 int i, iFaninLit0, iFaninLit1;
249 if ( iFaninLit0 >= 2 * i )
250 printf(
"Fanin0 of AND node %d is not in a topological order.\n", i ), status = 0;
251 if ( iFaninLit1 >= 2 * i )
252 printf(
"Fanin0 of AND node %d is not in a topological order.\n", i ), status = 0;
259 if ( iFaninLit0 >= 2 * i )
260 printf(
"Fanin0 of PO node %d is not in a topological order.\n", i ), status = 0;
static int Mini_AigLitIsConst(int Lit)
static void Mini_AigSetRegNum(Mini_Aig_t *p, int n)
static int Mini_AigLitConst1()
#define MINI_AIG_REALLOC(type, obj, num)
static int Mini_AigLitIsConst0(int Lit)
static int Mini_AigVar2Lit(int Var, int fCompl)
static int Mini_AigNodeIsConst(Mini_Aig_t *p, int Id)
static Mini_Aig_t * Mini_AigStart()
static int Mini_AigNodeIsPi(Mini_Aig_t *p, int Id)
static void Mini_AigGrow(Mini_Aig_t *p, int nCapMin)
static int Mini_AigLitConst0()
static int Mini_AigCreatePo(Mini_Aig_t *p, int Lit0)
static int Mini_AigCreatePi(Mini_Aig_t *p)
#define MINI_AIG_ALLOC(type, num)
MACRO DEFINITIONS ///.
static int Mini_AigRegNum(Mini_Aig_t *p)
static int Mini_AigNodeIsPo(Mini_Aig_t *p, int Id)
#define Mini_AigForEachPo(p, i)
static int Mini_AigNodeFanin0(Mini_Aig_t *p, int Id)
static int Mini_AigNodeFanin1(Mini_Aig_t *p, int Id)
static Mini_Aig_t * Mini_AigLoad(char *pFileName)
#define Mini_AigForEachPi(p, i)
static void Mini_AigStop(Mini_Aig_t *p)
#define Mini_AigForEachAnd(p, i)
static int Mini_AigAnd(Mini_Aig_t *p, int Lit0, int Lit1)
static int Mini_AigLitIsCompl(int Lit)
static int Mini_AigNodeIsAnd(Mini_Aig_t *p, int Id)
#define MINI_AIG_CALLOC(type, num)
static void Mini_AigPrintStats(Mini_Aig_t *p)
static int Mini_AigLitNot(int Lit)
#define MINI_AIG_FREE(obj)
static int Mini_AigLitIsConst1(int Lit)
static int Mini_AigNodeNum(Mini_Aig_t *p)
static int Mini_AigLit2Var(int Lit)
static void Mini_AigDump(Mini_Aig_t *p, char *pFileName)
static int Mini_AigOr(Mini_Aig_t *p, int Lit0, int Lit1)
static int Mini_AigCheck(Mini_Aig_t *p)
static int Mini_AigMux(Mini_Aig_t *p, int LitC, int Lit1, int Lit0)
static int Mini_AigLitRegular(int Lit)
static int Mini_AigXor(Mini_Aig_t *p, int Lit0, int Lit1)
static void Mini_AigPush(Mini_Aig_t *p, int Lit0, int Lit1)
#define MINI_AIG_NULL
INCLUDES ///.
static int Mini_AigLitNotCond(int Lit, int c)
#define MINI_AIG_START_SIZE