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
3beb3677
Commit
3beb3677
authored
Nov 11, 2011
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enabled counter-example minimization in 'write_counter'.
parent
9fe4c749
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
61 additions
and
10 deletions
+61
-10
src/aig/saig/saig.h
+1
-1
src/aig/saig/saigAbsCba.c
+9
-3
src/base/abci/abc.c
+1
-1
src/base/io/io.c
+30
-4
src/misc/util/utilCex.c
+19
-1
src/misc/util/utilCex.h
+1
-0
No files found.
src/aig/saig/saig.h
View file @
3beb3677
...
@@ -136,7 +136,7 @@ extern Vec_Int_t * Saig_ManFlops2Classes( int nRegs, Vec_Int_t * vFlops );
...
@@ -136,7 +136,7 @@ extern Vec_Int_t * Saig_ManFlops2Classes( int nRegs, Vec_Int_t * vFlops );
extern
Abc_Cex_t
*
Saig_ManCexRemap
(
Aig_Man_t
*
p
,
Aig_Man_t
*
pAbs
,
Abc_Cex_t
*
pCexAbs
);
extern
Abc_Cex_t
*
Saig_ManCexRemap
(
Aig_Man_t
*
p
,
Aig_Man_t
*
pAbs
,
Abc_Cex_t
*
pCexAbs
);
/*=== sswAbsCba.c ==========================================================*/
/*=== sswAbsCba.c ==========================================================*/
extern
Vec_Int_t
*
Saig_ManCbaFilterFlops
(
Aig_Man_t
*
pAig
,
Abc_Cex_t
*
pAbsCex
,
Vec_Int_t
*
vFlopClasses
,
Vec_Int_t
*
vAbsFfsToAdd
,
int
nFfsToSelect
);
extern
Vec_Int_t
*
Saig_ManCbaFilterFlops
(
Aig_Man_t
*
pAig
,
Abc_Cex_t
*
pAbsCex
,
Vec_Int_t
*
vFlopClasses
,
Vec_Int_t
*
vAbsFfsToAdd
,
int
nFfsToSelect
);
extern
Abc_Cex_t
*
Saig_ManCbaFindCexCareBits
(
Aig_Man_t
*
pAig
,
Abc_Cex_t
*
pCex
,
int
nInputs
,
int
f
NewOrder
,
int
f
Verbose
);
extern
Abc_Cex_t
*
Saig_ManCbaFindCexCareBits
(
Aig_Man_t
*
pAig
,
Abc_Cex_t
*
pCex
,
int
nInputs
,
int
fVerbose
);
extern
Vec_Int_t
*
Saig_ManCbaFilterInputs
(
Aig_Man_t
*
pAig
,
int
iFirstFlopPi
,
Abc_Cex_t
*
pCex
,
int
fVerbose
);
extern
Vec_Int_t
*
Saig_ManCbaFilterInputs
(
Aig_Man_t
*
pAig
,
int
iFirstFlopPi
,
Abc_Cex_t
*
pCex
,
int
fVerbose
);
extern
Vec_Int_t
*
Saig_ManCbaPerform
(
Aig_Man_t
*
pAig
,
int
nInputs
,
Saig_ParBmc_t
*
pPars
);
extern
Vec_Int_t
*
Saig_ManCbaPerform
(
Aig_Man_t
*
pAig
,
int
nInputs
,
Saig_ParBmc_t
*
pPars
);
/*=== sswAbsPba.c ==========================================================*/
/*=== sswAbsPba.c ==========================================================*/
...
...
src/aig/saig/saigAbsCba.c
View file @
3beb3677
...
@@ -593,7 +593,7 @@ void Saig_ManCbaShrink( Saig_ManCba_t * p )
...
@@ -593,7 +593,7 @@ void Saig_ManCbaShrink( Saig_ManCba_t * p )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
Abc_Cex_t
*
Saig_ManCbaFindCexCareBits
(
Aig_Man_t
*
pAig
,
Abc_Cex_t
*
pCex
,
int
nInputs
,
int
f
NewOrder
,
int
f
Verbose
)
Abc_Cex_t
*
Saig_ManCbaFindCexCareBits
(
Aig_Man_t
*
pAig
,
Abc_Cex_t
*
pCex
,
int
nInputs
,
int
fVerbose
)
{
{
Saig_ManCba_t
*
p
;
Saig_ManCba_t
*
p
;
Vec_Int_t
*
vReasons
;
Vec_Int_t
*
vReasons
;
...
@@ -611,8 +611,8 @@ Abc_Cex_t * Saig_ManCbaFindCexCareBits( Aig_Man_t * pAig, Abc_Cex_t * pCex, int
...
@@ -611,8 +611,8 @@ Abc_Cex_t * Saig_ManCbaFindCexCareBits( Aig_Man_t * pAig, Abc_Cex_t * pCex, int
Saig_ManCbaShrink
(
p
);
Saig_ManCbaShrink
(
p
);
if
(
fVerbose
)
//
if ( fVerbose )
Aig_ManPrintStats
(
p
->
pFrames
);
//
Aig_ManPrintStats( p->pFrames );
if
(
fVerbose
)
if
(
fVerbose
)
{
{
...
@@ -629,9 +629,15 @@ ABC_PRT( "Time", clock() - clk );
...
@@ -629,9 +629,15 @@ ABC_PRT( "Time", clock() - clk );
Saig_ManCbaStop
(
p
);
Saig_ManCbaStop
(
p
);
if
(
fVerbose
)
if
(
fVerbose
)
{
printf
(
"Real "
);
Abc_CexPrintStats
(
pCex
);
Abc_CexPrintStats
(
pCex
);
}
if
(
fVerbose
)
if
(
fVerbose
)
{
printf
(
"Care "
);
Abc_CexPrintStats
(
pCare
);
Abc_CexPrintStats
(
pCare
);
}
return
pCare
;
return
pCare
;
}
}
...
...
src/base/abci/abc.c
View file @
3beb3677
...
@@ -8881,7 +8881,7 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -8881,7 +8881,7 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
{
{
Abc_Cex_t * pNew;
Abc_Cex_t * pNew;
Aig_Man_t * pAig = Abc_NtkToDar( pNtk, 0, 1 );
Aig_Man_t * pAig = Abc_NtkToDar( pNtk, 0, 1 );
pNew = Saig_ManCbaFindCexCareBits( pAig, pAbc->pCex, 0, f
NewOrder, f
Verbose );
pNew = Saig_ManCbaFindCexCareBits( pAig, pAbc->pCex, 0, fVerbose );
Aig_ManStop( pAig );
Aig_ManStop( pAig );
Abc_FrameReplaceCex( pAbc, &pNew );
Abc_FrameReplaceCex( pAbc, &pNew );
}
}
...
...
src/base/io/io.c
View file @
3beb3677
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "ioAbc.h"
#include "ioAbc.h"
#include "mainInt.h"
#include "mainInt.h"
#include "saig.h"
ABC_NAMESPACE_IMPL_START
ABC_NAMESPACE_IMPL_START
...
@@ -2012,14 +2013,17 @@ int IoCommandWriteCounter( Abc_Frame_t * pAbc, int argc, char **argv )
...
@@ -2012,14 +2013,17 @@ int IoCommandWriteCounter( Abc_Frame_t * pAbc, int argc, char **argv )
{
{
Abc_Ntk_t
*
pNtk
;
Abc_Ntk_t
*
pNtk
;
char
*
pFileName
;
char
*
pFileName
;
int
c
;
int
c
,
fNames
;
int
f
Names
;
int
f
Minimize
;
int
forceSeq
;
int
forceSeq
;
int
fVerbose
;
fNames
=
0
;
fNames
=
0
;
fMinimize
=
0
;
forceSeq
=
0
;
forceSeq
=
0
;
fVerbose
=
0
;
Extra_UtilGetoptReset
();
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"snh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"sn
mv
h"
)
)
!=
EOF
)
{
{
switch
(
c
)
switch
(
c
)
{
{
...
@@ -2029,6 +2033,12 @@ int IoCommandWriteCounter( Abc_Frame_t * pAbc, int argc, char **argv )
...
@@ -2029,6 +2033,12 @@ int IoCommandWriteCounter( Abc_Frame_t * pAbc, int argc, char **argv )
case
'n'
:
case
'n'
:
fNames
^=
1
;
fNames
^=
1
;
break
;
break
;
case
'm'
:
fMinimize
^=
1
;
break
;
case
'v'
:
fVerbose
^=
1
;
break
;
case
'h'
:
case
'h'
:
goto
usage
;
goto
usage
;
default
:
default
:
...
@@ -2080,11 +2090,25 @@ int IoCommandWriteCounter( Abc_Frame_t * pAbc, int argc, char **argv )
...
@@ -2080,11 +2090,25 @@ int IoCommandWriteCounter( Abc_Frame_t * pAbc, int argc, char **argv )
}
}
if
(
fNames
)
if
(
fNames
)
{
{
Abc_Cex_t
*
pCare
=
NULL
;
if
(
fMinimize
)
{
extern
Aig_Man_t
*
Abc_NtkToDar
(
Abc_Ntk_t
*
pNtk
,
int
fExors
,
int
fRegisters
);
Aig_Man_t
*
pAig
=
Abc_NtkToDar
(
pNtk
,
0
,
1
);
pCare
=
Saig_ManCbaFindCexCareBits
(
pAig
,
pCex
,
0
,
fVerbose
);
if
(
pCare
==
NULL
)
printf
(
"Counter-example minimization has failed.
\n
"
);
Aig_ManStop
(
pAig
);
}
// output flop values (unaffected by the minimization)
Abc_NtkForEachLatch
(
pNtk
,
pObj
,
i
)
Abc_NtkForEachLatch
(
pNtk
,
pObj
,
i
)
fprintf
(
pFile
,
"%s@0=%c "
,
Abc_ObjName
(
Abc_ObjFanout0
(
pObj
)),
'0'
+!
Abc_LatchIsInit0
(
pObj
)
);
fprintf
(
pFile
,
"%s@0=%c "
,
Abc_ObjName
(
Abc_ObjFanout0
(
pObj
)),
'0'
+!
Abc_LatchIsInit0
(
pObj
)
);
// output PI values (while skipping the minimized ones)
for
(
f
=
0
;
f
<=
pCex
->
iFrame
;
f
++
)
for
(
f
=
0
;
f
<=
pCex
->
iFrame
;
f
++
)
Abc_NtkForEachPi
(
pNtk
,
pObj
,
i
)
Abc_NtkForEachPi
(
pNtk
,
pObj
,
i
)
if
(
!
pCare
||
Abc_InfoHasBit
(
pCare
->
pData
,
pCare
->
nRegs
+
pCare
->
nPis
*
f
+
i
)
)
fprintf
(
pFile
,
"%s@%d=%c "
,
Abc_ObjName
(
pObj
),
f
,
'0'
+
Abc_InfoHasBit
(
pCex
->
pData
,
pCex
->
nRegs
+
pCex
->
nPis
*
f
+
i
)
);
fprintf
(
pFile
,
"%s@%d=%c "
,
Abc_ObjName
(
pObj
),
f
,
'0'
+
Abc_InfoHasBit
(
pCex
->
pData
,
pCex
->
nRegs
+
pCex
->
nPis
*
f
+
i
)
);
Abc_CexFreeP
(
&
pCare
);
}
}
else
else
{
{
...
@@ -2125,11 +2149,13 @@ int IoCommandWriteCounter( Abc_Frame_t * pAbc, int argc, char **argv )
...
@@ -2125,11 +2149,13 @@ int IoCommandWriteCounter( Abc_Frame_t * pAbc, int argc, char **argv )
return
0
;
return
0
;
usage
:
usage
:
fprintf
(
pAbc
->
Err
,
"usage: write_counter [-snh] <file>
\n
"
);
fprintf
(
pAbc
->
Err
,
"usage: write_counter [-sn
mv
h] <file>
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
saves counter-example derived by
\"
sat
\"
,
\"
iprove
\"
, or
\"
dprove
\"\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
saves counter-example derived by
\"
sat
\"
,
\"
iprove
\"
, or
\"
dprove
\"\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
the file contains values for each PI in the natural order
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
the file contains values for each PI in the natural order
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
-s : always report a sequential ctrex (cycle 0 for comb) [default = %s]
\n
"
,
forceSeq
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-s : always report a sequential ctrex (cycle 0 for comb) [default = %s]
\n
"
,
forceSeq
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-n : write input names into the file [default = %s]
\n
"
,
fNames
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-n : write input names into the file [default = %s]
\n
"
,
fNames
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-m : minimize counter-example by dropping don't-care values [default = %s]
\n
"
,
fMinimize
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-v : enable verbose output [default = %s].
\n
"
,
fVerbose
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-h : print the help massage
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
-h : print the help massage
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
file : the name of the file to write
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
file : the name of the file to write
\n
"
);
return
1
;
return
1
;
...
...
src/misc/util/utilCex.c
View file @
3beb3677
...
@@ -196,7 +196,7 @@ void Abc_CexPrintStats( Abc_Cex_t * p )
...
@@ -196,7 +196,7 @@ void Abc_CexPrintStats( Abc_Cex_t * p )
for
(
k
=
0
;
k
<
p
->
nBits
;
k
++
)
for
(
k
=
0
;
k
<
p
->
nBits
;
k
++
)
Counter
+=
Abc_InfoHasBit
(
p
->
pData
,
k
);
Counter
+=
Abc_InfoHasBit
(
p
->
pData
,
k
);
printf
(
"CEX: iPo = %d iFrame = %d nRegs = %d nPis = %d nBits = %d nOnes = %5d (%5.2f %%)
\n
"
,
printf
(
"CEX: iPo = %d iFrame = %d nRegs = %d nPis = %d nBits = %d nOnes = %5d (%5.2f %%)
\n
"
,
p
->
iPo
,
p
->
iFrame
,
p
->
nRegs
,
p
->
nPis
,
p
->
nBits
,
Counter
,
100
.
0
*
Counter
/
p
->
nBits
);
p
->
iPo
,
p
->
iFrame
,
p
->
nRegs
,
p
->
nPis
,
p
->
nBits
,
Counter
,
100
.
0
*
Counter
/
(
p
->
nBits
-
p
->
nRegs
)
);
}
}
/**Function*************************************************************
/**Function*************************************************************
...
@@ -244,6 +244,24 @@ void Abc_CexPrint( Abc_Cex_t * p )
...
@@ -244,6 +244,24 @@ void Abc_CexPrint( Abc_Cex_t * p )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
void
Abc_CexFreeP
(
Abc_Cex_t
**
p
)
{
if
(
*
p
==
NULL
)
return
;
ABC_FREE
(
*
p
);
}
/**Function*************************************************************
Synopsis [Frees the counter-example.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Abc_CexFree
(
Abc_Cex_t
*
p
)
void
Abc_CexFree
(
Abc_Cex_t
*
p
)
{
{
ABC_FREE
(
p
);
ABC_FREE
(
p
);
...
...
src/misc/util/utilCex.h
View file @
3beb3677
...
@@ -63,6 +63,7 @@ extern Abc_Cex_t * Abc_CexDup( Abc_Cex_t * p, int nRegsNew );
...
@@ -63,6 +63,7 @@ extern Abc_Cex_t * Abc_CexDup( Abc_Cex_t * p, int nRegsNew );
extern
Abc_Cex_t
*
Abc_CexDeriveFromCombModel
(
int
*
pModel
,
int
nPis
,
int
nRegs
,
int
iPo
);
extern
Abc_Cex_t
*
Abc_CexDeriveFromCombModel
(
int
*
pModel
,
int
nPis
,
int
nRegs
,
int
iPo
);
extern
void
Abc_CexPrintStats
(
Abc_Cex_t
*
p
);
extern
void
Abc_CexPrintStats
(
Abc_Cex_t
*
p
);
extern
void
Abc_CexPrint
(
Abc_Cex_t
*
p
);
extern
void
Abc_CexPrint
(
Abc_Cex_t
*
p
);
extern
void
Abc_CexFreeP
(
Abc_Cex_t
**
p
);
extern
void
Abc_CexFree
(
Abc_Cex_t
*
p
);
extern
void
Abc_CexFree
(
Abc_Cex_t
*
p
);
ABC_NAMESPACE_HEADER_END
ABC_NAMESPACE_HEADER_END
...
...
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