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
85207c75
Commit
85207c75
authored
Mar 18, 2008
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Version abc80318
parent
6074fa3a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
200 additions
and
2 deletions
+200
-2
src/aig/aig/aig.h
+1
-0
src/aig/aig/aigPart.c
+140
-0
src/base/abci/abc.c
+34
-2
src/base/abci/abcDar.c
+25
-0
No files found.
src/aig/aig/aig.h
View file @
85207c75
...
...
@@ -526,6 +526,7 @@ extern Vec_Ptr_t * Aig_ManPartitionSmartRegisters( Aig_Man_t * pAig, int nSu
extern
Vec_Ptr_t
*
Aig_ManPartitionNaive
(
Aig_Man_t
*
p
,
int
nPartSize
);
extern
Vec_Ptr_t
*
Aig_ManMiterPartitioned
(
Aig_Man_t
*
p1
,
Aig_Man_t
*
p2
,
int
nPartSize
);
extern
Aig_Man_t
*
Aig_ManChoicePartitioned
(
Vec_Ptr_t
*
vAigs
,
int
nPartSize
,
int
nConfMax
,
int
nLevelMax
,
int
fVerbose
);
extern
Aig_Man_t
*
Aig_ManFraigPartitioned
(
Aig_Man_t
*
pAig
,
int
nPartSize
,
int
nConfMax
,
int
nLevelMax
,
int
fVerbose
);
/*=== aigPartReg.c =========================================================*/
extern
Vec_Ptr_t
*
Aig_ManRegPartitionSimple
(
Aig_Man_t
*
pAig
,
int
nPartSize
,
int
nOverSize
);
extern
Vec_Ptr_t
*
Aig_ManRegPartitionSmart
(
Aig_Man_t
*
pAig
,
int
nPartSize
);
...
...
src/aig/aig/aigPart.c
View file @
85207c75
...
...
@@ -1022,6 +1022,75 @@ Vec_Ptr_t * Aig_ManDupPart( Aig_Man_t * pNew, Aig_Man_t * pOld, Vec_Int_t * vPar
/**Function*************************************************************
Synopsis [Adds internal nodes in the topological order.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Aig_ManDupPartAll_rec
(
Aig_Man_t
*
pNew
,
Aig_Man_t
*
pOld
,
Aig_Obj_t
*
pObj
)
{
Aig_Obj_t
*
pObjNew
;
assert
(
!
Aig_IsComplement
(
pObj
)
);
if
(
Aig_ObjIsTravIdCurrent
(
pOld
,
pObj
)
)
return
;
Aig_ObjSetTravIdCurrent
(
pOld
,
pObj
);
if
(
Aig_ObjIsPi
(
pObj
)
)
pObjNew
=
Aig_ObjCreatePi
(
pNew
);
else
if
(
Aig_ObjIsPo
(
pObj
)
)
{
Aig_ManDupPartAll_rec
(
pNew
,
pOld
,
Aig_ObjFanin0
(
pObj
)
);
pObjNew
=
Aig_ObjCreatePo
(
pNew
,
Aig_ObjChild0Copy
(
pObj
)
);
}
else
{
assert
(
Aig_ObjIsNode
(
pObj
)
);
Aig_ManDupPartAll_rec
(
pNew
,
pOld
,
Aig_ObjFanin0
(
pObj
)
);
Aig_ManDupPartAll_rec
(
pNew
,
pOld
,
Aig_ObjFanin1
(
pObj
)
);
pObjNew
=
Aig_And
(
pNew
,
Aig_ObjChild0Copy
(
pObj
),
Aig_ObjChild1Copy
(
pObj
)
);
}
pObj
->
pData
=
pObjNew
;
pObjNew
->
pData
=
pObj
;
}
/**Function*************************************************************
Synopsis [Adds internal nodes in the topological order.]
Description [Returns the array of new outputs.]
SideEffects []
SeeAlso []
***********************************************************************/
Aig_Man_t
*
Aig_ManDupPartAll
(
Aig_Man_t
*
pOld
,
Vec_Int_t
*
vPart
)
{
Aig_Man_t
*
pNew
;
Aig_Obj_t
*
pObj
,
*
pObjNew
;
int
i
,
Entry
;
Aig_ManIncrementTravId
(
pOld
);
pNew
=
Aig_ManStart
(
5000
);
// map constant nodes
pObj
=
Aig_ManConst1
(
pOld
);
pObjNew
=
Aig_ManConst1
(
pNew
);
pObj
->
pData
=
pObjNew
;
pObjNew
->
pData
=
pObj
;
Aig_ObjSetTravIdCurrent
(
pOld
,
pObj
);
// map all other nodes
Vec_IntForEachEntry
(
vPart
,
Entry
,
i
)
{
pObj
=
Aig_ManPo
(
pOld
,
Entry
);
Aig_ManDupPartAll_rec
(
pNew
,
pOld
,
pObj
);
}
return
pNew
;
}
/**Function*************************************************************
Synopsis [Create partitioned miter of the two AIGs.]
Description [Assumes that each output in the second AIG cannot have
...
...
@@ -1205,6 +1274,77 @@ Aig_Man_t * Aig_ManChoicePartitioned( Vec_Ptr_t * vAigs, int nPartSize, int nCon
return
pAig
;
}
/**Function*************************************************************
Synopsis [Performs partitioned choice computation.]
Description [Assumes that each output in the second AIG cannot have
more supp vars than the same output in the first AIG.]
SideEffects []
SeeAlso []
***********************************************************************/
Aig_Man_t
*
Aig_ManFraigPartitioned
(
Aig_Man_t
*
pAig
,
int
nPartSize
,
int
nConfMax
,
int
nLevelMax
,
int
fVerbose
)
{
extern
Aig_Man_t
*
Fra_FraigChoice
(
Aig_Man_t
*
pManAig
,
int
nConfMax
,
int
nLevelMax
);
Aig_Man_t
*
pAigPart
,
*
pAigTemp
;
Vec_Int_t
*
vPart
;
Vec_Ptr_t
*
vParts
;
Aig_Obj_t
*
pObj
;
void
**
ppData
;
int
i
,
k
;
// partition the outputs of the AIG
vParts
=
Aig_ManPartitionNaive
(
pAig
,
nPartSize
);
// start the equivalence classes
Aig_ManReprStart
(
pAig
,
Aig_ManObjNumMax
(
pAig
)
);
// set the PI numbers
Aig_ManForEachPi
(
pAig
,
pObj
,
k
)
pObj
->
pNext
=
(
Aig_Obj_t
*
)(
long
)
k
;
// create the total fraiged AIG
Vec_PtrForEachEntry
(
vParts
,
vPart
,
i
)
{
// derive the partition AIG
pAigPart
=
Aig_ManDupPartAll
(
pAig
,
vPart
);
// store contents of pData pointers
ppData
=
ALLOC
(
void
*
,
Aig_ManObjNumMax
(
pAigPart
)
);
Aig_ManForEachObj
(
pAigPart
,
pObj
,
k
)
ppData
[
k
]
=
pObj
->
pData
;
// report the process
if
(
fVerbose
)
printf
(
"Part %4d (out of %4d) PI = %5d. PO = %5d. And = %6d. Lev = %4d.
\r
"
,
i
+
1
,
Vec_PtrSize
(
vParts
),
Aig_ManPiNum
(
pAigPart
),
Aig_ManPoNum
(
pAigPart
),
Aig_ManNodeNum
(
pAigPart
),
Aig_ManLevelNum
(
pAigPart
)
);
// compute equivalence classes (to be stored in pNew->pReprs)
pAigTemp
=
Fra_FraigChoice
(
pAigPart
,
nConfMax
,
nLevelMax
);
Aig_ManStop
(
pAigTemp
);
// reset the pData pointers
Aig_ManForEachObj
(
pAigPart
,
pObj
,
k
)
pObj
->
pData
=
ppData
[
k
];
free
(
ppData
);
// transfer representatives to the total AIG
if
(
pAigPart
->
pReprs
)
Aig_ManTransferRepr
(
pAig
,
pAigPart
);
Aig_ManStop
(
pAigPart
);
}
if
(
fVerbose
)
printf
(
"
\r
"
);
Vec_VecFree
(
(
Vec_Vec_t
*
)
vParts
);
// clear the PI numbers
Aig_ManForEachPi
(
pAig
,
pObj
,
k
)
pObj
->
pNext
=
NULL
;
// derive the result of choicing
return
Aig_ManDupRepr
(
pAig
,
0
);
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
...
...
src/base/abci/abc.c
View file @
85207c75
...
...
@@ -8458,23 +8458,39 @@ int Abc_CommandIFraig( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Ntk_t
*
pNtk
,
*
pNtkRes
;
int
c
,
fProve
,
fVerbose
,
fDoSparse
;
int
nConfLimit
;
int
nPartSize
;
int
nLevelMax
;
extern
Abc_Ntk_t
*
Abc_NtkIvyFraig
(
Abc_Ntk_t
*
pNtk
,
int
nConfLimit
,
int
fDoSparse
,
int
fProve
,
int
fTransfer
,
int
fVerbose
);
extern
Abc_Ntk_t
*
Abc_NtkDarFraigPart
(
Abc_Ntk_t
*
pNtk
,
int
nPartSize
,
int
nConfLimit
,
int
nLevelMax
,
int
fVerbose
);
pNtk
=
Abc_FrameReadNtk
(
pAbc
);
pOut
=
Abc_FrameReadOut
(
pAbc
);
pErr
=
Abc_FrameReadErr
(
pAbc
);
// set defaults
nPartSize
=
0
;
nLevelMax
=
0
;
nConfLimit
=
100
;
fDoSparse
=
0
;
fProve
=
0
;
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"
C
spvh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"
PCL
spvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'P'
:
if
(
globalUtilOptind
>=
argc
)
{
fprintf
(
pErr
,
"Command line switch
\"
-P
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
nPartSize
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nPartSize
<
0
)
goto
usage
;
break
;
case
'C'
:
if
(
globalUtilOptind
>=
argc
)
{
...
...
@@ -8486,6 +8502,17 @@ int Abc_CommandIFraig( Abc_Frame_t * pAbc, int argc, char ** argv )
if
(
nConfLimit
<
0
)
goto
usage
;
break
;
case
'L'
:
if
(
globalUtilOptind
>=
argc
)
{
fprintf
(
pErr
,
"Command line switch
\"
-L
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
nLevelMax
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nLevelMax
<
0
)
goto
usage
;
break
;
case
's'
:
fDoSparse
^=
1
;
break
;
...
...
@@ -8512,6 +8539,9 @@ int Abc_CommandIFraig( Abc_Frame_t * pAbc, int argc, char ** argv )
return
1
;
}
if
(
nPartSize
>
0
)
pNtkRes
=
Abc_NtkDarFraigPart
(
pNtk
,
nPartSize
,
nConfLimit
,
nLevelMax
,
fVerbose
);
else
pNtkRes
=
Abc_NtkIvyFraig
(
pNtk
,
nConfLimit
,
fDoSparse
,
fProve
,
0
,
fVerbose
);
if
(
pNtkRes
==
NULL
)
{
...
...
@@ -8523,9 +8553,11 @@ int Abc_CommandIFraig( Abc_Frame_t * pAbc, int argc, char ** argv )
return
0
;
usage:
fprintf
(
pErr
,
"usage: ifraig [-
C
num] [-spvh]
\n
"
);
fprintf
(
pErr
,
"usage: ifraig [-
P num] [-C num] [-L
num] [-spvh]
\n
"
);
fprintf
(
pErr
,
"
\t
performs fraiging using a new method
\n
"
);
fprintf
(
pErr
,
"
\t
-P num : partition size (0 = partitioning is not used) [default = %d]
\n
"
,
nPartSize
);
fprintf
(
pErr
,
"
\t
-C num : limit on the number of conflicts [default = %d]
\n
"
,
nConfLimit
);
fprintf
(
pErr
,
"
\t
-L num : limit on node level to fraig (0 = fraig all nodes) [default = %d]
\n
"
,
nLevelMax
);
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"
);
...
...
src/base/abci/abcDar.c
View file @
85207c75
...
...
@@ -604,6 +604,31 @@ Abc_Ntk_t * Abc_NtkDarFraig( Abc_Ntk_t * pNtk, int nConfLimit, int fDoSparse, in
SeeAlso []
***********************************************************************/
Abc_Ntk_t
*
Abc_NtkDarFraigPart
(
Abc_Ntk_t
*
pNtk
,
int
nPartSize
,
int
nConfLimit
,
int
nLevelMax
,
int
fVerbose
)
{
Abc_Ntk_t
*
pNtkAig
;
Aig_Man_t
*
pMan
,
*
pTemp
;
pMan
=
Abc_NtkToDar
(
pNtk
,
0
);
if
(
pMan
==
NULL
)
return
NULL
;
pMan
=
Aig_ManFraigPartitioned
(
pTemp
=
pMan
,
nPartSize
,
nConfLimit
,
nLevelMax
,
fVerbose
);
Aig_ManStop
(
pTemp
);
pNtkAig
=
Abc_NtkFromDar
(
pNtk
,
pMan
);
Aig_ManStop
(
pMan
);
return
pNtkAig
;
}
/**Function*************************************************************
Synopsis [Gives the current ABC network to AIG manager for processing.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Abc_Ntk_t
*
Abc_NtkCSweep
(
Abc_Ntk_t
*
pNtk
,
int
nCutsMax
,
int
nLeafMax
,
int
fVerbose
)
{
extern
Aig_Man_t
*
Csw_Sweep
(
Aig_Man_t
*
pAig
,
int
nCutsMax
,
int
nLeafMax
,
int
fVerbose
);
...
...
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