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
8ec44da3
Commit
8ec44da3
authored
Aug 21, 2016
by
Mathias Soeken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More logging in exact synthesis.
parent
9bb5a2dd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
107 additions
and
53 deletions
+107
-53
src/base/abci/abcExact.c
+107
-53
No files found.
src/base/abci/abcExact.c
View file @
8ec44da3
...
@@ -25,7 +25,6 @@
...
@@ -25,7 +25,6 @@
#include "base/abc/abc.h"
#include "base/abc/abc.h"
#include "aig/gia/gia.h"
#include "aig/gia/gia.h"
#include "bool/kit/kit.h"
#include "misc/util/utilTruth.h"
#include "misc/util/utilTruth.h"
#include "misc/vec/vecInt.h"
#include "misc/vec/vecInt.h"
#include "misc/vec/vecPtr.h"
#include "misc/vec/vecPtr.h"
...
@@ -39,17 +38,6 @@ ABC_NAMESPACE_IMPL_START
...
@@ -39,17 +38,6 @@ ABC_NAMESPACE_IMPL_START
/// DECLARATIONS ///
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
static
word
s_Truths8
[
32
]
=
{
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
)
};
#define ABC_EXACT_SOL_NVARS 0
#define ABC_EXACT_SOL_NVARS 0
#define ABC_EXACT_SOL_NFUNC 1
#define ABC_EXACT_SOL_NFUNC 1
#define ABC_EXACT_SOL_NGATES 2
#define ABC_EXACT_SOL_NGATES 2
...
@@ -93,7 +81,13 @@ struct Ses_Man_t_
...
@@ -93,7 +81,13 @@ struct Ses_Man_t_
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
timeSatUndef
;
/* SAT runtime (undef instance) */
abctime
timeInstance
;
/* creating instance runtime */
abctime
timeTotal
;
/* all runtime */
abctime
timeTotal
;
/* all runtime */
int
nSatCalls
;
/* number of SAT calls */
int
nUnsatCalls
;
/* number of UNSAT calls */
int
nUndefCalls
;
/* number of UNDEF calls */
};
};
/***********************************************************************
/***********************************************************************
...
@@ -151,6 +145,18 @@ struct Ses_Store_t_
...
@@ -151,6 +145,18 @@ struct Ses_Store_t_
unsigned
long
pSynthesizedRL
[
9
];
/* -> per cut size */
unsigned
long
pSynthesizedRL
[
9
];
/* -> per cut size */
unsigned
long
nCacheHits
;
/* number of cache hits */
unsigned
long
nCacheHits
;
/* number of cache hits */
unsigned
long
pCacheHits
[
9
];
/* -> per cut size */
unsigned
long
pCacheHits
[
9
];
/* -> per cut size */
unsigned
long
nSatCalls
;
/* number of total SAT calls */
unsigned
long
nUnsatCalls
;
/* number of total UNSAT calls */
unsigned
long
nUndefCalls
;
/* number of total UNDEF calls */
abctime
timeExact
;
/* Exact synthesis runtime */
abctime
timeSat
;
/* SAT runtime */
abctime
timeSatSat
;
/* SAT runtime (sat instance) */
abctime
timeSatUnsat
;
/* SAT runtime (unsat instance) */
abctime
timeSatUndef
;
/* SAT runtime (undef instance) */
abctime
timeInstance
;
/* creating instance runtime */
abctime
timeTotal
;
/* all runtime */
};
};
static
Ses_Store_t
*
s_pSesStore
=
NULL
;
static
Ses_Store_t
*
s_pSesStore
=
NULL
;
...
@@ -183,14 +189,6 @@ static int Abc_NormalizeArrivalTimes( int * pArrTimeProfile, int nVars, int * ma
...
@@ -183,14 +189,6 @@ static int Abc_NormalizeArrivalTimes( int * pArrTimeProfile, int nVars, int * ma
return
delta
;
return
delta
;
}
}
static
inline
void
Abc_UnnormalizeArrivalTimes
(
int
*
pArrTimeProfile
,
int
nVars
,
int
nDelta
)
{
int
l
;
for
(
l
=
0
;
l
<
nVars
;
++
l
)
pArrTimeProfile
[
l
]
+=
nDelta
;
}
static
inline
Ses_Store_t
*
Ses_StoreAlloc
(
int
nBTLimit
,
int
fMakeAIG
,
int
fVerbose
)
static
inline
Ses_Store_t
*
Ses_StoreAlloc
(
int
nBTLimit
,
int
fMakeAIG
,
int
fVerbose
)
{
{
Ses_Store_t
*
pStore
=
ABC_CALLOC
(
Ses_Store_t
,
1
);
Ses_Store_t
*
pStore
=
ABC_CALLOC
(
Ses_Store_t
,
1
);
...
@@ -623,7 +621,7 @@ static inline void Ses_ManCreateMainClause( Ses_Man_t * pSes, int t, int i, int
...
@@ -623,7 +621,7 @@ static inline void Ses_ManCreateMainClause( Ses_Man_t * pSes, int t, int i, int
if
(
j
<
pSes
->
nSpecVars
)
if
(
j
<
pSes
->
nSpecVars
)
{
{
if
(
Abc_TtGetBit
(
s_Truths8
+
(
j
<<
2
),
t
+
1
)
!=
b
)
/* 1 in clause, we can omit the clause */
if
(
(
(
(
t
+
1
)
&
(
1
<<
j
)
)
?
1
:
0
)
!=
b
)
return
;
return
;
}
}
else
else
...
@@ -631,7 +629,7 @@ static inline void Ses_ManCreateMainClause( Ses_Man_t * pSes, int t, int i, int
...
@@ -631,7 +629,7 @@ static inline void Ses_ManCreateMainClause( Ses_Man_t * pSes, int t, int i, int
if
(
k
<
pSes
->
nSpecVars
)
if
(
k
<
pSes
->
nSpecVars
)
{
{
if
(
Abc_TtGetBit
(
s_Truths8
+
(
k
<<
2
),
t
+
1
)
!=
c
)
/* 1 in clause, we can omit the clause */
if
(
(
(
(
t
+
1
)
&
(
1
<<
k
)
)
?
1
:
0
)
!=
c
)
return
;
return
;
}
}
else
else
...
@@ -883,16 +881,20 @@ static inline int Ses_ManSolve( Ses_Man_t * pSes )
...
@@ -883,16 +881,20 @@ static inline int Ses_ManSolve( Ses_Man_t * pSes )
if
(
status
==
l_True
)
if
(
status
==
l_True
)
{
{
pSes
->
nSatCalls
++
;
pSes
->
timeSatSat
+=
timeDelta
;
pSes
->
timeSatSat
+=
timeDelta
;
return
1
;
return
1
;
}
}
else
if
(
status
==
l_False
)
else
if
(
status
==
l_False
)
{
{
pSes
->
nUnsatCalls
++
;
pSes
->
timeSatUnsat
+=
timeDelta
;
pSes
->
timeSatUnsat
+=
timeDelta
;
return
0
;
return
0
;
}
}
else
else
{
{
pSes
->
nUndefCalls
++
;
pSes
->
timeSatUndef
+=
timeDelta
;
if
(
pSes
->
fSatVerbose
)
if
(
pSes
->
fSatVerbose
)
{
{
printf
(
"resource limit reached
\n
"
);
printf
(
"resource limit reached
\n
"
);
...
@@ -1187,7 +1189,9 @@ static void Ses_ManPrintRuntime( Ses_Man_t * pSes )
...
@@ -1187,7 +1189,9 @@ static void Ses_ManPrintRuntime( Ses_Man_t * pSes )
printf
(
"Runtime breakdown:
\n
"
);
printf
(
"Runtime breakdown:
\n
"
);
ABC_PRTP
(
"Sat "
,
pSes
->
timeSat
,
pSes
->
timeTotal
);
ABC_PRTP
(
"Sat "
,
pSes
->
timeSat
,
pSes
->
timeTotal
);
ABC_PRTP
(
" Sat "
,
pSes
->
timeSatSat
,
pSes
->
timeTotal
);
ABC_PRTP
(
" Sat "
,
pSes
->
timeSatSat
,
pSes
->
timeTotal
);
ABC_PRTP
(
" Unsat"
,
pSes
->
timeSatUnsat
,
pSes
->
timeTotal
);
ABC_PRTP
(
" Unsat "
,
pSes
->
timeSatUnsat
,
pSes
->
timeTotal
);
ABC_PRTP
(
" Undef "
,
pSes
->
timeSatUndef
,
pSes
->
timeTotal
);
ABC_PRTP
(
"Instance"
,
pSes
->
timeInstance
,
pSes
->
timeTotal
);
ABC_PRTP
(
"ALL "
,
pSes
->
timeTotal
,
pSes
->
timeTotal
);
ABC_PRTP
(
"ALL "
,
pSes
->
timeTotal
,
pSes
->
timeTotal
);
}
}
...
@@ -1255,7 +1259,8 @@ static inline void Ses_ManPrintVars( Ses_Man_t * pSes )
...
@@ -1255,7 +1259,8 @@ static inline void Ses_ManPrintVars( Ses_Man_t * pSes )
***********************************************************************/
***********************************************************************/
static
int
Ses_ManFindMinimumSize
(
Ses_Man_t
*
pSes
)
static
int
Ses_ManFindMinimumSize
(
Ses_Man_t
*
pSes
)
{
{
int
nGates
=
0
;
int
nGates
=
0
,
f
;
abctime
timeStart
;
/* store whether call was unsuccessful due to resource limit and not due to impossible constraint */
/* store whether call was unsuccessful due to resource limit and not due to impossible constraint */
pSes
->
fHitResLimit
=
0
;
pSes
->
fHitResLimit
=
0
;
...
@@ -1280,8 +1285,11 @@ static int Ses_ManFindMinimumSize( Ses_Man_t * pSes )
...
@@ -1280,8 +1285,11 @@ static int Ses_ManFindMinimumSize( Ses_Man_t * pSes )
return
0
;
return
0
;
}
}
timeStart
=
Abc_Clock
();
Ses_ManCreateVars
(
pSes
,
nGates
);
Ses_ManCreateVars
(
pSes
,
nGates
);
if
(
!
Ses_ManCreateClauses
(
pSes
)
)
f
=
Ses_ManCreateClauses
(
pSes
);
pSes
->
timeInstance
+=
(
Abc_Clock
()
-
timeStart
);
if
(
!
f
)
continue
;
/* proven UNSAT while creating clauses */
continue
;
/* proven UNSAT while creating clauses */
switch
(
Ses_ManSolve
(
pSes
)
)
switch
(
Ses_ManSolve
(
pSes
)
)
...
@@ -1575,17 +1583,33 @@ void Abc_ExactStats()
...
@@ -1575,17 +1583,33 @@ void Abc_ExactStats()
printf
(
"number of entries : %d
\n
"
,
s_pSesStore
->
nEntriesCount
);
printf
(
"number of entries : %d
\n
"
,
s_pSesStore
->
nEntriesCount
);
printf
(
"number of valid entries : %d
\n
"
,
s_pSesStore
->
nValidEntriesCount
);
printf
(
"number of valid entries : %d
\n
"
,
s_pSesStore
->
nValidEntriesCount
);
printf
(
"number of invalid entries : %d
\n
"
,
s_pSesStore
->
nEntriesCount
-
s_pSesStore
->
nValidEntriesCount
);
printf
(
"number of invalid entries : %d
\n
"
,
s_pSesStore
->
nEntriesCount
-
s_pSesStore
->
nValidEntriesCount
);
printf
(
"-------------------------------------------------------------------------------------------------------------------------------
\n
"
);
printf
(
"number of SAT calls : %lu
\n
"
,
s_pSesStore
->
nSatCalls
);
printf
(
"number of UNSAT calls : %lu
\n
"
,
s_pSesStore
->
nUnsatCalls
);
printf
(
"number of UNDEF calls : %lu
\n
"
,
s_pSesStore
->
nUndefCalls
);
printf
(
"-------------------------------------------------------------------------------------------------------------------------------
\n
"
);
printf
(
"Runtime breakdown:
\n
"
);
ABC_PRTP
(
"Exact "
,
s_pSesStore
->
timeExact
,
s_pSesStore
->
timeTotal
);
ABC_PRTP
(
" Sat "
,
s_pSesStore
->
timeSat
,
s_pSesStore
->
timeTotal
);
ABC_PRTP
(
" Sat "
,
s_pSesStore
->
timeSatSat
,
s_pSesStore
->
timeTotal
);
ABC_PRTP
(
" Unsat "
,
s_pSesStore
->
timeSatUnsat
,
s_pSesStore
->
timeTotal
);
ABC_PRTP
(
" Undef "
,
s_pSesStore
->
timeSatUndef
,
s_pSesStore
->
timeTotal
);
ABC_PRTP
(
" Instance"
,
s_pSesStore
->
timeInstance
,
s_pSesStore
->
timeTotal
);
ABC_PRTP
(
"Other "
,
s_pSesStore
->
timeTotal
-
s_pSesStore
->
timeExact
,
s_pSesStore
->
timeTotal
);
ABC_PRTP
(
"ALL "
,
s_pSesStore
->
timeTotal
,
s_pSesStore
->
timeTotal
);
}
}
// this procedure takes TT and input arrival times (pArrTimeProfile) and return the smallest output arrival time;
// this procedure takes TT and input arrival times (pArrTimeProfile) and return the smallest output arrival time;
// it also returns the pin-to-pin delays (pPerm) between each cut leaf and the cut output and the cut area cost (Cost)
// it also returns the pin-to-pin delays (pPerm) between each cut leaf and the cut output and the cut area cost (Cost)
// the area cost should not exceed 2048, if the cut is implementable; otherwise, it should be ABC_INFINITY
// the area cost should not exceed 2048, if the cut is implementable; otherwise, it should be ABC_INFINITY
int
Abc_ExactDelayCost
(
word
*
pTruth
,
int
nVars
,
int
*
pArrTimeProfile
,
char
*
pPerm
,
int
*
Cost
,
int
AigLevel
)
int
Abc_ExactDelayCost
(
word
*
pTruth
,
int
nVars
,
int
*
pArrTimeProfile
,
char
*
pPerm
,
int
*
Cost
,
int
AigLevel
)
{
{
int
i
,
n
Delta
,
n
MaxArrival
,
l
;
int
i
,
nMaxArrival
,
l
;
Ses_Man_t
*
pSes
=
NULL
;
Ses_Man_t
*
pSes
=
NULL
;
char
*
pSol
=
NULL
,
*
p
;
char
*
pSol
=
NULL
,
*
p
;
int
pNormalArrTime
[
8
];
int
Delay
=
ABC_INFINITY
,
nMaxDepth
;
int
Delay
=
ABC_INFINITY
,
nMaxDepth
;
abctime
timeStart
;
abctime
timeStart
=
Abc_Clock
(),
timeStartExact
;
/* some checks */
/* some checks */
if
(
nVars
<
0
||
nVars
>
8
)
if
(
nVars
<
0
||
nVars
>
8
)
...
@@ -1604,6 +1628,7 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
...
@@ -1604,6 +1628,7 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
s_pSesStore
->
pSynthesizedTrivial
[
0
]
++
;
s_pSesStore
->
pSynthesizedTrivial
[
0
]
++
;
*
Cost
=
0
;
*
Cost
=
0
;
s_pSesStore
->
timeTotal
+=
(
Abc_Clock
()
-
timeStart
);
return
0
;
return
0
;
}
}
...
@@ -1614,6 +1639,7 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
...
@@ -1614,6 +1639,7 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
*
Cost
=
0
;
*
Cost
=
0
;
pPerm
[
0
]
=
(
char
)
0
;
pPerm
[
0
]
=
(
char
)
0
;
s_pSesStore
->
timeTotal
+=
(
Abc_Clock
()
-
timeStart
);
return
pArrTimeProfile
[
0
];
return
pArrTimeProfile
[
0
];
}
}
...
@@ -1625,7 +1651,10 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
...
@@ -1625,7 +1651,10 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
}
nDelta
=
Abc_NormalizeArrivalTimes
(
pArrTimeProfile
,
nVars
,
&
nMaxArrival
);
for
(
l
=
0
;
l
<
nVars
;
++
l
)
pNormalArrTime
[
l
]
=
pArrTimeProfile
[
l
];
Abc_NormalizeArrivalTimes
(
pNormalArrTime
,
nVars
,
&
nMaxArrival
);
if
(
s_pSesStore
->
fVeryVerbose
)
if
(
s_pSesStore
->
fVeryVerbose
)
{
{
...
@@ -1633,13 +1662,13 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
...
@@ -1633,13 +1662,13 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
Abc_TtPrintHexRev
(
stdout
,
pTruth
,
nVars
);
Abc_TtPrintHexRev
(
stdout
,
pTruth
,
nVars
);
printf
(
" with arrival times"
);
printf
(
" with arrival times"
);
for
(
l
=
0
;
l
<
nVars
;
++
l
)
for
(
l
=
0
;
l
<
nVars
;
++
l
)
printf
(
" %d"
,
p
ArrTimeProfil
e
[
l
]
);
printf
(
" %d"
,
p
NormalArrTim
e
[
l
]
);
printf
(
" at level %d
(nDelta = %d)
\n
"
,
AigLevel
,
nDelta
);
printf
(
" at level %d
\n
"
,
AigLevel
);
}
}
*
Cost
=
ABC_INFINITY
;
*
Cost
=
ABC_INFINITY
;
if
(
Ses_StoreGetEntry
(
s_pSesStore
,
pTruth
,
nVars
,
p
ArrTimeProfil
e
,
&
pSol
)
)
if
(
Ses_StoreGetEntry
(
s_pSesStore
,
pTruth
,
nVars
,
p
NormalArrTim
e
,
&
pSol
)
)
{
{
if
(
s_pSesStore
->
fVeryVerbose
)
if
(
s_pSesStore
->
fVeryVerbose
)
printf
(
" truth table already in store
\n
"
);
printf
(
" truth table already in store
\n
"
);
...
@@ -1649,16 +1678,16 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
...
@@ -1649,16 +1678,16 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
}
}
else
else
{
{
nMaxDepth
=
p
ArrTimeProfil
e
[
0
];
nMaxDepth
=
p
NormalArrTim
e
[
0
];
for
(
i
=
1
;
i
<
nVars
;
++
i
)
for
(
i
=
1
;
i
<
nVars
;
++
i
)
nMaxDepth
=
Abc_MaxInt
(
nMaxDepth
,
p
ArrTimeProfil
e
[
i
]
);
nMaxDepth
=
Abc_MaxInt
(
nMaxDepth
,
p
NormalArrTim
e
[
i
]
);
nMaxDepth
+=
nVars
+
1
;
nMaxDepth
+=
nVars
+
1
;
if
(
AigLevel
!=
-
1
)
if
(
AigLevel
!=
-
1
)
nMaxDepth
=
Abc_MinInt
(
AigLevel
,
nMaxDepth
+
nVars
+
1
);
nMaxDepth
=
Abc_MinInt
(
AigLevel
,
nMaxDepth
+
nVars
+
1
);
timeStart
=
Abc_Clock
();
timeStart
Exact
=
Abc_Clock
();
pSes
=
Ses_ManAlloc
(
pTruth
,
nVars
,
1
/* nSpecFunc */
,
nMaxDepth
,
p
ArrTimeProfil
e
,
s_pSesStore
->
fMakeAIG
,
s_pSesStore
->
nBTLimit
,
s_pSesStore
->
fVerbose
);
pSes
=
Ses_ManAlloc
(
pTruth
,
nVars
,
1
/* nSpecFunc */
,
nMaxDepth
,
p
NormalArrTim
e
,
s_pSesStore
->
fMakeAIG
,
s_pSesStore
->
nBTLimit
,
s_pSesStore
->
fVerbose
);
pSes
->
fVeryVerbose
=
s_pSesStore
->
fVeryVerbose
;
pSes
->
fVeryVerbose
=
s_pSesStore
->
fVeryVerbose
;
while
(
pSes
->
nMaxDepth
)
/* there is improvement */
while
(
pSes
->
nMaxDepth
)
/* there is improvement */
...
@@ -1686,6 +1715,9 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
...
@@ -1686,6 +1715,9 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
}
}
}
}
pSes
->
timeTotal
=
Abc_Clock
()
-
timeStartExact
;
/* statistics */
if
(
pSol
)
if
(
pSol
)
{
{
if
(
pSes
->
fHitResLimit
)
if
(
pSes
->
fHitResLimit
)
...
@@ -1713,13 +1745,22 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
...
@@ -1713,13 +1745,22 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
}
}
}
}
pSes
->
timeTotal
=
Abc_Clock
()
-
timeStart
;
s_pSesStore
->
nSatCalls
+=
pSes
->
nSatCalls
;
s_pSesStore
->
nUnsatCalls
+=
pSes
->
nUnsatCalls
;
s_pSesStore
->
nUndefCalls
+=
pSes
->
nUndefCalls
;
s_pSesStore
->
timeSat
+=
pSes
->
timeSat
;
s_pSesStore
->
timeSatSat
+=
pSes
->
timeSatSat
;
s_pSesStore
->
timeSatUnsat
+=
pSes
->
timeSatUnsat
;
s_pSesStore
->
timeSatUndef
+=
pSes
->
timeSatUndef
;
s_pSesStore
->
timeInstance
+=
pSes
->
timeInstance
;
s_pSesStore
->
timeExact
+=
pSes
->
timeTotal
;
/* cleanup */
/* cleanup */
Ses_ManClean
(
pSes
);
Ses_ManClean
(
pSes
);
/* store solution */
/* store solution */
Ses_StoreAddEntry
(
s_pSesStore
,
pTruth
,
nVars
,
p
ArrTimeProfil
e
,
pSol
);
Ses_StoreAddEntry
(
s_pSesStore
,
pTruth
,
nVars
,
p
NormalArrTim
e
,
pSol
);
}
}
if
(
pSol
)
if
(
pSol
)
...
@@ -1740,45 +1781,57 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
...
@@ -1740,45 +1781,57 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
Delay2
=
Abc_MaxInt
(
Delay2
,
pArrTimeProfile
[
l
]
+
pPerm
[
l
]
);
Delay2
=
Abc_MaxInt
(
Delay2
,
pArrTimeProfile
[
l
]
+
pPerm
[
l
]
);
}
}
//printf( " output arrival = %d recomputed = %d\n", Delay, Delay2 );
//printf( " output arrival = %d recomputed = %d\n", Delay, Delay2 );
if
(
Delay
!=
Delay2
)
//if ( Delay != Delay2 )
{
//{
printf
(
"^--- BUG!
\n
"
);
// printf( "^--- BUG!\n" );
assert
(
0
);
// assert( 0 );
}
//}
//Delay = Delay2;
}
Abc_UnnormalizeArrivalTimes
(
pArrTimeProfile
,
nVars
,
nDelta
);
if
(
!
pSol
)
s_pSesStore
->
timeTotal
+=
(
Abc_Clock
()
-
timeStart
);
return
Delay2
;
}
else
{
{
assert
(
*
Cost
==
ABC_INFINITY
);
assert
(
*
Cost
==
ABC_INFINITY
);
}
return
pSol
?
nDelta
+
Delay
:
ABC_INFINITY
;
s_pSesStore
->
timeTotal
+=
(
Abc_Clock
()
-
timeStart
);
return
ABC_INFINITY
;
}
}
}
// this procedure returns a new node whose output in terms of the given fanins
// this procedure returns a new node whose output in terms of the given fanins
// has the smallest possible arrival time (in agreement with the above Abc_ExactDelayCost)
// has the smallest possible arrival time (in agreement with the above Abc_ExactDelayCost)
Abc_Obj_t
*
Abc_ExactBuildNode
(
word
*
pTruth
,
int
nVars
,
int
*
pArrTimeProfile
,
Abc_Obj_t
**
pFanins
,
Abc_Ntk_t
*
pNtk
)
Abc_Obj_t
*
Abc_ExactBuildNode
(
word
*
pTruth
,
int
nVars
,
int
*
pArrTimeProfile
,
Abc_Obj_t
**
pFanins
,
Abc_Ntk_t
*
pNtk
)
{
{
char
*
pSol
=
NULL
;
char
*
pSol
=
NULL
;
int
i
,
j
,
nDelta
,
nMaxArrival
;
int
i
,
j
,
nMaxArrival
;
int
pNormalArrTime
[
8
];
char
const
*
p
;
char
const
*
p
;
Abc_Obj_t
*
pObj
;
Abc_Obj_t
*
pObj
;
Vec_Ptr_t
*
pGates
;
Vec_Ptr_t
*
pGates
;
char
pGateTruth
[
5
];
char
pGateTruth
[
5
];
char
*
pSopCover
;
char
*
pSopCover
;
abctime
timeStart
=
Abc_Clock
();
if
(
nVars
==
0
)
if
(
nVars
==
0
)
{
s_pSesStore
->
timeTotal
+=
(
Abc_Clock
()
-
timeStart
);
return
(
pTruth
[
0
]
&
1
)
?
Abc_NtkCreateNodeConst1
(
pNtk
)
:
Abc_NtkCreateNodeConst0
(
pNtk
);
return
(
pTruth
[
0
]
&
1
)
?
Abc_NtkCreateNodeConst1
(
pNtk
)
:
Abc_NtkCreateNodeConst0
(
pNtk
);
}
if
(
nVars
==
1
)
if
(
nVars
==
1
)
{
s_pSesStore
->
timeTotal
+=
(
Abc_Clock
()
-
timeStart
);
return
(
pTruth
[
0
]
&
1
)
?
Abc_NtkCreateNodeInv
(
pNtk
,
pFanins
[
0
])
:
Abc_NtkCreateNodeBuf
(
pNtk
,
pFanins
[
0
]);
return
(
pTruth
[
0
]
&
1
)
?
Abc_NtkCreateNodeInv
(
pNtk
,
pFanins
[
0
])
:
Abc_NtkCreateNodeBuf
(
pNtk
,
pFanins
[
0
]);
}
nDelta
=
Abc_NormalizeArrivalTimes
(
pArrTimeProfile
,
nVars
,
&
nMaxArrival
);
for
(
i
=
0
;
i
<
nVars
;
++
i
)
Ses_StoreGetEntry
(
s_pSesStore
,
pTruth
,
nVars
,
pArrTimeProfile
,
&
pSol
);
pNormalArrTime
[
i
]
=
pArrTimeProfile
[
i
];
Abc_UnnormalizeArrivalTimes
(
pArrTimeProfile
,
nVars
,
nDelta
);
Abc_NormalizeArrivalTimes
(
pNormalArrTime
,
nVars
,
&
nMaxArrival
);
Ses_StoreGetEntry
(
s_pSesStore
,
pTruth
,
nVars
,
pNormalArrTime
,
&
pSol
);
if
(
!
pSol
)
if
(
!
pSol
)
{
s_pSesStore
->
timeTotal
+=
(
Abc_Clock
()
-
timeStart
);
return
NULL
;
return
NULL
;
}
assert
(
pSol
[
ABC_EXACT_SOL_NVARS
]
==
nVars
);
assert
(
pSol
[
ABC_EXACT_SOL_NVARS
]
==
nVars
);
assert
(
pSol
[
ABC_EXACT_SOL_NFUNC
]
==
1
);
assert
(
pSol
[
ABC_EXACT_SOL_NFUNC
]
==
1
);
...
@@ -1827,6 +1880,7 @@ Abc_Obj_t * Abc_ExactBuildNode( word * pTruth, int nVars, int * pArrTimeProfile,
...
@@ -1827,6 +1880,7 @@ Abc_Obj_t * Abc_ExactBuildNode( word * pTruth, int nVars, int * pArrTimeProfile,
Vec_PtrFree
(
pGates
);
Vec_PtrFree
(
pGates
);
s_pSesStore
->
timeTotal
+=
(
Abc_Clock
()
-
timeStart
);
return
pObj
;
return
pObj
;
}
}
...
...
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