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
9519341a
Commit
9519341a
authored
Oct 25, 2015
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extending library handling to 8 inputs.
parent
9d67bbe5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
127 additions
and
31 deletions
+127
-31
src/base/abci/abc.c
+2
-2
src/map/mio/exp.h
+59
-0
src/map/mio/mio.h
+2
-1
src/map/mpm/mpmMan.c
+1
-1
src/misc/util/utilTruth.h
+30
-5
src/opt/sfm/sfmDec.c
+29
-18
src/opt/sfm/sfmInt.h
+3
-3
src/opt/sfm/sfmLib.c
+0
-0
src/opt/sfm/sfmTime.c
+1
-1
No files found.
src/base/abci/abc.c
View file @
9519341a
...
...
@@ -5233,7 +5233,7 @@ int Abc_CommandMfs3( Abc_Frame_t * pAbc, int argc, char ** argv )
}
pPars
->
nVarMax
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
pPars
->
nVarMax
<
2
||
pPars
->
nVarMax
>
6
)
if
(
pPars
->
nVarMax
<
2
||
pPars
->
nVarMax
>
8
)
goto
usage
;
break
;
case
'L'
:
...
...
@@ -5378,7 +5378,7 @@ usage:
Abc_Print
(
-
2
,
"
\t
-O <num> : the number of levels in the TFO cone (0 <= num) [default = %d]
\n
"
,
pPars
->
nTfoLevMax
);
Abc_Print
(
-
2
,
"
\t
-V <num> : the number of levels in the TFI/TFO cone (1 <= num) [default = %d]
\n
"
,
pPars
->
nTfiLevMax
);
Abc_Print
(
-
2
,
"
\t
-F <num> : the max number of fanouts to skip (1 <= num) [default = %d]
\n
"
,
pPars
->
nFanoutMax
);
Abc_Print
(
-
2
,
"
\t
-K <num> : the max number of variables (2 <= num <=
6
) [default = %d]
\n
"
,
pPars
->
nVarMax
);
Abc_Print
(
-
2
,
"
\t
-K <num> : the max number of variables (2 <= num <=
8
) [default = %d]
\n
"
,
pPars
->
nVarMax
);
Abc_Print
(
-
2
,
"
\t
-L <num> : the min size of max fanout-free cone (MFFC) (area-only) [default = %d]
\n
"
,
pPars
->
nMffcMin
);
Abc_Print
(
-
2
,
"
\t
-H <num> : the max size of max fanout-free cone (MFFC) (area-only) [default = %d]
\n
"
,
pPars
->
nMffcMax
);
Abc_Print
(
-
2
,
"
\t
-D <num> : the max number of decompositions to try (1 <= num <= 4) [default = %d]
\n
"
,
pPars
->
nDecMax
);
src/map/mio/exp.h
View file @
9519341a
...
...
@@ -202,6 +202,65 @@ static inline word Exp_Truth6( int nVars, Vec_Int_t * p, word * puFanins )
ABC_FREE
(
puNodes
);
return
Res
;
}
static
inline
void
Exp_Truth8
(
int
nVars
,
Vec_Int_t
*
p
,
word
**
puFanins
,
word
*
puRes
)
{
word
Truth8
[
8
][
4
]
=
{
{
ABC_CONST
(
0xAAAAAAAAAAAAAAAA
),
ABC_CONST
(
0xAAAAAAAAAAAAAAAA
),
ABC_CONST
(
0xAAAAAAAAAAAAAAAA
),
ABC_CONST
(
0xAAAAAAAAAAAAAAAA
)
},
{
ABC_CONST
(
0xCCCCCCCCCCCCCCCC
),
ABC_CONST
(
0xCCCCCCCCCCCCCCCC
),
ABC_CONST
(
0xCCCCCCCCCCCCCCCC
),
ABC_CONST
(
0xCCCCCCCCCCCCCCCC
)
},
{
ABC_CONST
(
0xF0F0F0F0F0F0F0F0
),
ABC_CONST
(
0xF0F0F0F0F0F0F0F0
),
ABC_CONST
(
0xF0F0F0F0F0F0F0F0
),
ABC_CONST
(
0xF0F0F0F0F0F0F0F0
)
},
{
ABC_CONST
(
0xFF00FF00FF00FF00
),
ABC_CONST
(
0xFF00FF00FF00FF00
),
ABC_CONST
(
0xFF00FF00FF00FF00
),
ABC_CONST
(
0xFF00FF00FF00FF00
)
},
{
ABC_CONST
(
0xFFFF0000FFFF0000
),
ABC_CONST
(
0xFFFF0000FFFF0000
),
ABC_CONST
(
0xFFFF0000FFFF0000
),
ABC_CONST
(
0xFFFF0000FFFF0000
)
},
{
ABC_CONST
(
0xFFFFFFFF00000000
),
ABC_CONST
(
0xFFFFFFFF00000000
),
ABC_CONST
(
0xFFFFFFFF00000000
),
ABC_CONST
(
0xFFFFFFFF00000000
)
},
{
ABC_CONST
(
0x0000000000000000
),
ABC_CONST
(
0xFFFFFFFFFFFFFFFF
),
ABC_CONST
(
0x0000000000000000
),
ABC_CONST
(
0xFFFFFFFFFFFFFFFF
)
},
{
ABC_CONST
(
0x0000000000000000
),
ABC_CONST
(
0x0000000000000000
),
ABC_CONST
(
0xFFFFFFFFFFFFFFFF
),
ABC_CONST
(
0xFFFFFFFFFFFFFFFF
)
}
};
word
*
puFaninsInt
[
8
],
*
pStore
,
*
pThis
=
NULL
;
int
i
,
k
,
iRoot
=
Vec_IntEntryLast
(
p
);
if
(
puFanins
==
NULL
)
{
puFanins
=
puFaninsInt
;
for
(
k
=
0
;
k
<
8
;
k
++
)
puFanins
[
k
]
=
Truth8
[
k
];
}
if
(
Exp_NodeNum
(
p
)
==
0
)
{
assert
(
iRoot
<
2
*
nVars
);
if
(
iRoot
==
EXP_CONST0
||
iRoot
==
EXP_CONST1
)
for
(
k
=
0
;
k
<
4
;
k
++
)
puRes
[
k
]
=
iRoot
==
EXP_CONST0
?
0
:
~
(
word
)
0
;
else
for
(
k
=
0
;
k
<
4
;
k
++
)
puRes
[
k
]
=
Abc_LitIsCompl
(
iRoot
)
?
~
puFanins
[
Abc_Lit2Var
(
iRoot
)][
k
]
:
puFanins
[
Abc_Lit2Var
(
iRoot
)][
k
];
return
;
}
pStore
=
ABC_CALLOC
(
word
,
4
*
Exp_NodeNum
(
p
)
);
for
(
i
=
0
;
i
<
Exp_NodeNum
(
p
);
i
++
)
{
int
iVar0
=
Abc_Lit2Var
(
Vec_IntEntry
(
p
,
2
*
i
+
0
)
);
int
iVar1
=
Abc_Lit2Var
(
Vec_IntEntry
(
p
,
2
*
i
+
1
)
);
int
fCompl0
=
Abc_LitIsCompl
(
Vec_IntEntry
(
p
,
2
*
i
+
0
)
);
int
fCompl1
=
Abc_LitIsCompl
(
Vec_IntEntry
(
p
,
2
*
i
+
1
)
);
word
*
pIn0
=
iVar0
<
nVars
?
puFanins
[
iVar0
]
:
pStore
+
4
*
(
iVar0
-
nVars
);
word
*
pIn1
=
iVar1
<
nVars
?
puFanins
[
iVar1
]
:
pStore
+
4
*
(
iVar1
-
nVars
);
pThis
=
pStore
+
4
*
i
;
if
(
fCompl0
&&
fCompl1
)
for
(
k
=
0
;
k
<
4
;
k
++
)
pThis
[
k
]
=
~
pIn0
[
k
]
&
~
pIn1
[
k
];
else
if
(
fCompl0
&&
!
fCompl1
)
for
(
k
=
0
;
k
<
4
;
k
++
)
pThis
[
k
]
=
~
pIn0
[
k
]
&
pIn1
[
k
];
else
if
(
!
fCompl0
&&
fCompl1
)
for
(
k
=
0
;
k
<
4
;
k
++
)
pThis
[
k
]
=
pIn0
[
k
]
&
~
pIn1
[
k
];
else
//if ( !fCompl0 && !fCompl1 )
for
(
k
=
0
;
k
<
4
;
k
++
)
pThis
[
k
]
=
pIn0
[
k
]
&
pIn1
[
k
];
}
assert
(
Abc_Lit2Var
(
iRoot
)
-
nVars
==
i
-
1
);
for
(
k
=
0
;
k
<
4
;
k
++
)
puRes
[
k
]
=
Abc_LitIsCompl
(
iRoot
)
?
~
pThis
[
k
]
:
pThis
[
k
];
ABC_FREE
(
pStore
);
}
static
inline
void
Exp_TruthLit
(
int
nVars
,
int
Lit
,
word
**
puFanins
,
word
**
puNodes
,
word
*
pRes
,
int
nWords
)
{
int
w
;
...
...
src/map/mio/mio.h
View file @
9519341a
...
...
@@ -59,7 +59,8 @@ struct Mio_Cell2_t_
{
char
*
pName
;
// name
Vec_Int_t
*
vExpr
;
// expression
unsigned
Id
:
28
;
// gate ID
unsigned
Id
:
26
;
// gate ID
unsigned
Type
:
2
;
// gate type
unsigned
nFanins
:
4
;
// gate fanins
word
Area
;
// area
word
uTruth
;
// truth table
...
...
src/map/mpm/mpmMan.c
View file @
9519341a
...
...
@@ -83,7 +83,7 @@ Mpm_Man_t * Mpm_ManStart( Mig_Man_t * pMig, Mpm_Par_t * pPars )
p
->
vTtMem
=
Vec_MemAlloc
(
p
->
nTruWords
,
12
);
// 32 KB/page for 6-var functions
Vec_MemHashAlloc
(
p
->
vTtMem
,
10000
);
p
->
funcCst0
=
Vec_MemHashInsert
(
p
->
vTtMem
,
p
->
Truth
);
Abc_TtUnit
(
p
->
Truth
,
p
->
nTruWords
);
Abc_TtUnit
(
p
->
Truth
,
p
->
nTruWords
,
0
);
p
->
funcVar0
=
Vec_MemHashInsert
(
p
->
vTtMem
,
p
->
Truth
);
}
else
if
(
p
->
pPars
->
fUseDsd
)
...
...
src/misc/util/utilTruth.h
View file @
9519341a
...
...
@@ -113,6 +113,17 @@ static word Ps_PMasks[5][6][3] = {
}
};
static
word
s_Truth8
[
8
][
4
]
=
{
{
ABC_CONST
(
0xAAAAAAAAAAAAAAAA
),
ABC_CONST
(
0xAAAAAAAAAAAAAAAA
),
ABC_CONST
(
0xAAAAAAAAAAAAAAAA
),
ABC_CONST
(
0xAAAAAAAAAAAAAAAA
)
},
{
ABC_CONST
(
0xCCCCCCCCCCCCCCCC
),
ABC_CONST
(
0xCCCCCCCCCCCCCCCC
),
ABC_CONST
(
0xCCCCCCCCCCCCCCCC
),
ABC_CONST
(
0xCCCCCCCCCCCCCCCC
)
},
{
ABC_CONST
(
0xF0F0F0F0F0F0F0F0
),
ABC_CONST
(
0xF0F0F0F0F0F0F0F0
),
ABC_CONST
(
0xF0F0F0F0F0F0F0F0
),
ABC_CONST
(
0xF0F0F0F0F0F0F0F0
)
},
{
ABC_CONST
(
0xFF00FF00FF00FF00
),
ABC_CONST
(
0xFF00FF00FF00FF00
),
ABC_CONST
(
0xFF00FF00FF00FF00
),
ABC_CONST
(
0xFF00FF00FF00FF00
)
},
{
ABC_CONST
(
0xFFFF0000FFFF0000
),
ABC_CONST
(
0xFFFF0000FFFF0000
),
ABC_CONST
(
0xFFFF0000FFFF0000
),
ABC_CONST
(
0xFFFF0000FFFF0000
)
},
{
ABC_CONST
(
0xFFFFFFFF00000000
),
ABC_CONST
(
0xFFFFFFFF00000000
),
ABC_CONST
(
0xFFFFFFFF00000000
),
ABC_CONST
(
0xFFFFFFFF00000000
)
},
{
ABC_CONST
(
0x0000000000000000
),
ABC_CONST
(
0xFFFFFFFFFFFFFFFF
),
ABC_CONST
(
0x0000000000000000
),
ABC_CONST
(
0xFFFFFFFFFFFFFFFF
)
},
{
ABC_CONST
(
0x0000000000000000
),
ABC_CONST
(
0x0000000000000000
),
ABC_CONST
(
0xFFFFFFFFFFFFFFFF
),
ABC_CONST
(
0xFFFFFFFFFFFFFFFF
)
}
};
// the bit count for the first 256 integer numbers
static
int
Abc_TtBitCount8
[
256
]
=
{
0
,
1
,
1
,
2
,
1
,
2
,
2
,
3
,
1
,
2
,
2
,
3
,
2
,
3
,
3
,
4
,
1
,
2
,
2
,
3
,
2
,
3
,
3
,
4
,
2
,
3
,
3
,
4
,
3
,
4
,
4
,
5
,
...
...
@@ -204,6 +215,12 @@ static inline word Abc_Tt6Mask( int nBits ) { assert( nBits >= 0 && nBits
SeeAlso []
***********************************************************************/
static
inline
void
Abc_TtConst
(
word
*
pOut
,
int
nWords
,
int
fConst1
)
{
int
w
;
for
(
w
=
0
;
w
<
nWords
;
w
++
)
pOut
[
w
]
=
fConst1
?
~
(
word
)
0
:
0
;
}
static
inline
void
Abc_TtClear
(
word
*
pOut
,
int
nWords
)
{
int
w
;
...
...
@@ -216,11 +233,11 @@ static inline void Abc_TtFill( word * pOut, int nWords )
for
(
w
=
0
;
w
<
nWords
;
w
++
)
pOut
[
w
]
=
~
(
word
)
0
;
}
static
inline
void
Abc_TtUnit
(
word
*
pOut
,
int
nWords
)
static
inline
void
Abc_TtUnit
(
word
*
pOut
,
int
nWords
,
int
fCompl
)
{
int
w
;
for
(
w
=
0
;
w
<
nWords
;
w
++
)
pOut
[
w
]
=
s_Truths6
[
0
];
pOut
[
w
]
=
fCompl
?
~
s_Truths6
[
0
]
:
s_Truths6
[
0
];
}
static
inline
void
Abc_TtNot
(
word
*
pOut
,
int
nWords
)
{
...
...
@@ -284,6 +301,14 @@ static inline int Abc_TtEqual( word * pIn1, word * pIn2, int nWords )
return
0
;
return
1
;
}
static
inline
int
Abc_TtOpposite
(
word
*
pIn1
,
word
*
pIn2
,
int
nWords
)
{
int
w
;
for
(
w
=
0
;
w
<
nWords
;
w
++
)
if
(
pIn1
[
w
]
!=
~
pIn2
[
w
]
)
return
0
;
return
1
;
}
static
inline
int
Abc_TtImply
(
word
*
pIn1
,
word
*
pIn2
,
int
nWords
)
{
int
w
;
...
...
@@ -1116,15 +1141,15 @@ static inline int Abc_TtOnlyOneOne( word t )
return
0
;
return
(
t
&
(
t
-
1
))
==
0
;
}
static
inline
int
Gia_ManTt
IsAndType
(
word
t
,
int
nVars
)
static
inline
int
Abc_Tt6
IsAndType
(
word
t
,
int
nVars
)
{
return
Abc_TtOnlyOneOne
(
t
&
Abc_Tt6Mask
(
1
<<
nVars
)
);
}
static
inline
int
Gia_ManTt
IsOrType
(
word
t
,
int
nVars
)
static
inline
int
Abc_Tt6
IsOrType
(
word
t
,
int
nVars
)
{
return
Abc_TtOnlyOneOne
(
~
t
&
Abc_Tt6Mask
(
1
<<
nVars
)
);
}
static
inline
int
Gia_ManTt
IsXorType
(
word
t
,
int
nVars
)
static
inline
int
Abc_Tt6
IsXorType
(
word
t
,
int
nVars
)
{
return
((((
t
&
1
)
?
~
t
:
t
)
^
s_TruthXors
[
nVars
])
&
Abc_Tt6Mask
(
1
<<
nVars
))
==
0
;
}
...
...
src/opt/sfm/sfmDec.c
View file @
9519341a
...
...
@@ -117,8 +117,8 @@ struct Sfm_Dec_t_
int
nMaxWin
;
word
nAllDivs
;
word
nAllWin
;
int
nLuckySizes
[
10
];
int
nLuckyGates
[
10
];
int
nLuckySizes
[
SFM_SUPP_MAX
+
1
];
int
nLuckyGates
[
SFM_SUPP_MAX
+
1
];
};
#define SFM_MASK_PI 1 // supp(node) is contained in supp(TFI(pivot))
...
...
@@ -274,6 +274,7 @@ static inline word Sfm_ObjSimulate( Abc_Obj_t * pObj )
Sfm_Dec_t
*
p
=
Sfm_DecMan
(
pObj
);
Vec_Int_t
*
vExpr
=
Mio_GateReadExpr
(
(
Mio_Gate_t
*
)
pObj
->
pData
);
Abc_Obj_t
*
pFanin
;
int
i
;
word
uFanins
[
6
];
assert
(
Abc_ObjFaninNum
(
pObj
)
<=
6
);
Abc_ObjForEachFanin
(
pObj
,
pFanin
,
i
)
uFanins
[
i
]
=
Sfm_DecObjSim
(
p
,
pFanin
);
return
Exp_Truth6
(
Abc_ObjFaninNum
(
pObj
),
vExpr
,
uFanins
);
...
...
@@ -778,13 +779,14 @@ int Sfm_DecCombineDec( Sfm_Dec_t * p, word * pTruth0, word * pTruth1, int * pSup
{
memcpy
(
pSupp
,
pSupp0
,
sizeof
(
int
)
*
nSupp0
);
memcpy
(
pTruth
,
pTruth0
,
sizeof
(
word
)
*
nWords0
);
Abc_TtStretch6
(
pTruth
,
nSupp0
,
p
->
pPars
->
nVarMax
);
return
nSupp0
;
}
// merge support variables
Vec_IntTwoMerge2Int
(
&
vVec0
,
&
vVec1
,
&
vVec
);
Vec_IntPushOrder
(
&
vVec
,
Var
);
nSupp
=
Vec_IntSize
(
&
vVec
);
if
(
nSupp
>
SFM_SUPP_MAX
)
if
(
nSupp
>
p
->
pPars
->
nVarMax
)
return
-
2
;
// expand truth tables
Abc_TtStretch6
(
pTruth0
,
nSupp0
,
nSupp
);
...
...
@@ -794,6 +796,7 @@ int Sfm_DecCombineDec( Sfm_Dec_t * p, word * pTruth0, word * pTruth1, int * pSup
// perform operation
iSuppVar
=
Vec_IntFind
(
&
vVec
,
Var
);
Abc_TtMux
(
pTruth
,
p
->
pTtElems
[
iSuppVar
],
pTruth1
,
pTruth0
,
Abc_TtWordNum
(
nSupp
)
);
Abc_TtStretch6
(
pTruth
,
nSupp
,
p
->
pPars
->
nVarMax
);
return
nSupp
;
}
int
Sfm_DecPeformDec_rec
(
Sfm_Dec_t
*
p
,
word
*
pTruth
,
int
*
pSupp
,
int
*
pAssump
,
int
nAssump
,
word
Masks
[
2
],
int
fCofactor
,
int
nSuppAdd
)
...
...
@@ -835,7 +838,7 @@ int Sfm_DecPeformDec_rec( Sfm_Dec_t * p, word * pTruth, int * pSupp, int * pAssu
{
p
->
nSatCallsUnsat
++
;
p
->
timeSatUnsat
+=
Abc_Clock
()
-
clk
;
pTruth
[
0
]
=
c
?
~
((
word
)
0
)
:
0
;
Abc_TtConst
(
pTruth
,
Abc_TtWordNum
(
p
->
pPars
->
nVarMax
),
c
)
;
if
(
p
->
pPars
->
fVeryVerbose
)
printf
(
"Found constant %d.
\n
"
,
c
);
return
0
;
...
...
@@ -907,13 +910,13 @@ int Sfm_DecPeformDec_rec( Sfm_Dec_t * p, word * pTruth, int * pSupp, int * pAssu
}
assert
(
Abc_Lit2Var
(
Impls
[
0
])
==
Abc_Lit2Var
(
Impls
[
1
])
);
// found buffer/inverter
pTruth
[
0
]
=
Abc_LitIsCompl
(
Impls
[
0
])
?
~
p
->
pTtElems
[
0
][
0
]
:
p
->
pTtElems
[
0
][
0
]
;
Abc_TtUnit
(
pTruth
,
Abc_TtWordNum
(
p
->
pPars
->
nVarMax
),
Abc_LitIsCompl
(
Impls
[
0
])
)
;
pSupp
[
0
]
=
Abc_Lit2Var
(
Impls
[
0
]);
if
(
p
->
pPars
->
fVeryVerbose
)
printf
(
"Found variable %s%d.
\n
"
,
Abc_LitIsCompl
(
Impls
[
0
])
?
"!"
:
""
,
pSupp
[
0
]
);
return
1
;
}
if
(
nSuppAdd
>
4
)
if
(
nSuppAdd
>
p
->
pPars
->
nVarMax
-
2
)
{
if
(
p
->
pPars
->
fVeryVerbose
)
printf
(
"The number of assumption is more than MFFC size.
\n
"
);
...
...
@@ -969,6 +972,7 @@ int Sfm_DecPeformDec_rec( Sfm_Dec_t * p, word * pTruth, int * pSupp, int * pAssu
pSupp
[
i
]
=
Abc_Lit2Var
(
pSupp
[
i
]);
}
}
Abc_TtStretch6
(
pTruth
,
nFinal
,
p
->
pPars
->
nVarMax
);
p
->
nNodesAndOr
++
;
if
(
p
->
pPars
->
fVeryVerbose
)
printf
(
"Found %d-input AND/OR gate.
\n
"
,
nFinal
);
...
...
@@ -1028,7 +1032,7 @@ int Sfm_DecPeformDec_rec( Sfm_Dec_t * p, word * pTruth, int * pSupp, int * pAssu
if
(
Var
>=
0
)
{
word
uTruth
[
2
][
SFM_WORD_MAX
],
MasksNext
[
2
];
int
Supp
[
2
][
2
*
SFM_SUPP_MAX
],
nSupp
[
2
]
=
{
0
}
,
nSuppAll
;
int
Supp
[
2
][
2
*
SFM_SUPP_MAX
],
nSupp
[
2
]
=
{
0
};
Vec_IntPush
(
&
p
->
vObjDec
,
Var
);
for
(
i
=
0
;
i
<
2
;
i
++
)
{
...
...
@@ -1043,10 +1047,7 @@ int Sfm_DecPeformDec_rec( Sfm_Dec_t * p, word * pTruth, int * pSupp, int * pAssu
return
-
2
;
}
// combine solutions
nSuppAll
=
Sfm_DecCombineDec
(
p
,
uTruth
[
0
],
uTruth
[
1
],
Supp
[
0
],
Supp
[
1
],
nSupp
[
0
],
nSupp
[
1
],
pTruth
,
pSupp
,
Var
);
if
(
nSuppAll
>
6
)
return
-
2
;
return
nSuppAll
;
return
Sfm_DecCombineDec
(
p
,
uTruth
[
0
],
uTruth
[
1
],
Supp
[
0
],
Supp
[
1
],
nSupp
[
0
],
nSupp
[
1
],
pTruth
,
pSupp
,
Var
);
}
return
-
2
;
}
...
...
@@ -1114,13 +1115,19 @@ int Sfm_DecPeformDec2( Sfm_Dec_t * p, Abc_Obj_t * pObj )
// Dau_DsdPrintFromTruth( uTruth[iBest], nSupp[iBest] );
}
// return -1;
RetValue
=
Sfm_LibImplement
(
p
->
pLib
,
uTruth
[
iBest
]
[
0
]
,
pSupp
[
iBest
],
nSupp
[
iBest
],
p
->
AreaMffc
,
&
p
->
vObjGates
,
&
p
->
vObjFanins
,
p
->
pPars
->
fZeroCost
);
RetValue
=
Sfm_LibImplement
(
p
->
pLib
,
uTruth
[
iBest
],
pSupp
[
iBest
],
nSupp
[
iBest
],
p
->
AreaMffc
,
&
p
->
vObjGates
,
&
p
->
vObjFanins
,
p
->
pPars
->
fZeroCost
);
if
(
fVeryVerbose
)
printf
(
"Area-reducing implementation %sfound.
\n
"
,
RetValue
<
0
?
"NOT "
:
""
);
if
(
RetValue
>=
0
)
{
assert
(
nSupp
[
iBest
]
<=
p
->
pPars
->
nVarMax
);
p
->
nLuckySizes
[
nSupp
[
iBest
]]
++
;
}
if
(
RetValue
>=
0
)
{
assert
(
RetValue
<=
2
);
p
->
nLuckyGates
[
RetValue
]
++
;
}
return
RetValue
;
}
int
Sfm_DecPeformDec3
(
Sfm_Dec_t
*
p
,
Abc_Obj_t
*
pObj
)
...
...
@@ -1171,8 +1178,10 @@ int Sfm_DecPeformDec3( Sfm_Dec_t * p, Abc_Obj_t * pObj )
Dau_DsdPrintFromTruth
(
uTruth
[
i
],
nSupp
[
i
]
);
if
(
nSupp
[
i
]
<
2
)
{
RetValue
=
Sfm_LibImplement
(
p
->
pLib
,
uTruth
[
i
][
0
],
pSupp
[
i
],
nSupp
[
i
],
p
->
AreaMffc
,
&
p
->
vObjGates
,
&
p
->
vObjFanins
,
p
->
pPars
->
fZeroCost
);
p
->
nLuckySizes
[
nSupp
[
i
]]
++
;
RetValue
=
Sfm_LibImplement
(
p
->
pLib
,
uTruth
[
i
],
pSupp
[
i
],
nSupp
[
i
],
p
->
AreaMffc
,
&
p
->
vObjGates
,
&
p
->
vObjFanins
,
p
->
pPars
->
fZeroCost
);
assert
(
nSupp
[
iBest
]
<=
p
->
pPars
->
nVarMax
);
p
->
nLuckySizes
[
nSupp
[
iBest
]]
++
;
assert
(
RetValue
<=
2
);
p
->
nLuckyGates
[
RetValue
]
++
;
return
RetValue
;
}
...
...
@@ -1182,7 +1191,7 @@ int Sfm_DecPeformDec3( Sfm_Dec_t * p, Abc_Obj_t * pObj )
//}
// try the delay
nMatches
=
Sfm_LibFindMatches
(
p
->
pLib
,
uTruth
[
i
]
[
0
]
,
pSupp
[
i
],
nSupp
[
i
],
&
p
->
vMatchGates
,
&
p
->
vMatchFans
);
nMatches
=
Sfm_LibFindMatches
(
p
->
pLib
,
uTruth
[
i
],
pSupp
[
i
],
nSupp
[
i
],
&
p
->
vMatchGates
,
&
p
->
vMatchFans
);
DelayMin
=
DelayOrig
=
Sfm_TimReadObjDelay
(
p
->
pTim
,
Abc_ObjId
(
pObj
)
);
for
(
k
=
0
;
k
<
nMatches
;
k
++
)
{
...
...
@@ -1217,7 +1226,9 @@ int Sfm_DecPeformDec3( Sfm_Dec_t * p, Abc_Obj_t * pObj )
// if ( fVeryVerbose )
// Dau_DsdPrintFromTruth( uTruth[iBest], nSupp[iBest] );
RetValue
=
Sfm_LibAddNewGates
(
p
->
pLib
,
pSupp
[
iBest
],
pGate1Best
,
pGate2Best
,
pFans1Best
,
pFans2Best
,
&
p
->
vObjGates
,
&
p
->
vObjFanins
);
assert
(
nSupp
[
iBest
]
<=
p
->
pPars
->
nVarMax
);
p
->
nLuckySizes
[
nSupp
[
iBest
]]
++
;
assert
(
RetValue
<=
2
);
p
->
nLuckyGates
[
RetValue
]
++
;
p
->
DelayMin
=
DelayMin
;
return
1
;
...
...
@@ -1629,13 +1640,13 @@ void Sfm_DecPrintStats( Sfm_Dec_t * p )
ABC_PRTP
(
"ALL "
,
p
->
timeTotal
,
p
->
timeTotal
);
printf
(
"Cone sizes: "
);
for
(
i
=
0
;
i
<
10
;
i
++
)
for
(
i
=
0
;
i
<
=
SFM_SUPP_MAX
;
i
++
)
if
(
p
->
nLuckySizes
[
i
]
)
printf
(
"%d=%d "
,
i
,
p
->
nLuckySizes
[
i
]
);
printf
(
" "
);
printf
(
"Gate sizes: "
);
for
(
i
=
0
;
i
<
10
;
i
++
)
for
(
i
=
0
;
i
<
=
SFM_SUPP_MAX
;
i
++
)
if
(
p
->
nLuckyGates
[
i
]
)
printf
(
"%d=%d "
,
i
,
p
->
nLuckyGates
[
i
]
);
printf
(
"
\n
"
);
...
...
@@ -1792,7 +1803,7 @@ clk = Abc_Clock();
Sfm_TimUpdateTiming
(
p
->
pTim
,
&
p
->
vTemp
);
p
->
timeTime
+=
Abc_Clock
()
-
clk
;
pObjNew
=
Abc_NtkObj
(
pNtk
,
Abc_NtkObjNumMax
(
pNtk
)
-
1
);
assert
(
p
->
DelayMin
==
Sfm_TimReadObjDelay
(
p
->
pTim
,
Abc_ObjId
(
pObjNew
))
);
assert
(
p
->
DelayMin
==
0
||
p
->
DelayMin
==
Sfm_TimReadObjDelay
(
p
->
pTim
,
Abc_ObjId
(
pObjNew
))
);
// report
if
(
pPars
->
fVerbose
)
printf
(
"Node %5d : I =%3d. Cand = %5d (%6.2f %%) Old =%8.2f. New =%8.2f. Final =%8.2f
\n
"
,
...
...
src/opt/sfm/sfmInt.h
View file @
9519341a
...
...
@@ -50,7 +50,7 @@ ABC_NAMESPACE_HEADER_START
#define SFM_SAT_UNDEC 0x1234567812345678
#define SFM_SAT_SAT 0x8765432187654321
#define SFM_SUPP_MAX
6
#define SFM_SUPP_MAX
8
#define SFM_WORD_MAX ((SFM_SUPP_MAX>6) ? (1<<(SFM_SUPP_MAX-6)) : 1)
#define SFM_WIN_MAX 1000
#define SFM_DEC_MAX 4
...
...
@@ -201,9 +201,9 @@ extern int Sfm_LibFindComplInputGate( Vec_Wrd_t * vFuncs, int iGate, in
extern
Sfm_Lib_t
*
Sfm_LibPrepare
(
int
nVars
,
int
fTwo
,
int
fDelay
,
int
fVerbose
);
extern
void
Sfm_LibPrint
(
Sfm_Lib_t
*
p
);
extern
void
Sfm_LibStop
(
Sfm_Lib_t
*
p
);
extern
int
Sfm_LibFindMatches
(
Sfm_Lib_t
*
p
,
word
u
Truth
,
int
*
pFanins
,
int
nFanins
,
Vec_Ptr_t
*
vGates
,
Vec_Ptr_t
*
vFans
);
extern
int
Sfm_LibFindMatches
(
Sfm_Lib_t
*
p
,
word
*
p
Truth
,
int
*
pFanins
,
int
nFanins
,
Vec_Ptr_t
*
vGates
,
Vec_Ptr_t
*
vFans
);
extern
int
Sfm_LibAddNewGates
(
Sfm_Lib_t
*
p
,
int
*
pFanins
,
Mio_Gate_t
*
pGateB
,
Mio_Gate_t
*
pGateT
,
char
*
pFansB
,
char
*
pFansT
,
Vec_Int_t
*
vGates
,
Vec_Wec_t
*
vFanins
);
extern
int
Sfm_LibImplement
(
Sfm_Lib_t
*
p
,
word
u
Truth
,
int
*
pFanins
,
int
nFanins
,
int
AreaMffc
,
Vec_Int_t
*
vGates
,
Vec_Wec_t
*
vFanins
,
int
fZeroCost
);
extern
int
Sfm_LibImplement
(
Sfm_Lib_t
*
p
,
word
*
p
Truth
,
int
*
pFanins
,
int
nFanins
,
int
AreaMffc
,
Vec_Int_t
*
vGates
,
Vec_Wec_t
*
vFanins
,
int
fZeroCost
);
/*=== sfmNtk.c ==========================================================*/
extern
Sfm_Ntk_t
*
Sfm_ConstructNetwork
(
Vec_Wec_t
*
vFanins
,
int
nPis
,
int
nPos
);
extern
void
Sfm_NtkPrepare
(
Sfm_Ntk_t
*
p
);
...
...
src/opt/sfm/sfmLib.c
View file @
9519341a
This diff is collapsed.
Click to expand it.
src/opt/sfm/sfmTime.c
View file @
9519341a
...
...
@@ -253,7 +253,7 @@ Sfm_Tim_t * Sfm_TimStart( Mio_Library_t * pLib, Scl_Con_t * pExt, Abc_Ntk_t * pN
// Vec_IntFillExtra( &p->vTimEdges, Vec_IntSize(Vec_IntSize(&p->vTimEdges)) + Abc_ObjFaninNum(pObj), 0 );
// }
p
->
Delay
=
Sfm_TimTrace
(
p
);
assert
(
DeltaCrit
>
0
&&
DeltaCrit
<
10
000
);
assert
(
DeltaCrit
>
0
&&
DeltaCrit
<
MIO_NUM
*
1
000
);
p
->
DeltaCrit
=
DeltaCrit
;
return
p
;
}
...
...
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