Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
2eebfc2e
Commit
2eebfc2e
authored
Nov 19, 2019
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dumping multiple counter-examples.
parent
f2702aee
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
134 additions
and
99 deletions
+134
-99
src/base/io/io.c
+134
-99
No files found.
src/base/io/io.c
View file @
2eebfc2e
...
...
@@ -2326,107 +2326,12 @@ int Abc_NtkCheckSpecialPi( Abc_Ntk_t * pNtk )
SeeAlso []
***********************************************************************/
int
IoCommandWriteCex
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
void
Abc_NtkDumpOneCex
(
FILE
*
pFile
,
Abc_Ntk_t
*
pNtk
,
Abc_Cex_t
*
pCex
,
int
fPrintFull
,
int
fNames
,
int
fUseFfNames
,
int
fMinimize
,
int
fUseOldMin
,
int
fCheckCex
,
int
fUseSatBased
,
int
fHighEffort
,
int
fAiger
,
int
fVerbose
)
{
Abc_Ntk_t
*
pNtk
;
char
*
pFileName
;
int
c
,
fNames
=
0
;
int
fMinimize
=
0
;
int
fUseSatBased
=
0
;
int
fHighEffort
=
0
;
int
fUseOldMin
=
0
;
int
fCheckCex
=
0
;
int
forceSeq
=
0
;
int
fAiger
=
0
;
int
fPrintFull
=
0
;
int
fUseFfNames
=
0
;
int
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"snmueocafzvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
's'
:
forceSeq
^=
1
;
break
;
case
'n'
:
fNames
^=
1
;
break
;
case
'm'
:
fMinimize
^=
1
;
break
;
case
'u'
:
fUseSatBased
^=
1
;
break
;
case
'e'
:
fHighEffort
^=
1
;
break
;
case
'o'
:
fUseOldMin
^=
1
;
break
;
case
'c'
:
fCheckCex
^=
1
;
break
;
case
'a'
:
fAiger
^=
1
;
break
;
case
'f'
:
fPrintFull
^=
1
;
break
;
case
'z'
:
fUseFfNames
^=
1
;
break
;
case
'v'
:
fVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
default
:
goto
usage
;
}
}
pNtk
=
pAbc
->
pNtkCur
;
if
(
pNtk
==
NULL
)
{
fprintf
(
pAbc
->
Out
,
"Empty network.
\n
"
);
return
0
;
}
if
(
pNtk
->
pModel
==
NULL
&&
pAbc
->
pCex
==
NULL
)
{
fprintf
(
pAbc
->
Out
,
"Counter-example is not available.
\n
"
);
return
0
;
}
if
(
argc
!=
globalUtilOptind
+
1
)
{
printf
(
"File name is missing on the command line.
\n
"
);
goto
usage
;
}
// get the input file name
pFileName
=
argv
[
globalUtilOptind
];
// write the counter-example into the file
if
(
pAbc
->
pCex
)
{
Abc_Cex_t
*
pCex
=
pAbc
->
pCex
;
Abc_Obj_t
*
pObj
;
FILE
*
pFile
;
int
i
,
f
;
/*
Abc_NtkForEachLatch( pNtk, pObj, i )
if ( !Abc_LatchIsInit0(pObj) )
{
fprintf( stdout, "IoCommandWriteCex(): The init-state should be all-0 for counter-example to work.\n" );
fprintf( stdout, "Run commands \"undc\" and \"zero\" and then rerun the equivalence check.\n" );
return 1;
}
*/
pFile
=
fopen
(
pFileName
,
"w"
);
if
(
pFile
==
NULL
)
{
fprintf
(
stdout
,
"IoCommandWriteCex(): Cannot open the output file
\"
%s
\"
.
\n
"
,
pFileName
);
return
1
;
}
if
(
fPrintFull
)
{
extern
Aig_Man_t
*
Abc_NtkToDar
(
Abc_Ntk_t
*
pNtk
,
int
fExors
,
int
fRegisters
);
...
...
@@ -2480,7 +2385,7 @@ int IoCommandWriteCex( Abc_Frame_t * pAbc, int argc, char **argv )
if
(
iPivotPi
==
Abc_NtkPiNum
(
pNtk
)
)
{
fprintf
(
stdout
,
"IoCommandWriteCex(): Cannot find special PI required by switch
\"
-z
\"
.
\n
"
);
return
1
;
return
;
}
// count X-valued flops
for
(
i
=
iPivotPi
+
1
;
i
<
Abc_NtkPiNum
(
pNtk
);
i
++
)
...
...
@@ -2533,6 +2438,136 @@ int IoCommandWriteCex( Abc_Frame_t * pAbc, int argc, char **argv )
fprintf
(
pFile
,
"%c"
,
'0'
+
Abc_InfoHasBit
(
pCex
->
pData
,
i
)
);
}
}
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
IoCommandWriteCex
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
Abc_Ntk_t
*
pNtk
;
char
*
pFileName
;
int
c
,
fNames
=
0
;
int
fMinimize
=
0
;
int
fUseSatBased
=
0
;
int
fHighEffort
=
0
;
int
fUseOldMin
=
0
;
int
fCheckCex
=
0
;
int
forceSeq
=
0
;
int
fAiger
=
0
;
int
fPrintFull
=
0
;
int
fUseFfNames
=
0
;
int
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"snmueocafzvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
's'
:
forceSeq
^=
1
;
break
;
case
'n'
:
fNames
^=
1
;
break
;
case
'm'
:
fMinimize
^=
1
;
break
;
case
'u'
:
fUseSatBased
^=
1
;
break
;
case
'e'
:
fHighEffort
^=
1
;
break
;
case
'o'
:
fUseOldMin
^=
1
;
break
;
case
'c'
:
fCheckCex
^=
1
;
break
;
case
'a'
:
fAiger
^=
1
;
break
;
case
'f'
:
fPrintFull
^=
1
;
break
;
case
'z'
:
fUseFfNames
^=
1
;
break
;
case
'v'
:
fVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
default
:
goto
usage
;
}
}
pNtk
=
pAbc
->
pNtkCur
;
if
(
pNtk
==
NULL
)
{
fprintf
(
pAbc
->
Out
,
"Empty network.
\n
"
);
return
0
;
}
if
(
pNtk
->
pModel
==
NULL
&&
pAbc
->
pCex
==
NULL
)
{
fprintf
(
pAbc
->
Out
,
"Counter-example is not available.
\n
"
);
return
0
;
}
if
(
argc
!=
globalUtilOptind
+
1
)
{
printf
(
"File name is missing on the command line.
\n
"
);
goto
usage
;
}
// get the input file name
pFileName
=
argv
[
globalUtilOptind
];
// write the counter-example into the file
if
(
pAbc
->
pCex
||
pAbc
->
vCexVec
)
{
Abc_Cex_t
*
pCex
=
pAbc
->
pCex
;
FILE
*
pFile
;
int
i
;
/*
Abc_NtkForEachLatch( pNtk, pObj, i )
if ( !Abc_LatchIsInit0(pObj) )
{
fprintf( stdout, "IoCommandWriteCex(): The init-state should be all-0 for counter-example to work.\n" );
fprintf( stdout, "Run commands \"undc\" and \"zero\" and then rerun the equivalence check.\n" );
return 1;
}
*/
pFile
=
fopen
(
pFileName
,
"w"
);
if
(
pFile
==
NULL
)
{
fprintf
(
stdout
,
"IoCommandWriteCex(): Cannot open the output file
\"
%s
\"
.
\n
"
,
pFileName
);
return
1
;
}
if
(
pAbc
->
pCex
)
{
Abc_NtkDumpOneCex
(
pFile
,
pNtk
,
pCex
,
fPrintFull
,
fNames
,
fUseFfNames
,
fMinimize
,
fUseOldMin
,
fCheckCex
,
fUseSatBased
,
fHighEffort
,
fAiger
,
fVerbose
);
}
else
if
(
pAbc
->
vCexVec
)
{
Vec_PtrForEachEntry
(
Abc_Cex_t
*
,
pAbc
->
vCexVec
,
pCex
,
i
)
{
if
(
pCex
==
NULL
)
continue
;
fprintf
(
pFile
,
"#
\n
# CEX for output number %d (%s)
\n
#
\n
"
,
i
,
Abc_ObjName
(
Abc_NtkPo
(
pNtk
,
i
))
);
Abc_NtkDumpOneCex
(
pFile
,
pNtk
,
pCex
,
fPrintFull
,
fNames
,
fUseFfNames
,
fMinimize
,
fUseOldMin
,
fCheckCex
,
fUseSatBased
,
fHighEffort
,
fAiger
,
fVerbose
);
}
}
fprintf
(
pFile
,
"# DONE
\n
"
);
fclose
(
pFile
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment