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
a8d75dcc
Commit
a8d75dcc
authored
Jul 10, 2007
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Version abc70710
parent
39bc4842
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
234 additions
and
52 deletions
+234
-52
abc.rc
+4
-3
src/aig/dar/darCore.c
+0
-4
src/aig/dar/darMan.c
+2
-2
src/aig/dar/module.make
+2
-0
src/aig/fra/fra.h
+5
-3
src/aig/fra/fraAnd.c
+11
-7
src/aig/fra/fraClass.c
+0
-0
src/aig/fra/fraCnf.c
+1
-0
src/aig/fra/fraMan.c
+36
-10
src/aig/fra/fraSim.c
+9
-5
src/aig/ivy/ivyFraig.c
+7
-1
src/base/abc/abcUtil.c
+2
-1
src/base/abci/abc.c
+95
-4
src/base/abci/abcDar.c
+32
-0
src/opt/kit/kitGraph.c
+2
-0
src/opt/lpk/lpkCore.c
+5
-3
src/opt/lpk/lpkCut.c
+13
-1
src/opt/lpk/lpkMan.c
+1
-1
src/opt/lpk/module.make
+7
-7
No files found.
abc.rc
View file @
a8d75dcc
...
...
@@ -160,8 +160,9 @@ alias tst6 "r i10_if6.blif; st; ps; r x/rec6_16_.blif; st; rec_start; r i10_
#alias t "r c.blif; st; wc c.cnf"
#alias t "r test/dsdmap6.blif; lutpack -vw; cec"
alias t "r i10_if4.blif; lp"
alias t1 "r pj1_if4.blif; lp"
alias t2 "r pj1_if6.blif; lp"
#alias t "r i10_if4.blif; lp"
#alias t1 "r pj1_if4.blif; lp"
#alias t2 "r pj1_if6.blif; lp"
alias t "r pj/pj1.blif; st; dfraig -v"
src/aig/dar/darCore.c
View file @
a8d75dcc
...
...
@@ -64,10 +64,6 @@ int Dar_ManRewrite( Dar_Man_t * p )
continue
;
if
(
i
>
nNodesOld
)
break
;
if
(
pObj
->
Id
==
654
)
{
int
x
=
0
;
}
// compute cuts for the node
clk
=
clock
();
pCutSet
=
Dar_ObjComputeCuts_rec
(
p
,
pObj
);
...
...
src/aig/dar/darMan.c
View file @
a8d75dcc
...
...
@@ -94,7 +94,7 @@ Dar_Man_t * Dar_ManStartFrom( Dar_Man_t * p )
Dar_Obj_t
*
pObj
;
int
i
;
// create the new manager
pNew
=
Dar_ManStart
();
pNew
=
Dar_ManStart
(
Dar_ManObjIdMax
(
p
)
+
1
);
// create the PIs
Dar_ManConst1
(
p
)
->
pData
=
Dar_ManConst1
(
pNew
);
Dar_ManForEachPi
(
p
,
pObj
,
i
)
...
...
@@ -119,7 +119,7 @@ Dar_Man_t * Dar_ManDup( Dar_Man_t * p )
Dar_Obj_t
*
pObj
;
int
i
;
// create the new manager
pNew
=
Dar_ManStart
();
pNew
=
Dar_ManStart
(
Dar_ManObjIdMax
(
p
)
+
1
);
// create the PIs
Dar_ManConst1
(
p
)
->
pData
=
Dar_ManConst1
(
pNew
);
Dar_ManForEachPi
(
p
,
pObj
,
i
)
...
...
src/aig/dar/module.make
View file @
a8d75dcc
...
...
@@ -9,5 +9,7 @@ SRC += src/aig/dar/darBalance.c \
src/aig/dar/darMem.c
\
src/aig/dar/darObj.c
\
src/aig/dar/darOper.c
\
src/aig/dar/darSeq.c
\
src/aig/dar/darTable.c
\
src/aig/dar/darTruth.c
\
src/aig/dar/darUtil.c
src/aig/fra/fra.h
View file @
a8d75dcc
...
...
@@ -142,14 +142,14 @@ static inline Dar_Obj_t * Fra_ObjRepr( Dar_Obj_t * pObj )
static
inline
Vec_Ptr_t
*
Fra_ObjFaninVec
(
Dar_Obj_t
*
pObj
)
{
return
((
Fra_Man_t
*
)
pObj
->
pData
)
->
pMemFanins
[
pObj
->
Id
];
}
static
inline
int
Fra_ObjSatNum
(
Dar_Obj_t
*
pObj
)
{
return
((
Fra_Man_t
*
)
pObj
->
pData
)
->
pMemSatNums
[
pObj
->
Id
];
}
static
inline
Dar_Obj_t
*
Fra_ObjChild0Fra
(
Dar_Obj_t
*
pObj
)
{
assert
(
!
Dar_IsComplement
(
pObj
)
);
return
Dar_ObjFanin0
(
pObj
)?
Dar_NotCond
(
Fra_ObjFraig
(
Dar_ObjFanin0
(
pObj
)),
Dar_ObjFaninC0
(
pObj
))
:
NULL
;
}
static
inline
Dar_Obj_t
*
Fra_ObjChild1Fra
(
Dar_Obj_t
*
pObj
)
{
assert
(
!
Dar_IsComplement
(
pObj
)
);
return
Dar_ObjFanin1
(
pObj
)?
Dar_NotCond
(
Fra_ObjFraig
(
Dar_ObjFanin1
(
pObj
)),
Dar_ObjFaninC1
(
pObj
))
:
NULL
;
}
static
inline
void
Fra_ObjSetFraig
(
Dar_Obj_t
*
pObj
,
Dar_Obj_t
*
pNode
)
{
((
Fra_Man_t
*
)
pObj
->
pData
)
->
pMemFraig
[
pObj
->
Id
]
=
pNode
;
}
static
inline
void
Fra_ObjSetRepr
(
Dar_Obj_t
*
pObj
,
Dar_Obj_t
*
pNode
)
{
((
Fra_Man_t
*
)
pObj
->
pData
)
->
pMemRepr
[
pObj
->
Id
]
=
pNode
;
}
static
inline
void
Fra_ObjSetFaninVec
(
Dar_Obj_t
*
pObj
,
Vec_Ptr_t
*
vFanins
)
{
((
Fra_Man_t
*
)
pObj
->
pData
)
->
pMemFanins
[
pObj
->
Id
]
=
vFanins
;
}
static
inline
void
Fra_ObjSetSatNum
(
Dar_Obj_t
*
pObj
,
int
Num
)
{
((
Fra_Man_t
*
)
pObj
->
pData
)
->
pMemSatNums
[
pObj
->
Id
]
=
Num
;
}
static
inline
Dar_Obj_t
*
Fra_ObjChild0Fra
(
Dar_Obj_t
*
pObj
)
{
assert
(
!
Dar_IsComplement
(
pObj
)
);
return
Dar_ObjFanin0
(
pObj
)?
Dar_NotCond
(
Fra_ObjFraig
(
Dar_ObjFanin0
(
pObj
)),
Dar_ObjFaninC0
(
pObj
))
:
NULL
;
}
static
inline
Dar_Obj_t
*
Fra_ObjChild1Fra
(
Dar_Obj_t
*
pObj
)
{
assert
(
!
Dar_IsComplement
(
pObj
)
);
return
Dar_ObjFanin1
(
pObj
)?
Dar_NotCond
(
Fra_ObjFraig
(
Dar_ObjFanin1
(
pObj
)),
Dar_ObjFaninC1
(
pObj
))
:
NULL
;
}
////////////////////////////////////////////////////////////////////////
/// ITERATORS ///
////////////////////////////////////////////////////////////////////////
...
...
@@ -161,6 +161,7 @@ static inline void Fra_ObjSetSatNum( Dar_Obj_t * pObj, int Num )
/*=== fraAnd.c ========================================================*/
extern
void
Fra_Sweep
(
Fra_Man_t
*
p
);
/*=== fraClass.c ========================================================*/
extern
void
Fra_PrintClasses
(
Fra_Man_t
*
p
);
extern
void
Fra_CreateClasses
(
Fra_Man_t
*
p
);
extern
int
Fra_RefineClasses
(
Fra_Man_t
*
p
);
extern
int
Fra_RefineClasses1
(
Fra_Man_t
*
p
);
...
...
@@ -171,6 +172,7 @@ extern Dar_Man_t * Fra_Perform( Dar_Man_t * pManAig, Fra_Par_t * pParams
/*=== fraMan.c ========================================================*/
extern
void
Fra_ParamsDefault
(
Fra_Par_t
*
pParams
);
extern
Fra_Man_t
*
Fra_ManStart
(
Dar_Man_t
*
pManAig
,
Fra_Par_t
*
pParams
);
extern
void
Fra_ManPrepare
(
Fra_Man_t
*
p
);
extern
void
Fra_ManStop
(
Fra_Man_t
*
p
);
extern
void
Fra_ManPrint
(
Fra_Man_t
*
p
);
/*=== fraSat.c ========================================================*/
...
...
src/aig/fra/fraAnd.c
View file @
a8d75dcc
...
...
@@ -51,14 +51,15 @@ Dar_Obj_t * Fra_And( Fra_Man_t * p, Dar_Obj_t * pObjOld )
pFanin1Fraig
=
Fra_ObjChild1Fra
(
pObjOld
);
// get the fraiged node
pObjFraig
=
Dar_And
(
p
->
pManFraig
,
pFanin0Fraig
,
pFanin1Fraig
);
Dar_Regular
(
pObjFraig
)
->
pData
=
p
;
// get representative of this class
pObjOldRepr
=
Fra_ObjRepr
(
pObjOld
);
if
(
pObjOldRepr
==
NULL
||
// this is a unique node
(
!
p
->
pPars
->
fDoSparse
&&
pObjOldRepr
==
Dar_ManConst1
(
p
->
pManAig
))
)
// this is a sparse node
{
assert
(
Dar_Regular
(
pFanin0Fraig
)
!=
Dar_Regular
(
pFanin1Fraig
)
);
assert
(
pObjFraig
!=
Dar_Regular
(
pFanin0Fraig
)
);
assert
(
pObjFraig
!=
Dar_Regular
(
pFanin1Fraig
)
);
assert
(
Dar_Regular
(
pObjFraig
)
!=
Dar_Regular
(
pFanin0Fraig
)
);
assert
(
Dar_Regular
(
pObjFraig
)
!=
Dar_Regular
(
pFanin1Fraig
)
);
return
pObjFraig
;
}
// get the fraiged representative
...
...
@@ -67,11 +68,13 @@ Dar_Obj_t * Fra_And( Fra_Man_t * p, Dar_Obj_t * pObjOld )
if
(
Dar_Regular
(
pObjFraig
)
==
Dar_Regular
(
pObjOldReprFraig
)
)
return
pObjFraig
;
assert
(
Dar_Regular
(
pObjFraig
)
!=
Dar_ManConst1
(
p
->
pManFraig
)
);
// printf( "Node = %d. Repr = %d.\n", pObjOld->Id, pObjOldRepr->Id );
// if they are proved different, the c-ex will be in p->pPatWords
RetValue
=
Fra_NodesAreEquiv
(
p
,
Dar_Regular
(
pObjOldReprFraig
),
Dar_Regular
(
pObjFraig
)
);
if
(
RetValue
==
1
)
// proved equivalent
{
pObjOld
->
fMarkA
=
1
;
//
pObjOld->fMarkA = 1;
return
Dar_NotCond
(
pObjOldReprFraig
,
pObjOld
->
fPhase
^
pObjOldRepr
->
fPhase
);
}
if
(
RetValue
==
-
1
)
// failed
...
...
@@ -79,11 +82,12 @@ Dar_Obj_t * Fra_And( Fra_Man_t * p, Dar_Obj_t * pObjOld )
if
(
!
p
->
pPars
->
fSpeculate
)
return
pObjFraig
;
// substitute the node
pObjOld
->
fMarkB
=
1
;
//
pObjOld->fMarkB = 1;
return
Dar_NotCond
(
pObjOldReprFraig
,
pObjOld
->
fPhase
^
pObjOldRepr
->
fPhase
);
}
// simulate the counter-example and return the Fraig node
Fra_Resimulate
(
p
);
assert
(
Fra_ObjRepr
(
pObjOld
)
!=
pObjOldRepr
);
return
pObjFraig
;
}
...
...
@@ -103,7 +107,7 @@ void Fra_Sweep( Fra_Man_t * p )
Dar_Obj_t
*
pObj
,
*
pObjNew
;
int
i
,
k
=
0
;
p
->
nClassesZero
=
Vec_PtrSize
(
p
->
vClasses1
);
p
->
nClassesBeg
=
Vec_PtrSize
(
p
->
vClasses
);
p
->
nClassesBeg
=
Vec_PtrSize
(
p
->
vClasses
)
+
(
int
)(
Vec_PtrSize
(
p
->
vClasses1
)
>
0
)
;
// duplicate internal nodes
// p->pProgress = Extra_ProgressBarStart( stdout, Dar_ManNodeNum(p->pManAig) );
Dar_ManForEachNode
(
p
->
pManAig
,
pObj
,
i
)
...
...
@@ -114,11 +118,11 @@ p->nClassesBeg = Vec_PtrSize(p->vClasses);
pObjNew
=
Dar_And
(
p
->
pManFraig
,
Fra_ObjChild0Fra
(
pObj
),
Fra_ObjChild1Fra
(
pObj
)
);
else
pObjNew
=
Fra_And
(
p
,
pObj
);
// pObjNew can be complemented
assert
(
Fra_ObjFraig
(
pObj
)
!=
NULL
);
Fra_ObjSetFraig
(
pObj
,
pObjNew
);
assert
(
Fra_ObjFraig
(
pObj
)
!=
NULL
);
}
// Extra_ProgressBarStop( p->pProgress );
p
->
nClassesEnd
=
Vec_PtrSize
(
p
->
vClasses
);
p
->
nClassesEnd
=
Vec_PtrSize
(
p
->
vClasses
)
+
(
int
)(
Vec_PtrSize
(
p
->
vClasses1
)
>
0
)
;
// try to prove the outputs of the miter
p
->
nNodesMiter
=
Dar_ManNodeNum
(
p
->
pManFraig
);
// Fra_MiterStatus( p->pManFraig );
...
...
src/aig/fra/fraClass.c
View file @
a8d75dcc
This diff is collapsed.
Click to expand it.
src/aig/fra/fraCnf.c
View file @
a8d75dcc
...
...
@@ -209,6 +209,7 @@ Vec_Ptr_t * Fra_CollectSuper( Dar_Obj_t * pObj, int fUseMuxes )
***********************************************************************/
void
Fra_ObjAddToFrontier
(
Fra_Man_t
*
p
,
Dar_Obj_t
*
pObj
,
Vec_Ptr_t
*
vFrontier
)
{
Fra_Man_t
*
pTemp
=
pObj
->
pData
;
assert
(
!
Dar_IsComplement
(
pObj
)
);
if
(
Fra_ObjSatNum
(
pObj
)
)
return
;
...
...
src/aig/fra/fraMan.c
View file @
a8d75dcc
...
...
@@ -69,8 +69,6 @@ void Fra_ParamsDefault( Fra_Par_t * pPars )
Fra_Man_t
*
Fra_ManStart
(
Dar_Man_t
*
pManAig
,
Fra_Par_t
*
pPars
)
{
Fra_Man_t
*
p
;
Dar_Obj_t
*
pObj
;
int
i
;
// allocate the fraiging manager
p
=
ALLOC
(
Fra_Man_t
,
1
);
memset
(
p
,
0
,
sizeof
(
Fra_Man_t
)
);
...
...
@@ -82,13 +80,17 @@ Fra_Man_t * Fra_ManStart( Dar_Man_t * pManAig, Fra_Par_t * pPars )
p
->
nSimWords
=
pPars
->
nSimWords
;
p
->
pSimWords
=
ALLOC
(
unsigned
,
(
Dar_ManObjIdMax
(
pManAig
)
+
1
)
*
p
->
nSimWords
);
// clean simulation info of the constant node
memset
(
p
->
pSimWords
,
0
,
p
->
nSimWords
*
sizeof
(
unsigned
)
);
memset
(
p
->
pSimWords
,
0
,
sizeof
(
unsigned
)
*
((
Dar_ManPiNum
(
pManAig
)
+
1
)
*
p
->
nSimWords
)
);
// allocate storage for sim pattern
p
->
nPatWords
=
Dar_BitWordNum
(
Dar_ManPiNum
(
pManAig
)
);
p
->
pPatWords
=
ALLOC
(
unsigned
,
p
->
nPatWords
);
p
->
pPatScores
=
ALLOC
(
int
,
32
*
p
->
nSimWords
);
p
->
vPiVars
=
Vec_PtrAlloc
(
100
);
p
->
vClasses
=
Vec_PtrAlloc
(
100
);
p
->
vClasses1
=
Vec_PtrAlloc
(
100
);
p
->
vClassOld
=
Vec_PtrAlloc
(
100
);
p
->
vClassNew
=
Vec_PtrAlloc
(
100
);
p
->
vClassesTemp
=
Vec_PtrAlloc
(
100
);
// allocate other members
p
->
nSizeAlloc
=
Dar_ManObjIdMax
(
pManAig
)
+
1
;
p
->
pMemFraig
=
ALLOC
(
Dar_Obj_t
*
,
p
->
nSizeAlloc
);
...
...
@@ -98,17 +100,41 @@ Fra_Man_t * Fra_ManStart( Dar_Man_t * pManAig, Fra_Par_t * pPars )
p
->
pMemFanins
=
ALLOC
(
Vec_Ptr_t
*
,
p
->
nSizeAlloc
);
memset
(
p
->
pMemFanins
,
0
,
p
->
nSizeAlloc
*
sizeof
(
Vec_Ptr_t
*
)
);
p
->
pMemSatNums
=
ALLOC
(
int
,
p
->
nSizeAlloc
);
memset
(
p
->
pMemSatNums
,
0xff
,
p
->
nSizeAlloc
*
sizeof
(
int
)
);
memset
(
p
->
pMemSatNums
,
0
,
p
->
nSizeAlloc
*
sizeof
(
int
)
);
// set random number generator
srand
(
0xABCABC
);
// make sure the satisfying assignment is node assigned
assert
(
p
->
pManFraig
->
pData
==
NULL
);
// connect AIG managers to the FRAIG manager
Fra_ManPrepare
(
p
);
return
p
;
}
/**Function*************************************************************
Synopsis [Prepares managers by transfering pointers to the objects.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Fra_ManPrepare
(
Fra_Man_t
*
p
)
{
Dar_Obj_t
*
pObj
;
int
i
;
// set the pointers to the manager
Dar_ManForEachObj
(
p
->
pManFraig
,
pObj
,
i
)
pObj
->
pData
=
p
;
// set the pointer to the manager
Dar_ManForEachObj
(
p
->
pManAig
,
pObj
,
i
)
pObj
->
pData
=
p
;
// set the pointers to the available fraig nodes
Fra_ObjSetFraig
(
Dar_ManConst1
(
p
->
pManAig
),
Dar_ManConst1
(
p
->
pManFraig
)
);
Dar_ManForEachPi
(
p
->
pManAig
,
pObj
,
i
)
Fra_ObjSetFraig
(
pObj
,
Dar_ManPi
(
p
->
pManFraig
,
i
)
);
// set the pointers to the manager
Dar_ManForEachObj
(
p
->
pManFraig
,
pObj
,
i
)
pObj
->
pData
=
p
->
pManFraig
;
// set random number generator
srand
(
0xABCABC
);
return
p
;
}
/**Function*************************************************************
...
...
src/aig/fra/fraSim.c
View file @
a8d75dcc
...
...
@@ -105,7 +105,11 @@ void Fra_AssignDist1( Fra_Man_t * p, unsigned * pPat )
Dar_Obj_t
*
pObj
;
int
i
,
Limit
;
Dar_ManForEachPi
(
p
->
pManAig
,
pObj
,
i
)
{
Fra_NodeAssignConst
(
p
,
pObj
,
Dar_InfoHasBit
(
pPat
,
i
)
);
// printf( "%d", Dar_InfoHasBit(pPat, i) );
}
// printf( "\n" );
Limit
=
DAR_MIN
(
Dar_ManPiNum
(
p
->
pManAig
),
p
->
nSimWords
*
32
-
1
);
for
(
i
=
0
;
i
<
Limit
;
i
++
)
Dar_InfoXorBit
(
Fra_ObjSim
(
Dar_ManPi
(
p
->
pManAig
,
i
)
),
i
+
1
);
...
...
@@ -441,7 +445,7 @@ void Fra_Resimulate( Fra_Man_t * p )
if
(
nChanges
<
1
)
printf
(
"Error: A counter-example did not refine classes!
\n
"
);
assert
(
nChanges
>=
1
);
//printf( "Refined classes
! = %5d. Changes = %4d.\n", p->lClasses.nItems
, nChanges );
//printf( "Refined classes
= %5d. Changes = %4d.\n", Vec_PtrSize(p->vClasses)
, nChanges );
if
(
!
p
->
pPars
->
fPatScores
)
return
;
...
...
@@ -487,7 +491,7 @@ void Fra_Simulate( Fra_Man_t * p )
Fra_SimulateOne
(
p
);
nChanges
=
Fra_RefineClasses
(
p
);
nChanges
+=
Fra_RefineClasses1
(
p
);
if
(
p
->
pManFraig
)
if
(
p
->
pManFraig
->
pData
)
return
;
//printf( "Refined classes = %5d. Changes = %4d. Pairs = %6d.\n", p->lClasses.nItems, nChanges, Fra_CountPairsClasses(p) );
Fra_SavePattern1
(
p
);
...
...
@@ -495,7 +499,7 @@ void Fra_Simulate( Fra_Man_t * p )
Fra_SimulateOne
(
p
);
nChanges
=
Fra_RefineClasses
(
p
);
nChanges
+=
Fra_RefineClasses1
(
p
);
if
(
p
->
pManFraig
)
if
(
p
->
pManFraig
->
pData
)
return
;
//printf( "Refined classes = %5d. Changes = %4d. Pairs = %6d.\n", p->lClasses.nItems, nChanges, Fra_CountPairsClasses(p) );
// refine classes by random simulation
...
...
@@ -505,11 +509,11 @@ void Fra_Simulate( Fra_Man_t * p )
nClasses
=
Vec_PtrSize
(
p
->
vClasses
);
nChanges
=
Fra_RefineClasses
(
p
);
nChanges
+=
Fra_RefineClasses1
(
p
);
if
(
p
->
pManFraig
)
if
(
p
->
pManFraig
->
pData
)
return
;
//printf( "Refined classes = %5d. Changes = %4d. Pairs = %6d.\n", p->lClasses.nItems, nChanges, Fra_CountPairsClasses(p) );
}
while
(
(
double
)
nChanges
/
nClasses
>
p
->
pPars
->
dSimSatur
);
// Fra_Print
Sim
Classes( p );
// Fra_PrintClasses( p );
}
/**Function*************************************************************
...
...
src/aig/ivy/ivyFraig.c
View file @
a8d75dcc
...
...
@@ -733,7 +733,12 @@ void Ivy_FraigAssignDist1( Ivy_FraigMan_t * p, unsigned * pPat )
Ivy_Obj_t
*
pObj
;
int
i
,
Limit
;
Ivy_ManForEachPi
(
p
->
pManAig
,
pObj
,
i
)
{
Ivy_NodeAssignConst
(
p
,
pObj
,
Ivy_InfoHasBit
(
pPat
,
i
)
);
// printf( "%d", Ivy_InfoHasBit(pPat, i) );
}
// printf( "\n" );
Limit
=
IVY_MIN
(
Ivy_ManPiNum
(
p
->
pManAig
),
p
->
nSimWords
*
32
-
1
);
for
(
i
=
0
;
i
<
Limit
;
i
++
)
Ivy_InfoXorBit
(
Ivy_ObjSim
(
Ivy_ManPi
(
p
->
pManAig
,
i
)
)
->
pData
,
i
+
1
);
...
...
@@ -1742,7 +1747,6 @@ void Ivy_FraigResimulate( Ivy_FraigMan_t * p )
printf
(
"Error: A counter-example did not refine classes!
\n
"
);
assert
(
nChanges
>=
1
);
//printf( "Refined classes! = %5d. Changes = %4d.\n", p->lClasses.nItems, nChanges );
if
(
!
p
->
pParams
->
fPatScores
)
return
;
...
...
@@ -2018,6 +2022,8 @@ Ivy_Obj_t * Ivy_FraigAnd( Ivy_FraigMan_t * p, Ivy_Obj_t * pObjOld )
if
(
Ivy_Regular
(
pObjNew
)
==
Ivy_Regular
(
pObjReprNew
)
)
return
pObjNew
;
assert
(
Ivy_Regular
(
pObjNew
)
!=
Ivy_ManConst1
(
p
->
pManFraig
)
);
// printf( "Node = %d. Repr = %d.\n", pObjOld->Id, Ivy_ObjClassNodeRepr(pObjOld)->Id );
// they are different (the counter-example is in p->pPatWords)
RetValue
=
Ivy_FraigNodesAreEquiv
(
p
,
Ivy_Regular
(
pObjReprNew
),
Ivy_Regular
(
pObjNew
)
);
if
(
RetValue
==
1
)
// proved equivalent
...
...
src/base/abc/abcUtil.c
View file @
a8d75dcc
...
...
@@ -1490,7 +1490,8 @@ void Abc_NtkTransferCopy( Abc_Ntk_t * pNtk )
static
inline
int
Abc_ObjCrossCutInc
(
Abc_Obj_t
*
pObj
)
{
// pObj->pCopy = (void *)(((int)pObj->pCopy)++);
((
char
*
)
pObj
->
pCopy
)
++
;
int
Value
=
(
int
)
pObj
->
pCopy
;
pObj
->
pCopy
=
(
void
*
)(
Value
+
1
);
return
(
int
)
pObj
->
pCopy
==
Abc_ObjFanoutNum
(
pObj
);
}
...
...
src/base/abci/abc.c
View file @
a8d75dcc
...
...
@@ -112,6 +112,7 @@ static int Abc_CommandIRewriteSeq ( Abc_Frame_t * pAbc, int argc, char ** arg
static
int
Abc_CommandIResyn
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandISat
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandIFraig
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandDFraig
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandIProve
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandHaig
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandMini
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
...
@@ -267,6 +268,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"New AIG"
,
"iresyn"
,
Abc_CommandIResyn
,
1
);
Cmd_CommandAdd
(
pAbc
,
"New AIG"
,
"isat"
,
Abc_CommandISat
,
1
);
Cmd_CommandAdd
(
pAbc
,
"New AIG"
,
"ifraig"
,
Abc_CommandIFraig
,
1
);
Cmd_CommandAdd
(
pAbc
,
"New AIG"
,
"dfraig"
,
Abc_CommandDFraig
,
1
);
Cmd_CommandAdd
(
pAbc
,
"New AIG"
,
"iprove"
,
Abc_CommandIProve
,
1
);
Cmd_CommandAdd
(
pAbc
,
"New AIG"
,
"haig"
,
Abc_CommandHaig
,
1
);
Cmd_CommandAdd
(
pAbc
,
"New AIG"
,
"mini"
,
Abc_CommandMini
,
1
);
...
...
@@ -333,7 +335,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
{
extern
void
Dar_LibStart
();
Dar_LibStart
();
//
Dar_LibStart();
}
}
...
...
@@ -352,7 +354,7 @@ void Abc_End()
{
{
extern
void
Dar_LibStop
();
Dar_LibStop
();
//
Dar_LibStop();
}
Abc_NtkFraigStoreClean
();
...
...
@@ -6077,14 +6079,16 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
// Abc_Ntk4VarTable( pNtk );
// Dar_NtkGenerateArrays( pNtk );
// Dar_ManDeriveCnfTest2();
/*
if ( !Abc_NtkIsStrash(pNtk) )
{
fprintf( pErr, "Network should be strashed. Command has failed.\n" );
return 1;
}
*/
// pNtkRes = Abc_NtkDar( pNtk );
pNtkRes
=
Abc_NtkDarToCnf
(
pNtk
,
"any.cnf"
);
// pNtkRes = Abc_NtkDarToCnf( pNtk, "any.cnf" );
pNtkRes
=
NULL
;
if
(
pNtkRes
==
NULL
)
{
fprintf
(
pErr
,
"Command has failed.
\n
"
);
...
...
@@ -6911,6 +6915,93 @@ usage:
SeeAlso []
***********************************************************************/
int
Abc_CommandDFraig
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
FILE
*
pOut
,
*
pErr
;
Abc_Ntk_t
*
pNtk
,
*
pNtkRes
;
int
c
,
fProve
,
fVerbose
,
fDoSparse
;
int
nConfLimit
;
extern
Abc_Ntk_t
*
Abc_NtkDarFraig
(
Abc_Ntk_t
*
pNtk
,
int
nConfLimit
,
int
fDoSparse
,
int
fProve
,
int
fTransfer
,
int
fVerbose
);
pNtk
=
Abc_FrameReadNtk
(
pAbc
);
pOut
=
Abc_FrameReadOut
(
pAbc
);
pErr
=
Abc_FrameReadErr
(
pAbc
);
// set defaults
nConfLimit
=
100
;
fDoSparse
=
0
;
fProve
=
0
;
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"Cspvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'C'
:
if
(
globalUtilOptind
>=
argc
)
{
fprintf
(
pErr
,
"Command line switch
\"
-C
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
nConfLimit
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nConfLimit
<
0
)
goto
usage
;
break
;
case
's'
:
fDoSparse
^=
1
;
break
;
case
'p'
:
fProve
^=
1
;
break
;
case
'v'
:
fVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
if
(
pNtk
==
NULL
)
{
fprintf
(
pErr
,
"Empty network.
\n
"
);
return
1
;
}
pNtkRes
=
Abc_NtkDarFraig
(
pNtk
,
nConfLimit
,
fDoSparse
,
fProve
,
0
,
fVerbose
);
if
(
pNtkRes
==
NULL
)
{
fprintf
(
pErr
,
"Command has failed.
\n
"
);
return
0
;
}
// replace the current network
Abc_FrameReplaceCurrentNetwork
(
pAbc
,
pNtkRes
);
return
0
;
usage:
fprintf
(
pErr
,
"usage: dfraig [-C num] [-spvh]
\n
"
);
fprintf
(
pErr
,
"
\t
performs fraiging using a new method
\n
"
);
fprintf
(
pErr
,
"
\t
-C num : limit on the number of conflicts [default = %d]
\n
"
,
nConfLimit
);
fprintf
(
pErr
,
"
\t
-s : toggle considering sparse functions [default = %s]
\n
"
,
fDoSparse
?
"yes"
:
"no"
);
fprintf
(
pErr
,
"
\t
-p : toggle proving the miter outputs [default = %s]
\n
"
,
fProve
?
"yes"
:
"no"
);
fprintf
(
pErr
,
"
\t
-v : toggle verbose printout [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
fprintf
(
pErr
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Abc_CommandIProve
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
Prove_Params_t
Params
,
*
pParams
=
&
Params
;
...
...
src/base/abci/abcDar.c
View file @
a8d75dcc
...
...
@@ -21,6 +21,7 @@
#include "abc.h"
#include "dar.h"
#include "cnf.h"
#include "fra.h"
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
...
...
@@ -443,6 +444,37 @@ Abc_Ntk_t * Abc_NtkDarToCnf( Abc_Ntk_t * pNtk, char * pFileName )
}
/**Function*************************************************************
Synopsis [Gives the current ABC network to AIG manager for processing.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Abc_Ntk_t
*
Abc_NtkDarFraig
(
Abc_Ntk_t
*
pNtk
,
int
nConfLimit
,
int
fDoSparse
,
int
fProve
,
int
fTransfer
,
int
fVerbose
)
{
Fra_Par_t
Params
,
*
pParams
=
&
Params
;
Abc_Ntk_t
*
pNtkAig
;
Dar_Man_t
*
pMan
,
*
pTemp
;
pMan
=
Abc_NtkToDar
(
pNtk
);
if
(
pMan
==
NULL
)
return
NULL
;
Fra_ParamsDefault
(
pParams
);
pParams
->
nBTLimitNode
=
nConfLimit
;
pParams
->
fVerbose
=
fVerbose
;
pParams
->
fProve
=
fProve
;
pParams
->
fDoSparse
=
fDoSparse
;
pMan
=
Fra_Perform
(
pTemp
=
pMan
,
pParams
);
pNtkAig
=
Abc_NtkFromDar
(
pNtk
,
pMan
);
Dar_ManStop
(
pTemp
);
Dar_ManStop
(
pMan
);
return
pNtkAig
;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...
...
src/opt/kit/kitGraph.c
View file @
a8d75dcc
...
...
@@ -357,6 +357,8 @@ Kit_Graph_t * Kit_TruthToGraph( unsigned * pTruth, int nVars, Vec_Int_t * vMemor
RetValue
=
Kit_TruthIsop
(
pTruth
,
nVars
,
vMemory
,
1
);
// tried 1 and found not useful in "renode"
if
(
RetValue
==
-
1
)
return
NULL
;
if
(
Vec_IntSize
(
vMemory
)
>
128
)
return
NULL
;
// printf( "Isop size = %d.\n", Vec_IntSize(vMemory) );
assert
(
RetValue
==
0
||
RetValue
==
1
);
// derive factored form
...
...
src/opt/lpk/lpkCore.c
View file @
a8d75dcc
...
...
@@ -229,7 +229,6 @@ p->timeMap += clock() - clk;
int
Lpk_ResynthesizeNode
(
Lpk_Man_t
*
p
)
{
static
int
Count
=
0
;
char
*
pFileName
;
Kit_DsdNtk_t
*
pDsdNtk
;
Lpk_Cut_t
*
pCut
;
unsigned
*
pTruth
;
...
...
@@ -245,6 +244,8 @@ p->timeCuts += clock() - clk;
}
p
->
timeCuts
+=
clock
()
-
clk
;
//return 0;
if
(
p
->
pPars
->
fVeryVerbose
)
printf
(
"Node %5d : Mffc size = %5d. Cuts = %5d.
\n
"
,
p
->
pObj
->
Id
,
p
->
nMffc
,
p
->
nEvals
);
// try the good cuts
...
...
@@ -289,12 +290,13 @@ p->timeTruth += clock() - clk;
if
(
p
->
pPars
->
fVeryVerbose
)
{
// char * pFileName;
printf
(
" C%02d: L= %2d/%2d V= %2d/%d N= %d W= %4.2f "
,
i
,
pCut
->
nLeaves
,
nSuppSize
,
pCut
->
nNodes
,
pCut
->
nNodesDup
,
pCut
->
nLuts
,
pCut
->
Weight
);
Kit_DsdPrint
(
stdout
,
pDsdNtk
);
// Kit_DsdPrintFromTruth( pTruth, pCut->nLeaves );
pFileName
=
Kit_TruthDumpToFile
(
pTruth
,
pCut
->
nLeaves
,
Count
++
);
printf
(
"Saved truth table in file
\"
%s
\"
.
\n
"
,
pFileName
);
//
pFileName = Kit_TruthDumpToFile( pTruth, pCut->nLeaves, Count++ );
//
printf( "Saved truth table in file \"%s\".\n", pFileName );
}
// update the network
...
...
src/opt/lpk/lpkCut.c
View file @
a8d75dcc
...
...
@@ -474,12 +474,16 @@ if ( p->pObj->Id == 31 && Node == 38 )//p->nCuts == 48 )
assert
(
p
->
nCuts
<
LPK_CUTS_MAX
);
p
->
nCuts
++
;
assert
(
pCut
->
nNodes
<=
p
->
nMffc
+
pCutNew
->
nNodesDup
);
// assert( pCut->nNodes <= p->nMffc + pCutNew->nNodesDup );
/*
printf( " Creating cut: " );
Lpk_NodePrintCut( p, pCutNew, 1 );
printf( "\n" );
*/
// if ( !(pCut->nNodes <= p->nMffc + pCutNew->nNodesDup) )
// printf( "Assertion in line 477 failed.\n" );
}
/**Function*************************************************************
...
...
@@ -519,9 +523,17 @@ int Lpk_NodeCuts( Lpk_Man_t * p )
pCut
=
p
->
pCuts
+
i
;
if
(
pCut
->
nLeaves
==
0
)
continue
;
// try to expand the fanins of this cut
for
(
k
=
0
;
k
<
(
int
)
pCut
->
nLeaves
;
k
++
)
{
if
(
p
->
pObj
->
Id
==
28
&&
i
==
273
&&
k
==
13
)
{
Abc_Obj_t
*
pFanin
=
Abc_NtkObj
(
p
->
pNtk
,
pCut
->
pLeaves
[
k
]);
int
s
=
0
;
}
// create a new cut
Lpk_NodeCutsOne
(
p
,
pCut
,
pCut
->
pLeaves
[
k
]
);
// quit if the number of cuts has exceeded the limit
...
...
src/opt/lpk/lpkMan.c
View file @
a8d75dcc
...
...
@@ -50,7 +50,7 @@ Lpk_Man_t * Lpk_ManStart( Lpk_Par_t * pPars )
p
->
pPars
=
pPars
;
p
->
nCutsMax
=
LPK_CUTS_MAX
;
p
->
vTtElems
=
Vec_PtrAllocTruthTables
(
pPars
->
nVarsMax
);
p
->
vTtNodes
=
Vec_PtrAllocSimInfo
(
256
,
Abc_TruthWordNum
(
pPars
->
nVarsMax
)
);
p
->
vTtNodes
=
Vec_PtrAllocSimInfo
(
1024
,
Abc_TruthWordNum
(
pPars
->
nVarsMax
)
);
p
->
vCover
=
Vec_IntAlloc
(
1
<<
12
);
for
(
i
=
0
;
i
<
8
;
i
++
)
p
->
vSets
[
i
]
=
Vec_IntAlloc
(
100
);
...
...
src/opt/lpk/module.make
View file @
a8d75dcc
SRC
+=
src/
aig
/lpk/lpkCore.c
\
src/
aig
/lpk/lpkCut.c
\
src/
aig
/lpk/lpkMan.c
\
src/
aig
/lpk/lpkMap.c
\
src/
aig
/lpk/lpkMulti.c
\
src/
aig
/lpk/lpkMux.c
\
src/
aig
/lpk/lpkSets.c
SRC
+=
src/
opt
/lpk/lpkCore.c
\
src/
opt
/lpk/lpkCut.c
\
src/
opt
/lpk/lpkMan.c
\
src/
opt
/lpk/lpkMap.c
\
src/
opt
/lpk/lpkMulti.c
\
src/
opt
/lpk/lpkMux.c
\
src/
opt
/lpk/lpkSets.c
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