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
290ea10c
Commit
290ea10c
authored
Mar 14, 2011
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exploring fanout cofactoring ideas...
parent
92a1c5b5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
152 additions
and
8 deletions
+152
-8
src/aig/aig/aigDoms.c
+136
-4
src/base/abci/abc.c
+16
-4
No files found.
src/aig/aig/aigDoms.c
View file @
290ea10c
...
@@ -44,6 +44,7 @@ struct Aig_Sto_t_
...
@@ -44,6 +44,7 @@ struct Aig_Sto_t_
Aig_MmFixed_t
*
pMem
;
// memory manager for dominators
Aig_MmFixed_t
*
pMem
;
// memory manager for dominators
Vec_Ptr_t
*
vDoms
;
// dominators
Vec_Ptr_t
*
vDoms
;
// dominators
Vec_Int_t
*
vFans
;
// temporary fanouts
Vec_Int_t
*
vFans
;
// temporary fanouts
Vec_Int_t
*
vTimes
;
// the number of times each appears
int
nDomNodes
;
// nodes with dominators
int
nDomNodes
;
// nodes with dominators
int
nDomsTotal
;
// total dominators
int
nDomsTotal
;
// total dominators
int
nDomsFilter1
;
// filtered dominators
int
nDomsFilter1
;
// filtered dominators
...
@@ -71,13 +72,13 @@ struct Aig_Sto_t_
...
@@ -71,13 +72,13 @@ struct Aig_Sto_t_
Aig_Sto_t
*
Aig_ManDomStart
(
Aig_Man_t
*
pAig
,
int
Limit
)
Aig_Sto_t
*
Aig_ManDomStart
(
Aig_Man_t
*
pAig
,
int
Limit
)
{
{
Aig_Sto_t
*
pSto
;
Aig_Sto_t
*
pSto
;
assert
(
Aig_ManRegNum
(
pAig
)
>
0
);
pSto
=
ABC_CALLOC
(
Aig_Sto_t
,
1
);
pSto
=
ABC_CALLOC
(
Aig_Sto_t
,
1
);
pSto
->
pAig
=
pAig
;
pSto
->
pAig
=
pAig
;
pSto
->
Limit
=
Limit
;
pSto
->
Limit
=
Limit
;
pSto
->
pMem
=
Aig_MmFixedStart
(
sizeof
(
Aig_Dom_t
)
+
sizeof
(
int
)
*
Limit
,
10000
);
pSto
->
pMem
=
Aig_MmFixedStart
(
sizeof
(
Aig_Dom_t
)
+
sizeof
(
int
)
*
Limit
,
10000
);
pSto
->
vDoms
=
Vec_PtrStart
(
Aig_ManObjNumMax
(
pAig
)
);
pSto
->
vDoms
=
Vec_PtrStart
(
Aig_ManObjNumMax
(
pAig
)
);
pSto
->
vFans
=
Vec_IntAlloc
(
100
);
pSto
->
vFans
=
Vec_IntAlloc
(
100
);
pSto
->
vTimes
=
Vec_IntStart
(
Aig_ManObjNumMax
(
pAig
)
);
return
pSto
;
return
pSto
;
}
}
...
@@ -233,6 +234,7 @@ void Aig_ManDomStop( Aig_Sto_t * pSto )
...
@@ -233,6 +234,7 @@ void Aig_ManDomStop( Aig_Sto_t * pSto )
Aig_ObjDomVecRecycle
(
pSto
,
vDoms
);
Aig_ObjDomVecRecycle
(
pSto
,
vDoms
);
Vec_PtrFree
(
pSto
->
vDoms
);
Vec_PtrFree
(
pSto
->
vDoms
);
Vec_IntFree
(
pSto
->
vFans
);
Vec_IntFree
(
pSto
->
vFans
);
Vec_IntFree
(
pSto
->
vTimes
);
Aig_MmFixedStop
(
pSto
->
pMem
,
0
);
Aig_MmFixedStop
(
pSto
->
pMem
,
0
);
ABC_FREE
(
pSto
);
ABC_FREE
(
pSto
);
}
}
...
@@ -616,7 +618,7 @@ void Aig_ManMarkFlopTfi( Aig_Man_t * p )
...
@@ -616,7 +618,7 @@ void Aig_ManMarkFlopTfi( Aig_Man_t * p )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
Aig_Sto_t
*
Aig_ManComputeDoms
(
Aig_Man_t
*
pAig
,
int
Limit
)
Aig_Sto_t
*
Aig_ManComputeDoms
Flops
(
Aig_Man_t
*
pAig
,
int
Limit
)
{
{
Aig_Sto_t
*
pSto
;
Aig_Sto_t
*
pSto
;
Vec_Ptr_t
*
vNodes
;
Vec_Ptr_t
*
vNodes
;
...
@@ -636,7 +638,6 @@ Aig_Sto_t * Aig_ManComputeDoms( Aig_Man_t * pAig, int Limit )
...
@@ -636,7 +638,6 @@ Aig_Sto_t * Aig_ManComputeDoms( Aig_Man_t * pAig, int Limit )
// compute combinational inputs
// compute combinational inputs
Aig_ManForEachPi
(
pAig
,
pObj
,
i
)
Aig_ManForEachPi
(
pAig
,
pObj
,
i
)
Aig_ObjDomCompute
(
pSto
,
pObj
);
Aig_ObjDomCompute
(
pSto
,
pObj
);
// print statistics
// print statistics
printf
(
"Nodes =%4d. Flops =%4d. Doms =%9d. Ave =%8.2f. "
,
printf
(
"Nodes =%4d. Flops =%4d. Doms =%9d. Ave =%8.2f. "
,
pSto
->
nDomNodes
,
Aig_ManRegNum
(
pSto
->
pAig
),
pSto
->
nDomsTotal
,
pSto
->
nDomNodes
,
Aig_ManRegNum
(
pSto
->
pAig
),
pSto
->
nDomsTotal
,
...
@@ -649,6 +650,44 @@ Aig_Sto_t * Aig_ManComputeDoms( Aig_Man_t * pAig, int Limit )
...
@@ -649,6 +650,44 @@ Aig_Sto_t * Aig_ManComputeDoms( Aig_Man_t * pAig, int Limit )
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Computes multi-node dominators.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Aig_Sto_t
*
Aig_ManComputeDomsNodes
(
Aig_Man_t
*
pAig
,
int
Limit
)
{
Aig_Sto_t
*
pSto
;
Vec_Ptr_t
*
vNodes
;
Aig_Obj_t
*
pObj
;
int
i
,
clk
=
clock
();
pSto
=
Aig_ManDomStart
(
pAig
,
Limit
);
// initialize flop inputs
Aig_ManForEachPo
(
pAig
,
pObj
,
i
)
Aig_ObjAddTriv
(
pSto
,
pObj
->
Id
,
Vec_PtrAlloc
(
1
)
);
// compute internal nodes
vNodes
=
Aig_ManDfsReverse
(
pAig
);
Vec_PtrForEachEntry
(
Aig_Obj_t
*
,
vNodes
,
pObj
,
i
)
Aig_ObjDomCompute
(
pSto
,
pObj
);
Vec_PtrFree
(
vNodes
);
// compute combinational inputs
Aig_ManForEachPi
(
pAig
,
pObj
,
i
)
Aig_ObjDomCompute
(
pSto
,
pObj
);
// print statistics
printf
(
"Nodes =%6d. Doms =%9d. Ave =%8.2f. "
,
pSto
->
nDomNodes
,
pSto
->
nDomsTotal
,
// pSto->nDomsFilter1, pSto->nDomsFilter2,
1
.
0
*
pSto
->
nDomsTotal
/
pSto
->
nDomNodes
);
Abc_PrintTime
(
1
,
"Time"
,
clock
()
-
clk
);
return
pSto
;
}
/**Function*************************************************************
Synopsis [Collects dominators from the cut.]
Synopsis [Collects dominators from the cut.]
Description []
Description []
...
@@ -941,7 +980,7 @@ void Aig_ManComputeDomsTest( Aig_Man_t * pAig, int Num )
...
@@ -941,7 +980,7 @@ void Aig_ManComputeDomsTest( Aig_Man_t * pAig, int Num )
// for ( i = 1; i < 9; i++ )
// for ( i = 1; i < 9; i++ )
{
{
printf
(
"ITERATION %d:
\n
"
,
Num
);
printf
(
"ITERATION %d:
\n
"
,
Num
);
pSto
=
Aig_ManComputeDoms
(
pAig
,
Num
);
pSto
=
Aig_ManComputeDoms
Flops
(
pAig
,
Num
);
Aig_ObjDomFindGood
(
pSto
);
Aig_ObjDomFindGood
(
pSto
);
// Aig_ManDomPrint( pSto );
// Aig_ManDomPrint( pSto );
Aig_ManDomStop
(
pSto
);
Aig_ManDomStop
(
pSto
);
...
@@ -950,6 +989,99 @@ void Aig_ManComputeDomsTest( Aig_Man_t * pAig, int Num )
...
@@ -950,6 +989,99 @@ void Aig_ManComputeDomsTest( Aig_Man_t * pAig, int Num )
}
}
/**Function*************************************************************
Synopsis [Collects dominators from the cut.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Aig_ObjDomCount
(
Aig_Sto_t
*
pSto
,
Aig_Obj_t
*
pObj
)
{
Aig_Dom_t
*
pDom
;
Aig_Obj_t
*
pFanout
;
Vec_Int_t
*
vSingles
;
Vec_Ptr_t
*
vDoms
;
int
i
,
k
,
Entry
,
iFanout
,
fPrint
=
0
;
vSingles
=
Vec_IntAlloc
(
100
);
// for each dominator of a fanout, count how many fanouts have it as a dominator
Aig_ObjForEachFanout
(
pSto
->
pAig
,
pObj
,
pFanout
,
iFanout
,
i
)
{
vDoms
=
(
Vec_Ptr_t
*
)
Vec_PtrEntry
(
pSto
->
vDoms
,
Aig_ObjId
(
pFanout
)
);
Vec_PtrForEachEntryStart
(
Aig_Dom_t
*
,
vDoms
,
pDom
,
k
,
1
)
{
// printf( "Fanout %d Dominator %d\n", Aig_ObjId(pFanout), pDom->pNodes[0] );
Vec_IntAddToEntry
(
pSto
->
vTimes
,
pDom
->
pNodes
[
0
],
1
);
Vec_IntPushUnique
(
vSingles
,
pDom
->
pNodes
[
0
]
);
}
}
// clear storage
Vec_IntForEachEntry
(
vSingles
,
Entry
,
i
)
{
if
(
Vec_IntEntry
(
pSto
->
vTimes
,
Entry
)
>
5
)
{
if
(
fPrint
==
0
)
{
printf
(
"%6d : Level =%4d. Fanout =%6d.
\n
"
,
Aig_ObjId
(
pObj
),
Aig_ObjLevel
(
pObj
),
Aig_ObjRefs
(
pObj
)
);
}
fPrint
=
1
;
printf
(
"%d(%d) "
,
Entry
,
Vec_IntEntry
(
pSto
->
vTimes
,
Entry
)
);
}
Vec_IntWriteEntry
(
pSto
->
vTimes
,
Entry
,
0
);
}
if
(
fPrint
)
printf
(
"
\n
"
);
Vec_IntFree
(
vSingles
);
}
/**Function*************************************************************
Synopsis [Computes multi-node dominators.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Aig_ManComputeDomsForCofactoring
(
Aig_Man_t
*
pAig
)
{
Vec_Ptr_t
*
vDoms
;
Aig_Sto_t
*
pSto
;
Aig_Obj_t
*
pObj
;
int
i
;
Aig_ManFanoutStart
(
pAig
);
pSto
=
Aig_ManComputeDomsNodes
(
pAig
,
1
);
Aig_ManForEachObj
(
pAig
,
pObj
,
i
)
{
if
(
!
Aig_ObjIsPi
(
pObj
)
&&
!
Aig_ObjIsNode
(
pObj
)
)
continue
;
if
(
Aig_ObjRefs
(
pObj
)
<
10
)
continue
;
vDoms
=
(
Vec_Ptr_t
*
)
Vec_PtrEntry
(
pSto
->
vDoms
,
Aig_ObjId
(
pObj
)
);
// printf( "%6d : Level =%4d. Fanout =%6d.\n",
// Aig_ObjId(pObj), Aig_ObjLevel(pObj), Aig_ObjRefs(pObj) );
Aig_ObjDomCount
(
pSto
,
pObj
);
}
Aig_ManDomStop
(
pSto
);
Aig_ManFanoutStop
(
pAig
);
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
...
src/base/abci/abc.c
View file @
290ea10c
...
@@ -475,6 +475,18 @@ void Abc_CommandUpdate9( Abc_Frame_t * pAbc, Gia_Man_t * pNew )
...
@@ -475,6 +475,18 @@ void Abc_CommandUpdate9( Abc_Frame_t * pAbc, Gia_Man_t * pNew )
***********************************************************************/
***********************************************************************/
void
Abc_Init
(
Abc_Frame_t
*
pAbc
)
void
Abc_Init
(
Abc_Frame_t
*
pAbc
)
{
{
/*
char * pBuff = ABC_ALLOC( char, (1<<29) );
int i, clk = clock();
for ( i = 0; i < (1<<29); i++ )
pBuff[i] = i % 53;
if ( pBuff == NULL )
printf( "Not allocated. " );
else
printf( "Allocated %d bytes. ", (1<<29) );
Abc_PrintTime( 1, "Time", clock() - clk );
*/
Cmd_CommandAdd
(
pAbc
,
"Printing"
,
"print_stats"
,
Abc_CommandPrintStats
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Printing"
,
"print_stats"
,
Abc_CommandPrintStats
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Printing"
,
"print_exdc"
,
Abc_CommandPrintExdc
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Printing"
,
"print_exdc"
,
Abc_CommandPrintExdc
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Printing"
,
"print_io"
,
Abc_CommandPrintIo
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Printing"
,
"print_io"
,
Abc_CommandPrintIo
,
0
);
...
@@ -8657,16 +8669,16 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -8657,16 +8669,16 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
// Abc_NtkDarTest( pNtk );
// Abc_NtkDarTest( pNtk );
// Bbl_ManTest( pNtk );
// Bbl_ManTest( pNtk );
/*
{
{
extern
Aig_Man_t
*
Abc_NtkToDar
(
Abc_Ntk_t
*
pNtk
,
int
fExors
,
int
fRegisters
);
extern
Aig_Man_t
*
Abc_NtkToDar
(
Abc_Ntk_t
*
pNtk
,
int
fExors
,
int
fRegisters
);
extern void Aig_Man
FactorAlgebraicTest
( Aig_Man_t * p );
extern
void
Aig_Man
ComputeDomsForCofactoring
(
Aig_Man_t
*
p
);
Aig_Man_t
*
pAig
;
Aig_Man_t
*
pAig
;
pAig
=
Abc_NtkToDar
(
pNtk
,
0
,
0
);
pAig
=
Abc_NtkToDar
(
pNtk
,
0
,
0
);
Aig_Man
FactorAlgebraicTest
( pAig );
Aig_Man
ComputeDomsForCofactoring
(
pAig
);
Aig_ManStop
(
pAig
);
Aig_ManStop
(
pAig
);
}
}
*/
/*
/*
{
{
...
...
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