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
ca8256fb
Commit
ca8256fb
authored
Aug 09, 2016
by
Mathias Soeken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exact synthesis.
parent
80551de3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
23 deletions
+105
-23
src/base/abci/abc.c
+1
-1
src/base/abci/abcExact.c
+104
-22
No files found.
src/base/abci/abc.c
View file @
ca8256fb
...
@@ -7399,7 +7399,7 @@ int Abc_CommandExact( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -7399,7 +7399,7 @@ int Abc_CommandExact( Abc_Frame_t * pAbc, int argc, char ** argv )
}
}
else
if
(
nVars
!=
nVarsTmp
)
else
if
(
nVars
!=
nVarsTmp
)
{
{
Abc_Print
(
-
1
,
"All functions need to have the same size
.
\n
"
);
Abc_Print
(
-
1
,
"All functions need to have the same size
(nVars = %d, nVarsTmp = %d, base = %d).
\n
"
,
nVars
,
nVarsTmp
,
Abc_Base2Log
(
2
)
);
goto
usage
;
goto
usage
;
}
}
}
}
src/base/abci/abcExact.c
View file @
ca8256fb
...
@@ -88,6 +88,8 @@ struct Ses_Man_t_
...
@@ -88,6 +88,8 @@ struct Ses_Man_t_
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 */
int
fHitResLimit
;
/* SAT solver gave up due to resource limit */
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) */
...
@@ -134,9 +136,21 @@ struct Ses_Store_t_
...
@@ -134,9 +136,21 @@ struct Ses_Store_t_
int
nValidEntriesCount
;
/* number of entries with network */
int
nValidEntriesCount
;
/* number of entries with network */
Ses_TruthEntry_t
*
pEntries
[
SES_STORE_TABLE_SIZE
];
/* hash table for truth table entries */
Ses_TruthEntry_t
*
pEntries
[
SES_STORE_TABLE_SIZE
];
/* hash table for truth table entries */
unsigned
long
nCutCount
;
/* statistics */
unsigned
long
pCutCount
[
9
];
unsigned
long
nCutCount
;
/* number of cuts investigated */
unsigned
long
nCacheHit
;
unsigned
long
pCutCount
[
9
];
/* -> per cut size */
unsigned
long
nUnsynthesizedImp
;
/* number of cuts which couldn't be optimized at all, opt. stopped because of imp. constraints */
unsigned
long
pUnsynthesizedImp
[
9
];
/* -> per cut size */
unsigned
long
nUnsynthesizedRL
;
/* number of cuts which couldn't be optimized at all, opt. stopped because of resource limits */
unsigned
long
pUnsynthesizedRL
[
9
];
/* -> per cut size */
unsigned
long
nSynthesizedTrivial
;
/* number of cuts which could be synthesized trivially (n < 2) */
unsigned
long
pSynthesizedTrivial
[
9
];
/* -> per cut size */
unsigned
long
nSynthesizedImp
;
/* number of cuts which could be synthesized, opt. stopped because of imp. constraints */
unsigned
long
pSynthesizedImp
[
9
];
/* -> per cut size */
unsigned
long
nSynthesizedRL
;
/* number of cuts which could be synthesized, opt. stopped because of resource limits */
unsigned
long
pSynthesizedRL
[
9
];
/* -> per cut size */
unsigned
long
nCacheHits
;
/* number of cache hits */
unsigned
long
pCacheHits
[
9
];
/* -> per cut size */
};
};
static
Ses_Store_t
*
s_pSesStore
=
NULL
;
static
Ses_Store_t
*
s_pSesStore
=
NULL
;
...
@@ -180,16 +194,11 @@ static inline void Abc_UnnormalizeArrivalTimes( int * pArrTimeProfile, int nVars
...
@@ -180,16 +194,11 @@ static inline void Abc_UnnormalizeArrivalTimes( int * pArrTimeProfile, int nVars
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
);
pStore
->
fMakeAIG
=
fMakeAIG
;
pStore
->
fMakeAIG
=
fMakeAIG
;
pStore
->
fVerbose
=
fVerbose
;
pStore
->
fVerbose
=
fVerbose
;
pStore
->
nBTLimit
=
nBTLimit
;
pStore
->
nBTLimit
=
nBTLimit
;
pStore
->
nEntriesCount
=
0
;
memset
(
pStore
->
pEntries
,
0
,
SES_STORE_TABLE_SIZE
);
memset
(
pStore
->
pEntries
,
0
,
SES_STORE_TABLE_SIZE
);
pStore
->
nCutCount
=
0
;
memset
(
pStore
->
pCutCount
,
0
,
9
);
pStore
->
nCacheHit
=
0
;
return
pStore
;
return
pStore
;
}
}
...
@@ -325,8 +334,11 @@ int Ses_StoreAddEntry( Ses_Store_t * pStore, word * pTruth, int nVars, int * pAr
...
@@ -325,8 +334,11 @@ int Ses_StoreAddEntry( Ses_Store_t * pStore, word * pTruth, int nVars, int * pAr
pStore
->
nValidEntriesCount
++
;
pStore
->
nValidEntriesCount
++
;
}
}
else
else
{
assert
(
0
);
/* item was already present */
/* item was already present */
fAdded
=
0
;
fAdded
=
0
;
}
return
fAdded
;
return
fAdded
;
}
}
...
@@ -1242,6 +1254,9 @@ static int Ses_ManFindMinimumSize( Ses_Man_t * pSes )
...
@@ -1242,6 +1254,9 @@ static int Ses_ManFindMinimumSize( Ses_Man_t * pSes )
{
{
int
nGates
=
0
;
int
nGates
=
0
;
/* store whether call was unsuccessful due to resource limit and not due to impossible constraint */
pSes
->
fHitResLimit
=
0
;
while
(
true
)
while
(
true
)
{
{
++
nGates
;
++
nGates
;
...
@@ -1256,12 +1271,14 @@ static int Ses_ManFindMinimumSize( Ses_Man_t * pSes )
...
@@ -1256,12 +1271,14 @@ static int Ses_ManFindMinimumSize( Ses_Man_t * pSes )
Ses_ManCreateVars
(
pSes
,
nGates
);
Ses_ManCreateVars
(
pSes
,
nGates
);
if
(
!
Ses_ManCreateClauses
(
pSes
)
)
if
(
!
Ses_ManCreateClauses
(
pSes
)
)
return
0
;
/* proven UNSAT while creating clauses */
continue
;
/* proven UNSAT while creating clauses */
switch
(
Ses_ManSolve
(
pSes
)
)
switch
(
Ses_ManSolve
(
pSes
)
)
{
{
case
1
:
return
1
;
/* SAT */
case
1
:
return
1
;
/* SAT */
case
2
:
return
0
;
/* resource limit */
case
2
:
pSes
->
fHitResLimit
=
1
;
return
0
;
/* resource limit */
}
}
}
}
...
@@ -1512,13 +1529,41 @@ void Abc_ExactStats()
...
@@ -1512,13 +1529,41 @@ void Abc_ExactStats()
return
;
return
;
}
}
printf
(
"-------------------------------------------------------------------------------------------------------------------------------
\n
"
);
printf
(
" 0 1 2 3 4 5 6 7 8 total
\n
"
);
printf
(
"-------------------------------------------------------------------------------------------------------------------------------
\n
"
);
printf
(
"number of considered cuts :"
);
printf
(
"number of considered cuts :"
);
for
(
i
=
2
;
i
<
9
;
++
i
)
for
(
i
=
0
;
i
<
9
;
++
i
)
printf
(
" %d = %lu "
,
i
,
s_pSesStore
->
pCutCount
[
i
]
);
printf
(
"%10lu"
,
s_pSesStore
->
pCutCount
[
i
]
);
printf
(
" total = %lu
\n
"
,
s_pSesStore
->
nCutCount
);
printf
(
"%10lu
\n
"
,
s_pSesStore
->
nCutCount
);
printf
(
"cache hits : %lu
\n
"
,
s_pSesStore
->
nCacheHit
);
printf
(
" - trivial :"
);
for
(
i
=
0
;
i
<
9
;
++
i
)
printf
(
"%10lu"
,
s_pSesStore
->
pSynthesizedTrivial
[
i
]
);
printf
(
"%10lu
\n
"
,
s_pSesStore
->
nSynthesizedTrivial
);
printf
(
" - synth (imp) :"
);
for
(
i
=
0
;
i
<
9
;
++
i
)
printf
(
"%10lu"
,
s_pSesStore
->
pSynthesizedImp
[
i
]
);
printf
(
"%10lu
\n
"
,
s_pSesStore
->
nSynthesizedImp
);
printf
(
" - synth (res) :"
);
for
(
i
=
0
;
i
<
9
;
++
i
)
printf
(
"%10lu"
,
s_pSesStore
->
pSynthesizedRL
[
i
]
);
printf
(
"%10lu
\n
"
,
s_pSesStore
->
nSynthesizedRL
);
printf
(
" - not synth (imp) :"
);
for
(
i
=
0
;
i
<
9
;
++
i
)
printf
(
"%10lu"
,
s_pSesStore
->
pUnsynthesizedImp
[
i
]
);
printf
(
"%10lu
\n
"
,
s_pSesStore
->
nUnsynthesizedImp
);
printf
(
" - not synth (res) :"
);
for
(
i
=
0
;
i
<
9
;
++
i
)
printf
(
"%10lu"
,
s_pSesStore
->
pUnsynthesizedRL
[
i
]
);
printf
(
"%10lu
\n
"
,
s_pSesStore
->
nUnsynthesizedRL
);
printf
(
" - cache hits :"
);
for
(
i
=
0
;
i
<
9
;
++
i
)
printf
(
"%10lu"
,
s_pSesStore
->
pCacheHits
[
i
]
);
printf
(
"%10lu
\n
"
,
s_pSesStore
->
nCacheHits
);
printf
(
"-------------------------------------------------------------------------------------------------------------------------------
\n
"
);
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
);
}
}
// 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)
...
@@ -1538,14 +1583,24 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
...
@@ -1538,14 +1583,24 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
assert
(
0
);
assert
(
0
);
}
}
/* statistics */
s_pSesStore
->
nCutCount
++
;
s_pSesStore
->
pCutCount
[
nVars
]
++
;
if
(
nVars
==
0
)
if
(
nVars
==
0
)
{
{
s_pSesStore
->
nSynthesizedTrivial
++
;
s_pSesStore
->
pSynthesizedTrivial
[
0
]
++
;
*
Cost
=
0
;
*
Cost
=
0
;
return
0
;
return
0
;
}
}
if
(
nVars
==
1
)
if
(
nVars
==
1
)
{
{
s_pSesStore
->
nSynthesizedTrivial
++
;
s_pSesStore
->
pSynthesizedTrivial
[
1
]
++
;
*
Cost
=
0
;
*
Cost
=
0
;
pPerm
[
0
]
=
(
char
)
0
;
pPerm
[
0
]
=
(
char
)
0
;
return
pArrTimeProfile
[
0
];
return
pArrTimeProfile
[
0
];
...
@@ -1563,17 +1618,15 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
...
@@ -1563,17 +1618,15 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
printf
(
" at level %d
\n
"
,
AigLevel
);
printf
(
" at level %d
\n
"
,
AigLevel
);
}
}
/* statistics */
s_pSesStore
->
nCutCount
++
;
s_pSesStore
->
pCutCount
[
nVars
]
++
;
*
Cost
=
ABC_INFINITY
;
*
Cost
=
ABC_INFINITY
;
if
(
Ses_StoreGetEntry
(
s_pSesStore
,
pTruth
,
nVars
,
pArrTimeProfile
,
&
pSol
)
)
if
(
Ses_StoreGetEntry
(
s_pSesStore
,
pTruth
,
nVars
,
pArrTimeProfile
,
&
pSol
)
)
{
{
if
(
s_pSesStore
->
fVeryVerbose
)
if
(
s_pSesStore
->
fVeryVerbose
)
printf
(
" truth table already in store
\n
"
);
printf
(
" truth table already in store
\n
"
);
s_pSesStore
->
nCacheHit
++
;
s_pSesStore
->
nCacheHits
++
;
s_pSesStore
->
pCacheHits
[
nVars
]
++
;
}
}
else
else
{
{
...
@@ -1613,6 +1666,33 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
...
@@ -1613,6 +1666,33 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
}
}
}
}
if
(
pSol
)
{
if
(
pSes
->
fHitResLimit
)
{
s_pSesStore
->
nSynthesizedRL
++
;
s_pSesStore
->
pSynthesizedRL
[
nVars
]
++
;
}
else
{
s_pSesStore
->
nSynthesizedImp
++
;
s_pSesStore
->
pSynthesizedImp
[
nVars
]
++
;
}
}
else
{
if
(
pSes
->
fHitResLimit
)
{
s_pSesStore
->
nUnsynthesizedRL
++
;
s_pSesStore
->
pUnsynthesizedRL
[
nVars
]
++
;
}
else
{
s_pSesStore
->
nUnsynthesizedImp
++
;
s_pSesStore
->
pUnsynthesizedImp
[
nVars
]
++
;
}
}
pSes
->
timeTotal
=
Abc_Clock
()
-
timeStart
;
pSes
->
timeTotal
=
Abc_Clock
()
-
timeStart
;
/* cleanup */
/* cleanup */
...
@@ -1685,6 +1765,7 @@ Abc_Obj_t * Abc_ExactBuildNode( word * pTruth, int nVars, int * pArrTimeProfile,
...
@@ -1685,6 +1765,7 @@ Abc_Obj_t * Abc_ExactBuildNode( word * pTruth, int nVars, int * pArrTimeProfile,
/* primary inputs */
/* primary inputs */
for
(
i
=
0
;
i
<
nVars
;
++
i
)
for
(
i
=
0
;
i
<
nVars
;
++
i
)
{
{
assert
(
pFanins
[
i
]
);
Vec_PtrPush
(
pGates
,
pFanins
[
i
]
);
Vec_PtrPush
(
pGates
,
pFanins
[
i
]
);
}
}
...
@@ -1707,6 +1788,7 @@ Abc_Obj_t * Abc_ExactBuildNode( word * pTruth, int nVars, int * pArrTimeProfile,
...
@@ -1707,6 +1788,7 @@ Abc_Obj_t * Abc_ExactBuildNode( word * pTruth, int nVars, int * pArrTimeProfile,
pSopCover
=
Abc_SopFromTruthBin
(
pGateTruth
);
pSopCover
=
Abc_SopFromTruthBin
(
pGateTruth
);
pObj
=
Abc_NtkCreateNode
(
pNtk
);
pObj
=
Abc_NtkCreateNode
(
pNtk
);
assert
(
pObj
);
pObj
->
pData
=
Abc_SopRegister
(
(
Mem_Flex_t
*
)
pNtk
->
pManFunc
,
pSopCover
);
pObj
->
pData
=
Abc_SopRegister
(
(
Mem_Flex_t
*
)
pNtk
->
pManFunc
,
pSopCover
);
Vec_PtrPush
(
pGates
,
pObj
);
Vec_PtrPush
(
pGates
,
pObj
);
ABC_FREE
(
pSopCover
);
ABC_FREE
(
pSopCover
);
...
...
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