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
6d0214ed
Commit
6d0214ed
authored
Jul 30, 2016
by
Mathias Soeken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract solution into intermediate format.
parent
0b01f5ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
211 additions
and
173 deletions
+211
-173
src/base/abci/abcExact.c
+211
-173
No files found.
src/base/abci/abcExact.c
View file @
6d0214ed
...
@@ -52,48 +52,48 @@ static word s_Truths8[32] = {
...
@@ -52,48 +52,48 @@ static word s_Truths8[32] = {
typedef
struct
Ses_Man_t_
Ses_Man_t
;
typedef
struct
Ses_Man_t_
Ses_Man_t
;
struct
Ses_Man_t_
struct
Ses_Man_t_
{
{
sat_solver
*
pSat
;
/* SAT solver */
sat_solver
*
pSat
;
/* SAT solver */
word
*
pSpec
;
/* specification */
word
*
pSpec
;
/* specification */
int
bSpecInv
;
/* remembers whether spec was inverted for normalization */
int
bSpecInv
;
/* remembers whether spec was inverted for normalization */
int
nSpecVars
;
/* number of variables in specification */
int
nSpecVars
;
/* number of variables in specification */
int
nSpecFunc
;
/* number of functions to synthesize */
int
nSpecFunc
;
/* number of functions to synthesize */
int
nRows
;
/* number of rows in the specification (without 0) */
int
nRows
;
/* number of rows in the specification (without 0) */
int
nMaxDepth
;
/* maximum depth (-1 if depth is not constrained) */
int
nMaxDepth
;
/* maximum depth (-1 if depth is not constrained) */
int
*
pArr
ivalTimes
;
/* arrival times of inputs (NULL if arrival times are ignored) */
int
*
pArr
TimeProfile
;
/* arrival times of inputs (NULL if arrival times are ignored) */
int
nArr
ivalDelta
;
/* delta to the original arrival times (arrival times are normalized to have 0 as minimum element) */
int
nArr
TimeDelta
;
/* delta to the original arrival times (arrival times are normalized to have 0 as minimum element) */
int
nArr
ivalMax
;
/* maximum normalized arrival time */
int
nArr
TimeMax
;
/* maximum normalized arrival time */
int
nBTLimit
;
/* conflict limit */
int
nBTLimit
;
/* conflict limit */
int
fMakeAIG
;
/* create AIG instead of general network */
int
fMakeAIG
;
/* create AIG instead of general network */
int
fVerbose
;
/* be verbose */
int
fVerbose
;
/* be verbose */
int
fVeryVerbose
;
/* be very verbose */
int
fVeryVerbose
;
/* be very verbose */
int
nGates
;
/* number of gates */
int
nGates
;
/* number of gates */
int
nSimVars
;
/* number of simulation vars x(i, t) */
int
nSimVars
;
/* number of simulation vars x(i, t) */
int
nOutputVars
;
/* number of output variables g(h, i) */
int
nOutputVars
;
/* number of output variables g(h, i) */
int
nGateVars
;
/* number of gate variables f(i, p, q) */
int
nGateVars
;
/* number of gate variables f(i, p, q) */
int
nSelectVars
;
/* number of select variables s(i, j, k) */
int
nSelectVars
;
/* number of select variables s(i, j, k) */
int
nDepthVars
;
/* number of depth variables d(i, j) */
int
nDepthVars
;
/* number of depth variables d(i, j) */
int
nOutputOffset
;
/* offset where output variables start */
int
nOutputOffset
;
/* offset where output variables start */
int
nGateOffset
;
/* offset where gate variables start */
int
nGateOffset
;
/* offset where gate variables start */
int
nSelectOffset
;
/* offset where select variables start */
int
nSelectOffset
;
/* offset where select variables start */
int
nDepthOffset
;
/* offset where depth variables start */
int
nDepthOffset
;
/* offset where depth variables start */
abctime
timeSat
;
/* SAT runtime */
abctime
timeSat
;
/* SAT runtime */
abctime
timeSatSat
;
/* SAT runtime (sat instance) */
abctime
timeSatSat
;
/* SAT runtime (sat instance) */
abctime
timeSatUnsat
;
/* SAT runtime (unsat instance) */
abctime
timeSatUnsat
;
/* SAT runtime (unsat instance) */
abctime
timeTotal
;
/* all runtime */
abctime
timeTotal
;
/* all runtime */
};
};
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
int
NormalizeArrivalTimes
(
int
*
pArr
ivalTimes
,
int
nVars
,
int
*
maxNormalized
)
int
NormalizeArrivalTimes
(
int
*
pArr
TimeProfile
,
int
nVars
,
int
*
maxNormalized
)
{
{
int
*
p
=
pArr
ivalTimes
,
*
pEnd
=
pArrivalTimes
+
nVars
;
int
*
p
=
pArr
TimeProfile
,
*
pEnd
=
pArrTimeProfile
+
nVars
;
int
delta
=
*
p
;
int
delta
=
*
p
;
while
(
++
p
<
pEnd
)
while
(
++
p
<
pEnd
)
...
@@ -101,7 +101,7 @@ int NormalizeArrivalTimes( int * pArrivalTimes, int nVars, int * maxNormalized )
...
@@ -101,7 +101,7 @@ int NormalizeArrivalTimes( int * pArrivalTimes, int nVars, int * maxNormalized )
delta
=
*
p
;
delta
=
*
p
;
*
maxNormalized
=
0
;
*
maxNormalized
=
0
;
p
=
pArr
ivalTimes
;
p
=
pArr
TimeProfile
;
while
(
p
<
pEnd
)
while
(
p
<
pEnd
)
{
{
*
p
-=
delta
;
*
p
-=
delta
;
...
@@ -115,7 +115,7 @@ int NormalizeArrivalTimes( int * pArrivalTimes, int nVars, int * maxNormalized )
...
@@ -115,7 +115,7 @@ int NormalizeArrivalTimes( int * pArrivalTimes, int nVars, int * maxNormalized )
return
delta
;
return
delta
;
}
}
static
inline
Ses_Man_t
*
Ses_ManAlloc
(
word
*
pTruth
,
int
nVars
,
int
nFunc
,
int
nMaxDepth
,
int
*
pArr
ivalTimes
,
int
fMakeAIG
,
int
fVerbose
)
static
inline
Ses_Man_t
*
Ses_ManAlloc
(
word
*
pTruth
,
int
nVars
,
int
nFunc
,
int
nMaxDepth
,
int
*
pArr
TimeProfile
,
int
fMakeAIG
,
int
fVerbose
)
{
{
int
h
,
i
;
int
h
,
i
;
...
@@ -134,11 +134,11 @@ static inline Ses_Man_t * Ses_ManAlloc( word * pTruth, int nVars, int nFunc, int
...
@@ -134,11 +134,11 @@ static inline Ses_Man_t * Ses_ManAlloc( word * pTruth, int nVars, int nFunc, int
p
->
nSpecFunc
=
nFunc
;
p
->
nSpecFunc
=
nFunc
;
p
->
nRows
=
(
1
<<
nVars
)
-
1
;
p
->
nRows
=
(
1
<<
nVars
)
-
1
;
p
->
nMaxDepth
=
nMaxDepth
;
p
->
nMaxDepth
=
nMaxDepth
;
p
->
pArr
ivalTimes
=
nMaxDepth
>=
0
?
pArrivalTimes
:
NULL
;
p
->
pArr
TimeProfile
=
nMaxDepth
>=
0
?
pArrTimeProfile
:
NULL
;
if
(
p
->
pArr
ivalTimes
)
if
(
p
->
pArr
TimeProfile
)
p
->
nArr
ivalDelta
=
NormalizeArrivalTimes
(
p
->
pArrivalTimes
,
nVars
,
&
p
->
nArrival
Max
);
p
->
nArr
TimeDelta
=
NormalizeArrivalTimes
(
p
->
pArrTimeProfile
,
nVars
,
&
p
->
nArrTime
Max
);
else
else
p
->
nArr
ivalDelta
=
p
->
nArrival
Max
=
0
;
p
->
nArr
TimeDelta
=
p
->
nArrTime
Max
=
0
;
p
->
fMakeAIG
=
fMakeAIG
;
p
->
fMakeAIG
=
fMakeAIG
;
p
->
nBTLimit
=
nMaxDepth
>=
0
?
50000
:
0
;
p
->
nBTLimit
=
nMaxDepth
>=
0
?
50000
:
0
;
p
->
fVerbose
=
fVerbose
;
p
->
fVerbose
=
fVerbose
;
...
@@ -155,9 +155,9 @@ static inline void Ses_ManClean( Ses_Man_t * pSes )
...
@@ -155,9 +155,9 @@ static inline void Ses_ManClean( Ses_Man_t * pSes )
for
(
i
=
0
;
i
<
4
;
++
i
)
for
(
i
=
0
;
i
<
4
;
++
i
)
pSes
->
pSpec
[(
h
<<
2
)
+
i
]
=
~
(
pSes
->
pSpec
[(
h
<<
2
)
+
i
]
);
pSes
->
pSpec
[(
h
<<
2
)
+
i
]
=
~
(
pSes
->
pSpec
[(
h
<<
2
)
+
i
]
);
if
(
pSes
->
pArr
ivalTimes
)
if
(
pSes
->
pArr
TimeProfile
)
for
(
i
=
0
;
i
<
pSes
->
nSpecVars
;
++
i
)
for
(
i
=
0
;
i
<
pSes
->
nSpecVars
;
++
i
)
pSes
->
pArr
ivalTimes
[
i
]
+=
pSes
->
nArrival
Delta
;
pSes
->
pArr
TimeProfile
[
i
]
+=
pSes
->
nArrTime
Delta
;
if
(
pSes
->
pSat
)
if
(
pSes
->
pSat
)
sat_solver_delete
(
pSes
->
pSat
);
sat_solver_delete
(
pSes
->
pSat
);
...
@@ -215,9 +215,9 @@ static inline int Ses_ManSelectVar( Ses_Man_t * pSes, int i, int j, int k )
...
@@ -215,9 +215,9 @@ static inline int Ses_ManSelectVar( Ses_Man_t * pSes, int i, int j, int k )
static
inline
int
Ses_ManDepthVar
(
Ses_Man_t
*
pSes
,
int
i
,
int
j
)
static
inline
int
Ses_ManDepthVar
(
Ses_Man_t
*
pSes
,
int
i
,
int
j
)
{
{
assert
(
i
<
pSes
->
nGates
);
assert
(
i
<
pSes
->
nGates
);
assert
(
j
<=
pSes
->
nArr
ival
Max
+
i
);
assert
(
j
<=
pSes
->
nArr
Time
Max
+
i
);
return
pSes
->
nDepthOffset
+
i
*
pSes
->
nArr
ival
Max
+
(
(
i
*
(
i
+
1
)
)
/
2
)
+
j
;
return
pSes
->
nDepthOffset
+
i
*
pSes
->
nArr
Time
Max
+
(
(
i
*
(
i
+
1
)
)
/
2
)
+
j
;
}
}
/**Function*************************************************************
/**Function*************************************************************
...
@@ -241,7 +241,7 @@ static void Ses_ManCreateVars( Ses_Man_t * pSes, int nGates )
...
@@ -241,7 +241,7 @@ static void Ses_ManCreateVars( Ses_Man_t * pSes, int nGates )
pSes
->
nSelectVars
=
0
;
pSes
->
nSelectVars
=
0
;
for
(
i
=
pSes
->
nSpecVars
;
i
<
pSes
->
nSpecVars
+
nGates
;
++
i
)
for
(
i
=
pSes
->
nSpecVars
;
i
<
pSes
->
nSpecVars
+
nGates
;
++
i
)
pSes
->
nSelectVars
+=
(
i
*
(
i
-
1
)
)
/
2
;
pSes
->
nSelectVars
+=
(
i
*
(
i
-
1
)
)
/
2
;
pSes
->
nDepthVars
=
pSes
->
nMaxDepth
>
0
?
nGates
*
pSes
->
nArr
ival
Max
+
(
nGates
*
(
nGates
+
1
)
)
/
2
:
0
;
pSes
->
nDepthVars
=
pSes
->
nMaxDepth
>
0
?
nGates
*
pSes
->
nArr
Time
Max
+
(
nGates
*
(
nGates
+
1
)
)
/
2
:
0
;
pSes
->
nOutputOffset
=
pSes
->
nSimVars
;
pSes
->
nOutputOffset
=
pSes
->
nSimVars
;
pSes
->
nGateOffset
=
pSes
->
nSimVars
+
pSes
->
nOutputVars
;
pSes
->
nGateOffset
=
pSes
->
nSimVars
+
pSes
->
nOutputVars
;
...
@@ -440,7 +440,7 @@ static void Ses_ManCreateClauses( Ses_Man_t * pSes )
...
@@ -440,7 +440,7 @@ static void Ses_ManCreateClauses( Ses_Man_t * pSes )
for
(
j
=
0
;
j
<
k
;
++
j
)
for
(
j
=
0
;
j
<
k
;
++
j
)
{
{
pLits
[
0
]
=
Abc_Var2Lit
(
Ses_ManSelectVar
(
pSes
,
i
,
pSes
->
nSpecVars
+
j
,
pSes
->
nSpecVars
+
k
),
1
);
pLits
[
0
]
=
Abc_Var2Lit
(
Ses_ManSelectVar
(
pSes
,
i
,
pSes
->
nSpecVars
+
j
,
pSes
->
nSpecVars
+
k
),
1
);
for
(
jj
=
0
;
jj
<=
pSes
->
nArr
ival
Max
+
j
;
++
jj
)
for
(
jj
=
0
;
jj
<=
pSes
->
nArr
Time
Max
+
j
;
++
jj
)
{
{
pLits
[
1
]
=
Abc_Var2Lit
(
Ses_ManDepthVar
(
pSes
,
j
,
jj
),
1
);
pLits
[
1
]
=
Abc_Var2Lit
(
Ses_ManDepthVar
(
pSes
,
j
,
jj
),
1
);
pLits
[
2
]
=
Abc_Var2Lit
(
Ses_ManDepthVar
(
pSes
,
i
,
jj
+
1
),
0
);
pLits
[
2
]
=
Abc_Var2Lit
(
Ses_ManDepthVar
(
pSes
,
i
,
jj
+
1
),
0
);
...
@@ -452,7 +452,7 @@ static void Ses_ManCreateClauses( Ses_Man_t * pSes )
...
@@ -452,7 +452,7 @@ static void Ses_ManCreateClauses( Ses_Man_t * pSes )
for
(
j
=
0
;
j
<
pSes
->
nSpecVars
+
k
;
++
j
)
for
(
j
=
0
;
j
<
pSes
->
nSpecVars
+
k
;
++
j
)
{
{
pLits
[
0
]
=
Abc_Var2Lit
(
Ses_ManSelectVar
(
pSes
,
i
,
j
,
pSes
->
nSpecVars
+
k
),
1
);
pLits
[
0
]
=
Abc_Var2Lit
(
Ses_ManSelectVar
(
pSes
,
i
,
j
,
pSes
->
nSpecVars
+
k
),
1
);
for
(
kk
=
0
;
kk
<=
pSes
->
nArr
ival
Max
+
k
;
++
kk
)
for
(
kk
=
0
;
kk
<=
pSes
->
nArr
Time
Max
+
k
;
++
kk
)
{
{
pLits
[
1
]
=
Abc_Var2Lit
(
Ses_ManDepthVar
(
pSes
,
k
,
kk
),
1
);
pLits
[
1
]
=
Abc_Var2Lit
(
Ses_ManDepthVar
(
pSes
,
k
,
kk
),
1
);
pLits
[
2
]
=
Abc_Var2Lit
(
Ses_ManDepthVar
(
pSes
,
i
,
kk
+
1
),
0
);
pLits
[
2
]
=
Abc_Var2Lit
(
Ses_ManDepthVar
(
pSes
,
i
,
kk
+
1
),
0
);
...
@@ -461,14 +461,14 @@ static void Ses_ManCreateClauses( Ses_Man_t * pSes )
...
@@ -461,14 +461,14 @@ static void Ses_ManCreateClauses( Ses_Man_t * pSes )
}
}
/* propagate depths from arrival times at PIs */
/* propagate depths from arrival times at PIs */
if
(
pSes
->
pArr
ivalTimes
)
if
(
pSes
->
pArr
TimeProfile
)
{
{
for
(
k
=
1
;
k
<
pSes
->
nSpecVars
+
i
;
++
k
)
for
(
k
=
1
;
k
<
pSes
->
nSpecVars
+
i
;
++
k
)
for
(
j
=
0
;
j
<
(
(
k
<
pSes
->
nSpecVars
)
?
k
:
pSes
->
nSpecVars
);
++
j
)
for
(
j
=
0
;
j
<
(
(
k
<
pSes
->
nSpecVars
)
?
k
:
pSes
->
nSpecVars
);
++
j
)
{
{
d
=
pSes
->
pArr
ivalTimes
[
j
];
d
=
pSes
->
pArr
TimeProfile
[
j
];
if
(
k
<
pSes
->
nSpecVars
&&
pSes
->
pArr
ivalTimes
[
k
]
>
d
)
if
(
k
<
pSes
->
nSpecVars
&&
pSes
->
pArr
TimeProfile
[
k
]
>
d
)
d
=
pSes
->
pArr
ivalTimes
[
k
];
d
=
pSes
->
pArr
TimeProfile
[
k
];
pLits
[
0
]
=
Abc_Var2Lit
(
Ses_ManSelectVar
(
pSes
,
i
,
j
,
k
),
1
);
pLits
[
0
]
=
Abc_Var2Lit
(
Ses_ManSelectVar
(
pSes
,
i
,
j
,
k
),
1
);
pLits
[
1
]
=
Abc_Var2Lit
(
Ses_ManDepthVar
(
pSes
,
i
,
d
+
1
),
0
);
pLits
[
1
]
=
Abc_Var2Lit
(
Ses_ManDepthVar
(
pSes
,
i
,
d
+
1
),
0
);
...
@@ -483,7 +483,7 @@ static void Ses_ManCreateClauses( Ses_Man_t * pSes )
...
@@ -483,7 +483,7 @@ static void Ses_ManCreateClauses( Ses_Man_t * pSes )
}
}
/* reverse order encoding of depth variables */
/* reverse order encoding of depth variables */
for
(
j
=
1
;
j
<=
pSes
->
nArr
ival
Max
+
i
;
++
j
)
for
(
j
=
1
;
j
<=
pSes
->
nArr
Time
Max
+
i
;
++
j
)
{
{
pLits
[
0
]
=
Abc_Var2Lit
(
Ses_ManDepthVar
(
pSes
,
i
,
j
),
1
);
pLits
[
0
]
=
Abc_Var2Lit
(
Ses_ManDepthVar
(
pSes
,
i
,
j
),
1
);
pLits
[
1
]
=
Abc_Var2Lit
(
Ses_ManDepthVar
(
pSes
,
i
,
j
-
1
),
0
);
pLits
[
1
]
=
Abc_Var2Lit
(
Ses_ManDepthVar
(
pSes
,
i
,
j
-
1
),
0
);
...
@@ -491,7 +491,7 @@ static void Ses_ManCreateClauses( Ses_Man_t * pSes )
...
@@ -491,7 +491,7 @@ static void Ses_ManCreateClauses( Ses_Man_t * pSes )
}
}
/* constrain maximum depth */
/* constrain maximum depth */
if
(
pSes
->
nMaxDepth
<
pSes
->
nArr
ival
Max
+
i
)
if
(
pSes
->
nMaxDepth
<
pSes
->
nArr
Time
Max
+
i
)
for
(
h
=
0
;
h
<
pSes
->
nSpecFunc
;
++
h
)
for
(
h
=
0
;
h
<
pSes
->
nSpecFunc
;
++
h
)
{
{
pLits
[
0
]
=
Abc_Var2Lit
(
Ses_ManOutputVar
(
pSes
,
h
,
i
),
1
);
pLits
[
0
]
=
Abc_Var2Lit
(
Ses_ManOutputVar
(
pSes
,
h
,
i
),
1
);
...
@@ -548,9 +548,82 @@ static inline int Ses_ManSolve( Ses_Man_t * pSes )
...
@@ -548,9 +548,82 @@ static inline int Ses_ManSolve( Ses_Man_t * pSes )
Synopsis [Extract solution.]
Synopsis [Extract solution.]
***********************************************************************/
***********************************************************************/
static
Abc_Ntk_t
*
Ses_ManExtractNtk
(
Ses_Man_t
*
pSes
)
// char is an array of short integers that stores the synthesized network
// using the following format
// | nvars | nfunc | ngates | gate1 | ... | gaten | func1 | .. | funcm |
// nvars: integer with number of variables
// nfunc: integer with number of functions
// ngates: integer with number of gates
// gate: | op | nfanin | fanin1 | ... | faninl |
// op: integer of gate's truth table (divided by 2, because gate is normal)
// nfanin: integer with number of fanins
// fanin: integer to primary input or other gate
// func: integer as literal to some gate (not primary input), can be complemented
#define ABC_EXACT_SOL_NVARS 0
#define ABC_EXACT_SOL_NFUNC 1
#define ABC_EXACT_SOL_NGATES 2
static
char
*
Ses_ManExtractSolution
(
Ses_Man_t
*
pSes
)
{
{
int
h
,
i
,
j
,
k
;
int
nSol
,
h
,
i
,
j
,
k
,
nOp
;
char
*
pSol
,
*
p
;
/* compute length of solution, for now all gates have 2 inputs */
nSol
=
3
+
pSes
->
nGates
*
4
+
pSes
->
nSpecFunc
;
p
=
pSol
=
ABC_CALLOC
(
char
,
nSol
);
/* header */
*
p
++
=
pSes
->
nSpecVars
;
*
p
++
=
pSes
->
nSpecFunc
;
*
p
++
=
pSes
->
nGates
;
/* gates */
for
(
i
=
0
;
i
<
pSes
->
nGates
;
++
i
)
{
nOp
=
sat_solver_var_value
(
pSes
->
pSat
,
Ses_ManGateVar
(
pSes
,
i
,
0
,
1
)
);
nOp
|=
sat_solver_var_value
(
pSes
->
pSat
,
Ses_ManGateVar
(
pSes
,
i
,
1
,
0
)
)
<<
1
;
nOp
|=
sat_solver_var_value
(
pSes
->
pSat
,
Ses_ManGateVar
(
pSes
,
i
,
1
,
1
)
)
<<
2
;
*
p
++
=
nOp
;
*
p
++
=
2
;
for
(
k
=
0
;
k
<
pSes
->
nSpecVars
+
i
;
++
k
)
for
(
j
=
0
;
j
<
k
;
++
j
)
if
(
sat_solver_var_value
(
pSes
->
pSat
,
Ses_ManSelectVar
(
pSes
,
i
,
j
,
k
)
)
)
{
*
p
++
=
j
;
*
p
++
=
k
;
break
;
}
/* if ( pSes->fVeryVerbose ) */
/* { */
/* if ( pSes->nMaxDepth > 0 ) */
/* { */
/* printf( " and depth vector " ); */
/* for ( j = 0; j <= pSes->nArrTimeMax + i; ++j ) */
/* printf( "%d", sat_solver_var_value( pSes->pSat, Ses_ManDepthVar( pSes, i, j ) ) ); */
/* } */
/* printf( "\n" ); */
/* } */
}
/* outputs */
for
(
h
=
0
;
h
<
pSes
->
nSpecFunc
;
++
h
)
for
(
i
=
0
;
i
<
pSes
->
nGates
;
++
i
)
if
(
sat_solver_var_value
(
pSes
->
pSat
,
Ses_ManOutputVar
(
pSes
,
h
,
i
)
)
)
*
p
++
=
Abc_Var2Lit
(
i
,
(
pSes
->
bSpecInv
>>
h
)
&
1
);
/* have we used all the fields? */
assert
(
(
p
-
pSol
)
==
nSol
);
return
pSol
;
}
static
Abc_Ntk_t
*
Ses_ManExtractNtk
(
char
const
*
pSol
)
{
int
h
,
i
;
char
const
*
p
;
Abc_Ntk_t
*
pNtk
;
Abc_Ntk_t
*
pNtk
;
Abc_Obj_t
*
pObj
;
Abc_Obj_t
*
pObj
;
Vec_Ptr_t
*
pGates
,
*
vNames
;
Vec_Ptr_t
*
pGates
,
*
vNames
;
...
@@ -559,14 +632,14 @@ static Abc_Ntk_t * Ses_ManExtractNtk( Ses_Man_t * pSes )
...
@@ -559,14 +632,14 @@ static Abc_Ntk_t * Ses_ManExtractNtk( Ses_Man_t * pSes )
pNtk
=
Abc_NtkAlloc
(
ABC_NTK_LOGIC
,
ABC_FUNC_SOP
,
1
);
pNtk
=
Abc_NtkAlloc
(
ABC_NTK_LOGIC
,
ABC_FUNC_SOP
,
1
);
pNtk
->
pName
=
Extra_UtilStrsav
(
"exact"
);
pNtk
->
pName
=
Extra_UtilStrsav
(
"exact"
);
pGates
=
Vec_PtrAlloc
(
pS
es
->
nSpecVars
+
pSes
->
nGates
);
pGates
=
Vec_PtrAlloc
(
pS
ol
[
ABC_EXACT_SOL_NVARS
]
+
pSol
[
ABC_EXACT_SOL_NGATES
]
);
pGateTruth
[
3
]
=
'0'
;
pGateTruth
[
3
]
=
'0'
;
pGateTruth
[
4
]
=
'\0'
;
pGateTruth
[
4
]
=
'\0'
;
vNames
=
Abc_NodeGetFakeNames
(
pS
es
->
nSpecVars
+
pSes
->
nSpecFunc
);
vNames
=
Abc_NodeGetFakeNames
(
pS
ol
[
ABC_EXACT_SOL_NVARS
]
+
pSol
[
ABC_EXACT_SOL_NFUNC
]
);
/* primary inputs */
/* primary inputs */
Vec_PtrPush
(
pNtk
->
vObjs
,
NULL
);
Vec_PtrPush
(
pNtk
->
vObjs
,
NULL
);
for
(
i
=
0
;
i
<
pS
es
->
nSpecVars
;
++
i
)
for
(
i
=
0
;
i
<
pS
ol
[
ABC_EXACT_SOL_NVARS
]
;
++
i
)
{
{
pObj
=
Abc_NtkCreatePi
(
pNtk
);
pObj
=
Abc_NtkCreatePi
(
pNtk
);
Abc_ObjAssignName
(
pObj
,
(
char
*
)
Vec_PtrEntry
(
vNames
,
i
),
NULL
);
Abc_ObjAssignName
(
pObj
,
(
char
*
)
Vec_PtrEntry
(
vNames
,
i
),
NULL
);
...
@@ -574,16 +647,16 @@ static Abc_Ntk_t * Ses_ManExtractNtk( Ses_Man_t * pSes )
...
@@ -574,16 +647,16 @@ static Abc_Ntk_t * Ses_ManExtractNtk( Ses_Man_t * pSes )
}
}
/* gates */
/* gates */
for
(
i
=
0
;
i
<
pSes
->
nGates
;
++
i
)
p
=
pSol
+
3
;
for
(
i
=
0
;
i
<
pSol
[
ABC_EXACT_SOL_NGATES
];
++
i
)
{
{
pGateTruth
[
2
]
=
'0'
+
sat_solver_var_value
(
pSes
->
pSat
,
Ses_ManGateVar
(
pSes
,
i
,
0
,
1
)
);
pGateTruth
[
2
]
=
'0'
+
(
*
p
&
1
);
pGateTruth
[
1
]
=
'0'
+
sat_solver_var_value
(
pSes
->
pSat
,
Ses_ManGateVar
(
pSes
,
i
,
1
,
0
)
);
pGateTruth
[
1
]
=
'0'
+
(
(
*
p
>>
1
)
&
1
);
pGateTruth
[
0
]
=
'0'
+
sat_solver_var_value
(
pSes
->
pSat
,
Ses_ManGateVar
(
pSes
,
i
,
1
,
1
)
);
pGateTruth
[
0
]
=
'0'
+
(
(
*
p
>>
2
)
&
1
);
++
p
;
if
(
pSes
->
fVeryVerbose
)
assert
(
*
p
==
2
);
/* binary gate */
{
++
p
;
printf
(
"gate %d has truth table %s"
,
pSes
->
nSpecVars
+
i
,
pGateTruth
);
}
pSopCover
=
Abc_SopFromTruthBin
(
pGateTruth
);
pSopCover
=
Abc_SopFromTruthBin
(
pGateTruth
);
pObj
=
Abc_NtkCreateNode
(
pNtk
);
pObj
=
Abc_NtkCreateNode
(
pNtk
);
...
@@ -591,54 +664,19 @@ static Abc_Ntk_t * Ses_ManExtractNtk( Ses_Man_t * pSes )
...
@@ -591,54 +664,19 @@ static Abc_Ntk_t * Ses_ManExtractNtk( Ses_Man_t * pSes )
Vec_PtrPush
(
pGates
,
pObj
);
Vec_PtrPush
(
pGates
,
pObj
);
ABC_FREE
(
pSopCover
);
ABC_FREE
(
pSopCover
);
for
(
k
=
0
;
k
<
pSes
->
nSpecVars
+
i
;
++
k
)
Abc_ObjAddFanin
(
pObj
,
(
Abc_Obj_t
*
)
Vec_PtrEntry
(
pGates
,
*
p
++
)
);
for
(
j
=
0
;
j
<
k
;
++
j
)
Abc_ObjAddFanin
(
pObj
,
(
Abc_Obj_t
*
)
Vec_PtrEntry
(
pGates
,
*
p
++
)
);
if
(
sat_solver_var_value
(
pSes
->
pSat
,
Ses_ManSelectVar
(
pSes
,
i
,
j
,
k
)
)
)
{
if
(
pSes
->
fVeryVerbose
)
printf
(
" with children %d and %d"
,
j
,
k
);
Abc_ObjAddFanin
(
pObj
,
(
Abc_Obj_t
*
)
Vec_PtrEntry
(
pGates
,
j
)
);
Abc_ObjAddFanin
(
pObj
,
(
Abc_Obj_t
*
)
Vec_PtrEntry
(
pGates
,
k
)
);
break
;
}
if
(
pSes
->
fVeryVerbose
)
{
if
(
pSes
->
nMaxDepth
>
0
)
{
printf
(
" and depth vector "
);
for
(
j
=
0
;
j
<=
pSes
->
nArrivalMax
+
i
;
++
j
)
printf
(
"%d"
,
sat_solver_var_value
(
pSes
->
pSat
,
Ses_ManDepthVar
(
pSes
,
i
,
j
)
)
);
}
printf
(
"
\n
"
);
}
}
}
/* outputs */
/* outputs */
for
(
h
=
0
;
h
<
pS
es
->
nSpecFunc
;
++
h
)
for
(
h
=
0
;
h
<
pS
ol
[
ABC_EXACT_SOL_NFUNC
];
++
h
,
++
p
)
{
{
pObj
=
Abc_NtkCreatePo
(
pNtk
);
pObj
=
Abc_NtkCreatePo
(
pNtk
);
Abc_ObjAssignName
(
pObj
,
(
char
*
)
Vec_PtrEntry
(
vNames
,
pSes
->
nSpecVars
+
h
),
NULL
);
Abc_ObjAssignName
(
pObj
,
(
char
*
)
Vec_PtrEntry
(
vNames
,
pSol
[
ABC_EXACT_SOL_NVARS
]
+
h
),
NULL
);
for
(
i
=
0
;
i
<
pSes
->
nGates
;
++
i
)
if
(
Abc_LitIsCompl
(
*
p
)
)
{
Abc_ObjAddFanin
(
pObj
,
Abc_NtkCreateNodeInv
(
pNtk
,
(
Abc_Obj_t
*
)
Vec_PtrEntry
(
pGates
,
pSol
[
ABC_EXACT_SOL_NVARS
]
+
Abc_Lit2Var
(
*
p
)
)
)
);
if
(
sat_solver_var_value
(
pSes
->
pSat
,
Ses_ManOutputVar
(
pSes
,
h
,
i
)
)
)
else
{
Abc_ObjAddFanin
(
pObj
,
(
Abc_Obj_t
*
)
Vec_PtrEntry
(
pGates
,
pSol
[
ABC_EXACT_SOL_NVARS
]
+
Abc_Lit2Var
(
*
p
)
)
);
if
(
pSes
->
fVeryVerbose
)
printf
(
"output %d points to gate %d"
,
h
,
pSes
->
nSpecVars
+
i
);
/* if output has been inverted, we need to add an inverter */
if
(
(
pSes
->
bSpecInv
>>
h
)
&
1
)
{
Abc_ObjAddFanin
(
pObj
,
Abc_NtkCreateNodeInv
(
pNtk
,
(
Abc_Obj_t
*
)
Vec_PtrEntry
(
pGates
,
pSes
->
nSpecVars
+
i
)
)
);
if
(
pSes
->
fVeryVerbose
)
printf
(
" and needs to be inverted"
);
}
else
Abc_ObjAddFanin
(
pObj
,
(
Abc_Obj_t
*
)
Vec_PtrEntry
(
pGates
,
pSes
->
nSpecVars
+
i
)
);
if
(
pSes
->
fVeryVerbose
)
printf
(
"
\n
"
);
}
}
}
}
Abc_NodeFreeNames
(
vNames
);
Abc_NodeFreeNames
(
vNames
);
...
@@ -647,28 +685,28 @@ static Abc_Ntk_t * Ses_ManExtractNtk( Ses_Man_t * pSes )
...
@@ -647,28 +685,28 @@ static Abc_Ntk_t * Ses_ManExtractNtk( Ses_Man_t * pSes )
if
(
!
Abc_NtkCheck
(
pNtk
)
)
if
(
!
Abc_NtkCheck
(
pNtk
)
)
printf
(
"Ses_ManExtractSolution(): Network check has failed.
\n
"
);
printf
(
"Ses_ManExtractSolution(): Network check has failed.
\n
"
);
return
pNtk
;
return
pNtk
;
}
}
static
Gia_Man_t
*
Ses_ManExtractGia
(
Ses_Man_t
*
pSes
)
static
Gia_Man_t
*
Ses_ManExtractGia
(
char
const
*
pSol
)
{
{
int
h
,
i
,
j
,
k
;
int
h
,
i
;
char
const
*
p
;
Gia_Man_t
*
pGia
;
Gia_Man_t
*
pGia
;
Vec_Int_t
*
pGates
;
Vec_Int_t
*
pGates
;
Vec_Ptr_t
*
vNames
;
Vec_Ptr_t
*
vNames
;
int
nObj
,
nChild1
,
nChild2
,
fChild1Comp
,
fChild2Comp
;
int
nObj
,
nChild1
,
nChild2
,
fChild1Comp
,
fChild2Comp
;
pGia
=
Gia_ManStart
(
pS
es
->
nSpecVars
+
pSes
->
nGates
+
pSes
->
nSpecFunc
+
1
);
pGia
=
Gia_ManStart
(
pS
ol
[
ABC_EXACT_SOL_NVARS
]
+
pSol
[
ABC_EXACT_SOL_NGATES
]
+
pSol
[
ABC_EXACT_SOL_NFUNC
]
+
1
);
pGia
->
nConstrs
=
0
;
pGia
->
nConstrs
=
0
;
pGia
->
pName
=
Extra_UtilStrsav
(
"exact"
);
pGia
->
pName
=
Extra_UtilStrsav
(
"exact"
);
pGates
=
Vec_IntAlloc
(
pS
es
->
nSpecVars
+
pSes
->
nGates
);
pGates
=
Vec_IntAlloc
(
pS
ol
[
ABC_EXACT_SOL_NVARS
]
+
pSol
[
ABC_EXACT_SOL_NGATES
]
);
vNames
=
Abc_NodeGetFakeNames
(
pS
es
->
nSpecVars
+
pSes
->
nSpecFunc
);
vNames
=
Abc_NodeGetFakeNames
(
pS
ol
[
ABC_EXACT_SOL_NVARS
]
+
pSol
[
ABC_EXACT_SOL_NFUNC
]
);
/* primary inputs */
/* primary inputs */
pGia
->
vNamesIn
=
Vec_PtrStart
(
pS
es
->
nSpecVars
);
pGia
->
vNamesIn
=
Vec_PtrStart
(
pS
ol
[
ABC_EXACT_SOL_NVARS
]
);
for
(
i
=
0
;
i
<
pS
es
->
nSpecVars
;
++
i
)
for
(
i
=
0
;
i
<
pS
ol
[
ABC_EXACT_SOL_NVARS
]
;
++
i
)
{
{
nObj
=
Gia_ManAppendCi
(
pGia
);
nObj
=
Gia_ManAppendCi
(
pGia
);
Vec_IntPush
(
pGates
,
nObj
);
Vec_IntPush
(
pGates
,
nObj
);
...
@@ -676,55 +714,45 @@ static Gia_Man_t * Ses_ManExtractGia( Ses_Man_t * pSes )
...
@@ -676,55 +714,45 @@ static Gia_Man_t * Ses_ManExtractGia( Ses_Man_t * pSes )
}
}
/* gates */
/* gates */
for
(
i
=
0
;
i
<
pSes
->
nGates
;
++
i
)
p
=
pSol
+
3
;
for
(
i
=
0
;
i
<
pSol
[
ABC_EXACT_SOL_NGATES
];
++
i
)
{
{
for
(
k
=
0
;
k
<
pSes
->
nSpecVars
+
i
;
++
k
)
assert
(
p
[
1
]
==
2
);
for
(
j
=
0
;
j
<
k
;
++
j
)
nChild1
=
Vec_IntEntry
(
pGates
,
p
[
2
]
);
if
(
sat_solver_var_value
(
pSes
->
pSat
,
Ses_ManSelectVar
(
pSes
,
i
,
j
,
k
)
)
)
nChild2
=
Vec_IntEntry
(
pGates
,
p
[
3
]
);
{
fChild1Comp
=
fChild2Comp
=
0
;
nChild1
=
Vec_IntEntry
(
pGates
,
j
);
nChild2
=
Vec_IntEntry
(
pGates
,
k
);
fChild1Comp
=
fChild2Comp
=
0
;
if
(
sat_solver_var_value
(
pSes
->
pSat
,
Ses_ManGateVar
(
pSes
,
i
,
0
,
1
)
)
)
if
(
*
p
&
1
)
{
{
nChild1
=
Abc_LitNot
(
nChild1
);
nChild1
=
Abc_LitNot
(
nChild1
);
fChild1Comp
=
1
;
fChild1Comp
=
1
;
}
}
if
(
sat_solver_var_value
(
pSes
->
pSat
,
Ses_ManGateVar
(
pSes
,
i
,
1
,
0
)
)
)
if
(
(
*
p
>>
1
)
&
1
)
{
{
nChild2
=
Abc_LitNot
(
nChild2
);
nChild2
=
Abc_LitNot
(
nChild2
);
fChild2Comp
=
1
;
fChild2Comp
=
1
;
}
}
nObj
=
Gia_ManAppendAnd
(
pGia
,
nChild1
,
nChild2
);
nObj
=
Gia_ManAppendAnd
(
pGia
,
nChild1
,
nChild2
);
if
(
fChild1Comp
&&
fChild2Comp
)
if
(
fChild1Comp
&&
fChild2Comp
)
{
{
assert
(
sat_solver_var_value
(
pSes
->
pSat
,
Ses_ManGateVar
(
pSes
,
i
,
1
,
1
)
)
);
assert
(
(
*
p
>>
2
)
&
1
);
nObj
=
Abc_LitNot
(
nObj
);
nObj
=
Abc_LitNot
(
nObj
);
}
}
Vec_IntPush
(
pGates
,
nObj
);
Vec_IntPush
(
pGates
,
nObj
);
break
;
p
+=
4
;
}
}
}
/* outputs */
/* outputs */
pGia
->
vNamesOut
=
Vec_PtrStart
(
pS
es
->
nSpecFunc
);
pGia
->
vNamesOut
=
Vec_PtrStart
(
pS
ol
[
ABC_EXACT_SOL_NFUNC
]
);
for
(
h
=
0
;
h
<
pS
es
->
nSpecFunc
;
++
h
)
for
(
h
=
0
;
h
<
pS
ol
[
ABC_EXACT_SOL_NFUNC
];
++
h
,
++
p
)
{
{
for
(
i
=
0
;
i
<
pSes
->
nGates
;
++
i
)
nObj
=
Vec_IntEntry
(
pGates
,
pSol
[
ABC_EXACT_SOL_NVARS
]
+
Abc_Lit2Var
(
*
p
)
);
{
if
(
Abc_LitIsCompl
(
*
p
)
)
if
(
sat_solver_var_value
(
pSes
->
pSat
,
Ses_ManOutputVar
(
pSes
,
h
,
i
)
)
)
nObj
=
Abc_LitNot
(
nObj
);
{
Gia_ManAppendCo
(
pGia
,
nObj
);
nObj
=
Vec_IntEntry
(
pGates
,
pSes
->
nSpecVars
+
i
);
Vec_PtrSetEntry
(
pGia
->
vNamesOut
,
h
,
Extra_UtilStrsav
(
Vec_PtrEntry
(
vNames
,
pSol
[
ABC_EXACT_SOL_NVARS
]
+
h
)
)
);
/* if output has been inverted, we need to add an inverter */
if
(
(
pSes
->
bSpecInv
>>
h
)
&
1
)
nObj
=
Abc_LitNot
(
nObj
);
Gia_ManAppendCo
(
pGia
,
nObj
);
Vec_PtrSetEntry
(
pGia
->
vNamesOut
,
h
,
Extra_UtilStrsav
(
Vec_PtrEntry
(
vNames
,
pSes
->
nSpecVars
+
h
)
)
);
}
}
}
}
Abc_NodeFreeNames
(
vNames
);
Abc_NodeFreeNames
(
vNames
);
...
@@ -827,17 +855,18 @@ static int Ses_ManFindMinimumSize( Ses_Man_t * pSes )
...
@@ -827,17 +855,18 @@ static int Ses_ManFindMinimumSize( Ses_Man_t * pSes )
Synopsis [Find minimum size networks with a SAT solver.]
Synopsis [Find minimum size networks with a SAT solver.]
Description [If nMaxDepth is -1, then depth constraints are ignored.
Description [If nMaxDepth is -1, then depth constraints are ignored.
If nMaxDepth is not -1, one can set pArr
ivalTimes
which should have the length of nVars.
If nMaxDepth is not -1, one can set pArr
TimeProfile
which should have the length of nVars.
One can ignore pArr
ivalTimes
by setting it to NULL.]
One can ignore pArr
TimeProfile
by setting it to NULL.]
SideEffects []
SideEffects []
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
Abc_Ntk_t
*
Abc_NtkFindExact
(
word
*
pTruth
,
int
nVars
,
int
nFunc
,
int
nMaxDepth
,
int
*
pArr
ivalTimes
,
int
fVerbose
)
Abc_Ntk_t
*
Abc_NtkFindExact
(
word
*
pTruth
,
int
nVars
,
int
nFunc
,
int
nMaxDepth
,
int
*
pArr
TimeProfile
,
int
fVerbose
)
{
{
Ses_Man_t
*
pSes
;
Ses_Man_t
*
pSes
;
char
*
pSol
;
Abc_Ntk_t
*
pNtk
=
NULL
;
Abc_Ntk_t
*
pNtk
=
NULL
;
abctime
timeStart
;
abctime
timeStart
;
...
@@ -846,12 +875,16 @@ Abc_Ntk_t * Abc_NtkFindExact( word * pTruth, int nVars, int nFunc, int nMaxDepth
...
@@ -846,12 +875,16 @@ Abc_Ntk_t * Abc_NtkFindExact( word * pTruth, int nVars, int nFunc, int nMaxDepth
timeStart
=
Abc_Clock
();
timeStart
=
Abc_Clock
();
pSes
=
Ses_ManAlloc
(
pTruth
,
nVars
,
nFunc
,
nMaxDepth
,
pArr
ivalTimes
,
0
,
fVerbose
);
pSes
=
Ses_ManAlloc
(
pTruth
,
nVars
,
nFunc
,
nMaxDepth
,
pArr
TimeProfile
,
0
,
fVerbose
);
if
(
fVerbose
)
if
(
fVerbose
)
Ses_ManPrintFuncs
(
pSes
);
Ses_ManPrintFuncs
(
pSes
);
if
(
Ses_ManFindMinimumSize
(
pSes
)
)
if
(
Ses_ManFindMinimumSize
(
pSes
)
)
pNtk
=
Ses_ManExtractNtk
(
pSes
);
{
pSol
=
Ses_ManExtractSolution
(
pSes
);
pNtk
=
Ses_ManExtractNtk
(
pSol
);
ABC_FREE
(
pSol
);
}
pSes
->
timeTotal
=
Abc_Clock
()
-
timeStart
;
pSes
->
timeTotal
=
Abc_Clock
()
-
timeStart
;
...
@@ -864,9 +897,10 @@ Abc_Ntk_t * Abc_NtkFindExact( word * pTruth, int nVars, int nFunc, int nMaxDepth
...
@@ -864,9 +897,10 @@ Abc_Ntk_t * Abc_NtkFindExact( word * pTruth, int nVars, int nFunc, int nMaxDepth
return
pNtk
;
return
pNtk
;
}
}
Gia_Man_t
*
Gia_ManFindExact
(
word
*
pTruth
,
int
nVars
,
int
nFunc
,
int
nMaxDepth
,
int
*
pArr
ivalTimes
,
int
fVerbose
)
Gia_Man_t
*
Gia_ManFindExact
(
word
*
pTruth
,
int
nVars
,
int
nFunc
,
int
nMaxDepth
,
int
*
pArr
TimeProfile
,
int
fVerbose
)
{
{
Ses_Man_t
*
pSes
;
Ses_Man_t
*
pSes
;
char
*
pSol
;
Gia_Man_t
*
pGia
=
NULL
;
Gia_Man_t
*
pGia
=
NULL
;
abctime
timeStart
;
abctime
timeStart
;
...
@@ -875,12 +909,16 @@ Gia_Man_t * Gia_ManFindExact( word * pTruth, int nVars, int nFunc, int nMaxDepth
...
@@ -875,12 +909,16 @@ Gia_Man_t * Gia_ManFindExact( word * pTruth, int nVars, int nFunc, int nMaxDepth
timeStart
=
Abc_Clock
();
timeStart
=
Abc_Clock
();
pSes
=
Ses_ManAlloc
(
pTruth
,
nVars
,
nFunc
,
nMaxDepth
,
pArr
ivalTimes
,
1
,
fVerbose
);
pSes
=
Ses_ManAlloc
(
pTruth
,
nVars
,
nFunc
,
nMaxDepth
,
pArr
TimeProfile
,
1
,
fVerbose
);
if
(
fVerbose
)
if
(
fVerbose
)
Ses_ManPrintFuncs
(
pSes
);
Ses_ManPrintFuncs
(
pSes
);
if
(
Ses_ManFindMinimumSize
(
pSes
)
)
if
(
Ses_ManFindMinimumSize
(
pSes
)
)
pGia
=
Ses_ManExtractGia
(
pSes
);
{
pSol
=
Ses_ManExtractSolution
(
pSes
);
pGia
=
Ses_ManExtractGia
(
pSol
);
ABC_FREE
(
pSol
);
}
pSes
->
timeTotal
=
Abc_Clock
()
-
timeStart
;
pSes
->
timeTotal
=
Abc_Clock
()
-
timeStart
;
...
@@ -920,7 +958,7 @@ void Abc_ExactTestSingleOutput( int fVerbose )
...
@@ -920,7 +958,7 @@ void Abc_ExactTestSingleOutput( int fVerbose )
word
pTruth
[
4
]
=
{
0xcafe
,
0
,
0
,
0
};
word
pTruth
[
4
]
=
{
0xcafe
,
0
,
0
,
0
};
Abc_Ntk_t
*
pNtk
,
*
pNtk2
,
*
pNtk3
,
*
pNtk4
;
Abc_Ntk_t
*
pNtk
,
*
pNtk2
,
*
pNtk3
,
*
pNtk4
;
int
pArr
ivalTimes
[
4
]
=
{
6
,
2
,
8
,
5
};
int
pArr
TimeProfile
[
4
]
=
{
6
,
2
,
8
,
5
};
pNtk
=
Abc_NtkFromTruthTable
(
pTruth
,
4
);
pNtk
=
Abc_NtkFromTruthTable
(
pTruth
,
4
);
...
@@ -938,7 +976,7 @@ void Abc_ExactTestSingleOutput( int fVerbose )
...
@@ -938,7 +976,7 @@ void Abc_ExactTestSingleOutput( int fVerbose )
assert
(
Abc_NtkLevel
(
pNtk3
)
<=
3
);
assert
(
Abc_NtkLevel
(
pNtk3
)
<=
3
);
Abc_NtkDelete
(
pNtk3
);
Abc_NtkDelete
(
pNtk3
);
pNtk4
=
Abc_NtkFindExact
(
pTruth
,
4
,
1
,
9
,
pArr
ivalTimes
,
fVerbose
);
pNtk4
=
Abc_NtkFindExact
(
pTruth
,
4
,
1
,
9
,
pArr
TimeProfile
,
fVerbose
);
Abc_NtkShortNames
(
pNtk4
);
Abc_NtkShortNames
(
pNtk4
);
Abc_NtkCecSat
(
pNtk
,
pNtk4
,
10000
,
0
);
Abc_NtkCecSat
(
pNtk
,
pNtk4
,
10000
,
0
);
assert
(
pNtk4
);
assert
(
pNtk4
);
...
@@ -947,7 +985,7 @@ void Abc_ExactTestSingleOutput( int fVerbose )
...
@@ -947,7 +985,7 @@ void Abc_ExactTestSingleOutput( int fVerbose )
assert
(
!
Abc_NtkFindExact
(
pTruth
,
4
,
1
,
2
,
NULL
,
fVerbose
)
);
assert
(
!
Abc_NtkFindExact
(
pTruth
,
4
,
1
,
2
,
NULL
,
fVerbose
)
);
assert
(
!
Abc_NtkFindExact
(
pTruth
,
4
,
1
,
8
,
pArr
ivalTimes
,
fVerbose
)
);
assert
(
!
Abc_NtkFindExact
(
pTruth
,
4
,
1
,
8
,
pArr
TimeProfile
,
fVerbose
)
);
Abc_NtkDelete
(
pNtk
);
Abc_NtkDelete
(
pNtk
);
}
}
...
@@ -958,7 +996,7 @@ void Abc_ExactTestSingleOutputAIG( int fVerbose )
...
@@ -958,7 +996,7 @@ void Abc_ExactTestSingleOutputAIG( int fVerbose )
Abc_Ntk_t
*
pNtk
;
Abc_Ntk_t
*
pNtk
;
Gia_Man_t
*
pGia
,
*
pGia2
,
*
pGia3
,
*
pGia4
,
*
pMiter
;
Gia_Man_t
*
pGia
,
*
pGia2
,
*
pGia3
,
*
pGia4
,
*
pMiter
;
Cec_ParCec_t
ParsCec
,
*
pPars
=
&
ParsCec
;
Cec_ParCec_t
ParsCec
,
*
pPars
=
&
ParsCec
;
int
pArr
ivalTimes
[
4
]
=
{
6
,
2
,
8
,
5
};
int
pArr
TimeProfile
[
4
]
=
{
6
,
2
,
8
,
5
};
Cec_ManCecSetDefaultParams
(
pPars
);
Cec_ManCecSetDefaultParams
(
pPars
);
...
@@ -978,7 +1016,7 @@ void Abc_ExactTestSingleOutputAIG( int fVerbose )
...
@@ -978,7 +1016,7 @@ void Abc_ExactTestSingleOutputAIG( int fVerbose )
Cec_ManVerify
(
pMiter
,
pPars
);
Cec_ManVerify
(
pMiter
,
pPars
);
Gia_ManStop
(
pMiter
);
Gia_ManStop
(
pMiter
);
pGia4
=
Gia_ManFindExact
(
pTruth
,
4
,
1
,
9
,
pArr
ivalTimes
,
fVerbose
);
pGia4
=
Gia_ManFindExact
(
pTruth
,
4
,
1
,
9
,
pArr
TimeProfile
,
fVerbose
);
pMiter
=
Gia_ManMiter
(
pGia
,
pGia4
,
0
,
1
,
0
,
0
,
1
);
pMiter
=
Gia_ManMiter
(
pGia
,
pGia4
,
0
,
1
,
0
,
0
,
1
);
assert
(
pMiter
);
assert
(
pMiter
);
Cec_ManVerify
(
pMiter
,
pPars
);
Cec_ManVerify
(
pMiter
,
pPars
);
...
@@ -986,7 +1024,7 @@ void Abc_ExactTestSingleOutputAIG( int fVerbose )
...
@@ -986,7 +1024,7 @@ void Abc_ExactTestSingleOutputAIG( int fVerbose )
assert
(
!
Gia_ManFindExact
(
pTruth
,
4
,
1
,
2
,
NULL
,
fVerbose
)
);
assert
(
!
Gia_ManFindExact
(
pTruth
,
4
,
1
,
2
,
NULL
,
fVerbose
)
);
assert
(
!
Gia_ManFindExact
(
pTruth
,
4
,
1
,
8
,
pArr
ivalTimes
,
fVerbose
)
);
assert
(
!
Gia_ManFindExact
(
pTruth
,
4
,
1
,
8
,
pArr
TimeProfile
,
fVerbose
)
);
Gia_ManStop
(
pGia
);
Gia_ManStop
(
pGia
);
Gia_ManStop
(
pGia2
);
Gia_ManStop
(
pGia2
);
...
...
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