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
c7b65a15
Commit
c7b65a15
authored
Dec 06, 2017
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding parameter structure to 'twoexact' and 'lutexact'.
parent
93b96fc3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
84 deletions
+94
-84
src/base/abci/abc.c
+0
-0
src/sat/bmc/bmc.h
+28
-2
src/sat/bmc/bmcMaj.c
+33
-41
src/sat/bmc/bmcMaj2.c
+33
-41
No files found.
src/base/abci/abc.c
View file @
c7b65a15
This diff is collapsed.
Click to expand it.
src/sat/bmc/bmc.h
View file @
c7b65a15
...
@@ -36,13 +36,39 @@
...
@@ -36,13 +36,39 @@
ABC_NAMESPACE_HEADER_START
ABC_NAMESPACE_HEADER_START
//#define USE_NODE_ORDER 1
//#define USE_NODE_ORDER 1
//#define USE_FIRST_SPECIAL 1
//#define USE_LESS_VARS 1
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// BASIC TYPES ///
/// BASIC TYPES ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// exact synthesis parameters
typedef
struct
Bmc_EsPar_t_
Bmc_EsPar_t
;
struct
Bmc_EsPar_t_
{
int
nVars
;
int
nNodes
;
int
nLutSize
;
int
fGlucose
;
int
fOnlyAnd
;
int
fFewerVars
;
int
fVerbose
;
char
*
pTtStr
;
};
static
inline
void
Bmc_EsParSetDefault
(
Bmc_EsPar_t
*
pPars
)
{
pPars
->
nVars
=
5
;
// when first GC happens (4096) (degree of 2)
pPars
->
nNodes
=
4
;
// when each next GC happens (5)
pPars
->
nLutSize
=
3
;
// log difference compared to unique table
pPars
->
fGlucose
=
0
;
// minimum gain when reodering is not performed
pPars
->
fOnlyAnd
=
0
;
// minimum gain when reodering is not performed
pPars
->
fFewerVars
=
0
;
// minimum gain when reodering is not performed
pPars
->
fVerbose
=
1
;
// verbose output
}
// unrolling manager
// unrolling manager
typedef
struct
Unr_Man_t_
Unr_Man_t
;
typedef
struct
Unr_Man_t_
Unr_Man_t
;
...
...
src/sat/bmc/bmcMaj.c
View file @
c7b65a15
...
@@ -392,6 +392,7 @@ int Maj_ManExactSynthesis( int nVars, int nNodes, int fUseConst, int fUseLine, i
...
@@ -392,6 +392,7 @@ int Maj_ManExactSynthesis( int nVars, int nNodes, int fUseConst, int fUseLine, i
typedef
struct
Exa_Man_t_
Exa_Man_t
;
typedef
struct
Exa_Man_t_
Exa_Man_t
;
struct
Exa_Man_t_
struct
Exa_Man_t_
{
{
Bmc_EsPar_t
*
pPars
;
// parameters
int
nVars
;
// inputs
int
nVars
;
// inputs
int
nNodes
;
// internal nodes
int
nNodes
;
// internal nodes
int
nObjs
;
// total objects (nVars inputs + nNodes internal nodes)
int
nObjs
;
// total objects (nVars inputs + nNodes internal nodes)
...
@@ -438,20 +439,14 @@ int Exa_ManMarkup( Exa_Man_t * p )
...
@@ -438,20 +439,14 @@ int Exa_ManMarkup( Exa_Man_t * p )
{
{
for
(
k
=
0
;
k
<
2
;
k
++
)
for
(
k
=
0
;
k
<
2
;
k
++
)
{
{
#ifdef USE_FIRST_SPECIAL
if
(
p
->
pPars
->
fFewerVars
&&
i
==
p
->
nObjs
-
1
&&
k
==
0
)
if
(
i
==
p
->
nObjs
-
1
&&
k
==
0
)
{
{
j
=
p
->
nObjs
-
2
;
j
=
p
->
nObjs
-
2
;
Vec_WecPush
(
p
->
vOutLits
,
j
,
Abc_Var2Lit
(
p
->
iVar
,
0
)
);
Vec_WecPush
(
p
->
vOutLits
,
j
,
Abc_Var2Lit
(
p
->
iVar
,
0
)
);
p
->
VarMarks
[
i
][
k
][
j
]
=
p
->
iVar
++
;
p
->
VarMarks
[
i
][
k
][
j
]
=
p
->
iVar
++
;
continue
;
continue
;
}
}
#endif
for
(
j
=
p
->
pPars
->
fFewerVars
?
1
-
k
:
0
;
j
<
i
-
k
;
j
++
)
#ifdef USE_LESS_VARS
for
(
j
=
1
-
k
;
j
<
i
-
k
;
j
++
)
#else
for
(
j
=
0
;
j
<
i
-
k
;
j
++
)
#endif
{
{
Vec_WecPush
(
p
->
vOutLits
,
j
,
Abc_Var2Lit
(
p
->
iVar
,
0
)
);
Vec_WecPush
(
p
->
vOutLits
,
j
,
Abc_Var2Lit
(
p
->
iVar
,
0
)
);
p
->
VarMarks
[
i
][
k
][
j
]
=
p
->
iVar
++
;
p
->
VarMarks
[
i
][
k
][
j
]
=
p
->
iVar
++
;
...
@@ -473,13 +468,14 @@ int Exa_ManMarkup( Exa_Man_t * p )
...
@@ -473,13 +468,14 @@ int Exa_ManMarkup( Exa_Man_t * p )
}
}
return
p
->
iVar
;
return
p
->
iVar
;
}
}
Exa_Man_t
*
Exa_ManAlloc
(
int
nVars
,
int
nNode
s
,
word
*
pTruth
)
Exa_Man_t
*
Exa_ManAlloc
(
Bmc_EsPar_t
*
pPar
s
,
word
*
pTruth
)
{
{
Exa_Man_t
*
p
=
ABC_CALLOC
(
Exa_Man_t
,
1
);
Exa_Man_t
*
p
=
ABC_CALLOC
(
Exa_Man_t
,
1
);
p
->
nVars
=
nVars
;
p
->
pPars
=
pPars
;
p
->
nNodes
=
nNodes
;
p
->
nVars
=
pPars
->
nVars
;
p
->
nObjs
=
nVars
+
nNodes
;
p
->
nNodes
=
pPars
->
nNodes
;
p
->
nWords
=
Abc_TtWordNum
(
nVars
);
p
->
nObjs
=
pPars
->
nVars
+
pPars
->
nNodes
;
p
->
nWords
=
Abc_TtWordNum
(
pPars
->
nVars
);
p
->
pTruth
=
pTruth
;
p
->
pTruth
=
pTruth
;
p
->
vOutLits
=
Vec_WecStart
(
p
->
nObjs
);
p
->
vOutLits
=
Vec_WecStart
(
p
->
nObjs
);
p
->
iVar
=
Exa_ManMarkup
(
p
);
p
->
iVar
=
Exa_ManMarkup
(
p
);
...
@@ -729,16 +725,16 @@ int Exa_ManAddCnf( Exa_Man_t * p, int iMint )
...
@@ -729,16 +725,16 @@ int Exa_ManAddCnf( Exa_Man_t * p, int iMint )
p
->
iVar
+=
3
*
p
->
nNodes
;
p
->
iVar
+=
3
*
p
->
nNodes
;
return
1
;
return
1
;
}
}
void
Exa_ManExactSynthesis
(
char
*
pTtStr
,
int
nVars
,
int
nNodes
,
int
fOnlyAnd
,
int
fVerbose
)
void
Exa_ManExactSynthesis
(
Bmc_EsPar_t
*
pPars
)
{
{
int
i
,
status
,
iMint
=
1
;
int
i
,
status
,
iMint
=
1
;
abctime
clkTotal
=
Abc_Clock
();
abctime
clkTotal
=
Abc_Clock
();
Exa_Man_t
*
p
;
int
fCompl
=
0
;
Exa_Man_t
*
p
;
int
fCompl
=
0
;
word
pTruth
[
16
];
Abc_TtReadHex
(
pTruth
,
pTtStr
);
word
pTruth
[
16
];
Abc_TtReadHex
(
pTruth
,
p
Pars
->
p
TtStr
);
assert
(
nVars
<=
10
);
assert
(
pPars
->
nVars
<=
10
);
p
=
Exa_ManAlloc
(
nVars
,
nNode
s
,
pTruth
);
p
=
Exa_ManAlloc
(
pPar
s
,
pTruth
);
if
(
pTruth
[
0
]
&
1
)
{
fCompl
=
1
;
Abc_TtNot
(
pTruth
,
p
->
nWords
);
}
if
(
pTruth
[
0
]
&
1
)
{
fCompl
=
1
;
Abc_TtNot
(
pTruth
,
p
->
nWords
);
}
status
=
Exa_ManAddCnfStart
(
p
,
fOnlyAnd
);
status
=
Exa_ManAddCnfStart
(
p
,
pPars
->
fOnlyAnd
);
assert
(
status
);
assert
(
status
);
printf
(
"Running exact synthesis for %d-input function with %d two-input gates...
\n
"
,
p
->
nVars
,
p
->
nNodes
);
printf
(
"Running exact synthesis for %d-input function with %d two-input gates...
\n
"
,
p
->
nVars
,
p
->
nNodes
);
for
(
i
=
0
;
iMint
!=
-
1
;
i
++
)
for
(
i
=
0
;
iMint
!=
-
1
;
i
++
)
...
@@ -747,7 +743,7 @@ void Exa_ManExactSynthesis( char * pTtStr, int nVars, int nNodes, int fOnlyAnd,
...
@@ -747,7 +743,7 @@ void Exa_ManExactSynthesis( char * pTtStr, int nVars, int nNodes, int fOnlyAnd,
if
(
!
Exa_ManAddCnf
(
p
,
iMint
)
)
if
(
!
Exa_ManAddCnf
(
p
,
iMint
)
)
break
;
break
;
status
=
bmcg_sat_solver_solve
(
p
->
pSat
,
NULL
,
0
);
status
=
bmcg_sat_solver_solve
(
p
->
pSat
,
NULL
,
0
);
if
(
fVerbose
)
if
(
pPars
->
fVerbose
)
{
{
printf
(
"Iter %3d : "
,
i
);
printf
(
"Iter %3d : "
,
i
);
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
&
iMint
,
p
->
nVars
);
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
&
iMint
,
p
->
nVars
);
...
@@ -775,6 +771,7 @@ void Exa_ManExactSynthesis( char * pTtStr, int nVars, int nNodes, int fOnlyAnd,
...
@@ -775,6 +771,7 @@ void Exa_ManExactSynthesis( char * pTtStr, int nVars, int nNodes, int fOnlyAnd,
typedef
struct
Exa3_Man_t_
Exa3_Man_t
;
typedef
struct
Exa3_Man_t_
Exa3_Man_t
;
struct
Exa3_Man_t_
struct
Exa3_Man_t_
{
{
Bmc_EsPar_t
*
pPars
;
// parameters
int
nVars
;
// inputs
int
nVars
;
// inputs
int
nNodes
;
// internal nodes
int
nNodes
;
// internal nodes
int
nLutSize
;
// lut size
int
nLutSize
;
// lut size
...
@@ -823,20 +820,14 @@ static int Exa3_ManMarkup( Exa3_Man_t * p )
...
@@ -823,20 +820,14 @@ static int Exa3_ManMarkup( Exa3_Man_t * p )
{
{
for
(
k
=
0
;
k
<
p
->
nLutSize
;
k
++
)
for
(
k
=
0
;
k
<
p
->
nLutSize
;
k
++
)
{
{
#ifdef USE_FIRST_SPECIAL
if
(
p
->
pPars
->
fFewerVars
&&
i
==
p
->
nObjs
-
1
&&
k
==
0
)
if
(
i
==
p
->
nObjs
-
1
&&
k
==
0
)
{
{
j
=
p
->
nObjs
-
2
;
j
=
p
->
nObjs
-
2
;
Vec_WecPush
(
p
->
vOutLits
,
j
,
Abc_Var2Lit
(
p
->
iVar
,
0
)
);
Vec_WecPush
(
p
->
vOutLits
,
j
,
Abc_Var2Lit
(
p
->
iVar
,
0
)
);
p
->
VarMarks
[
i
][
k
][
j
]
=
p
->
iVar
++
;
p
->
VarMarks
[
i
][
k
][
j
]
=
p
->
iVar
++
;
continue
;
continue
;
}
}
#endif
for
(
j
=
p
->
pPars
->
fFewerVars
?
p
->
nLutSize
-
1
-
k
:
0
;
j
<
i
-
k
;
j
++
)
#ifdef USE_LESS_VARS
for
(
j
=
p
->
nLutSize
-
1
-
k
;
j
<
i
-
k
;
j
++
)
#else
for
(
j
=
0
;
j
<
i
-
k
;
j
++
)
#endif
{
{
Vec_WecPush
(
p
->
vOutLits
,
j
,
Abc_Var2Lit
(
p
->
iVar
,
0
)
);
Vec_WecPush
(
p
->
vOutLits
,
j
,
Abc_Var2Lit
(
p
->
iVar
,
0
)
);
p
->
VarMarks
[
i
][
k
][
j
]
=
p
->
iVar
++
;
p
->
VarMarks
[
i
][
k
][
j
]
=
p
->
iVar
++
;
...
@@ -859,15 +850,16 @@ static int Exa3_ManMarkup( Exa3_Man_t * p )
...
@@ -859,15 +850,16 @@ static int Exa3_ManMarkup( Exa3_Man_t * p )
}
}
return
p
->
iVar
;
return
p
->
iVar
;
}
}
static
Exa3_Man_t
*
Exa3_ManAlloc
(
int
nVars
,
int
nNodes
,
int
nLutSize
,
word
*
pTruth
)
static
Exa3_Man_t
*
Exa3_ManAlloc
(
Bmc_EsPar_t
*
pPars
,
word
*
pTruth
)
{
{
Exa3_Man_t
*
p
=
ABC_CALLOC
(
Exa3_Man_t
,
1
);
Exa3_Man_t
*
p
=
ABC_CALLOC
(
Exa3_Man_t
,
1
);
p
->
nVars
=
nVars
;
p
->
pPars
=
pPars
;
p
->
nNodes
=
nNodes
;
p
->
nVars
=
pPars
->
nVars
;
p
->
nLutSize
=
nLutSize
;
p
->
nNodes
=
pPars
->
nNodes
;
p
->
LutMask
=
(
1
<<
nLutSize
)
-
1
;
p
->
nLutSize
=
pPars
->
nLutSize
;
p
->
nObjs
=
nVars
+
nNodes
;
p
->
LutMask
=
(
1
<<
pPars
->
nLutSize
)
-
1
;
p
->
nWords
=
Abc_TtWordNum
(
nVars
);
p
->
nObjs
=
pPars
->
nVars
+
pPars
->
nNodes
;
p
->
nWords
=
Abc_TtWordNum
(
pPars
->
nVars
);
p
->
pTruth
=
pTruth
;
p
->
pTruth
=
pTruth
;
p
->
vOutLits
=
Vec_WecStart
(
p
->
nObjs
);
p
->
vOutLits
=
Vec_WecStart
(
p
->
nObjs
);
p
->
iVar
=
Exa3_ManMarkup
(
p
);
p
->
iVar
=
Exa3_ManMarkup
(
p
);
...
@@ -1132,17 +1124,17 @@ static int Exa3_ManAddCnf( Exa3_Man_t * p, int iMint )
...
@@ -1132,17 +1124,17 @@ static int Exa3_ManAddCnf( Exa3_Man_t * p, int iMint )
p
->
iVar
+=
(
p
->
nLutSize
+
1
)
*
p
->
nNodes
;
p
->
iVar
+=
(
p
->
nLutSize
+
1
)
*
p
->
nNodes
;
return
1
;
return
1
;
}
}
void
Exa3_ManExactSynthesis
(
char
*
pTtStr
,
int
nVars
,
int
nNodes
,
int
nLutSize
,
int
fOnlyAnd
,
int
fVerbose
)
void
Exa3_ManExactSynthesis
(
Bmc_EsPar_t
*
pPars
)
{
{
int
i
,
status
,
iMint
=
1
;
int
i
,
status
,
iMint
=
1
;
abctime
clkTotal
=
Abc_Clock
();
abctime
clkTotal
=
Abc_Clock
();
Exa3_Man_t
*
p
;
int
fCompl
=
0
;
Exa3_Man_t
*
p
;
int
fCompl
=
0
;
word
pTruth
[
16
];
Abc_TtReadHex
(
pTruth
,
pTtStr
);
word
pTruth
[
16
];
Abc_TtReadHex
(
pTruth
,
p
Pars
->
p
TtStr
);
assert
(
nVars
<=
10
);
assert
(
pPars
->
nVars
<=
10
);
assert
(
nLutSize
<=
6
);
assert
(
pPars
->
nLutSize
<=
6
);
p
=
Exa3_ManAlloc
(
nVars
,
nNodes
,
nLutSize
,
pTruth
);
p
=
Exa3_ManAlloc
(
pPars
,
pTruth
);
if
(
pTruth
[
0
]
&
1
)
{
fCompl
=
1
;
Abc_TtNot
(
pTruth
,
p
->
nWords
);
}
if
(
pTruth
[
0
]
&
1
)
{
fCompl
=
1
;
Abc_TtNot
(
pTruth
,
p
->
nWords
);
}
status
=
Exa3_ManAddCnfStart
(
p
,
fOnlyAnd
);
status
=
Exa3_ManAddCnfStart
(
p
,
pPars
->
fOnlyAnd
);
assert
(
status
);
assert
(
status
);
printf
(
"Running exact synthesis for %d-input function with %d %d-input LUTs...
\n
"
,
p
->
nVars
,
p
->
nNodes
,
p
->
nLutSize
);
printf
(
"Running exact synthesis for %d-input function with %d %d-input LUTs...
\n
"
,
p
->
nVars
,
p
->
nNodes
,
p
->
nLutSize
);
for
(
i
=
0
;
iMint
!=
-
1
;
i
++
)
for
(
i
=
0
;
iMint
!=
-
1
;
i
++
)
...
@@ -1151,7 +1143,7 @@ void Exa3_ManExactSynthesis( char * pTtStr, int nVars, int nNodes, int nLutSize,
...
@@ -1151,7 +1143,7 @@ void Exa3_ManExactSynthesis( char * pTtStr, int nVars, int nNodes, int nLutSize,
if
(
!
Exa3_ManAddCnf
(
p
,
iMint
)
)
if
(
!
Exa3_ManAddCnf
(
p
,
iMint
)
)
break
;
break
;
status
=
bmcg_sat_solver_solve
(
p
->
pSat
,
NULL
,
0
);
status
=
bmcg_sat_solver_solve
(
p
->
pSat
,
NULL
,
0
);
if
(
fVerbose
)
if
(
pPars
->
fVerbose
)
{
{
printf
(
"Iter %3d : "
,
i
);
printf
(
"Iter %3d : "
,
i
);
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
&
iMint
,
p
->
nVars
);
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
&
iMint
,
p
->
nVars
);
...
...
src/sat/bmc/bmcMaj2.c
View file @
c7b65a15
...
@@ -498,6 +498,7 @@ int Maj_ManExactSynthesisTest()
...
@@ -498,6 +498,7 @@ int Maj_ManExactSynthesisTest()
typedef
struct
Exa_Man_t_
Exa_Man_t
;
typedef
struct
Exa_Man_t_
Exa_Man_t
;
struct
Exa_Man_t_
struct
Exa_Man_t_
{
{
Bmc_EsPar_t
*
pPars
;
// parameters
int
nVars
;
// inputs
int
nVars
;
// inputs
int
nNodes
;
// internal nodes
int
nNodes
;
// internal nodes
int
nObjs
;
// total objects (nVars inputs + nNodes internal nodes)
int
nObjs
;
// total objects (nVars inputs + nNodes internal nodes)
...
@@ -544,20 +545,14 @@ static int Exa_ManMarkup( Exa_Man_t * p )
...
@@ -544,20 +545,14 @@ static int Exa_ManMarkup( Exa_Man_t * p )
{
{
for
(
k
=
0
;
k
<
2
;
k
++
)
for
(
k
=
0
;
k
<
2
;
k
++
)
{
{
#ifdef USE_FIRST_SPECIAL
if
(
p
->
pPars
->
fFewerVars
&&
i
==
p
->
nObjs
-
1
&&
k
==
0
)
if
(
i
==
p
->
nObjs
-
1
&&
k
==
0
)
{
{
j
=
p
->
nObjs
-
2
;
j
=
p
->
nObjs
-
2
;
Vec_WecPush
(
p
->
vOutLits
,
j
,
Abc_Var2Lit
(
p
->
iVar
,
0
)
);
Vec_WecPush
(
p
->
vOutLits
,
j
,
Abc_Var2Lit
(
p
->
iVar
,
0
)
);
p
->
VarMarks
[
i
][
k
][
j
]
=
p
->
iVar
++
;
p
->
VarMarks
[
i
][
k
][
j
]
=
p
->
iVar
++
;
continue
;
continue
;
}
}
#endif
for
(
j
=
p
->
pPars
->
fFewerVars
?
1
-
k
:
0
;
j
<
i
-
k
;
j
++
)
#ifdef USE_LESS_VARS
for
(
j
=
1
-
k
;
j
<
i
-
k
;
j
++
)
#else
for
(
j
=
0
;
j
<
i
-
k
;
j
++
)
#endif
{
{
Vec_WecPush
(
p
->
vOutLits
,
j
,
Abc_Var2Lit
(
p
->
iVar
,
0
)
);
Vec_WecPush
(
p
->
vOutLits
,
j
,
Abc_Var2Lit
(
p
->
iVar
,
0
)
);
p
->
VarMarks
[
i
][
k
][
j
]
=
p
->
iVar
++
;
p
->
VarMarks
[
i
][
k
][
j
]
=
p
->
iVar
++
;
...
@@ -579,13 +574,14 @@ static int Exa_ManMarkup( Exa_Man_t * p )
...
@@ -579,13 +574,14 @@ static int Exa_ManMarkup( Exa_Man_t * p )
}
}
return
p
->
iVar
;
return
p
->
iVar
;
}
}
static
Exa_Man_t
*
Exa_ManAlloc
(
int
nVars
,
int
nNode
s
,
word
*
pTruth
)
static
Exa_Man_t
*
Exa_ManAlloc
(
Bmc_EsPar_t
*
pPar
s
,
word
*
pTruth
)
{
{
Exa_Man_t
*
p
=
ABC_CALLOC
(
Exa_Man_t
,
1
);
Exa_Man_t
*
p
=
ABC_CALLOC
(
Exa_Man_t
,
1
);
p
->
nVars
=
nVars
;
p
->
pPars
=
pPars
;
p
->
nNodes
=
nNodes
;
p
->
nVars
=
pPars
->
nVars
;
p
->
nObjs
=
nVars
+
nNodes
;
p
->
nNodes
=
pPars
->
nNodes
;
p
->
nWords
=
Abc_TtWordNum
(
nVars
);
p
->
nObjs
=
pPars
->
nVars
+
pPars
->
nNodes
;
p
->
nWords
=
Abc_TtWordNum
(
pPars
->
nVars
);
p
->
pTruth
=
pTruth
;
p
->
pTruth
=
pTruth
;
p
->
vOutLits
=
Vec_WecStart
(
p
->
nObjs
);
p
->
vOutLits
=
Vec_WecStart
(
p
->
nObjs
);
p
->
iVar
=
Exa_ManMarkup
(
p
);
p
->
iVar
=
Exa_ManMarkup
(
p
);
...
@@ -835,16 +831,16 @@ static int Exa_ManAddCnf( Exa_Man_t * p, int iMint )
...
@@ -835,16 +831,16 @@ static int Exa_ManAddCnf( Exa_Man_t * p, int iMint )
p
->
iVar
+=
3
*
p
->
nNodes
;
p
->
iVar
+=
3
*
p
->
nNodes
;
return
1
;
return
1
;
}
}
void
Exa_ManExactSynthesis2
(
char
*
pTtStr
,
int
nVars
,
int
nNodes
,
int
fOnlyAnd
,
int
fVerbose
)
void
Exa_ManExactSynthesis2
(
Bmc_EsPar_t
*
pPars
)
{
{
int
i
,
status
,
iMint
=
1
;
int
i
,
status
,
iMint
=
1
;
abctime
clkTotal
=
Abc_Clock
();
abctime
clkTotal
=
Abc_Clock
();
Exa_Man_t
*
p
;
int
fCompl
=
0
;
Exa_Man_t
*
p
;
int
fCompl
=
0
;
word
pTruth
[
16
];
Abc_TtReadHex
(
pTruth
,
pTtStr
);
word
pTruth
[
16
];
Abc_TtReadHex
(
pTruth
,
p
Pars
->
p
TtStr
);
assert
(
nVars
<=
10
);
assert
(
pPars
->
nVars
<=
10
);
p
=
Exa_ManAlloc
(
nVars
,
nNode
s
,
pTruth
);
p
=
Exa_ManAlloc
(
pPar
s
,
pTruth
);
if
(
pTruth
[
0
]
&
1
)
{
fCompl
=
1
;
Abc_TtNot
(
pTruth
,
p
->
nWords
);
}
if
(
pTruth
[
0
]
&
1
)
{
fCompl
=
1
;
Abc_TtNot
(
pTruth
,
p
->
nWords
);
}
status
=
Exa_ManAddCnfStart
(
p
,
fOnlyAnd
);
status
=
Exa_ManAddCnfStart
(
p
,
pPars
->
fOnlyAnd
);
assert
(
status
);
assert
(
status
);
printf
(
"Running exact synthesis for %d-input function with %d two-input gates...
\n
"
,
p
->
nVars
,
p
->
nNodes
);
printf
(
"Running exact synthesis for %d-input function with %d two-input gates...
\n
"
,
p
->
nVars
,
p
->
nNodes
);
for
(
i
=
0
;
iMint
!=
-
1
;
i
++
)
for
(
i
=
0
;
iMint
!=
-
1
;
i
++
)
...
@@ -853,7 +849,7 @@ void Exa_ManExactSynthesis2( char * pTtStr, int nVars, int nNodes, int fOnlyAnd,
...
@@ -853,7 +849,7 @@ void Exa_ManExactSynthesis2( char * pTtStr, int nVars, int nNodes, int fOnlyAnd,
if
(
!
Exa_ManAddCnf
(
p
,
iMint
)
)
if
(
!
Exa_ManAddCnf
(
p
,
iMint
)
)
break
;
break
;
status
=
sat_solver_solve
(
p
->
pSat
,
NULL
,
NULL
,
0
,
0
,
0
,
0
);
status
=
sat_solver_solve
(
p
->
pSat
,
NULL
,
NULL
,
0
,
0
,
0
,
0
);
if
(
fVerbose
)
if
(
pPars
->
fVerbose
)
{
{
printf
(
"Iter %3d : "
,
i
);
printf
(
"Iter %3d : "
,
i
);
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
&
iMint
,
p
->
nVars
);
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
&
iMint
,
p
->
nVars
);
...
@@ -883,6 +879,7 @@ void Exa_ManExactSynthesis2( char * pTtStr, int nVars, int nNodes, int fOnlyAnd,
...
@@ -883,6 +879,7 @@ void Exa_ManExactSynthesis2( char * pTtStr, int nVars, int nNodes, int fOnlyAnd,
typedef
struct
Exa3_Man_t_
Exa3_Man_t
;
typedef
struct
Exa3_Man_t_
Exa3_Man_t
;
struct
Exa3_Man_t_
struct
Exa3_Man_t_
{
{
Bmc_EsPar_t
*
pPars
;
// parameters
int
nVars
;
// inputs
int
nVars
;
// inputs
int
nNodes
;
// internal nodes
int
nNodes
;
// internal nodes
int
nLutSize
;
// lut size
int
nLutSize
;
// lut size
...
@@ -931,20 +928,14 @@ static int Exa3_ManMarkup( Exa3_Man_t * p )
...
@@ -931,20 +928,14 @@ static int Exa3_ManMarkup( Exa3_Man_t * p )
{
{
for
(
k
=
0
;
k
<
p
->
nLutSize
;
k
++
)
for
(
k
=
0
;
k
<
p
->
nLutSize
;
k
++
)
{
{
#ifdef USE_FIRST_SPECIAL
if
(
p
->
pPars
->
fFewerVars
&&
i
==
p
->
nObjs
-
1
&&
k
==
0
)
if
(
i
==
p
->
nObjs
-
1
&&
k
==
0
)
{
{
j
=
p
->
nObjs
-
2
;
j
=
p
->
nObjs
-
2
;
Vec_WecPush
(
p
->
vOutLits
,
j
,
Abc_Var2Lit
(
p
->
iVar
,
0
)
);
Vec_WecPush
(
p
->
vOutLits
,
j
,
Abc_Var2Lit
(
p
->
iVar
,
0
)
);
p
->
VarMarks
[
i
][
k
][
j
]
=
p
->
iVar
++
;
p
->
VarMarks
[
i
][
k
][
j
]
=
p
->
iVar
++
;
continue
;
continue
;
}
}
#endif
for
(
j
=
p
->
pPars
->
fFewerVars
?
p
->
nLutSize
-
1
-
k
:
0
;
j
<
i
-
k
;
j
++
)
#ifdef USE_LESS_VARS
for
(
j
=
p
->
nLutSize
-
1
-
k
;
j
<
i
-
k
;
j
++
)
#else
for
(
j
=
0
;
j
<
i
-
k
;
j
++
)
#endif
{
{
Vec_WecPush
(
p
->
vOutLits
,
j
,
Abc_Var2Lit
(
p
->
iVar
,
0
)
);
Vec_WecPush
(
p
->
vOutLits
,
j
,
Abc_Var2Lit
(
p
->
iVar
,
0
)
);
p
->
VarMarks
[
i
][
k
][
j
]
=
p
->
iVar
++
;
p
->
VarMarks
[
i
][
k
][
j
]
=
p
->
iVar
++
;
...
@@ -1016,15 +1007,16 @@ static void Exa3_ManInitPolarity( Exa3_Man_t * p )
...
@@ -1016,15 +1007,16 @@ static void Exa3_ManInitPolarity( Exa3_Man_t * p )
//intf( "\n" );
//intf( "\n" );
}
}
}
}
static
Exa3_Man_t
*
Exa3_ManAlloc
(
int
nVars
,
int
nNodes
,
int
nLutSize
,
word
*
pTruth
)
static
Exa3_Man_t
*
Exa3_ManAlloc
(
Bmc_EsPar_t
*
pPars
,
word
*
pTruth
)
{
{
Exa3_Man_t
*
p
=
ABC_CALLOC
(
Exa3_Man_t
,
1
);
Exa3_Man_t
*
p
=
ABC_CALLOC
(
Exa3_Man_t
,
1
);
p
->
nVars
=
nVars
;
p
->
pPars
=
pPars
;
p
->
nNodes
=
nNodes
;
p
->
nVars
=
pPars
->
nVars
;
p
->
nLutSize
=
nLutSize
;
p
->
nNodes
=
pPars
->
nNodes
;
p
->
LutMask
=
(
1
<<
nLutSize
)
-
1
;
p
->
nLutSize
=
pPars
->
nLutSize
;
p
->
nObjs
=
nVars
+
nNodes
;
p
->
LutMask
=
(
1
<<
pPars
->
nLutSize
)
-
1
;
p
->
nWords
=
Abc_TtWordNum
(
nVars
);
p
->
nObjs
=
pPars
->
nVars
+
pPars
->
nNodes
;
p
->
nWords
=
Abc_TtWordNum
(
pPars
->
nVars
);
p
->
pTruth
=
pTruth
;
p
->
pTruth
=
pTruth
;
p
->
vOutLits
=
Vec_WecStart
(
p
->
nObjs
);
p
->
vOutLits
=
Vec_WecStart
(
p
->
nObjs
);
p
->
iVar
=
Exa3_ManMarkup
(
p
);
p
->
iVar
=
Exa3_ManMarkup
(
p
);
...
@@ -1300,17 +1292,17 @@ static int Exa3_ManAddCnf( Exa3_Man_t * p, int iMint )
...
@@ -1300,17 +1292,17 @@ static int Exa3_ManAddCnf( Exa3_Man_t * p, int iMint )
p
->
iVar
+=
(
p
->
nLutSize
+
1
)
*
p
->
nNodes
;
p
->
iVar
+=
(
p
->
nLutSize
+
1
)
*
p
->
nNodes
;
return
1
;
return
1
;
}
}
void
Exa3_ManExactSynthesis2
(
char
*
pTtStr
,
int
nVars
,
int
nNodes
,
int
nLutSize
,
int
fOnlyAnd
,
int
fVerbose
)
void
Exa3_ManExactSynthesis2
(
Bmc_EsPar_t
*
pPars
)
{
{
int
i
,
status
,
iMint
=
1
;
int
i
,
status
,
iMint
=
1
;
abctime
clkTotal
=
Abc_Clock
();
abctime
clkTotal
=
Abc_Clock
();
Exa3_Man_t
*
p
;
int
fCompl
=
0
;
Exa3_Man_t
*
p
;
int
fCompl
=
0
;
word
pTruth
[
16
];
Abc_TtReadHex
(
pTruth
,
pTtStr
);
word
pTruth
[
16
];
Abc_TtReadHex
(
pTruth
,
p
Pars
->
p
TtStr
);
assert
(
nVars
<=
10
);
assert
(
pPars
->
nVars
<=
10
);
assert
(
nLutSize
<=
6
);
assert
(
pPars
->
nLutSize
<=
6
);
p
=
Exa3_ManAlloc
(
nVars
,
nNodes
,
nLutSize
,
pTruth
);
p
=
Exa3_ManAlloc
(
pPars
,
pTruth
);
if
(
pTruth
[
0
]
&
1
)
{
fCompl
=
1
;
Abc_TtNot
(
pTruth
,
p
->
nWords
);
}
if
(
pTruth
[
0
]
&
1
)
{
fCompl
=
1
;
Abc_TtNot
(
pTruth
,
p
->
nWords
);
}
status
=
Exa3_ManAddCnfStart
(
p
,
fOnlyAnd
);
status
=
Exa3_ManAddCnfStart
(
p
,
pPars
->
fOnlyAnd
);
assert
(
status
);
assert
(
status
);
printf
(
"Running exact synthesis for %d-input function with %d %d-input LUTs...
\n
"
,
p
->
nVars
,
p
->
nNodes
,
p
->
nLutSize
);
printf
(
"Running exact synthesis for %d-input function with %d %d-input LUTs...
\n
"
,
p
->
nVars
,
p
->
nNodes
,
p
->
nLutSize
);
for
(
i
=
0
;
iMint
!=
-
1
;
i
++
)
for
(
i
=
0
;
iMint
!=
-
1
;
i
++
)
...
@@ -1319,7 +1311,7 @@ void Exa3_ManExactSynthesis2( char * pTtStr, int nVars, int nNodes, int nLutSize
...
@@ -1319,7 +1311,7 @@ void Exa3_ManExactSynthesis2( char * pTtStr, int nVars, int nNodes, int nLutSize
if
(
!
Exa3_ManAddCnf
(
p
,
iMint
)
)
if
(
!
Exa3_ManAddCnf
(
p
,
iMint
)
)
break
;
break
;
status
=
sat_solver_solve
(
p
->
pSat
,
NULL
,
NULL
,
0
,
0
,
0
,
0
);
status
=
sat_solver_solve
(
p
->
pSat
,
NULL
,
NULL
,
0
,
0
,
0
,
0
);
if
(
fVerbose
)
if
(
pPars
->
fVerbose
)
{
{
printf
(
"Iter %3d : "
,
i
);
printf
(
"Iter %3d : "
,
i
);
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
&
iMint
,
p
->
nVars
);
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
&
iMint
,
p
->
nVars
);
...
...
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