137 if (
strcmp( pTemp, argv[0] ) == 0 )
138 return (
char *)
Vec_PtrEntry( pAbc->vPlugInComBinPairs, i );
160 pFile = fopen( pFileName,
"r" );
163 printf(
"Cannot open file \"%s\".\n", pFileName );
167 while ( (c = fgetc(pFile)) != EOF )
195 pStr =
strstr( pStr, pToken );
201 for ( i = 0; i < Length; i++ )
203 if ( pStr[i] ==
'0' || pStr[i] ==
'?' )
205 else if ( pStr[i] ==
'1' )
207 if ( (
'a' <= pStr[i] && pStr[i] <=
'z') ||
208 (
'A' <= pStr[i] && pStr[i] <=
'Z') )
236 pStr =
strstr( pStr, pToken );
238 Result = atoi( pStr +
strlen(pToken) );
263 pStr =
strstr( pStr, pToken );
266 if (
strncmp(pStr+8,
"proved", 6) == 0 )
268 else if (
strncmp(pStr+8,
"failed", 6) == 0 )
330 static unsigned textToBin(
char* text,
unsigned long text_sz)
333 const char* src = text;
335 sscanf(src,
"%u ", &sz);
336 while(*src++ !=
' ');
337 for ( i = 0; i < sz; i += 3 )
339 dst[0] = (char)( (
unsigned)src[0] -
'0') | (((
unsigned)src[1] -
'0') << 6);
340 dst[1] = (char)(((
unsigned)src[1] -
'0') >> 2) | (((unsigned)src[2] -
'0') << 4);
341 dst[2] = (char)(((
unsigned)src[2] -
'0') >> 4) | (((unsigned)src[3] -
'0') << 2);
362 unsigned nBinaryPart;
369 pStr =
strstr( pStr, pToken );
375 while ( *pStr ==
' ' )
378 for ( pEnd = pStr; *pEnd; pEnd++ )
379 if ( *pEnd ==
'\r' || *pEnd ==
'\n' )
389 FILE * pFile = fopen(
"test.aig",
"wb" );
390 fwrite( pStr, 1, nBinaryPart, pFile );
414 char * pFileIn, * pFileOut;
415 char * pFileNameBinary;
437 if ( pAbc->pGia == NULL )
439 if (argc == 2 &&
strcmp(argv[1],
"-h") == 0)
454 Abc_Print( -1,
"Current AIG does not exist (try command &ps).\n" );
461 if ( (pFile = fopen( pFileNameBinary,
"r" )) == NULL )
463 Abc_Print( -1,
"Cannot run the binary \"%s\".\n\n", pFileNameBinary );
472 Abc_Print( -1,
"Cannot create a temporary file.\n" );
486 Abc_Print( -1,
"Cannot create a temporary file.\n" );
508 if (
strcmp( argv[argc-1],
"!" ) == 0 )
510 Abc_Print( 0,
"Input file \"%s\" and output file \"%s\" are not deleted.\n", pFileIn, pFileOut );
529 for ( i = 0; i < argc; i++ )
542 Abc_Print( -1,
"The following command has returned non-zero exit status:\n" );
550 if ( (pFile = fopen( pFileOut,
"r" )) == NULL )
552 Abc_Print( -1,
"There is no output file \"%s\".\n", pFileOut );
570 int nFrames, nRemain;
577 Abc_Print( 1,
"Adjusting counter-example by adding zeros for PIs without fanout.\n" );
586 Abc_Print( 1,
"Counter example has a wrong length.\n" );
589 Abc_Print( 1,
"Problem is satisfiable. Found counter-example in frame %d. ", nFrames-1 );
601 if ( pAbc->pCex->iPo == -1 )
603 Abc_Print( 1,
"Generated counter-example is INVALID.\n" );
608 Abc_Print( 1,
"Returned counter-example successfully verified in ABC.\n" );
648 char * pStrDirBin, * pStrSection;
653 Abc_Print( -1,
"Wrong number of arguments.\n" );
657 pStrDirBin = argv[argc-2];
658 pStrSection = argv[argc-1];
661 if ( (pFile = fopen( pStrDirBin,
"r" )) == NULL )
673 Abc_Print( -1,
"Cannot create a temporary file.\n" );
685 sprintf( pCommandLine,
"%s -abc -list-commands > %s", pStrDirBin, pTempFile );
687 if ( RetValue == -1 )
689 Abc_Print( -1,
"Command \"%s\" did not succeed.\n", pCommandLine );
697 pFile = fopen( pTempFile,
"r" );
700 Abc_Print( -1,
"Cannot open file with the list of commands.\n" );
704 while ( fgets( pBuffer, 1000, pFile ) != NULL )
706 if ( pBuffer[
strlen(pBuffer)-1] ==
'\n' )
707 pBuffer[
strlen(pBuffer)-1] = 0;
719 Abc_Print( -2,
"usage: load_plugin <plugin_dir\\binary_name> <section_name>\n" );
720 Abc_Print( -2,
"\t loads external binary as a plugin\n" );
721 Abc_Print( -2,
"\t-h : print the command usage\n");
static int * Vec_IntArray(Vec_Int_t *p)
void Gia_ManCreateRefs(Gia_Man_t *p)
int Util_SignalTmpFile(const char *prefix, const char *suffix, char **out_name)
INCLUDES ///.
int Cmd_CommandAbcLoadPlugIn(Abc_Frame_t *pAbc, int argc, char **argv)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
static char * Vec_StrArray(Vec_Str_t *p)
Gia_Man_t * Gia_AigerReadFromMemory(char *pContents, int nFileSize, int fSkipStrash, int fCheck)
Gia_Man_t * Abc_ManReadAig(char *pFileName, char *pToken)
int Cmd_CommandAbcPlugIn(Abc_Frame_t *pAbc, int argc, char **argv)
int Abc_ManReadStatus(char *pFileName, char *pToken)
static int Gia_ObjRefNum(Gia_Man_t *p, Gia_Obj_t *pObj)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
void Cmd_CommandAdd(Abc_Frame_t *pAbc, const char *sGroup, const char *sName, Cmd_CommandFuncType pFunc, int fChanges)
#define ABC_ALLOC(type, num)
static Vec_Str_t * Vec_StrAlloc(int nCap)
static abctime Abc_Clock()
static void Vec_StrPush(Vec_Str_t *p, char Entry)
int Gia_ManFindFailedPoCex(Gia_Man_t *pAig, Abc_Cex_t *p, int nOutputs)
void Gia_ManStopP(Gia_Man_t **p)
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Vec_Str_t * Abc_ManReadFile(char *pFileName)
static unsigned textToBin(char *text, unsigned long text_sz)
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
Vec_Int_t * Abc_ManReadBinary(char *pFileName, char *pToken)
static void Vec_StrAppend(Vec_Str_t *p, const char *pString)
Vec_Int_t * Abc_ManExpandCex(Gia_Man_t *pGia, Vec_Int_t *vCex)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
void Util_SignalTmpFileRemove(const char *fname, int fLeave)
static void Vec_StrFree(Vec_Str_t *p)
static int Vec_IntEntry(Vec_Int_t *p, int i)
#define ABC_NAMESPACE_IMPL_END
static void Vec_IntPush(Vec_Int_t *p, int Entry)
static void Vec_IntFreeP(Vec_Int_t **p)
int Abc_ManReadInteger(char *pFileName, char *pToken)
#define Gia_ManForEachPi(p, pObj, i)
static void Abc_Print(int level, const char *format,...)
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact)
#define ABC_NAMESPACE_IMPL_START
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static int Vec_IntSize(Vec_Int_t *p)
#define Gia_ManForEachRo(p, pObj, i)
ABC_NAMESPACE_IMPL_START int Util_SignalSystem(const char *cmd)
DECLARATIONS ///.
ABC_NAMESPACE_IMPL_START char * Abc_GetBinaryName(Abc_Frame_t *pAbc, int argc, char **argv)
DECLARATIONS ///.
static void Vec_IntFree(Vec_Int_t *p)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
static int Gia_ManPiNum(Gia_Man_t *p)
Abc_Cex_t * Abc_CexCreate(int nRegs, int nPis, int *pArray, int iFrame, int iPo, int fSkipRegs)
static int Gia_ManRegNum(Gia_Man_t *p)