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
5a4f1fe4
Commit
5a4f1fe4
authored
Sep 16, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made abstraction and PDR communicate in-memory rather than through a file.
parent
fdf5ad34
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
65 deletions
+59
-65
src/proof/abs/abs.h
+4
-0
src/proof/abs/absGla.c
+10
-14
src/proof/abs/absPth.c
+45
-51
No files found.
src/proof/abs/abs.h
View file @
5a4f1fe4
...
@@ -99,6 +99,10 @@ extern int Gia_ManPerformGla( Gia_Man_t * p, Abs_Par_t * pPars );
...
@@ -99,6 +99,10 @@ extern int Gia_ManPerformGla( Gia_Man_t * p, Abs_Par_t * pPars );
extern
int
Gia_ManPerformGlaOld
(
Gia_Man_t
*
p
,
Abs_Par_t
*
pPars
,
int
fStartVta
);
extern
int
Gia_ManPerformGlaOld
(
Gia_Man_t
*
p
,
Abs_Par_t
*
pPars
,
int
fStartVta
);
/*=== absIter.c =========================================================*/
/*=== absIter.c =========================================================*/
extern
Gia_Man_t
*
Gia_ManShrinkGla
(
Gia_Man_t
*
p
,
int
nFrameMax
,
int
nTimeOut
,
int
fUsePdr
,
int
fUseSat
,
int
fUseBdd
,
int
fVerbose
);
extern
Gia_Man_t
*
Gia_ManShrinkGla
(
Gia_Man_t
*
p
,
int
nFrameMax
,
int
nTimeOut
,
int
fUsePdr
,
int
fUseSat
,
int
fUseBdd
,
int
fVerbose
);
/*=== absPth.c =========================================================*/
extern
void
Gia_GlaProveAbsracted
(
Gia_Man_t
*
p
,
int
fVerbose
);
extern
void
Gia_GlaProveCancel
(
int
fVerbose
);
extern
int
Gia_GlaProveCheck
(
int
fVerbose
);
/*=== absVta.c =========================================================*/
/*=== absVta.c =========================================================*/
extern
int
Gia_VtaPerform
(
Gia_Man_t
*
pAig
,
Abs_Par_t
*
pPars
);
extern
int
Gia_VtaPerform
(
Gia_Man_t
*
pAig
,
Abs_Par_t
*
pPars
);
/*=== absUtil.c =========================================================*/
/*=== absUtil.c =========================================================*/
...
...
src/proof/abs/absGla.c
View file @
5a4f1fe4
...
@@ -126,11 +126,6 @@ static inline int Ga2_ObjFindOrAddLit( Ga2_Man_t * p, Gia_Obj_t * pObj, int f )
...
@@ -126,11 +126,6 @@ static inline int Ga2_ObjFindOrAddLit( Ga2_Man_t * p, Gia_Obj_t * pObj, int f )
}
}
// calling pthreads
extern
void
Gia_Ga2ProveAbsracted
(
char
*
pFileName
,
int
fVerbose
);
extern
void
Gia_Ga2ProveCancel
(
int
fVerbose
);
extern
int
Gia_Ga2ProveCheck
(
int
fVerbose
);
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
@@ -1449,7 +1444,7 @@ char * Ga2_GlaGetFileName( Ga2_Man_t * p, int fAbs )
...
@@ -1449,7 +1444,7 @@ char * Ga2_GlaGetFileName( Ga2_Man_t * p, int fAbs )
void
Ga2_GlaDumpAbsracted
(
Ga2_Man_t
*
p
,
int
fVerbose
)
void
Ga2_GlaDumpAbsracted
(
Ga2_Man_t
*
p
,
int
fVerbose
)
{
{
char
*
pFileName
;
char
*
pFileName
;
assert
(
p
->
pPars
->
fDumpMabs
||
p
->
pPars
->
fDumpVabs
||
p
->
pPars
->
fCallProver
);
assert
(
p
->
pPars
->
fDumpMabs
||
p
->
pPars
->
fDumpVabs
);
if
(
p
->
pPars
->
fDumpMabs
)
if
(
p
->
pPars
->
fDumpMabs
)
{
{
pFileName
=
Ga2_GlaGetFileName
(
p
,
0
);
pFileName
=
Ga2_GlaGetFileName
(
p
,
0
);
...
@@ -1460,7 +1455,7 @@ void Ga2_GlaDumpAbsracted( Ga2_Man_t * p, int fVerbose )
...
@@ -1460,7 +1455,7 @@ void Ga2_GlaDumpAbsracted( Ga2_Man_t * p, int fVerbose )
p
->
pGia
->
vGateClasses
=
Ga2_ManAbsTranslate
(
p
);
p
->
pGia
->
vGateClasses
=
Ga2_ManAbsTranslate
(
p
);
Gia_WriteAiger
(
p
->
pGia
,
pFileName
,
0
,
0
);
Gia_WriteAiger
(
p
->
pGia
,
pFileName
,
0
,
0
);
}
}
if
(
p
->
pPars
->
fDumpVabs
||
p
->
pPars
->
fCallProver
)
else
if
(
p
->
pPars
->
fDumpVabs
)
{
{
Vec_Int_t
*
vGateClasses
;
Vec_Int_t
*
vGateClasses
;
Gia_Man_t
*
pAbs
;
Gia_Man_t
*
pAbs
;
...
@@ -1475,6 +1470,7 @@ void Ga2_GlaDumpAbsracted( Ga2_Man_t * p, int fVerbose )
...
@@ -1475,6 +1470,7 @@ void Ga2_GlaDumpAbsracted( Ga2_Man_t * p, int fVerbose )
Gia_ManStop
(
pAbs
);
Gia_ManStop
(
pAbs
);
Vec_IntFreeP
(
&
vGateClasses
);
Vec_IntFreeP
(
&
vGateClasses
);
}
}
else
assert
(
0
);
}
}
/**Function*************************************************************
/**Function*************************************************************
...
@@ -1564,7 +1560,7 @@ int Gia_ManPerformGla( Gia_Man_t * pAig, Abs_Par_t * pPars )
...
@@ -1564,7 +1560,7 @@ int Gia_ManPerformGla( Gia_Man_t * pAig, Abs_Par_t * pPars )
Abc_Print
(
1
,
"FrameMax = %d ConfMax = %d Timeout = %d RatioMin = %d %% RatioMax = %d %%
\n
"
,
Abc_Print
(
1
,
"FrameMax = %d ConfMax = %d Timeout = %d RatioMin = %d %% RatioMax = %d %%
\n
"
,
pPars
->
nFramesMax
,
pPars
->
nConfLimit
,
pPars
->
nTimeOut
,
pPars
->
nRatioMin
,
pPars
->
nRatioMax
);
pPars
->
nFramesMax
,
pPars
->
nConfLimit
,
pPars
->
nTimeOut
,
pPars
->
nRatioMin
,
pPars
->
nRatioMax
);
Abc_Print
(
1
,
"LrnStart = %d LrnDelta = %d LrnRatio = %d %% Skip = %d SimpleCNF = %d Dump = %d
\n
"
,
Abc_Print
(
1
,
"LrnStart = %d LrnDelta = %d LrnRatio = %d %% Skip = %d SimpleCNF = %d Dump = %d
\n
"
,
pPars
->
nLearnedStart
,
pPars
->
nLearnedDelta
,
pPars
->
nLearnedPerce
,
pPars
->
fUseSkip
,
pPars
->
fUseSimple
,
pPars
->
fDumpVabs
|
pPars
->
fDumpMabs
|
pPars
->
fCallProver
);
pPars
->
nLearnedStart
,
pPars
->
nLearnedDelta
,
pPars
->
nLearnedPerce
,
pPars
->
fUseSkip
,
pPars
->
fUseSimple
,
pPars
->
fDumpVabs
|
pPars
->
fDumpMabs
);
if
(
pPars
->
fDumpVabs
||
pPars
->
fDumpMabs
)
if
(
pPars
->
fDumpVabs
||
pPars
->
fDumpMabs
)
Abc_Print
(
1
,
"%s will be dumped into file
\"
%s
\"
.
\n
"
,
Abc_Print
(
1
,
"%s will be dumped into file
\"
%s
\"
.
\n
"
,
pPars
->
fDumpVabs
?
"Abstracted model"
:
"Miter with abstraction map"
,
pPars
->
fDumpVabs
?
"Abstracted model"
:
"Miter with abstraction map"
,
...
@@ -1642,7 +1638,7 @@ int Gia_ManPerformGla( Gia_Man_t * pAig, Abs_Par_t * pPars )
...
@@ -1642,7 +1638,7 @@ int Gia_ManPerformGla( Gia_Man_t * pAig, Abs_Par_t * pPars )
}
}
if
(
iFrameTryToProve
>=
0
)
if
(
iFrameTryToProve
>=
0
)
{
{
Gia_G
a2
ProveCancel
(
pPars
->
fVerbose
);
Gia_G
la
ProveCancel
(
pPars
->
fVerbose
);
iFrameTryToProve
=
-
1
;
iFrameTryToProve
=
-
1
;
}
}
...
@@ -1762,7 +1758,7 @@ int Gia_ManPerformGla( Gia_Man_t * pAig, Abs_Par_t * pPars )
...
@@ -1762,7 +1758,7 @@ int Gia_ManPerformGla( Gia_Man_t * pAig, Abs_Par_t * pPars )
if
(
pPars
->
fVerbose
)
if
(
pPars
->
fVerbose
)
Ga2_ManAbsPrintFrame
(
p
,
f
,
sat_solver2_nconflicts
(
p
->
pSat
)
-
nConflsBeg
,
c
,
clock
()
-
clk
,
1
);
Ga2_ManAbsPrintFrame
(
p
,
f
,
sat_solver2_nconflicts
(
p
->
pSat
)
-
nConflsBeg
,
c
,
clock
()
-
clk
,
1
);
// check if abstraction was proved
// check if abstraction was proved
if
(
Gia_G
a2
ProveCheck
(
pPars
->
fVerbose
)
)
if
(
Gia_G
la
ProveCheck
(
pPars
->
fVerbose
)
)
{
{
RetValue
=
1
;
RetValue
=
1
;
goto
finish
;
goto
finish
;
...
@@ -1785,7 +1781,7 @@ int Gia_ManPerformGla( Gia_Man_t * pAig, Abs_Par_t * pPars )
...
@@ -1785,7 +1781,7 @@ int Gia_ManPerformGla( Gia_Man_t * pAig, Abs_Par_t * pPars )
if
(
p
->
pPars
->
nFramesNoChange
==
p
->
pPars
->
nFramesNoChangeLim
)
if
(
p
->
pPars
->
nFramesNoChange
==
p
->
pPars
->
nFramesNoChangeLim
)
{
{
// dump the model into file
// dump the model into file
if
(
p
->
pPars
->
fDumpVabs
||
p
->
pPars
->
fDumpMabs
||
p
->
pPars
->
fCallProver
)
if
(
p
->
pPars
->
fDumpVabs
||
p
->
pPars
->
fDumpMabs
)
{
{
char
Command
[
1000
];
char
Command
[
1000
];
Abc_FrameSetStatus
(
-
1
);
Abc_FrameSetStatus
(
-
1
);
...
@@ -1800,9 +1796,9 @@ int Gia_ManPerformGla( Gia_Man_t * pAig, Abs_Par_t * pPars )
...
@@ -1800,9 +1796,9 @@ int Gia_ManPerformGla( Gia_Man_t * pAig, Abs_Par_t * pPars )
{
{
// cancel old one if it is proving
// cancel old one if it is proving
if
(
iFrameTryToProve
>=
0
)
if
(
iFrameTryToProve
>=
0
)
Gia_G
a2
ProveCancel
(
pPars
->
fVerbose
);
Gia_G
la
ProveCancel
(
pPars
->
fVerbose
);
// prove new one
// prove new one
Gia_G
a2ProveAbsracted
(
Ga2_GlaGetFileName
(
p
,
1
)
,
pPars
->
fVerbose
);
Gia_G
laProveAbsracted
(
pAig
,
pPars
->
fVerbose
);
iFrameTryToProve
=
f
;
iFrameTryToProve
=
f
;
}
}
// speak to the bridge
// speak to the bridge
...
@@ -1832,7 +1828,7 @@ finish:
...
@@ -1832,7 +1828,7 @@ finish:
Prf_ManStopP
(
&
p
->
pSat
->
pPrf2
);
Prf_ManStopP
(
&
p
->
pSat
->
pPrf2
);
// cancel old one if it is proving
// cancel old one if it is proving
if
(
iFrameTryToProve
>=
0
)
if
(
iFrameTryToProve
>=
0
)
Gia_G
a2
ProveCancel
(
pPars
->
fVerbose
);
Gia_G
la
ProveCancel
(
pPars
->
fVerbose
);
// analize the results
// analize the results
if
(
RetValue
==
1
)
if
(
RetValue
==
1
)
Abc_Print
(
1
,
"GLA completed %d frames and proved abstraction derived in frame %d. "
,
p
->
pPars
->
iFrameProved
+
1
,
iFrameTryToProve
);
Abc_Print
(
1
,
"GLA completed %d frames and proved abstraction derived in frame %d. "
,
p
->
pPars
->
iFrameProved
+
1
,
iFrameTryToProve
);
...
...
src/proof/abs/absPth.c
View file @
5a4f1fe4
...
@@ -18,16 +18,14 @@
...
@@ -18,16 +18,14 @@
***********************************************************************/
***********************************************************************/
#include "a
ig/ioa/ioa
.h"
#include "a
bs
.h"
#include "proof/pdr/pdr.h"
#include "proof/pdr/pdr.h"
// to compile on Linux, add -lpthread to LIBS in Makefile
// uncomment this line to enable pthreads
// uncomment this line to enable pthreads
//#define ABC_USE_PTHREADS
//#define ABC_USE_PTHREADS
// to compile on Linux, modify Makefile as follows:
// add -pthread to OPTFLAGS
// add -lpthread to LIBS
#ifdef ABC_USE_PTHREADS
#ifdef ABC_USE_PTHREADS
#ifdef WIN32
#ifdef WIN32
...
@@ -47,18 +45,18 @@ ABC_NAMESPACE_IMPL_START
...
@@ -47,18 +45,18 @@ ABC_NAMESPACE_IMPL_START
#ifndef ABC_USE_PTHREADS
#ifndef ABC_USE_PTHREADS
void
Gia_G
a2ProveAbsracted
(
char
*
pFileName
,
int
fVerbose
)
{}
void
Gia_G
laProveAbsracted
(
Gia_Man_t
*
p
,
int
fVerbose
)
{}
void
Gia_G
a2ProveCancel
(
int
fVerbose
)
{}
void
Gia_G
laProveCancel
(
int
fVerbose
)
{}
int
Gia_G
a2ProveCheck
(
int
fVerbose
)
{
return
0
;
}
int
Gia_G
laProveCheck
(
int
fVerbose
)
{
return
0
;
}
#else // pthreads are used
#else // pthreads are used
// information given to the thread
// information given to the thread
typedef
struct
Abs_ThData_t_
typedef
struct
Abs_ThData_t_
{
{
char
*
pFileName
;
Aig_Man_t
*
pAig
;
int
fVerbose
;
int
fVerbose
;
int
RunId
;
int
RunId
;
}
Abs_ThData_t
;
}
Abs_ThData_t
;
// mutext to control access to shared variables
// mutext to control access to shared variables
...
@@ -101,66 +99,62 @@ void * Abs_ProverThread( void * pArg )
...
@@ -101,66 +99,62 @@ void * Abs_ProverThread( void * pArg )
{
{
Abs_ThData_t
*
pThData
=
(
Abs_ThData_t
*
)
pArg
;
Abs_ThData_t
*
pThData
=
(
Abs_ThData_t
*
)
pArg
;
Pdr_Par_t
Pars
,
*
pPars
=
&
Pars
;
Pdr_Par_t
Pars
,
*
pPars
=
&
Pars
;
Aig_Man_t
*
pAig
,
*
pTemp
;
int
RetValue
,
status
;
int
RetValue
,
status
;
pAig
=
Ioa_ReadAiger
(
pThData
->
pFileName
,
0
);
// call PDR
if
(
pAig
==
NULL
)
Pdr_ManSetDefaultParams
(
pPars
);
Abc_Print
(
1
,
"
\n
Cannot open file
\"
%s
\"
.
\n
"
,
pThData
->
pFileName
);
pPars
->
fSilent
=
1
;
else
pPars
->
RunId
=
pThData
->
RunId
;
pPars
->
pFuncStop
=
Abs_CallBackToStop
;
RetValue
=
Pdr_ManSolve
(
pThData
->
pAig
,
pPars
,
NULL
);
// RetValue = Pdr_ManSolve_test( pAig, pPars, NULL );
// update the result
if
(
RetValue
==
1
)
{
status
=
pthread_mutex_lock
(
&
g_mutex
);
assert
(
status
==
0
);
g_fAbstractionProved
=
1
;
status
=
pthread_mutex_unlock
(
&
g_mutex
);
assert
(
status
==
0
);
}
// quit this thread
if
(
pThData
->
fVerbose
)
{
{
// synthesize abstraction
pAig
=
Aig_ManScl
(
pTemp
=
pAig
,
1
,
1
,
0
,
-
1
,
-
1
,
0
,
0
);
Aig_ManStop
(
pTemp
);
// call PDR
Pdr_ManSetDefaultParams
(
pPars
);
pPars
->
fSilent
=
1
;
pPars
->
RunId
=
pThData
->
RunId
;
pPars
->
pFuncStop
=
Abs_CallBackToStop
;
RetValue
=
Pdr_ManSolve
(
pAig
,
pPars
,
NULL
);
// RetValue = Pdr_ManSolve_test( pAig, pPars, NULL );
// update the result
if
(
RetValue
==
1
)
if
(
RetValue
==
1
)
{
Abc_Print
(
1
,
"
\n
Proved abstraction %d.
\n
"
,
pThData
->
RunId
);
status
=
pthread_mutex_lock
(
&
g_mutex
);
assert
(
status
==
0
);
else
if
(
RetValue
==
0
)
g_fAbstractionProved
=
1
;
Abc_Print
(
1
,
"
\n
Disproved abstraction %d.
\n
"
,
pThData
->
RunId
);
status
=
pthread_mutex_unlock
(
&
g_mutex
);
assert
(
status
==
0
);
else
if
(
RetValue
==
-
1
)
}
Abc_Print
(
1
,
"
\n
Cancelled abstraction %d.
\n
"
,
pThData
->
RunId
);
// free memory
else
assert
(
0
);
Aig_ManStop
(
pAig
);
// quit this thread
if
(
pThData
->
fVerbose
)
{
if
(
RetValue
==
1
)
Abc_Print
(
1
,
"
\n
Proved abstraction %d.
\n
"
,
pThData
->
RunId
);
else
if
(
RetValue
==
0
)
Abc_Print
(
1
,
"
\n
Disproved abstraction %d.
\n
"
,
pThData
->
RunId
);
else
if
(
RetValue
==
-
1
)
Abc_Print
(
1
,
"
\n
Cancelled abstraction %d.
\n
"
,
pThData
->
RunId
);
else
assert
(
0
);
}
}
}
ABC_FREE
(
pThData
->
pFileName
);
// free memory
Aig_ManStop
(
pThData
->
pAig
);
ABC_FREE
(
pThData
);
ABC_FREE
(
pThData
);
// quit this thread
// quit this thread
pthread_exit
(
NULL
);
pthread_exit
(
NULL
);
assert
(
0
);
assert
(
0
);
return
NULL
;
return
NULL
;
}
}
void
Gia_G
a2ProveAbsracted
(
char
*
pFileName
,
int
fVerbose
)
void
Gia_G
laProveAbsracted
(
Gia_Man_t
*
pGia
,
int
fVerbose
)
{
{
Abs_ThData_t
*
pThData
;
Abs_ThData_t
*
pThData
;
Gia_Man_t
*
pAbs
;
Aig_Man_t
*
pAig
;
pthread_t
ProverThread
;
pthread_t
ProverThread
;
int
status
;
int
status
;
assert
(
pFileName
!=
NULL
);
// disable verbosity
// disable verbosity
fVerbose
=
0
;
fVerbose
=
0
;
// create abstraction
assert
(
pGia
->
vGateClasses
!=
NULL
);
pAbs
=
Gia_ManDupAbsGates
(
pGia
,
pGia
->
vGateClasses
);
Gia_ManCleanValue
(
pGia
);
pAig
=
Gia_ManToAigSimple
(
pAbs
);
Gia_ManStop
(
pAbs
);
// reset the proof
// reset the proof
status
=
pthread_mutex_lock
(
&
g_mutex
);
assert
(
status
==
0
);
status
=
pthread_mutex_lock
(
&
g_mutex
);
assert
(
status
==
0
);
g_fAbstractionProved
=
0
;
g_fAbstractionProved
=
0
;
status
=
pthread_mutex_unlock
(
&
g_mutex
);
assert
(
status
==
0
);
status
=
pthread_mutex_unlock
(
&
g_mutex
);
assert
(
status
==
0
);
// collect thread data
// collect thread data
pThData
=
ABC_CALLOC
(
Abs_ThData_t
,
1
);
pThData
=
ABC_CALLOC
(
Abs_ThData_t
,
1
);
pThData
->
p
FileName
=
Abc_UtilStrsav
(
(
void
*
)
pFileName
)
;
pThData
->
p
Aig
=
pAig
;
pThData
->
fVerbose
=
fVerbose
;
pThData
->
fVerbose
=
fVerbose
;
status
=
pthread_mutex_lock
(
&
g_mutex
);
assert
(
status
==
0
);
status
=
pthread_mutex_lock
(
&
g_mutex
);
assert
(
status
==
0
);
pThData
->
RunId
=
++
g_nRunIds
;
pThData
->
RunId
=
++
g_nRunIds
;
...
@@ -170,14 +164,14 @@ void Gia_Ga2ProveAbsracted( char * pFileName, int fVerbose )
...
@@ -170,14 +164,14 @@ void Gia_Ga2ProveAbsracted( char * pFileName, int fVerbose )
status
=
pthread_create
(
&
ProverThread
,
NULL
,
Abs_ProverThread
,
pThData
);
status
=
pthread_create
(
&
ProverThread
,
NULL
,
Abs_ProverThread
,
pThData
);
assert
(
status
==
0
);
assert
(
status
==
0
);
}
}
void
Gia_G
a2
ProveCancel
(
int
fVerbose
)
void
Gia_G
la
ProveCancel
(
int
fVerbose
)
{
{
int
status
;
int
status
;
status
=
pthread_mutex_lock
(
&
g_mutex
);
assert
(
status
==
0
);
status
=
pthread_mutex_lock
(
&
g_mutex
);
assert
(
status
==
0
);
g_nRunIds
++
;
g_nRunIds
++
;
status
=
pthread_mutex_unlock
(
&
g_mutex
);
assert
(
status
==
0
);
status
=
pthread_mutex_unlock
(
&
g_mutex
);
assert
(
status
==
0
);
}
}
int
Gia_G
a2
ProveCheck
(
int
fVerbose
)
int
Gia_G
la
ProveCheck
(
int
fVerbose
)
{
{
int
status
;
int
status
;
if
(
g_fAbstractionProved
==
0
)
if
(
g_fAbstractionProved
==
0
)
...
...
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