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
6f0b87dd
Commit
6f0b87dd
authored
Oct 15, 2011
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New abstraction code.
parent
e4bd4d54
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
209 additions
and
48 deletions
+209
-48
src/aig/gia/gia.h
+2
-0
src/aig/gia/giaAbs.c
+36
-0
src/aig/gia/giaAig.c
+1
-0
src/aig/gia/giaDup.c
+88
-29
src/aig/gia/giaMan.c
+38
-8
src/aig/saig/saigAbsGla.c
+0
-0
src/base/abci/abc.c
+12
-11
src/misc/vec/vecInt.h
+30
-0
src/sat/bsat/satSolver.c
+2
-0
No files found.
src/aig/gia/gia.h
View file @
6f0b87dd
...
...
@@ -603,6 +603,7 @@ Gia_Man_t * Gia_ManCexAbstractionDerive( Gia_Man_t * pGia );
int
Gia_ManCexAbstractionRefine
(
Gia_Man_t
*
pGia
,
Abc_Cex_t
*
pCex
,
int
nFfToAddMax
,
int
fTryFour
,
int
fSensePath
,
int
fVerbose
);
extern
int
Gia_ManPbaPerform
(
Gia_Man_t
*
pGia
,
int
nStart
,
int
nFrames
,
int
nConfLimit
,
int
nTimeLimit
,
int
fVerbose
,
int
*
piFrame
);
extern
int
Gia_ManCbaPerform
(
Gia_Man_t
*
pGia
,
void
*
pPars
);
extern
int
Gia_ManGlaCbaPerform
(
Gia_Man_t
*
pGia
,
void
*
pPars
);
/*=== giaAiger.c ===========================================================*/
extern
int
Gia_FileSize
(
char
*
pFileName
);
extern
Gia_Man_t
*
Gia_ReadAigerFromMemory
(
char
*
pContents
,
int
nFileSize
,
int
fCheck
);
...
...
@@ -659,6 +660,7 @@ extern Gia_Man_t * Gia_ManChoiceMiter( Vec_Ptr_t * vGias );
extern
Gia_Man_t
*
Gia_ManDupWithConstraints
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vPoTypes
);
extern
Gia_Man_t
*
Gia_ManDupAbsFlops
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vFlopClasses
);
extern
Gia_Man_t
*
Gia_ManDupAbsGates
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vGateClasses
);
extern
Vec_Int_t
*
Gia_GlaCollectAssigned
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vGateClasses
);
/*=== giaEnable.c ==========================================================*/
extern
void
Gia_ManDetectSeqSignals
(
Gia_Man_t
*
p
,
int
fSetReset
,
int
fVerbose
);
extern
Gia_Man_t
*
Gia_ManUnrollAndCofactor
(
Gia_Man_t
*
p
,
int
nFrames
,
int
nFanMax
,
int
fVerbose
);
...
...
src/aig/gia/giaAbs.c
View file @
6f0b87dd
...
...
@@ -366,6 +366,42 @@ int Gia_ManPbaPerform( Gia_Man_t * pGia, int nStart, int nFrames, int nConfLimit
}
/**Function*************************************************************
Synopsis [Derive unrolled timeframes.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Gia_ManGlaCbaPerform
(
Gia_Man_t
*
pGia
,
void
*
pPars
)
{
extern
Vec_Int_t
*
Aig_GlaManTest
(
Aig_Man_t
*
pAig
,
int
nFramesMax
,
int
nConfLimit
,
int
TimeLimit
,
int
fVerbose
);
Saig_ParBmc_t
*
p
=
(
Saig_ParBmc_t
*
)
pPars
;
Vec_Int_t
*
vGateClasses
;
Aig_Man_t
*
pAig
;
/*
// check if flop classes are given
if ( pGia->vGateClasses == NULL )
{
Abc_Print( 0, "Initial gate map is not given. Trivial abstraction is assumed.\n" );
pGia->vGateClasses = Vec_IntStart( Gia_ManObjNum(pGia) );
}
*/
// perform abstraction
pAig
=
Gia_ManToAigSimple
(
pGia
);
vGateClasses
=
Aig_GlaManTest
(
pAig
,
p
->
nFramesMax
,
p
->
nConfLimit
,
p
->
nTimeOut
,
p
->
fVerbose
);
Aig_ManStop
(
pAig
);
// update the map
Vec_IntFreeP
(
&
pGia
->
vGateClasses
);
pGia
->
vGateClasses
=
vGateClasses
;
return
1
;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...
...
src/aig/gia/giaAig.c
View file @
6f0b87dd
...
...
@@ -350,6 +350,7 @@ Aig_Man_t * Gia_ManToAigSimple( Gia_Man_t * p )
else
assert
(
0
);
pObj
->
Value
=
Gia_Var2Lit
(
Aig_ObjId
(
Aig_Regular
(
ppNodes
[
i
])),
Aig_IsComplement
(
ppNodes
[
i
])
);
assert
(
i
==
0
||
Aig_ObjId
(
ppNodes
[
i
])
==
i
);
}
Aig_ManSetRegNum
(
pNew
,
Gia_ManRegNum
(
p
)
);
ABC_FREE
(
ppNodes
);
...
...
src/aig/gia/giaDup.c
View file @
6f0b87dd
...
...
@@ -1586,8 +1586,8 @@ Gia_Man_t * Gia_ManDupAbsFlops( Gia_Man_t * p, Vec_Int_t * vFlopClasses )
Synopsis [Performs abstraction of the AIG to preserve the included gates.]
Description [The array contains
PIs, LOs, and internal nodes included.
0=unsed, 1=PI, 2=PPI, 3=FF, 4=AND
.]
Description [The array contains
1 for those objects (const, RO, AND)
that are included in the abstraction; 0, otherwise
.]
SideEffects []
...
...
@@ -1596,51 +1596,110 @@ Gia_Man_t * Gia_ManDupAbsFlops( Gia_Man_t * p, Vec_Int_t * vFlopClasses )
***********************************************************************/
Gia_Man_t
*
Gia_ManDupAbsGates
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vGateClasses
)
{
Vec_Int_t
*
vAssigned
,
*
vPis
,
*
vPPis
,
*
vFlops
,
*
vNodes
;
Gia_Man_t
*
pNew
,
*
pTemp
;
Gia_Obj_t
*
pObj
;
int
i
,
nFlops
=
0
;
assert
(
Gia_ManPoNum
(
p
)
==
1
);
Gia_ManFillValue
(
p
);
assert
(
Vec_IntSize
(
vGateClasses
)
==
Gia_ManObjNum
(
p
)
);
// create included objects and their fanins
vAssigned
=
Gia_GlaCollectAssigned
(
p
,
vGateClasses
);
// create additional arrays
vPis
=
Vec_IntAlloc
(
1000
);
vPPis
=
Vec_IntAlloc
(
1000
);
vFlops
=
Vec_IntAlloc
(
1000
);
vNodes
=
Vec_IntAlloc
(
1000
);
Gia_ManForEachObjVec
(
vAssigned
,
p
,
pObj
,
i
)
{
if
(
Gia_ObjIsPi
(
p
,
pObj
)
)
Vec_IntPush
(
vPis
,
Gia_ObjId
(
p
,
pObj
)
);
else
if
(
!
Vec_IntEntry
(
vGateClasses
,
Gia_ObjId
(
p
,
pObj
))
)
Vec_IntPush
(
vPPis
,
Gia_ObjId
(
p
,
pObj
)
);
else
if
(
Gia_ObjIsAnd
(
pObj
)
)
Vec_IntPush
(
vNodes
,
Gia_ObjId
(
p
,
pObj
)
);
else
if
(
Gia_ObjIsRo
(
p
,
pObj
)
)
Vec_IntPush
(
vFlops
,
Gia_ObjId
(
p
,
pObj
)
);
else
assert
(
Gia_ObjIsConst0
(
pObj
)
);
}
// start the new manager
pNew
=
Gia_ManStart
(
5000
);
pNew
->
pName
=
Gia_UtilStrsav
(
p
->
pName
);
// create PIs
// create constant
Gia_ManFillValue
(
p
);
Gia_ManConst0
(
p
)
->
Value
=
0
;
Gia_ManForEachPi
(
p
,
pObj
,
i
)
if
(
Vec_IntEntry
(
vGateClasses
,
Gia_ObjId
(
p
,
pObj
))
==
1
)
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
// create PIs
Gia_ManForEachObjVec
(
vPis
,
p
,
pObj
,
i
)
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
// create additional PIs
Gia_ManForEachPi
(
p
,
pObj
,
i
)
if
(
Vec_IntEntry
(
vGateClasses
,
Gia_ObjId
(
p
,
pObj
))
==
2
)
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
Gia_ManForEachObjVec
(
vPPis
,
p
,
pObj
,
i
)
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
// create ROs
Gia_ManForEachRo
(
p
,
pObj
,
i
)
if
(
Vec_IntEntry
(
vGateClasses
,
Gia_ObjId
(
p
,
pObj
))
==
3
)
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
// create POs
Gia_ManHashAlloc
(
pNew
);
Gia_ManForEachObjVec
(
vFlops
,
p
,
pObj
,
i
)
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
// create internal nodes
Gia_ManForEachObjVec
(
vNodes
,
p
,
pObj
,
i
)
pObj
->
Value
=
Gia_ManAppendAnd
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
// create PO
Gia_ManForEachPo
(
p
,
pObj
,
i
)
{
Gia_ManDupAbsFlops_rec
(
pNew
,
Gia_ObjFanin0
(
pObj
)
);
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
}
pObj
->
Value
=
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
// create RIs
Gia_ManForEachRo
(
p
,
pObj
,
i
)
if
(
Vec_IntEntry
(
vGateClasses
,
Gia_ObjId
(
p
,
pObj
))
==
3
)
{
pObj
=
Gia_ObjRoToRi
(
p
,
pObj
);
Gia_ManDupAbsFlops_rec
(
pNew
,
Gia_ObjFanin0
(
pObj
)
);
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
nFlops
++
;
}
Gia_ManHashStop
(
pNew
);
Gia_ManSetRegNum
(
pNew
,
nFlops
);
Gia_ManForEachObjVec
(
vFlops
,
p
,
pObj
,
i
)
Gia_ObjRoToRi
(
p
,
pObj
)
->
Value
=
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
Gia_ObjRoToRi
(
p
,
pObj
))
);
Gia_ManSetRegNum
(
pNew
,
Vec_IntSize
(
vFlops
)
);
// clean up
pNew
=
Gia_ManSeqCleanup
(
pTemp
=
pNew
);
assert
(
Gia_ManObjNum
(
pTemp
)
==
Gia_ManObjNum
(
pNew
)
);
Gia_ManStop
(
pTemp
);
Vec_IntFree
(
vPis
);
Vec_IntFree
(
vPPis
);
Vec_IntFree
(
vFlops
);
Vec_IntFree
(
vNodes
);
Vec_IntFree
(
vAssigned
);
return
pNew
;
}
/**Function*************************************************************
Synopsis [Returns the array of neighbors.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Int_t
*
Gia_GlaCollectAssigned
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vGateClasses
)
{
Vec_Int_t
*
vAssigned
;
Gia_Obj_t
*
pObj
;
int
i
,
Entry
;
vAssigned
=
Vec_IntAlloc
(
1000
);
Vec_IntForEachEntry
(
vGateClasses
,
Entry
,
i
)
{
if
(
Entry
==
0
)
continue
;
assert
(
Entry
==
1
);
pObj
=
Gia_ManObj
(
p
,
i
);
Vec_IntPush
(
vAssigned
,
Gia_ObjId
(
p
,
pObj
)
);
if
(
Gia_ObjIsAnd
(
pObj
)
)
{
Vec_IntPush
(
vAssigned
,
Gia_ObjFaninId0p
(
p
,
pObj
)
);
Vec_IntPush
(
vAssigned
,
Gia_ObjFaninId1p
(
p
,
pObj
)
);
}
else
if
(
Gia_ObjIsRo
(
p
,
pObj
)
)
Vec_IntPush
(
vAssigned
,
Gia_ObjFaninId0p
(
p
,
Gia_ObjRoToRi
(
p
,
pObj
))
);
else
assert
(
Gia_ObjIsConst0
(
pObj
)
);
}
Vec_IntUniqify
(
vAssigned
);
return
vAssigned
;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...
...
src/aig/gia/giaMan.c
View file @
6f0b87dd
...
...
@@ -179,7 +179,8 @@ void Gia_ManPrintFlopClasses( Gia_Man_t * p )
}
Counter0
=
Vec_IntCountEntry
(
p
->
vFlopClasses
,
0
);
Counter1
=
Vec_IntCountEntry
(
p
->
vFlopClasses
,
1
);
printf
(
"Flop-level abstraction: Excluded FFs = %d Included FFs = %d "
,
Counter0
,
Counter1
);
printf
(
"Flop-level abstraction: Excluded FFs = %d Included FFs = %d (%.2f %%) "
,
Counter0
,
Counter1
,
100
.
0
*
Counter1
/
(
Counter0
+
Counter1
+
1
)
);
if
(
Counter0
+
Counter1
<
Gia_ManRegNum
(
p
)
)
printf
(
"and there are other FF classes..."
);
printf
(
"
\n
"
);
...
...
@@ -198,7 +199,10 @@ void Gia_ManPrintFlopClasses( Gia_Man_t * p )
***********************************************************************/
void
Gia_ManPrintGateClasses
(
Gia_Man_t
*
p
)
{
int
i
,
Counter
[
5
];
Vec_Int_t
*
vAssigned
,
*
vPis
,
*
vPPis
,
*
vFlops
,
*
vNodes
;
Gia_Obj_t
*
pObj
;
int
i
;
if
(
p
->
vGateClasses
==
NULL
)
return
;
if
(
Vec_IntSize
(
p
->
vGateClasses
)
!=
Gia_ManObjNum
(
p
)
)
...
...
@@ -206,12 +210,38 @@ void Gia_ManPrintGateClasses( Gia_Man_t * p )
printf
(
"Gia_ManPrintGateClasses(): The number of flop map entries differs from the number of flops.
\n
"
);
return
;
}
for
(
i
=
0
;
i
<
5
;
i
++
)
Counter
[
i
]
=
Vec_IntCountEntry
(
p
->
vGateClasses
,
i
);
printf
(
"Gate-level abstraction: PI = %d PPI = %d FF = %d AND = %d Unused = %d
\n
"
,
Counter
[
1
],
Counter
[
2
],
Counter
[
3
],
Counter
[
4
],
Counter
[
0
]
);
if
(
Counter
[
0
]
+
Counter
[
1
]
+
Counter
[
2
]
+
Counter
[
3
]
+
Counter
[
4
]
!=
Gia_ManObjNum
(
p
)
)
printf
(
"Gia_ManPrintGateClasses(): Mismatch in the object count.
\n
"
);
// create included objects and their fanins
vAssigned
=
Gia_GlaCollectAssigned
(
p
,
p
->
vGateClasses
);
// create additional arrays
vPis
=
Vec_IntAlloc
(
1000
);
vPPis
=
Vec_IntAlloc
(
1000
);
vFlops
=
Vec_IntAlloc
(
1000
);
vNodes
=
Vec_IntAlloc
(
1000
);
Gia_ManForEachObjVec
(
vAssigned
,
p
,
pObj
,
i
)
{
if
(
Gia_ObjIsPi
(
p
,
pObj
)
)
Vec_IntPush
(
vPis
,
Gia_ObjId
(
p
,
pObj
)
);
else
if
(
!
Vec_IntEntry
(
p
->
vGateClasses
,
Gia_ObjId
(
p
,
pObj
))
)
Vec_IntPush
(
vPPis
,
Gia_ObjId
(
p
,
pObj
)
);
else
if
(
Gia_ObjIsAnd
(
pObj
)
)
Vec_IntPush
(
vNodes
,
Gia_ObjId
(
p
,
pObj
)
);
else
if
(
Gia_ObjIsRo
(
p
,
pObj
)
)
Vec_IntPush
(
vFlops
,
Gia_ObjId
(
p
,
pObj
)
);
else
assert
(
Gia_ObjIsConst0
(
pObj
)
);
}
printf
(
"Gate-level abstraction: PI = %d PPI = %d FF = %d (%.2f %%) AND = %d (%.2f %%)
\n
"
,
Vec_IntSize
(
vPis
),
Vec_IntSize
(
vPPis
),
Vec_IntSize
(
vFlops
),
100
.
0
*
Vec_IntSize
(
vFlops
)
/
(
Gia_ManRegNum
(
p
)
+
1
),
Vec_IntSize
(
vNodes
),
100
.
0
*
Vec_IntSize
(
vNodes
)
/
(
Gia_ManAndNum
(
p
)
+
1
)
);
Vec_IntFree
(
vPis
);
Vec_IntFree
(
vPPis
);
Vec_IntFree
(
vFlops
);
Vec_IntFree
(
vNodes
);
Vec_IntFree
(
vAssigned
);
}
/**Function*************************************************************
...
...
src/aig/saig/saigAbsGla.c
View file @
6f0b87dd
This diff is collapsed.
Click to expand it.
src/base/abci/abc.c
View file @
6f0b87dd
...
...
@@ -28858,12 +28858,12 @@ int Abc_CommandAbc9GlaDerive( Abc_Frame_t * pAbc, int argc, char ** argv )
*/
if
(
pAbc
->
pGia
->
vGateClasses
==
NULL
)
{
Abc_Print
(
-
1
,
"Abstraction
flop
map is missing.
\n
"
);
Abc_Print
(
-
1
,
"Abstraction
gate
map is missing.
\n
"
);
return
0
;
}
//
pTemp = Gia_ManDupAbsGates( pAbc->pGia, pAbc->pGia->vGateClasses );
//
Abc_CommandUpdate9( pAbc, pTemp );
printf
(
"This command is currently not enabled.
\n
"
);
pTemp
=
Gia_ManDupAbsGates
(
pAbc
->
pGia
,
pAbc
->
pGia
->
vGateClasses
);
Abc_CommandUpdate9
(
pAbc
,
pTemp
);
//
printf( "This command is currently not enabled.\n" );
return
0
;
usage:
...
...
@@ -28890,8 +28890,9 @@ int Abc_CommandAbc9GlaCba( Abc_Frame_t * pAbc, int argc, char ** argv )
Saig_ParBmc_t
Pars
,
*
pPars
=
&
Pars
;
int
c
;
Saig_ParBmcSetDefaultParams
(
pPars
);
pPars
->
nStart
=
0
;
//(pAbc->nFrames >= 0) ? pAbc->nFrames : 0;
pPars
->
nFramesMax
=
pPars
->
nStart
+
10
;
pPars
->
nStart
=
0
;
//(pAbc->nFrames >= 0) ? pAbc->nFrames : 0;
pPars
->
nFramesMax
=
50
;
//pPars->nStart + 10;
pPars
->
nConfLimit
=
5000
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"SFCMTvh"
)
)
!=
EOF
)
{
...
...
@@ -28971,11 +28972,11 @@ int Abc_CommandAbc9GlaCba( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print
(
-
1
,
"The network is combinational.
\n
"
);
return
0
;
}
// pAbc->Status = Gia_Man
CbaPerform( pAbc->pGia, pPars );
//
if ( pPars->nStart == 0 )
//
pAbc->nFrames = pPars->iFrame;
//
Abc_FrameReplaceCex( pAbc, &pAbc->pGia->pCexSeq );
printf
(
"This command is currently not enabled.
\n
"
);
pAbc
->
Status
=
Gia_ManGla
CbaPerform
(
pAbc
->
pGia
,
pPars
);
if
(
pPars
->
nStart
==
0
)
pAbc
->
nFrames
=
pPars
->
iFrame
;
Abc_FrameReplaceCex
(
pAbc
,
&
pAbc
->
pGia
->
pCexSeq
);
//
printf( "This command is currently not enabled.\n" );
return
0
;
usage:
...
...
src/misc/vec/vecInt.h
View file @
6f0b87dd
...
...
@@ -657,6 +657,36 @@ static inline void Vec_IntPushOrder( Vec_Int_t * p, int Entry )
SeeAlso []
***********************************************************************/
static
inline
void
Vec_IntPushOrderReverse
(
Vec_Int_t
*
p
,
int
Entry
)
{
int
i
;
if
(
p
->
nSize
==
p
->
nCap
)
{
if
(
p
->
nCap
<
16
)
Vec_IntGrow
(
p
,
16
);
else
Vec_IntGrow
(
p
,
2
*
p
->
nCap
);
}
p
->
nSize
++
;
for
(
i
=
p
->
nSize
-
2
;
i
>=
0
;
i
--
)
if
(
p
->
pArray
[
i
]
<
Entry
)
p
->
pArray
[
i
+
1
]
=
p
->
pArray
[
i
];
else
break
;
p
->
pArray
[
i
+
1
]
=
Entry
;
}
/**Function*************************************************************
Synopsis [Inserts the entry while preserving the increasing order.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
int
Vec_IntPushUniqueOrder
(
Vec_Int_t
*
p
,
int
Entry
)
{
int
i
;
...
...
src/sat/bsat/satSolver.c
View file @
6f0b87dd
...
...
@@ -1485,6 +1485,8 @@ int sat_solver_solve(sat_solver* s, lit* begin, lit* end, ABC_INT64_T nConfLimit
// int nConfs = 0;
double
Ratio
=
(
s
->
stats
.
learnts
==
0
)
?
0
.
0
:
s
->
stats
.
learnts_literals
/
(
double
)
s
->
stats
.
learnts
;
if
(
s
->
nRuntimeLimit
&&
clock
()
>
s
->
nRuntimeLimit
)
break
;
if
(
s
->
verbosity
>=
1
)
{
...
...
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