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
26ec3868
Commit
26ec3868
authored
Apr 07, 2016
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding AIG rehashing after LUT mapping in Gia.
parent
887f3c21
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
9 deletions
+82
-9
src/aig/gia/gia.h
+1
-0
src/aig/gia/giaIf.c
+56
-1
src/aig/gia/giaSatLut.c
+6
-4
src/aig/gia/giaTim.c
+6
-1
src/base/abci/abc.c
+13
-3
No files found.
src/aig/gia/gia.h
View file @
26ec3868
...
@@ -1305,6 +1305,7 @@ extern void Gia_ManTransferTiming( Gia_Man_t * p, Gia_Man_t * pGi
...
@@ -1305,6 +1305,7 @@ extern void Gia_ManTransferTiming( Gia_Man_t * p, Gia_Man_t * pGi
extern
Gia_Man_t
*
Gia_ManPerformMapping
(
Gia_Man_t
*
p
,
void
*
pIfPars
);
extern
Gia_Man_t
*
Gia_ManPerformMapping
(
Gia_Man_t
*
p
,
void
*
pIfPars
);
extern
Gia_Man_t
*
Gia_ManPerformSopBalance
(
Gia_Man_t
*
p
,
int
nCutNum
,
int
nRelaxRatio
,
int
fVerbose
);
extern
Gia_Man_t
*
Gia_ManPerformSopBalance
(
Gia_Man_t
*
p
,
int
nCutNum
,
int
nRelaxRatio
,
int
fVerbose
);
extern
Gia_Man_t
*
Gia_ManPerformDsdBalance
(
Gia_Man_t
*
p
,
int
nLutSize
,
int
nCutNum
,
int
nRelaxRatio
,
int
fVerbose
);
extern
Gia_Man_t
*
Gia_ManPerformDsdBalance
(
Gia_Man_t
*
p
,
int
nLutSize
,
int
nCutNum
,
int
nRelaxRatio
,
int
fVerbose
);
extern
Gia_Man_t
*
Gia_ManDupHashMapping
(
Gia_Man_t
*
p
);
/*=== giaJf.c ===========================================================*/
/*=== giaJf.c ===========================================================*/
extern
void
Jf_ManSetDefaultPars
(
Jf_Par_t
*
pPars
);
extern
void
Jf_ManSetDefaultPars
(
Jf_Par_t
*
pPars
);
extern
Gia_Man_t
*
Jf_ManPerformMapping
(
Gia_Man_t
*
pGia
,
Jf_Par_t
*
pPars
);
extern
Gia_Man_t
*
Jf_ManPerformMapping
(
Gia_Man_t
*
pGia
,
Jf_Par_t
*
pPars
);
...
...
src/aig/gia/giaIf.c
View file @
26ec3868
...
@@ -2183,9 +2183,15 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp )
...
@@ -2183,9 +2183,15 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp )
}
}
else
else
{
{
// mapping
int
fHashMapping
=
1
;
pNew
=
Gia_ManPerformMappingInt
(
p
,
(
If_Par_t
*
)
pp
);
pNew
=
Gia_ManPerformMappingInt
(
p
,
(
If_Par_t
*
)
pp
);
Gia_ManTransferTiming
(
pNew
,
p
);
Gia_ManTransferTiming
(
pNew
,
p
);
if
(
fHashMapping
)
{
pNew
=
Gia_ManDupHashMapping
(
p
=
pNew
);
Gia_ManTransferTiming
(
pNew
,
p
);
Gia_ManStop
(
p
);
}
}
}
pNew
->
MappedDelay
=
(
int
)((
If_Par_t
*
)
pp
)
->
FinalDelay
;
pNew
->
MappedDelay
=
(
int
)((
If_Par_t
*
)
pp
)
->
FinalDelay
;
pNew
->
MappedArea
=
(
int
)((
If_Par_t
*
)
pp
)
->
FinalArea
;
pNew
->
MappedArea
=
(
int
)((
If_Par_t
*
)
pp
)
->
FinalArea
;
...
@@ -2313,6 +2319,55 @@ void Gia_ManTestStruct( Gia_Man_t * p )
...
@@ -2313,6 +2319,55 @@ void Gia_ManTestStruct( Gia_Man_t * p )
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
}
/**Function*************************************************************
Synopsis [Performs hashing for a mapped AIG.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Gia_ManDupHashMapping
(
Gia_Man_t
*
p
)
{
Gia_Man_t
*
pNew
;
Vec_Int_t
*
vMapping
;
Gia_Obj_t
*
pObj
,
*
pFanin
;
int
i
,
k
;
assert
(
Gia_ManHasMapping
(
p
)
);
// copy the old manager with hashing
pNew
=
Gia_ManStart
(
Gia_ManObjNum
(
p
)
);
pNew
->
pName
=
Abc_UtilStrsav
(
p
->
pName
);
pNew
->
pSpec
=
Abc_UtilStrsav
(
p
->
pSpec
);
Gia_ManHashAlloc
(
pNew
);
Gia_ManFillValue
(
p
);
Gia_ManConst0
(
p
)
->
Value
=
0
;
Gia_ManForEachCi
(
p
,
pObj
,
i
)
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
Gia_ManForEachAnd
(
p
,
pObj
,
i
)
pObj
->
Value
=
Gia_ManHashAnd
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
Gia_ManForEachCo
(
p
,
pObj
,
i
)
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
Gia_ManHashStop
(
pNew
);
Gia_ManSetRegNum
(
pNew
,
Gia_ManRegNum
(
p
)
);
// recreate mapping
vMapping
=
Vec_IntAlloc
(
Vec_IntSize
(
p
->
vMapping
)
);
Vec_IntFill
(
vMapping
,
Gia_ManObjNum
(
p
),
0
);
Gia_ManForEachLut
(
p
,
i
)
{
pObj
=
Gia_ManObj
(
p
,
i
);
Vec_IntWriteEntry
(
vMapping
,
Abc_Lit2Var
(
pObj
->
Value
),
Vec_IntSize
(
vMapping
)
);
Vec_IntPush
(
vMapping
,
Gia_ObjLutSize
(
p
,
i
)
);
Gia_LutForEachFaninObj
(
p
,
i
,
pFanin
,
k
)
Vec_IntPush
(
vMapping
,
Abc_Lit2Var
(
pFanin
->
Value
)
);
Vec_IntPush
(
vMapping
,
Abc_Lit2Var
(
pObj
->
Value
)
);
}
pNew
->
vMapping
=
vMapping
;
return
pNew
;
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
/// END OF FILE ///
...
...
src/aig/gia/giaSatLut.c
View file @
26ec3868
...
@@ -46,6 +46,7 @@ struct Sbl_Man_t_
...
@@ -46,6 +46,7 @@ struct Sbl_Man_t_
int
nRuns
;
// the number of runs
int
nRuns
;
// the number of runs
int
nSmallWins
;
// the number of small windows
int
nSmallWins
;
// the number of small windows
int
nLargeWins
;
// the number of large windows
int
nLargeWins
;
// the number of large windows
int
nIterOuts
;
// the number of iters exceeded
// parameters
// parameters
int
nBTLimit
;
// conflicts
int
nBTLimit
;
// conflicts
int
DelayMax
;
// external delay
int
DelayMax
;
// external delay
...
@@ -1109,9 +1110,10 @@ int Sbl_ManTestSat( Sbl_Man_t * p, int iPivot )
...
@@ -1109,9 +1110,10 @@ int Sbl_ManTestSat( Sbl_Man_t * p, int iPivot )
printf
(
"LitCount = %d.
\n
"
,
LitCount
);
printf
(
"LitCount = %d.
\n
"
,
LitCount
);
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
}
if
(
nIters
==
2
0
)
if
(
nIters
==
1
0
)
{
{
printf
(
"Obj %d : Quitting after %d iterations.
\n
"
,
iPivot
,
nIters
);
p
->
nIterOuts
++
;
//printf( "Obj %d : Quitting after %d iterations.\n", iPivot, nIters );
break
;
break
;
}
}
}
}
...
@@ -1183,8 +1185,8 @@ void Gia_ManLutSat( Gia_Man_t * pGia, int nNumber, int nImproves, int nBTLimit,
...
@@ -1183,8 +1185,8 @@ void Gia_ManLutSat( Gia_Man_t * pGia, int nNumber, int nImproves, int nBTLimit,
}
}
Gia_ManComputeOneWin
(
pGia
,
-
1
,
NULL
,
NULL
,
NULL
,
NULL
);
Gia_ManComputeOneWin
(
pGia
,
-
1
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
p
->
fVerbose
)
if
(
p
->
fVerbose
)
printf
(
"Tried = %d. Improved = %d.
Small win = %d. Large win = %d. Total
SAT runs = %d.
\n
"
,
printf
(
"Tried = %d. Improved = %d.
SmallWin = %d. LargeWin = %d. IterOut = %d.
SAT runs = %d.
\n
"
,
p
->
nTried
,
p
->
nImproved
,
p
->
nSmallWins
,
p
->
nLargeWins
,
p
->
nRuns
);
p
->
nTried
,
p
->
nImproved
,
p
->
nSmallWins
,
p
->
nLargeWins
,
p
->
n
IterOuts
,
p
->
n
Runs
);
if
(
p
->
fVerbose
)
if
(
p
->
fVerbose
)
Sbl_ManPrintRuntime
(
p
);
Sbl_ManPrintRuntime
(
p
);
Sbl_ManStop
(
p
);
Sbl_ManStop
(
p
);
...
...
src/aig/gia/giaTim.c
View file @
26ec3868
...
@@ -137,6 +137,7 @@ int Gia_ManIsNormalized( Gia_Man_t * p )
...
@@ -137,6 +137,7 @@ int Gia_ManIsNormalized( Gia_Man_t * p )
***********************************************************************/
***********************************************************************/
Gia_Man_t
*
Gia_ManDupNormalize
(
Gia_Man_t
*
p
)
Gia_Man_t
*
Gia_ManDupNormalize
(
Gia_Man_t
*
p
)
{
{
int
fHash
=
1
;
Gia_Man_t
*
pNew
;
Gia_Man_t
*
pNew
;
Gia_Obj_t
*
pObj
;
Gia_Obj_t
*
pObj
;
int
i
;
int
i
;
...
@@ -170,11 +171,15 @@ Gia_Man_t * Gia_ManDupNormalize( Gia_Man_t * p )
...
@@ -170,11 +171,15 @@ Gia_Man_t * Gia_ManDupNormalize( Gia_Man_t * p )
Gia_ManCi
(
p
,
i
)
->
Value
=
Gia_ManAppendCi
(
pNew
);
Gia_ManCi
(
p
,
i
)
->
Value
=
Gia_ManAppendCi
(
pNew
);
printf
(
"Warning: Shuffled CI order to be correct sequential AIG.
\n
"
);
printf
(
"Warning: Shuffled CI order to be correct sequential AIG.
\n
"
);
}
}
if
(
fHash
)
Gia_ManHashAlloc
(
pNew
);
Gia_ManForEachAnd
(
p
,
pObj
,
i
)
Gia_ManForEachAnd
(
p
,
pObj
,
i
)
if
(
Gia_ObjIsBuf
(
pObj
)
)
if
(
Gia_ObjIsBuf
(
pObj
)
)
pObj
->
Value
=
Gia_ManAppendBuf
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
pObj
->
Value
=
Gia_ManAppendBuf
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
else
else
if
(
fHash
)
pObj
->
Value
=
Gia_ManHashAnd
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
else
pObj
->
Value
=
Gia_ManAppendAnd
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
pObj
->
Value
=
Gia_ManAppendAnd
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
if
(
fHash
)
Gia_ManHashStop
(
pNew
);
Gia_ManForEachCo
(
p
,
pObj
,
i
)
Gia_ManForEachCo
(
p
,
pObj
,
i
)
pObj
->
Value
=
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
pObj
->
Value
=
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
Gia_ManSetRegNum
(
pNew
,
Gia_ManRegNum
(
p
)
);
Gia_ManSetRegNum
(
pNew
,
Gia_ManRegNum
(
p
)
);
...
...
src/base/abci/abc.c
View file @
26ec3868
...
@@ -27641,8 +27641,9 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -27641,8 +27641,9 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv )
int
fAddStrash
=
0
;
int
fAddStrash
=
0
;
int
fCollapse
=
0
;
int
fCollapse
=
0
;
int
fAddMuxes
=
0
;
int
fAddMuxes
=
0
;
int
fRehashMap
=
0
;
Extra_UtilGetoptReset
();
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"Lacmh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"Lacm
r
h"
)
)
!=
EOF
)
{
{
switch
(
c
)
switch
(
c
)
{
{
...
@@ -27666,6 +27667,9 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -27666,6 +27667,9 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv )
case
'm'
:
case
'm'
:
fAddMuxes
^=
1
;
fAddMuxes
^=
1
;
break
;
break
;
case
'r'
:
fRehashMap
^=
1
;
break
;
case
'h'
:
case
'h'
:
goto
usage
;
goto
usage
;
default:
default:
...
@@ -27677,7 +27681,12 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -27677,7 +27681,12 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print
(
-
1
,
"Abc_CommandAbc9Strash(): There is no AIG.
\n
"
);
Abc_Print
(
-
1
,
"Abc_CommandAbc9Strash(): There is no AIG.
\n
"
);
return
1
;
return
1
;
}
}
if
(
Gia_ManHasMapping
(
pAbc
->
pGia
)
&&
pAbc
->
pGia
->
vConfigs
)
if
(
Gia_ManHasMapping
(
pAbc
->
pGia
)
&&
fRehashMap
)
{
extern
Gia_Man_t
*
Gia_ManDupHashMapping
(
Gia_Man_t
*
p
);
pTemp
=
Gia_ManDupHashMapping
(
pAbc
->
pGia
);
}
else
if
(
Gia_ManHasMapping
(
pAbc
->
pGia
)
&&
pAbc
->
pGia
->
vConfigs
)
pTemp
=
(
Gia_Man_t
*
)
If_ManDeriveGiaFromCells
(
pAbc
->
pGia
);
pTemp
=
(
Gia_Man_t
*
)
If_ManDeriveGiaFromCells
(
pAbc
->
pGia
);
else
if
(
Gia_ManHasMapping
(
pAbc
->
pGia
)
)
else
if
(
Gia_ManHasMapping
(
pAbc
->
pGia
)
)
pTemp
=
(
Gia_Man_t
*
)
Dsm_ManDeriveGia
(
pAbc
->
pGia
,
fAddMuxes
);
// delay-oriented unmapping
pTemp
=
(
Gia_Man_t
*
)
Dsm_ManDeriveGia
(
pAbc
->
pGia
,
fAddMuxes
);
// delay-oriented unmapping
...
@@ -27730,12 +27739,13 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -27730,12 +27739,13 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv )
return
0
;
return
0
;
usage:
usage:
Abc_Print
(
-
2
,
"usage: &st [-L num] [-acmh]
\n
"
);
Abc_Print
(
-
2
,
"usage: &st [-L num] [-acm
r
h]
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs structural hashing
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs structural hashing
\n
"
);
Abc_Print
(
-
2
,
"
\t
-a : toggle additional hashing [default = %s]
\n
"
,
fAddStrash
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-a : toggle additional hashing [default = %s]
\n
"
,
fAddStrash
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-c : toggle collapsing hierarchical AIG [default = %s]
\n
"
,
fCollapse
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-c : toggle collapsing hierarchical AIG [default = %s]
\n
"
,
fCollapse
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-m : toggle converting to larger gates [default = %s]
\n
"
,
fAddMuxes
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-m : toggle converting to larger gates [default = %s]
\n
"
,
fAddMuxes
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-L num : create MUX when sum of refs does not exceed this limit [default = %d]
\n
"
,
Limit
);
Abc_Print
(
-
2
,
"
\t
-L num : create MUX when sum of refs does not exceed this limit [default = %d]
\n
"
,
Limit
);
Abc_Print
(
-
2
,
"
\t
-r : toggle rehashing AIG while preserving mapping [default = %s]
\n
"
,
fRehashMap
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
return
1
;
}
}
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