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
5b79c789
Commit
5b79c789
authored
May 19, 2008
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Version abc80519
parent
f81e16b6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
137 deletions
+57
-137
src/aig/fra/fraLcr.c
+3
-3
src/aig/fra/fraSec.c
+1
-1
src/aig/saig/saigHaig.c
+53
-133
No files found.
src/aig/fra/fraLcr.c
View file @
5b79c789
...
@@ -533,7 +533,7 @@ Aig_Man_t * Fra_FraigLatchCorrespondence( Aig_Man_t * pAig, int nFramesP, int nC
...
@@ -533,7 +533,7 @@ Aig_Man_t * Fra_FraigLatchCorrespondence( Aig_Man_t * pAig, int nFramesP, int nC
Fra_Lcr_t
*
p
;
Fra_Lcr_t
*
p
;
Fra_Sml_t
*
pSml
;
Fra_Sml_t
*
pSml
;
Fra_Man_t
*
pTemp
;
Fra_Man_t
*
pTemp
;
Aig_Man_t
*
pAigPart
,
*
pAigNew
=
NULL
;
Aig_Man_t
*
pAigPart
,
*
pAig
Temp
,
*
pAig
New
=
NULL
;
Vec_Int_t
*
vPart
;
Vec_Int_t
*
vPart
;
int
i
,
nIter
,
timeSim
,
clk
=
clock
(),
clk2
,
clk3
;
int
i
,
nIter
,
timeSim
,
clk
=
clock
(),
clk2
,
clk3
;
int
TimeToStop
=
(
TimeLimit
==
0
.
0
)
?
0
:
clock
()
+
(
int
)(
TimeLimit
*
CLOCKS_PER_SEC
);
int
TimeToStop
=
(
TimeLimit
==
0
.
0
)
?
0
:
clock
()
+
(
int
)(
TimeLimit
*
CLOCKS_PER_SEC
);
...
@@ -623,9 +623,9 @@ clk2 = clock();
...
@@ -623,9 +623,9 @@ clk2 = clock();
pAigPart
=
Fra_LcrCreatePart
(
p
,
vPart
);
pAigPart
=
Fra_LcrCreatePart
(
p
,
vPart
);
p
->
timeTrav
+=
clock
()
-
clk2
;
p
->
timeTrav
+=
clock
()
-
clk2
;
clk2
=
clock
();
clk2
=
clock
();
pAig
New
=
Fra_FraigEquivence
(
pAigPart
,
nConfMax
,
0
);
pAig
Temp
=
Fra_FraigEquivence
(
pAigPart
,
nConfMax
,
0
);
p
->
timeFraig
+=
clock
()
-
clk2
;
p
->
timeFraig
+=
clock
()
-
clk2
;
Vec_PtrPush
(
p
->
vFraigs
,
pAig
New
);
Vec_PtrPush
(
p
->
vFraigs
,
pAig
Temp
);
Aig_ManStop
(
pAigPart
);
Aig_ManStop
(
pAigPart
);
}
}
Fra_ClassNodesUnmark
(
p
);
Fra_ClassNodesUnmark
(
p
);
...
...
src/aig/fra/fraSec.c
View file @
5b79c789
...
@@ -57,7 +57,7 @@ void Fra_SecSetDefaultParams( Fra_Sec_t * p )
...
@@ -57,7 +57,7 @@ void Fra_SecSetDefaultParams( Fra_Sec_t * p )
p
->
fVeryVerbose
=
0
;
// enables very verbose reporting
p
->
fVeryVerbose
=
0
;
// enables very verbose reporting
p
->
TimeLimit
=
0
;
// enables the timeout
p
->
TimeLimit
=
0
;
// enables the timeout
// internal parameters
// internal parameters
p
->
fReportSolution
=
0
;
// enables specialized format for reporting solution
p
->
fReportSolution
=
1
;
// enables specialized format for reporting solution
}
}
/**Function*************************************************************
/**Function*************************************************************
...
...
src/aig/saig/saigHaig.c
View file @
5b79c789
...
@@ -195,169 +195,89 @@ int Aig_ManMapHaigNodes( Aig_Man_t * pHaig )
...
@@ -195,169 +195,89 @@ int Aig_ManMapHaigNodes( Aig_Man_t * pHaig )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
void
Aig_ManHaigVerifyComb
(
Aig_Man_t
*
pHaig
)
int
Aig_ManHaigVerify
(
Aig_Man_t
*
p
,
Aig_Man_t
*
pAig
,
Aig_Man_t
*
pHaig
,
int
nFrames
)
{
{
int
nBTLimit
=
0
;
int
nBTLimit
=
0
;
Vec_Ptr_t
*
vResult
;
Aig_Man_t
*
pFrames
,
*
pTemp
;
Aig_Man_t
*
pFrames
;
Cnf_Dat_t
*
pCnf
;
Cnf_Dat_t
*
pCnf
;
sat_solver
*
pSat
;
sat_solver
*
pSat
;
Aig_Obj_t
*
pObj1
,
*
pObj2
;
Aig_Obj_t
*
pObj1
,
*
pObj2
;
int
i
,
RetValue
,
RetValue1
,
RetValue2
,
Counter
,
Lits
[
2
]
;
int
i
,
RetValue
1
,
RetValue2
,
Counter
,
Lits
[
2
],
nOvers
;
int
clk
=
clock
();
int
clk
=
clock
();
printf
(
"Filtering combinational cases:
\n
"
);
nOvers
=
Aig_ManMapHaigNodes
(
pHaig
);
// return;
// create time frames with speculative reduction and convert them into CNF
// create time frames with speculative reduction and convert them into CNF
clk
=
clock
();
clk
=
clock
();
pFrames
=
Aig_ManHaigFrames
(
pHaig
,
1
);
pFrames
=
Aig_ManHaigFrames
(
pHaig
,
nFrames
);
Aig_ManCleanMarkA
(
pHaig
);
// collect the HAIG nodes that were used to create spec miters
vResult
=
Vec_PtrAlloc
(
Aig_ManPoNum
(
pFrames
)
/
2
);
Aig_ManForEachPo
(
pFrames
,
pObj1
,
i
)
{
pObj2
=
Aig_ManPo
(
pFrames
,
++
i
);
Vec_PtrPush
(
vResult
,
pObj1
->
pData
);
}
printf
(
"Frames: "
);
printf
(
"Frames: "
);
Aig_ManPrintStats
(
pFrames
);
Aig_ManPrintStats
(
pFrames
);
//
pFrames = Dar_ManRwsat( pTemp = pFrames, 1, 0 );
pFrames
=
Dar_ManRwsat
(
pTemp
=
pFrames
,
1
,
0
);
//
Aig_ManStop( pTemp );
Aig_ManStop
(
pTemp
);
printf
(
"Frames
:
"
);
printf
(
"Frames
synt:
"
);
Aig_ManPrintStats
(
pFrames
);
Aig_ManPrintStats
(
pFrames
);
printf
(
"Additional frames stats: Assumptions = %d. Assert
s = %d. Pairs
= %d.
\n
"
,
printf
(
"Additional frames stats: Assumptions = %d. Assert
ions = %d. Pairs = %d. Over
= %d.
\n
"
,
Aig_ManPoNum
(
pFrames
)
/
2
-
pFrames
->
nAsserts
/
2
,
pFrames
->
nAsserts
/
2
,
Vec_IntSize
(
pHaig
->
vEquPairs
)
/
2
);
Aig_ManPoNum
(
pFrames
)
/
2
-
pFrames
->
nAsserts
/
2
,
pFrames
->
nAsserts
/
2
,
Vec_IntSize
(
pHaig
->
vEquPairs
)
/
2
,
nOvers
);
// pCnf = Cnf_DeriveSimple( pFrames, Aig_ManPoNum(pFrames) );
// pCnf = Cnf_DeriveSimple( pFrames, Aig_ManPoNum(pFrames) );
pCnf
=
Cnf_Derive
(
pFrames
,
Aig_ManPoNum
(
pFrames
)
);
pCnf
=
Cnf_Derive
(
pFrames
,
Aig_ManPoNum
(
pFrames
)
);
// pCnf = Cnf_Derive( pFrames, Aig_ManPoNum(pFrames) - pFrames->nAsserts );
/*
//Cnf_DataWriteIntoFile( pCnf, "temp.cnf", 1 );
// print the statistic into a file
// Saig_ManDumpBlif( pHaig, "haig_temp.blif" );
// Saig_ManDumpBlif( pFrames, "haig_temp_frames.blif" );
// create the SAT solver to be used for this problem
pSat
=
Cnf_DataWriteIntoSolver
(
pCnf
,
1
,
0
);
if
(
pSat
==
NULL
)
{
printf
(
"Aig_ManHaigVerify(): Computed CNF is not valid.
\n
"
);
return
;
}
PRT
(
"Preparation"
,
clock
()
-
clk
);
// check in the second timeframe
clk
=
clock
();
Counter
=
0
;
printf
(
"Started solving ...
\r
"
);
Aig_ManForEachPo
(
pFrames
,
pObj1
,
i
)
{
{
pObj2
=
Aig_ManPo
(
pFrames
,
++
i
);
FILE * pTable;
assert
(
pObj1
->
fPhase
==
pObj2
->
fPhase
);
Aig_Man_t * pTemp, * pHaig2;
Lits
[
0
]
=
toLitCond
(
pCnf
->
pVarNums
[
pObj1
->
Id
],
0
);
Lits
[
1
]
=
toLitCond
(
pCnf
->
pVarNums
[
pObj2
->
Id
],
1
);
RetValue1
=
sat_solver_solve
(
pSat
,
Lits
,
Lits
+
2
,
(
sint64
)
10
,
(
sint64
)
0
,
(
sint64
)
0
,
(
sint64
)
0
);
if
(
RetValue1
==
l_False
)
{
Lits
[
0
]
=
lit_neg
(
Lits
[
0
]
);
Lits
[
1
]
=
lit_neg
(
Lits
[
1
]
);
RetValue
=
sat_solver_addclause
(
pSat
,
Lits
,
Lits
+
2
);
assert
(
RetValue
);
}
Lits
[
0
]
++
;
Lits
[
1
]
--
;
RetValue2
=
sat_solver_solve
(
pSat
,
Lits
,
Lits
+
2
,
(
sint64
)
10
,
(
sint64
)
0
,
(
sint64
)
0
,
(
sint64
)
0
);
if
(
RetValue2
==
l_False
)
{
Lits
[
0
]
=
lit_neg
(
Lits
[
0
]
);
Lits
[
1
]
=
lit_neg
(
Lits
[
1
]
);
RetValue
=
sat_solver_addclause
(
pSat
,
Lits
,
Lits
+
2
);
assert
(
RetValue
);
}
if
(
RetValue1
!=
l_False
||
RetValue2
!=
l_False
)
{
Counter
++
;
}
else
{
pObj1
=
Vec_PtrEntry
(
vResult
,
i
/
2
);
assert
(
pObj1
->
pHaig
!=
NULL
);
pObj1
->
fMarkA
=
1
;
}
if
(
i
%
50
==
1
)
printf
(
"Solving assertion %6d out of %6d.
\r
"
,
(
i
-
(
Aig_ManPoNum
(
pFrames
)
-
pFrames
->
nAsserts
))
/
2
,
pFrames
->
nAsserts
/
2
);
// if ( nClasses == 1000 )
// break;
}
printf
(
"
\r
"
);
PRT
(
"Solving "
,
clock
()
-
clk
);
if
(
Counter
)
printf
(
"Verification failed for %d out of %d assertions.
\n
"
,
Counter
,
pFrames
->
nAsserts
/
2
);
else
printf
(
"Verification is successful for all %d assertions.
\n
"
,
pFrames
->
nAsserts
/
2
);
// clean up
pHaig2 = pAig->pManHaig;
Aig_ManStop
(
pFrames
);
pAig->pManHaig = NULL;
Cnf_DataFree
(
pCnf
);
pTemp = Aig_ManDupDfs( pAig );
sat_solver_delete
(
pSat
);
pAig->pManHaig = pHaig2;
Vec_PtrFree
(
vResult
);
}
/**Function*************************************************************
Synopsis []
Aig_ManSeqCleanup( pTemp );
Description []
pTable = fopen( "stats.txt", "a+" );
fprintf( pTable, "%s ", p->pName );
SideEffects []
fprintf( pTable, "%d ", Saig_ManPiNum(p) );
fprintf( pTable, "%d ", Saig_ManPoNum(p) );
SeeAlso []
fprintf( pTable, "%d ", Saig_ManRegNum(p) );
fprintf( pTable, "%d ", Aig_ManNodeNum(p) );
fprintf( pTable, "%d ", Aig_ManLevelNum(p) );
***********************************************************************/
fprintf( pTable, "%d ", Saig_ManRegNum(pTemp) );
int
Aig_ManHaigVerify
(
Aig_Man_t
*
pAig
,
Aig_Man_t
*
pHaig
,
int
nFrames
)
fprintf( pTable, "%d ", Aig_ManNodeNum(pTemp) );
{
fprintf( pTable, "%d ", Aig_ManLevelNum(pTemp) );
int
nBTLimit
=
0
;
Aig_Man_t
*
pFrames
,
*
pTemp
;
Cnf_Dat_t
*
pCnf
;
sat_solver
*
pSat
;
Aig_Obj_t
*
pObj1
,
*
pObj2
;
int
i
,
RetValue1
,
RetValue2
,
Counter
,
Lits
[
2
],
nOvers
;
int
clk
=
clock
();
nOvers
=
Aig_ManMapHaigNodes
(
pHaig
);
fprintf( pTable, "%d ", Saig_ManRegNum(pHaig) );
fprintf( pTable, "%d ", Aig_ManNodeNum(pHaig) );
fprintf( pTable, "%d ", Aig_ManLevelNum(pHaig) );
fprintf( pTable, "\n" );
fclose( pTable );
// if ( nFrames == 2 )
// Aig_ManHaigVerifyComb( pHaig );
// create time frames with speculative reduction and convert them into CNF
pTable = fopen( "stats2.txt", "a+" );
clk
=
clock
(
);
fprintf( pTable, "%s ", p->pSpec
);
pFrames
=
Aig_ManHaigFrames
(
pHaig
,
nFrames
);
fprintf( pTable, "%d ", Aig_ManNodeNum(pFrames)
);
Aig_ManCleanMarkA
(
pHaig
);
fprintf( pTable, "%d ", Aig_ManLevelNum(pFrames)
);
printf
(
"Frames: "
);
fprintf( pTable, "%d ", pCnf->nVars );
Aig_ManPrintStats
(
pFrames
);
fprintf( pTable, "%d ", pCnf->nClauses );
fprintf( pTable, "%d ", pCnf->nLiterals );
pFrames
=
Dar_ManRwsat
(
pTemp
=
pFrames
,
1
,
0
);
fprintf( pTable, "%d ", Aig_ManPoNum(pFrames)/2 - pFrames->nAsserts/2 );
Aig_ManStop
(
pTemp
);
fprintf( pTable, "%d ", pFrames->nAsserts/2 );
fprintf( pTable, "%d ", Vec_IntSize(pHaig->vEquPairs)/2 );
fprintf( pTable, "\n" );
fclose( pTable );
printf
(
"Frames synt:"
);
Aig_ManStop( pTemp );
Aig_ManPrintStats
(
pFrames
);
}
*/
printf
(
"Additional frames stats: Assumptions = %d. Assertions = %d. Pairs = %d. Over = %d.
\n
"
,
Aig_ManPoNum
(
pFrames
)
/
2
-
pFrames
->
nAsserts
/
2
,
pFrames
->
nAsserts
/
2
,
Vec_IntSize
(
pHaig
->
vEquPairs
)
/
2
,
nOvers
);
// pCnf = Cnf_DeriveSimple( pFrames, Aig_ManPoNum(pFrames) );
pCnf
=
Cnf_Derive
(
pFrames
,
Aig_ManPoNum
(
pFrames
)
);
// pCnf = Cnf_Derive( pFrames, Aig_ManPoNum(pFrames) - pFrames->nAsserts );
// pCnf = Cnf_Derive( pFrames, Aig_ManPoNum(pFrames) - pFrames->nAsserts );
//Cnf_DataWriteIntoFile( pCnf, "temp.cnf", 1 );
//Cnf_DataWriteIntoFile( pCnf, "temp.cnf", 1 );
...
@@ -478,7 +398,7 @@ PRT( "Solving ", clock() - clk );
...
@@ -478,7 +398,7 @@ PRT( "Solving ", clock() - clk );
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
int
Aig_ManHaigVerify2
(
Aig_Man_t
*
pAig
,
Aig_Man_t
*
pHaig
,
int
nFrames
)
int
Aig_ManHaigVerify2
(
Aig_Man_t
*
p
,
Aig_Man_t
*
p
Aig
,
Aig_Man_t
*
pHaig
,
int
nFrames
)
{
{
int
nBTLimit
=
0
;
int
nBTLimit
=
0
;
Cnf_Dat_t
*
pCnf
;
Cnf_Dat_t
*
pCnf
;
...
@@ -774,12 +694,12 @@ PRT( "Synthesis time ", clock() - clk );
...
@@ -774,12 +694,12 @@ PRT( "Synthesis time ", clock() - clk );
if
(
fUseCnf
)
if
(
fUseCnf
)
{
{
if
(
!
Aig_ManHaigVerify2
(
pNew
,
pNew
->
pManHaig
,
1
+
fSeqHaig
)
)
if
(
!
Aig_ManHaigVerify2
(
p
,
p
New
,
pNew
->
pManHaig
,
1
+
fSeqHaig
)
)
printf
(
"Constructing SAT solver has failed.
\n
"
);
printf
(
"Constructing SAT solver has failed.
\n
"
);
}
}
else
else
{
{
if
(
!
Aig_ManHaigVerify
(
pNew
,
pNew
->
pManHaig
,
1
+
fSeqHaig
)
)
if
(
!
Aig_ManHaigVerify
(
p
,
p
New
,
pNew
->
pManHaig
,
1
+
fSeqHaig
)
)
printf
(
"Constructing SAT solver has failed.
\n
"
);
printf
(
"Constructing SAT solver has failed.
\n
"
);
}
}
...
...
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