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 );
166 vStr = Vec_StrAlloc( 100 );
167 while ( (c = fgetc(pFile)) != EOF )
168 Vec_StrPush( vStr, (
char)c );
169 Vec_StrPush( vStr,
'\0' );
194 pStr = Vec_StrArray( vStr );
195 pStr =
strstr( pStr, pToken );
199 vMap = Vec_IntAlloc( 100 );
201 for ( i = 0; i < Length; i++ )
203 if ( pStr[i] ==
'0' || pStr[i] ==
'?' )
204 Vec_IntPush( vMap, 0 );
205 else if ( pStr[i] ==
'1' )
206 Vec_IntPush( vMap, 1 );
207 if ( (
'a' <= pStr[i] && pStr[i] <=
'z') ||
208 (
'A' <= pStr[i] && pStr[i] <=
'Z') )
235 pStr = Vec_StrArray( vStr );
236 pStr =
strstr( pStr, pToken );
238 Result = atoi( pStr +
strlen(pToken) );
262 pStr = Vec_StrArray( vStr );
263 pStr =
strstr( pStr, pToken );
266 if (
strncmp(pStr+8,
"proved", 6) == 0 )
268 else if (
strncmp(pStr+8,
"failed", 6) == 0 )
293 vCexNew = Vec_IntAlloc( Vec_IntSize(vCex) );
295 Vec_IntPush( vCexNew, 0 );
299 k = Gia_ManRegNum( pGia );
304 if ( Gia_ObjRefNum(pGia, pObj) == 0 )
305 Vec_IntPush( vCexNew, 0 );
308 if ( k == Vec_IntSize(vCex) )
310 Vec_IntPush( vCexNew, Vec_IntEntry(vCex, k++) );
313 if ( k == Vec_IntSize(vCex) )
330static 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;
368 pStr = Vec_StrArray( vStr );
369 pStr =
strstr( pStr, pToken );
375 while ( *pStr ==
' ' )
378 for ( pEnd = pStr; *pEnd; pEnd++ )
379 if ( *pEnd ==
'\r' || *pEnd ==
'\n' )
385 nBinaryPart = textToBin( pStr,
strlen(pStr) );
389 FILE * pFile = fopen(
"test.aig",
"wb" );
390 fwrite( pStr, 1, nBinaryPart, pFile );
414 char * pFileIn, * pFileOut;
436 if ( pAbc->pGia == NULL )
438 if (argc == 2 &&
strcmp(argv[1],
"-h") == 0)
441 vCommand = Vec_StrAlloc( 100 );
443 Vec_StrAppend( vCommand,
" -abc " );
444 Vec_StrAppend( vCommand, argv[0] );
445 Vec_StrAppend( vCommand,
" -h" );
446 Vec_StrPush( vCommand, 0 );
448 Vec_StrFree( vCommand );
452 Abc_Print( -1,
"Current AIG does not exist (try command &ps).\n" );
461 Abc_Print( -1,
"Cannot create a temporary file.\n" );
475 Abc_Print( -1,
"Cannot create a temporary file.\n" );
497 if (
strcmp( argv[argc-1],
"!" ) == 0 )
499 Abc_Print( 0,
"Input file \"%s\" and output file \"%s\" are not deleted.\n", pFileIn, pFileOut );
508 vCommand = Vec_StrAlloc( 100 );
511 Vec_StrAppend( vCommand,
" -abc" );
513 Vec_StrAppend( vCommand,
" -input=" );
514 Vec_StrAppend( vCommand, pFileIn );
515 Vec_StrAppend( vCommand,
" -output=" );
516 Vec_StrAppend( vCommand, pFileOut );
518 for ( i = 0; i < argc; i++ )
520 Vec_StrAppend( vCommand,
" " );
521 Vec_StrAppend( vCommand, argv[i] );
523 Vec_StrPush( vCommand, 0 );
531 Abc_Print( -1,
"The following command has returned non-zero exit status:\n" );
532 Abc_Print( -1,
"\"%s\"\n", Vec_StrArray(vCommand) );
535 clk = Abc_Clock() - clk;
536 Vec_StrFree( vCommand );
539 if ( (pFile = fopen( pFileOut,
"r" )) == NULL )
541 Abc_Print( -1,
"There is no output file \"%s\".\n", pFileOut );
559 int nFrames, nRemain;
561 nFrames = (Vec_IntSize(vCex) - Gia_ManRegNum(pAbc->pGia)) / Gia_ManPiNum(pAbc->pGia);
562 nRemain = (Vec_IntSize(vCex) - Gia_ManRegNum(pAbc->pGia)) % Gia_ManPiNum(pAbc->pGia);
566 Abc_Print( 1,
"Adjusting counter-example by adding zeros for PIs without fanout.\n" );
569 Vec_IntFree( vTemp );
572 nFrames = (Vec_IntSize(vCex) - Gia_ManRegNum(pAbc->pGia)) / Gia_ManPiNum(pAbc->pGia);
573 nRemain = (Vec_IntSize(vCex) - Gia_ManRegNum(pAbc->pGia)) % Gia_ManPiNum(pAbc->pGia);
575 Abc_Print( 1,
"Counter example has a wrong length.\n" );
578 Abc_Print( 1,
"Problem is satisfiable. Found counter-example in frame %d. ", nFrames-1 );
579 Abc_PrintTime( 1,
"Time", clk );
581 pAbc->pCex =
Abc_CexCreate( Gia_ManRegNum(pAbc->pGia), Gia_ManPiNum(pAbc->pGia), Vec_IntArray(vCex), nFrames-1, 0, 0 );
590 if ( pAbc->pCex->iPo == -1 )
592 Abc_Print( 1,
"Generated counter-example is INVALID.\n" );
597 Abc_Print( 1,
"Returned counter-example successfully verified in ABC.\n" );
600 Vec_IntFreeP( &vCex );
634 int fd = -1, RetValue = -1, c;
636 char * pStrDirBin = NULL, * pStrSection = NULL;
638 char * pTempFile = NULL;
664 pStrDirBin = argv[argc-2];
665 pStrSection = argv[argc-1];
670 FILE* pFile = fopen( pStrDirBin,
"r" );
674 Abc_Print(
ABC_ERROR,
"Cannot run the binary \"%s\". File does not exist.\n", pStrDirBin );
686 Abc_Print(
ABC_ERROR,
"Cannot create a temporary file.\n" );
697 sCommandLine = Vec_StrAlloc(1000);
699 Vec_StrPrintF(sCommandLine,
"%s -abc -list-commands > %s", pStrDirBin, pTempFile );
700 Vec_StrPush(sCommandLine,
'\0');
704 Abc_Print(
ABC_VERBOSE,
"Running command %s\n", Vec_StrArray(sCommandLine));
711 Abc_Print(
ABC_ERROR,
"Command \"%s\" failed.\n", Vec_StrArray(sCommandLine) );
716 pFile = fopen( pTempFile,
"r" );
720 Abc_Print( -1,
"Cannot open file with the list of commands.\n" );
726 while ( fgets( pBuffer, 1000, pFile ) != NULL )
728 if ( pBuffer[
strlen(pBuffer)-1] ==
'\n' )
729 pBuffer[
strlen(pBuffer)-1] = 0;
738 Abc_Print(
ABC_VERBOSE,
"Creating command %s with binary %s\n", pBuffer, pStrDirBin);
750 Vec_StrFreeP(&sCommandLine);
758 Abc_Print( -2,
"usage: load_plugin [-pvh] <plugin_dir\\binary_name> <section_name>\n" );
759 Abc_Print( -2,
"\t loads external binary as a plugin\n" );
760 Abc_Print( -2,
"\t-p : toggle searching the command in PATH [default = %s].\n", fPath?
"yes":
"no" );
761 Abc_Print( -2,
"\t-v : enable verbose output [default = %s].\n", fVerbose?
"yes":
"no" );
762 Abc_Print( -2,
"\t-h : print the command usage\n");
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
struct Vec_Str_t_ Vec_Str_t
Vec_Int_t * Abc_ManExpandCex(Gia_Man_t *pGia, Vec_Int_t *vCex)
int Abc_ManReadInteger(char *pFileName, char *pToken)
int Abc_ManReadStatus(char *pFileName, char *pToken)
int Cmd_CommandAbcLoadPlugIn(Abc_Frame_t *pAbc, int argc, char **argv)
Vec_Int_t * Abc_ManReadBinary(char *pFileName, char *pToken)
Vec_Str_t * Abc_ManReadFile(char *pFileName)
Gia_Man_t * Abc_ManReadAig(char *pFileName, char *pToken)
int Cmd_CommandAbcPlugIn(Abc_Frame_t *pAbc, int argc, char **argv)
ABC_NAMESPACE_IMPL_START char * Abc_GetBinaryName(Abc_Frame_t *pAbc, int argc, char **argv)
DECLARATIONS ///.
void Cmd_CommandAdd(Abc_Frame_t *pAbc, const char *sGroup, const char *sName, Cmd_CommandFuncType pFunc, int fChanges)
#define Gia_ManForEachRo(p, pObj, i)
int Gia_ManFindFailedPoCex(Gia_Man_t *pAig, Abc_Cex_t *p, int nOutputs)
void Gia_ManStopP(Gia_Man_t **p)
#define Gia_ManForEachPi(p, pObj, i)
struct Gia_Obj_t_ Gia_Obj_t
Gia_Man_t * Gia_AigerReadFromMemory(char *pContents, int nFileSize, int fGiaSimple, int fSkipStrash, int fCheck)
struct Gia_Man_t_ Gia_Man_t
void Gia_ManCreateRefs(Gia_Man_t *p)
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact, int fWriteNewLine)
Abc_Cex_t * Abc_CexCreate(int nRegs, int nPis, int *pArray, int iFrame, int iPo, int fSkipRegs)
ABC_NAMESPACE_IMPL_START int Util_SignalSystem(const char *cmd)
DECLARATIONS ///.
void Util_SignalTmpFileRemove(const char *fname, int fLeave)
int Util_SignalTmpFile(const char *prefix, const char *suffix, char **out_name)
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.