25 #if defined(LIN) || defined(LIN64)
37 #define BRIDGE_TEXT_MESSAGE 999996
39 #define BRIDGE_ABORT 5
40 #define BRIDGE_PROGRESS 3
41 #define BRIDGE_RESULTS 101
42 #define BRIDGE_BAD_ABS 105
46 #define BRIDGE_VALUE_X 0
47 #define BRIDGE_VALUE_0 2
48 #define BRIDGE_VALUE_1 3
70 int i, uLit0, uLit1, nNodes;
129 fprintf( pFile,
"%.6d", Type );
130 fprintf( pFile,
" " );
131 fprintf( pFile,
"%.16d", Size );
132 fprintf( pFile,
" " );
133 #if !defined(LIN) && !defined(LIN64)
136 RetValue = fwrite( pBuffer, Size, 1, pFile );
137 assert( RetValue == 1 || Size == 0);
142 int fd = fileno(pFile);
144 ssize_t bytes_written = 0;
145 while (bytes_written < Size){
146 ssize_t n = write(fd, &pBuffer[bytes_written], Size - bytes_written);
148 fprintf(stderr,
"BridgeMode: failed to send package; aborting\n"); fflush(stderr);
231 fprintf( pFile,
"%.6d", 101 );
232 fprintf( pFile,
" " );
234 fprintf( pFile,
" " );
237 fputc( (
char)1, pFile );
239 fputc( (
char)0, pFile );
244 fprintf( pFile,
"%.6d", 101 );
245 fprintf( pFile,
" " );
246 fprintf( pFile,
"%.16d", 2 +
aigerNumSize(iPoUnknown) );
247 fprintf( pFile,
" " );
250 fputc( (
char)1, pFile );
267 for ( f = 0; f <= pCex->iFrame; f++ )
270 for ( i = 0; i < pCex->nPis; i++, iBit++ )
273 assert( iBit == pCex->nBits );
276 for ( i = 0; i < pCex->nRegs; i++ )
288 else if ( Result == 1 )
290 else if ( Result == -1 )
313 unsigned char * pBufferPivot, * pBufferEnd = pBuffer + Size;
314 int i, nInputs, nFlops, nGates, nProps;
315 unsigned iFan0, iFan1;
326 p =
Gia_ManStart( nInputs + nFlops * 2 + nGates + 1 + 1 );
330 for ( i = 0; i < nInputs; i++ )
334 for ( i = 0; i < nFlops; i++ )
340 for ( i = 0; i < nGates; i++ )
358 pBufferPivot = pBuffer;
360 for ( i = 0; i < nFlops; i++ )
366 for ( i = 0; i < nProps; i++ )
374 assert( pBufferEnd == pBuffer );
377 pBuffer = pBufferPivot;
379 for ( i = 0; i < nFlops; i++ )
423 RetValue = fread( Temp, 24, 1, pFile );
426 printf(
"Gia_ManFromBridgeReadPackage(); Error 1: Something is wrong!\n" );
432 *pType = atoi( Temp );
433 *pSize = atoi( Temp + 7 );
435 *ppBuffer =
ABC_ALLOC(
unsigned char, *pSize );
436 RetValue = fread( *ppBuffer, *pSize, 1, pFile );
437 if ( RetValue != 1 && *pSize != 0 )
440 printf(
"Gia_ManFromBridgeReadPackage(); Error 2: Something is wrong!\n" );
459 unsigned char * pBuffer;
460 int Type, Size, RetValue;
505 FILE * pFile = fopen( pFileName,
"wb" );
508 printf(
"Cannot open output file \"%s\".\n", pFileName );
529 FILE * pFile = fopen( pFileName,
"rb" );
532 printf(
"Cannot open input file \"%s\".\n", pFileName );
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
static int aigerNumSize(unsigned x)
int Gia_ManToBridgeResult(FILE *pFile, int Result, Abc_Cex_t *pCex, int iPoProved)
DECLARATIONS ///.
void Gia_ManStop(Gia_Man_t *p)
void Gia_CreateHeader(FILE *pFile, int Type, int Size, unsigned char *pBuffer)
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
static int Gia_ManPoNum(Gia_Man_t *p)
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
static char * Vec_StrArray(Vec_Str_t *p)
static int Abc_InfoHasBit(unsigned *p, int i)
static int Gia_ManAppendCi(Gia_Man_t *p)
Gia_Man_t * Gia_ManFromBridgeReadBody(int Size, unsigned char *pBuffer, Vec_Int_t **pvInits)
static int Abc_Var2Lit(int Var, int fCompl)
void Gia_ManFromBridgeUnknown(FILE *pFile, int iPoUnknown)
int Gia_ManToBridgeBadAbs(FILE *pFile)
#define ABC_ALLOC(type, num)
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
static Vec_Str_t * Vec_StrAlloc(int nCap)
static void Gia_AigerWriteUnsigned(Vec_Str_t *vStr, unsigned x)
static void Vec_StrPush(Vec_Str_t *p, char Entry)
void Gia_ManToBridgeAbsNetlistTest(char *pFileName, Gia_Man_t *p, int msg_type)
static int Abc_LitNotCond(int Lit, int c)
#define BRIDGE_TEXT_MESSAGE
DECLARATIONS ///.
#define Gia_ManForEachCi(p, pObj, i)
static int Gia_ManAndNum(Gia_Man_t *p)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
int Gia_ManFromBridgeReadPackage(FILE *pFile, int *pType, int *pSize, unsigned char **ppBuffer)
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
static void Vec_StrFree(Vec_Str_t *p)
static int Vec_IntEntry(Vec_Int_t *p, int i)
#define ABC_NAMESPACE_IMPL_END
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
#define Gia_ManForEachAnd(p, pObj, i)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact)
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
#define ABC_NAMESPACE_IMPL_START
static int Vec_StrSize(Vec_Str_t *p)
Vec_Str_t * Gia_ManToBridgeVec(Gia_Man_t *p)
FUNCTION DEFINITIONS ///.
static int Abc_LitNot(int Lit)
int Gia_ManToBridgeAbsNetlist(FILE *pFile, void *p, int pkg_type)
void Gia_ManFromBridgeTest(char *pFileName)
int Gia_ManToBridgeProgress(FILE *pFile, int Size, unsigned char *pBuffer)
int Gia_ManToBridgeAbort(FILE *pFile, int Size, unsigned char *pBuffer)
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Gia_Man_t * Gia_ManFromBridge(FILE *pFile, Vec_Int_t **pvInit)
static void Gia_AigerWriteUnsignedFile(FILE *pFile, unsigned x)
#define BRIDGE_ABS_NETLIST
void Gia_ManFromBridgeHolds(FILE *pFile, int iPoProved)
static unsigned Gia_AigerReadUnsigned(unsigned char **ppPos)
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
#define Gia_ManForEachRi(p, pObj, i)
void Gia_ManHashAlloc(Gia_Man_t *p)
static void Vec_IntFree(Vec_Int_t *p)
static int Gia_ManPiNum(Gia_Man_t *p)
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
char * Abc_UtilStrsav(char *s)
#define Gia_ManForEachPo(p, pObj, i)
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
void Gia_ManFromBridgeCex(FILE *pFile, Abc_Cex_t *pCex)
int Gia_ManToBridgeText(FILE *pFile, int Size, unsigned char *pBuffer)
void Gia_ManHashStop(Gia_Man_t *p)
static int Gia_ManRegNum(Gia_Man_t *p)