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
5f976129
Commit
5f976129
authored
Jul 16, 2013
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Imporvements to 'eliminate'.
parent
e731d3b1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
91 additions
and
11 deletions
+91
-11
src/aig/gia/giaShrink.c
+2
-2
src/aig/hop/hop.h
+2
-1
src/aig/hop/hopTruth.c
+47
-0
src/base/abc/abcMinBase.c
+20
-2
src/base/abci/abc.c
+20
-6
No files found.
src/aig/gia/giaShrink.c
View file @
5f976129
...
...
@@ -106,8 +106,8 @@ Gia_Man_t * Gia_ManMapShrink4( Gia_Man_t * p, int fKeepLevel, int fVerbose )
// change from node IDs to their literals
Gia_ManForEachObjVec
(
vLeaves
,
p
,
pFanin
,
k
)
{
assert
(
Gia_ObjValue
(
pFanin
)
!=
~
0
);
Vec_IntWriteEntry
(
vLeaves
,
k
,
Gia_ObjValue
(
pFanin
)
);
//
assert( Gia_ObjValue(pFanin) != ~0 );
Vec_IntWriteEntry
(
vLeaves
,
k
,
Gia_ObjValue
(
pFanin
)
!=
~
0
?
Gia_ObjValue
(
pFanin
)
:
0
);
}
// derive new structre
if
(
Gia_ManTruthIsConst0
(
pTruth
,
Vec_IntSize
(
vLeaves
))
)
...
...
src/aig/hop/hop.h
View file @
5f976129
...
...
@@ -326,7 +326,8 @@ extern void Hop_TableDelete( Hop_Man_t * p, Hop_Obj_t * pObj );
extern
int
Hop_TableCountEntries
(
Hop_Man_t
*
p
);
extern
void
Hop_TableProfile
(
Hop_Man_t
*
p
);
/*=== hopTruth.c ========================================================*/
unsigned
*
Hop_ManConvertAigToTruth
(
Hop_Man_t
*
p
,
Hop_Obj_t
*
pRoot
,
int
nVars
,
Vec_Int_t
*
vTruth
,
int
fMsbFirst
);
extern
unsigned
*
Hop_ManConvertAigToTruth
(
Hop_Man_t
*
p
,
Hop_Obj_t
*
pRoot
,
int
nVars
,
Vec_Int_t
*
vTruth
,
int
fMsbFirst
);
extern
word
Hop_ManComputeTruth6
(
Hop_Man_t
*
p
,
Hop_Obj_t
*
pObj
,
int
nVars
);
/*=== hopUtil.c =========================================================*/
extern
void
Hop_ManIncrementTravId
(
Hop_Man_t
*
p
);
extern
void
Hop_ManCleanData
(
Hop_Man_t
*
p
);
...
...
src/aig/hop/hopTruth.c
View file @
5f976129
...
...
@@ -218,6 +218,53 @@ unsigned * Hop_ManConvertAigToTruth( Hop_Man_t * p, Hop_Obj_t * pRoot, int nVars
return
pTruth
;
}
/**Function*************************************************************
Synopsis [Compute truth table.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
word
Truth
[
8
]
=
{
ABC_CONST
(
0xAAAAAAAAAAAAAAAA
),
ABC_CONST
(
0xCCCCCCCCCCCCCCCC
),
ABC_CONST
(
0xF0F0F0F0F0F0F0F0
),
ABC_CONST
(
0xFF00FF00FF00FF00
),
ABC_CONST
(
0xFFFF0000FFFF0000
),
ABC_CONST
(
0xFFFFFFFF00000000
),
ABC_CONST
(
0x0000000000000000
),
ABC_CONST
(
0xFFFFFFFFFFFFFFFF
)
};
word
Hop_ManComputeTruth6_rec
(
Hop_Man_t
*
p
,
Hop_Obj_t
*
pObj
)
{
word
Truth0
,
Truth1
;
if
(
Hop_ObjIsPi
(
pObj
)
)
return
Truth
[
pObj
->
iData
];
assert
(
Hop_ObjIsNode
(
pObj
)
);
Truth0
=
Hop_ManComputeTruth6_rec
(
p
,
Hop_ObjFanin0
(
pObj
)
);
Truth1
=
Hop_ManComputeTruth6_rec
(
p
,
Hop_ObjFanin1
(
pObj
)
);
Truth0
=
Hop_ObjFaninC0
(
pObj
)
?
~
Truth0
:
Truth0
;
Truth1
=
Hop_ObjFaninC1
(
pObj
)
?
~
Truth1
:
Truth1
;
return
Truth0
&
Truth1
;
}
word
Hop_ManComputeTruth6
(
Hop_Man_t
*
p
,
Hop_Obj_t
*
pObj
,
int
nVars
)
{
word
Truth
;
int
i
;
if
(
Hop_ObjIsConst1
(
Hop_Regular
(
pObj
)
)
)
return
Hop_IsComplement
(
pObj
)
?
0
:
~
(
word
)
0
;
for
(
i
=
0
;
i
<
nVars
;
i
++
)
Hop_ManPi
(
p
,
i
)
->
iData
=
i
;
Truth
=
Hop_ManComputeTruth6_rec
(
p
,
Hop_Regular
(
pObj
)
);
return
Hop_IsComplement
(
pObj
)
?
~
Truth
:
Truth
;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...
...
src/base/abc/abcMinBase.c
View file @
5f976129
...
...
@@ -578,6 +578,22 @@ int Abc_NodeCollapse1( Abc_Obj_t * pFanin, Abc_Obj_t * pFanout, Vec_Ptr_t * vFan
Abc_NtkDeleteObj_rec
(
pFanout
,
1
);
return
1
;
}
int
Abc_NodeIsExor
(
Abc_Obj_t
*
pNode
)
{
Hop_Man_t
*
pMan
;
word
Truth
;
if
(
Abc_ObjFaninNum
(
pNode
)
<
3
||
Abc_ObjFaninNum
(
pNode
)
>
6
)
return
0
;
pMan
=
(
Hop_Man_t
*
)
pNode
->
pNtk
->
pManFunc
;
Truth
=
Hop_ManComputeTruth6
(
pMan
,
(
Hop_Obj_t
*
)
pNode
->
pData
,
Abc_ObjFaninNum
(
pNode
)
);
if
(
Truth
==
0x6666666666666666
||
Truth
==
0x9999999999999999
||
Truth
==
0x9696969696969696
||
Truth
==
0x6969696969696969
||
Truth
==
0x6996699669966996
||
Truth
==
0x9669966996699669
||
Truth
==
0x9669699696696996
||
Truth
==
0x6996966969969669
||
Truth
==
0x6996966996696996
||
Truth
==
0x9669699669969669
)
return
1
;
return
0
;
}
int
Abc_NtkEliminate1One
(
Abc_Ntk_t
*
pNtk
,
int
ElimValue
,
int
nMaxSize
,
int
fReverse
,
int
fVerbose
)
{
Vec_Ptr_t
*
vFanouts
,
*
vFanins
,
*
vNodes
;
...
...
@@ -607,6 +623,8 @@ int Abc_NtkEliminate1One( Abc_Ntk_t * pNtk, int ElimValue, int nMaxSize, int fRe
continue
;
if
(
Abc_ObjFaninNum
(
pNode
)
>
nMaxSize
)
continue
;
if
(
Abc_NodeIsExor
(
pNode
)
)
continue
;
// skip nodes with more than one fanout
// if ( Abc_ObjFanoutNum(pNode) != 1 )
// continue;
...
...
@@ -642,10 +660,10 @@ int Abc_NtkEliminate1One( Abc_Ntk_t * pNtk, int ElimValue, int nMaxSize, int fRe
ABC_FREE
(
pPermFanout
);
return
1
;
}
int
Abc_NtkEliminate1
(
Abc_Ntk_t
*
pNtk
,
int
ElimValue
,
int
nMaxSize
,
int
fReverse
,
int
fVerbose
)
int
Abc_NtkEliminate1
(
Abc_Ntk_t
*
pNtk
,
int
ElimValue
,
int
nMaxSize
,
int
nIterMax
,
int
fReverse
,
int
fVerbose
)
{
int
i
;
for
(
i
=
0
;
i
<
3
;
i
++
)
for
(
i
=
0
;
i
<
nIterMax
;
i
++
)
{
int
nNodes
=
Abc_NtkNodeNum
(
pNtk
);
// printf( "%d ", nNodes );
...
...
src/base/abci/abc.c
View file @
5f976129
...
...
@@ -3746,23 +3746,25 @@ usage:
int
Abc_CommandEliminate
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
Abc_Ntk_t
*
pNtk
=
Abc_FrameReadNtk
(
pAbc
);
int
nMaxSize
;
int
ElimValue
;
int
nMaxSize
;
int
nIterMax
;
int
fGreedy
;
int
fReverse
;
int
fVerbose
;
int
c
;
extern
int
Abc_NtkEliminate
(
Abc_Ntk_t
*
pNtk
,
int
nMaxSize
,
int
fReverse
,
int
fVerbose
);
extern
int
Abc_NtkEliminate1
(
Abc_Ntk_t
*
pNtk
,
int
ElimValue
,
int
nMaxSize
,
int
fReverse
,
int
fVerbose
);
extern
int
Abc_NtkEliminate1
(
Abc_Ntk_t
*
pNtk
,
int
ElimValue
,
int
nMaxSize
,
int
nIterMax
,
int
fReverse
,
int
fVerbose
);
// set the defaults
nMaxSize
=
30
;
ElimValue
=
-
1
;
nMaxSize
=
12
;
nIterMax
=
1
;
fGreedy
=
0
;
fReverse
=
0
;
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"VNgrvh"
))
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"VN
I
grvh"
))
!=
EOF
)
{
switch
(
c
)
{
...
...
@@ -3788,6 +3790,17 @@ int Abc_CommandEliminate( Abc_Frame_t * pAbc, int argc, char ** argv )
if
(
nMaxSize
<=
0
)
goto
usage
;
break
;
case
'I'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-I
\"
should be followed by a positive integer.
\n
"
);
goto
usage
;
}
nIterMax
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nIterMax
<=
0
)
goto
usage
;
break
;
case
'g'
:
fGreedy
^=
1
;
break
;
...
...
@@ -3826,15 +3839,16 @@ int Abc_CommandEliminate( Abc_Frame_t * pAbc, int argc, char ** argv )
if
(
fGreedy
)
Abc_NtkEliminate
(
pNtk
,
nMaxSize
,
fReverse
,
fVerbose
);
else
Abc_NtkEliminate1
(
pNtk
,
ElimValue
,
nMaxSize
,
fReverse
,
fVerbose
);
Abc_NtkEliminate1
(
pNtk
,
ElimValue
,
nMaxSize
,
nIterMax
,
fReverse
,
fVerbose
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: eliminate [-VN <num>] [-grvh]
\n
"
);
Abc_Print
(
-
2
,
"usage: eliminate [-VN
I
<num>] [-grvh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
traditional
\"
eliminate -1
\"
, which collapses the node into its fanout
\n
"
);
Abc_Print
(
-
2
,
"
\t
if the node's variable appears in the fanout's factored form only once
\n
"
);
Abc_Print
(
-
2
,
"
\t
-V <num> : the
\"
value
\"
parameter used by
\"
eliminate
\"
in SIS [default = %d]
\n
"
,
ElimValue
);
Abc_Print
(
-
2
,
"
\t
-N <num> : the maximum node support after collapsing [default = %d]
\n
"
,
nMaxSize
);
Abc_Print
(
-
2
,
"
\t
-I <num> : the maximum number of iterations [default = %d]
\n
"
,
nIterMax
);
Abc_Print
(
-
2
,
"
\t
-g : toggle using greedy eliminate (without
\"
value
\"
) [default = %s]
\n
"
,
fGreedy
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-r : use the reverse topological order [default = %s]
\n
"
,
fReverse
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-v : print verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
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