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
52015095
Commit
52015095
authored
Sep 07, 2013
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements to the new technology mapper.
parent
2a39b635
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
5 deletions
+80
-5
src/aig/gia/gia.h
+2
-0
src/aig/gia/giaJf.c
+48
-3
src/aig/gia/giaUtil.c
+24
-0
src/base/abci/abc.c
+6
-2
No files found.
src/aig/gia/gia.h
View file @
52015095
...
...
@@ -241,6 +241,7 @@ struct Jf_Par_t_
int
nRounds
;
int
DelayTarget
;
int
fAreaOnly
;
int
fCoarsen
;
int
fVerbose
;
int
fVeryVerbose
;
int
nLutSizeMax
;
...
...
@@ -1204,6 +1205,7 @@ extern Vec_Int_t * Gia_ManGetDangling( Gia_Man_t * p );
extern
void
Gia_ObjPrint
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
);
extern
void
Gia_ManPrint
(
Gia_Man_t
*
p
);
extern
void
Gia_ManPrintCo
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
);
extern
void
Gia_ManPrintCone
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
,
int
*
pLeaves
,
int
nLeaves
,
Vec_Int_t
*
vNodes
);
extern
void
Gia_ManInvertConstraints
(
Gia_Man_t
*
pAig
);
extern
void
Gia_ManInvertPos
(
Gia_Man_t
*
pAig
);
extern
int
Gia_ManCompare
(
Gia_Man_t
*
p1
,
Gia_Man_t
*
p2
);
...
...
src/aig/gia/giaJf.c
View file @
52015095
...
...
@@ -55,6 +55,7 @@ struct Jf_Man_t_
float
(
*
pCutCmp
)
(
Jf_Cut_t
*
,
Jf_Cut_t
*
);
// procedure to compare cuts
abctime
clkStart
;
// starting time
word
CutCount
[
4
];
// statistics
int
nCoarse
;
// coarse nodes
};
static
inline
int
Jf_ObjCutH
(
Jf_Man_t
*
p
,
int
i
)
{
return
Vec_IntEntry
(
&
p
->
vCuts
,
i
);
}
...
...
@@ -82,8 +83,9 @@ static inline float Jf_ObjRefs( Jf_Man_t * p, int i ) { return Vec_FltEntry(
SeeAlso []
***********************************************************************/
float
*
Jf_ManInitRefs
(
Gia_Man_t
*
p
)
float
*
Jf_ManInitRefs
(
Jf_Man_t
*
pMan
)
{
Gia_Man_t
*
p
=
pMan
->
pGia
;
Gia_Obj_t
*
pObj
,
*
pCtrl
,
*
pData0
,
*
pData1
;
float
*
pRes
;
int
i
;
assert
(
p
->
pRefs
==
NULL
);
...
...
@@ -104,6 +106,20 @@ float * Jf_ManInitRefs( Gia_Man_t * p )
}
Gia_ManForEachCo
(
p
,
pObj
,
i
)
Gia_ObjRefFanin0Inc
(
p
,
pObj
);
// mark XOR/MUX internal nodes, which are not used elsewhere
if
(
pMan
->
pPars
->
fCoarsen
)
{
pMan
->
nCoarse
=
0
;
Gia_ManForEachAnd
(
p
,
pObj
,
i
)
{
if
(
Gia_ObjIsBuf
(
pObj
)
||
!
Gia_ObjIsMuxType
(
pObj
)
)
continue
;
if
(
Gia_ObjRefNum
(
p
,
Gia_ObjFanin0
(
pObj
))
==
1
)
Gia_ObjFanin0
(
pObj
)
->
fMark0
=
1
,
pMan
->
nCoarse
++
;
if
(
Gia_ObjRefNum
(
p
,
Gia_ObjFanin1
(
pObj
))
==
1
)
Gia_ObjFanin1
(
pObj
)
->
fMark0
=
1
,
pMan
->
nCoarse
++
;
}
}
// multiply by factor
pRes
=
ABC_ALLOC
(
float
,
Gia_ManObjNum
(
p
)
);
for
(
i
=
0
;
i
<
Gia_ManObjNum
(
p
);
i
++
)
...
...
@@ -136,7 +152,7 @@ Jf_Man_t * Jf_ManAlloc( Gia_Man_t * pGia, Jf_Par_t * pPars )
Vec_IntFill
(
&
p
->
vDep
,
Gia_ManObjNum
(
pGia
),
0
);
Vec_FltFill
(
&
p
->
vFlow
,
Gia_ManObjNum
(
pGia
),
0
);
p
->
vRefs
.
nCap
=
p
->
vRefs
.
nSize
=
Gia_ManObjNum
(
pGia
);
p
->
vRefs
.
pArray
=
Jf_ManInitRefs
(
p
Gia
);
p
->
vRefs
.
pArray
=
Jf_ManInitRefs
(
p
);
Vec_SetAlloc_
(
&
p
->
pMem
,
20
);
p
->
vTemp
=
Vec_IntAlloc
(
1000
);
p
->
clkStart
=
Abc_Clock
();
...
...
@@ -144,6 +160,8 @@ Jf_Man_t * Jf_ManAlloc( Gia_Man_t * pGia, Jf_Par_t * pPars )
}
void
Jf_ManFree
(
Jf_Man_t
*
p
)
{
if
(
p
->
pPars
->
fCoarsen
)
Gia_ManCleanMark0
(
p
->
pGia
);
ABC_FREE
(
p
->
pGia
->
pRefs
);
ABC_FREE
(
p
->
vCuts
.
pArray
);
ABC_FREE
(
p
->
vArr
.
pArray
);
...
...
@@ -181,6 +199,13 @@ static inline void Jf_ObjCutPrint( int * pCuts )
Jf_CutPrint
(
pCut
);
printf
(
"
\n
"
);
}
static
inline
void
Jf_ObjBestCutConePrint
(
Jf_Man_t
*
p
,
Gia_Obj_t
*
pObj
)
{
int
*
pCut
=
Jf_ObjCutBest
(
p
,
Gia_ObjId
(
p
->
pGia
,
pObj
)
);
printf
(
"Best cut of node %d : "
,
Gia_ObjId
(
p
->
pGia
,
pObj
)
);
Jf_CutPrint
(
pCut
);
Gia_ManPrintCone
(
p
->
pGia
,
pObj
,
pCut
+
1
,
pCut
[
0
],
p
->
vTemp
);
}
static
inline
unsigned
Jf_CutGetSign
(
int
*
pCut
)
{
unsigned
Sign
=
0
;
int
i
;
...
...
@@ -506,6 +531,21 @@ void Jf_ObjComputeCuts( Jf_Man_t * p, Gia_Obj_t * pObj )
c
=
Jf_ObjAddCutToStore
(
p
,
pSto
,
c
,
CutNum
);
assert
(
c
<=
CutNum
);
}
// fix the case when both fanins have no unit cuts
if
(
c
==
0
)
{
assert
(
!
pObj
->
fMark0
);
assert
(
Gia_ObjFanin0
(
pObj
)
->
fMark0
);
assert
(
Gia_ObjFanin1
(
pObj
)
->
fMark0
);
Vec_IntClear
(
p
->
vTemp
);
Vec_IntPushUnique
(
p
->
vTemp
,
Gia_ObjFaninId0p
(
p
->
pGia
,
Gia_ObjFanin0
(
pObj
))
);
Vec_IntPushUnique
(
p
->
vTemp
,
Gia_ObjFaninId1p
(
p
->
pGia
,
Gia_ObjFanin0
(
pObj
))
);
Vec_IntPushUnique
(
p
->
vTemp
,
Gia_ObjFaninId0p
(
p
->
pGia
,
Gia_ObjFanin1
(
pObj
))
);
Vec_IntPushUnique
(
p
->
vTemp
,
Gia_ObjFaninId1p
(
p
->
pGia
,
Gia_ObjFanin1
(
pObj
))
);
pSto
[
c
]
->
pCut
[
0
]
=
Vec_IntSize
(
p
->
vTemp
);
memcpy
(
pSto
[
c
]
->
pCut
+
1
,
Vec_IntArray
(
p
->
vTemp
),
sizeof
(
int
)
*
Vec_IntSize
(
p
->
vTemp
)
);
c
++
;
}
// Jf_ObjCheckPtrs( pSto, CutNum );
// Jf_ObjCheckStore( p, pSto, c, iObj );
p
->
CutCount
[
3
]
+=
c
;
...
...
@@ -553,6 +593,8 @@ void Jf_ManComputeCuts( Jf_Man_t * p )
printf
(
"Gia = %.2f MB "
,
Gia_ManMemory
(
p
->
pGia
)
/
(
1
<<
20
)
);
printf
(
"Man = %.2f MB "
,
6
.
0
*
sizeof
(
int
)
*
Gia_ManObjNum
(
p
->
pGia
)
/
(
1
<<
20
)
);
printf
(
"Cuts = %.2f MB"
,
Vec_ReportMemory
(
&
p
->
pMem
)
/
(
1
<<
20
)
);
if
(
p
->
nCoarse
)
printf
(
" Coarse = %d (%.1f %%)"
,
p
->
nCoarse
,
100
.
0
*
p
->
nCoarse
/
Gia_ManObjNum
(
p
->
pGia
)
);
printf
(
"
\n
"
);
}
}
...
...
@@ -603,6 +645,7 @@ int Jf_ManComputeRefs( Jf_Man_t * p )
Gia_ObjRefInc
(
p
->
pGia
,
Gia_ObjFanin0
(
pObj
)
);
else
if
(
Gia_ObjIsAnd
(
pObj
)
&&
Gia_ObjRefNum
(
p
->
pGia
,
pObj
)
>
0
)
{
assert
(
!
pObj
->
fMark0
);
Jf_CutRef
(
p
,
Jf_ObjCutBest
(
p
,
i
)
);
p
->
pPars
->
Edge
+=
Jf_ObjCutBest
(
p
,
i
)[
0
];
p
->
pPars
->
Area
++
;
...
...
@@ -654,7 +697,7 @@ void Jf_ManPropagateFlow( Jf_Man_t * p, int fEdge )
Gia_ManForEachObj
(
p
->
pGia
,
pObj
,
i
)
if
(
Gia_ObjIsBuf
(
pObj
)
)
Jf_ObjPropagateBuf
(
p
,
pObj
,
0
);
else
if
(
Gia_ObjIsAnd
(
pObj
)
)
else
if
(
Gia_ObjIsAnd
(
pObj
)
&&
!
pObj
->
fMark0
)
Jf_ObjComputeBestCut
(
p
,
pObj
,
fEdge
,
0
);
Jf_ManComputeRefs
(
p
);
}
...
...
@@ -668,6 +711,7 @@ void Jf_ManPropagateEla( Jf_Man_t * p, int fEdge )
Jf_ObjPropagateBuf
(
p
,
pObj
,
1
);
else
if
(
Gia_ObjIsAnd
(
pObj
)
&&
Gia_ObjRefNum
(
p
->
pGia
,
pObj
)
>
0
)
{
assert
(
!
pObj
->
fMark0
);
CostBef
=
Jf_CutDeref_rec
(
p
,
Jf_ObjCutBest
(
p
,
i
),
fEdge
,
ABC_INFINITY
);
Jf_ObjComputeBestCut
(
p
,
pObj
,
fEdge
,
1
);
CostAft
=
Jf_CutRef_rec
(
p
,
Jf_ObjCutBest
(
p
,
i
),
fEdge
,
ABC_INFINITY
);
...
...
@@ -716,6 +760,7 @@ void Jf_ManSetDefaultPars( Jf_Par_t * pPars )
pPars
->
nRounds
=
1
;
pPars
->
DelayTarget
=
-
1
;
pPars
->
fAreaOnly
=
1
;
pPars
->
fCoarsen
=
1
;
pPars
->
fVerbose
=
0
;
pPars
->
fVeryVerbose
=
0
;
pPars
->
nLutSizeMax
=
JF_LEAF_MAX
;
...
...
src/aig/gia/giaUtil.c
View file @
52015095
...
...
@@ -1138,6 +1138,10 @@ void Gia_ObjPrint( Gia_Man_t * p, Gia_Obj_t * pObj )
Gia_ObjFaninId1p
(
p
,
pObj
),
(
Gia_ObjFaninC1
(
pObj
)
?
"
\'
"
:
" "
)
);
if
(
p
->
pRefs
)
printf
(
" (refs = %3d)"
,
Gia_ObjRefNum
(
p
,
pObj
)
);
if
(
pObj
->
fMark0
)
printf
(
" mark0"
);
if
(
pObj
->
fMark1
)
printf
(
" mark1"
);
printf
(
"
\n
"
);
/*
if ( p->pRefs )
...
...
@@ -1189,6 +1193,26 @@ void Gia_ManPrintCo( Gia_Man_t * p, Gia_Obj_t * pObj )
Gia_ManPrintCo_rec
(
p
,
Gia_ObjFanin0
(
pObj
)
);
Gia_ObjPrint
(
p
,
pObj
);
}
void
Gia_ManPrintCollect_rec
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
,
Vec_Int_t
*
vNodes
)
{
if
(
Vec_IntFind
(
vNodes
,
Gia_ObjId
(
p
,
pObj
))
>=
0
)
return
;
assert
(
Gia_ObjIsAnd
(
pObj
)
);
Gia_ManPrintCollect_rec
(
p
,
Gia_ObjFanin0
(
pObj
),
vNodes
);
Gia_ManPrintCollect_rec
(
p
,
Gia_ObjFanin1
(
pObj
),
vNodes
);
Vec_IntPush
(
vNodes
,
Gia_ObjId
(
p
,
pObj
)
);
}
void
Gia_ManPrintCone
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
,
int
*
pLeaves
,
int
nLeaves
,
Vec_Int_t
*
vNodes
)
{
int
i
;
Vec_IntClear
(
vNodes
);
for
(
i
=
0
;
i
<
nLeaves
;
i
++
)
Vec_IntPush
(
vNodes
,
pLeaves
[
i
]
);
Gia_ManPrintCollect_rec
(
p
,
pObj
,
vNodes
);
printf
(
"GIA logic cone for node %d:
\n
"
,
Gia_ObjId
(
p
,
pObj
)
);
Gia_ManForEachObjVec
(
vNodes
,
p
,
pObj
,
i
)
Gia_ObjPrint
(
p
,
pObj
);
}
/**Function*************************************************************
...
...
src/base/abci/abc.c
View file @
52015095
...
...
@@ -29825,7 +29825,7 @@ int Abc_CommandAbc9Jf( Abc_Frame_t * pAbc, int argc, char ** argv )
int
c
;
Jf_ManSetDefaultPars
(
pPars
);
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"KCRDavwh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"KCRDa
c
vwh"
)
)
!=
EOF
)
{
switch
(
c
)
{
...
...
@@ -29882,6 +29882,9 @@ int Abc_CommandAbc9Jf( Abc_Frame_t * pAbc, int argc, char ** argv )
case
'a'
:
pPars
->
fAreaOnly
^=
1
;
break
;
case
'c'
:
pPars
->
fCoarsen
^=
1
;
break
;
case
'v'
:
pPars
->
fVerbose
^=
1
;
break
;
...
...
@@ -29907,13 +29910,14 @@ usage:
sprintf
(
Buffer
,
"best possible"
);
else
sprintf
(
Buffer
,
"%d"
,
pPars
->
DelayTarget
);
Abc_Print
(
-
2
,
"usage: &jf [-KCRD num] [-avwh]
\n
"
);
Abc_Print
(
-
2
,
"usage: &jf [-KCRD num] [-a
c
vwh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs technology mapping of the network
\n
"
);
Abc_Print
(
-
2
,
"
\t
-K num : LUT size for the mapping (2 <= K <= %d) [default = %d]
\n
"
,
pPars
->
nLutSizeMax
,
pPars
->
nLutSize
);
Abc_Print
(
-
2
,
"
\t
-C num : the max number of priority cuts (1 <= C <= %d) [default = %d]
\n
"
,
pPars
->
nCutNumMax
,
pPars
->
nCutNum
);
Abc_Print
(
-
2
,
"
\t
-R num : the number of mapping rounds [default = %d]
\n
"
,
pPars
->
nRounds
);
Abc_Print
(
-
2
,
"
\t
-D num : sets the delay constraint for the mapping [default = %s]
\n
"
,
Buffer
);
Abc_Print
(
-
2
,
"
\t
-a : toggles area-oriented mapping [default = %s]
\n
"
,
pPars
->
fAreaOnly
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-c : toggles coarsening the subject graph [default = %s]
\n
"
,
pPars
->
fCoarsen
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-v : toggles verbose output [default = %s]
\n
"
,
pPars
->
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-w : toggles very verbose output [default = %s]
\n
"
,
pPars
->
fVeryVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-h : prints the command usage
\n
"
);
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