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
ee50e84e
Commit
ee50e84e
authored
Nov 26, 2013
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Structural mapper into structures.
parent
a9eb8677
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
42 deletions
+65
-42
src/aig/gia/giaIff.c
+50
-39
src/base/abci/abc.c
+15
-3
No files found.
src/aig/gia/giaIff.c
View file @
ee50e84e
...
...
@@ -90,24 +90,24 @@ void Gia_ManIffStop( Iff_Man_t * p )
SeeAlso []
***********************************************************************/
int
Gia_IffObjCount
(
Gia_Man_t
*
pGia
,
int
iObj
,
int
iFaninSkip
,
int
iFaninSkip2
)
int
Gia_IffObjCount
(
Gia_Man_t
*
pGia
,
int
iObj
,
int
iFaninSkip
2
,
int
iFaninSkip3
)
{
int
i
,
iFanin
,
Count
=
0
;
Gia_ManIncrementTravId
(
pGia
);
Gia_LutForEachFanin
(
pGia
,
iObj
,
iFanin
,
i
)
{
if
(
iFanin
==
iFaninSkip
||
iFanin
==
iFaninSkip2
)
if
(
iFanin
==
iFaninSkip
2
||
iFanin
==
iFaninSkip3
)
continue
;
if
(
Gia_ObjIsTravIdCurrentId
(
pGia
,
iFanin
)
)
continue
;
Gia_ObjSetTravIdCurrentId
(
pGia
,
iFanin
);
Count
++
;
}
if
(
iFaninSkip
>=
0
)
if
(
iFaninSkip
2
>=
0
)
{
Gia_LutForEachFanin
(
pGia
,
iFaninSkip
,
iFanin
,
i
)
Gia_LutForEachFanin
(
pGia
,
iFaninSkip
2
,
iFanin
,
i
)
{
if
(
iFanin
==
iFaninSkip
2
)
if
(
iFanin
==
iFaninSkip
3
)
continue
;
if
(
Gia_ObjIsTravIdCurrentId
(
pGia
,
iFanin
)
)
continue
;
...
...
@@ -115,11 +115,11 @@ int Gia_IffObjCount( Gia_Man_t * pGia, int iObj, int iFaninSkip, int iFaninSkip2
Count
++
;
}
}
if
(
iFaninSkip
2
>=
0
)
if
(
iFaninSkip
3
>=
0
)
{
Gia_LutForEachFanin
(
pGia
,
iFaninSkip
2
,
iFanin
,
i
)
Gia_LutForEachFanin
(
pGia
,
iFaninSkip
3
,
iFanin
,
i
)
{
if
(
iFanin
==
iFaninSkip
)
if
(
iFanin
==
iFaninSkip
2
)
continue
;
if
(
Gia_ObjIsTravIdCurrentId
(
pGia
,
iFanin
)
)
continue
;
...
...
@@ -141,23 +141,23 @@ int Gia_IffObjCount( Gia_Man_t * pGia, int iObj, int iFaninSkip, int iFaninSkip2
SeeAlso []
***********************************************************************/
float
Gia_IffObjTimeOne
(
Iff_Man_t
*
p
,
int
iObj
,
int
iFaninSkip
,
int
iFaninSkip2
)
float
Gia_IffObjTimeOne
(
Iff_Man_t
*
p
,
int
iObj
,
int
iFaninSkip
2
,
int
iFaninSkip3
)
{
int
i
,
iFanin
;
float
DelayMax
=
-
ABC_INFINITY
;
Gia_LutForEachFanin
(
p
->
pGia
,
iObj
,
iFanin
,
i
)
if
(
iFanin
!=
iFaninSkip
&&
iFanin
!=
iFaninSkip2
&&
DelayMax
<
Iff_ObjTimeId
(
p
,
iFanin
)
)
if
(
iFanin
!=
iFaninSkip
2
&&
iFanin
!=
iFaninSkip3
&&
DelayMax
<
Iff_ObjTimeId
(
p
,
iFanin
)
)
DelayMax
=
Iff_ObjTimeId
(
p
,
iFanin
);
assert
(
i
==
Gia_ObjLutSize
(
p
->
pGia
,
iObj
)
);
if
(
iFaninSkip
==
-
1
)
return
DelayMax
;
Gia_LutForEachFanin
(
p
->
pGia
,
iFaninSkip
,
iFanin
,
i
)
if
(
iFanin
!=
iFaninSkip2
&&
DelayMax
<
Iff_ObjTimeId
(
p
,
iFanin
)
)
DelayMax
=
Iff_ObjTimeId
(
p
,
iFanin
);
if
(
iFaninSkip2
==
-
1
)
return
DelayMax
;
Gia_LutForEachFanin
(
p
->
pGia
,
iFaninSkip2
,
iFanin
,
i
)
if
(
iFanin
!=
iFaninSkip
&&
DelayMax
<
Iff_ObjTimeId
(
p
,
iFanin
)
)
if
(
iFanin
!=
iFaninSkip3
&&
DelayMax
<
Iff_ObjTimeId
(
p
,
iFanin
)
)
DelayMax
=
Iff_ObjTimeId
(
p
,
iFanin
);
if
(
iFaninSkip3
==
-
1
)
return
DelayMax
;
Gia_LutForEachFanin
(
p
->
pGia
,
iFaninSkip3
,
iFanin
,
i
)
if
(
iFanin
!=
iFaninSkip2
&&
DelayMax
<
Iff_ObjTimeId
(
p
,
iFanin
)
)
DelayMax
=
Iff_ObjTimeId
(
p
,
iFanin
);
assert
(
DelayMax
>=
0
);
return
DelayMax
;
...
...
@@ -169,6 +169,8 @@ float Gia_IffObjTimeTwo( Iff_Man_t * p, int iObj, int * piFanin, float DelayMin
*
piFanin
=
-
1
;
Gia_LutForEachFanin
(
p
->
pGia
,
iObj
,
iFanin
,
i
)
{
if
(
Gia_ObjIsCi
(
Gia_ManObj
(
p
->
pGia
,
iFanin
))
)
continue
;
This
=
Gia_IffObjTimeOne
(
p
,
iObj
,
iFanin
,
-
1
);
nSize
=
Gia_IffObjCount
(
p
->
pGia
,
iObj
,
iFanin
,
-
1
);
assert
(
nSize
<=
p
->
pLib
->
LutMax
);
...
...
@@ -192,6 +194,10 @@ float Gia_IffObjTimeThree( Iff_Man_t * p, int iObj, int * piFanin, int * piFanin
{
if
(
iFanin
==
iFanin2
)
continue
;
if
(
Gia_ObjIsCi
(
Gia_ManObj
(
p
->
pGia
,
iFanin
))
)
continue
;
if
(
Gia_ObjIsCi
(
Gia_ManObj
(
p
->
pGia
,
iFanin2
))
)
continue
;
This
=
Gia_IffObjTimeOne
(
p
,
iObj
,
iFanin
,
iFanin2
);
nSize
=
Gia_IffObjCount
(
p
->
pGia
,
iObj
,
iFanin
,
iFanin2
);
assert
(
nSize
<=
p
->
pLib
->
LutMax
);
...
...
@@ -223,7 +229,7 @@ Iff_Man_t * Gia_ManIffPerform( Gia_Man_t * pGia, If_LibLut_t * pLib, Tim_Man_t *
Gia_Obj_t
*
pObj
;
int
iObj
,
iFanin
,
iFanin1
,
iFanin2
;
int
CountAll
=
0
,
Count2
=
0
,
Count3
=
0
;
float
arrTime1
,
arrTime2
,
arrTime3
,
arr
Best
=
-
ABC_INFINITY
;
float
arrTime1
,
arrTime2
,
arrTime3
,
arr
Max
=
-
ABC_INFINITY
;
assert
(
nDegree
==
2
||
nDegree
==
3
);
// start the mapping manager and set its parameters
p
=
Gia_ManIffStart
(
pGia
);
...
...
@@ -265,6 +271,7 @@ Iff_Man_t * Gia_ManIffPerform( Gia_Man_t * pGia, If_LibLut_t * pLib, Tim_Man_t *
Iff_ObjSetMatchId
(
p
,
iObj
,
2
,
iFanin
),
Count2
++
;
else
{
assert
(
arrTime3
<
arrTime2
);
Iff_ObjSetMatchId
(
p
,
iObj
,
2
,
iFanin1
);
Iff_ObjSetMatchId
(
p
,
iObj
,
3
,
iFanin2
),
Count3
++
;
}
...
...
@@ -281,12 +288,12 @@ Iff_Man_t * Gia_ManIffPerform( Gia_Man_t * pGia, If_LibLut_t * pLib, Tim_Man_t *
arrTime1
=
Iff_ObjTimeId
(
p
,
Gia_ObjFaninId0p
(
pGia
,
pObj
)
);
Tim_ManSetCoArrival
(
pTime
,
Gia_ObjCioId
(
pObj
),
arrTime1
);
Iff_ObjSetTime
(
p
,
pObj
,
arrTime1
);
arr
Best
=
Abc_MaxFloat
(
arrBest
,
arrTime1
);
arr
Max
=
Abc_MaxFloat
(
arrMax
,
arrTime1
);
}
else
assert
(
0
);
}
printf
(
"Max delay = %.2f. Count1 = %d. Count2 = %d. Count3 = %d.
\n
"
,
arr
Best
,
CountAll
-
Count2
-
Count3
,
Count2
,
Count3
);
arr
Max
,
CountAll
-
Count2
-
Count3
,
Count2
,
Count3
);
return
p
;
}
...
...
@@ -303,48 +310,48 @@ Iff_Man_t * Gia_ManIffPerform( Gia_Man_t * pGia, If_LibLut_t * pLib, Tim_Man_t *
***********************************************************************/
void
Gia_ManIffSelect_rec
(
Iff_Man_t
*
p
,
int
iObj
,
Vec_Int_t
*
vPacking
)
{
int
i
,
iFanin
,
iFaninSkip
,
iFaninSkip2
;
int
i
,
iFanin
,
iFaninSkip
2
,
iFaninSkip3
;
if
(
Gia_ObjIsTravIdCurrentId
(
p
->
pGia
,
iObj
)
)
return
;
Gia_ObjSetTravIdCurrentId
(
p
->
pGia
,
iObj
);
assert
(
Gia_ObjIsLut
(
p
->
pGia
,
iObj
)
);
iFaninSkip
=
Iff_ObjMatchId
(
p
,
iObj
,
2
);
iFaninSkip
2
=
Iff_ObjMatchId
(
p
,
iObj
,
3
);
if
(
iFaninSkip
==
-
1
)
iFaninSkip
2
=
Iff_ObjMatchId
(
p
,
iObj
,
2
);
iFaninSkip
3
=
Iff_ObjMatchId
(
p
,
iObj
,
3
);
if
(
iFaninSkip
2
==
-
1
)
{
assert
(
iFaninSkip
2
==
-
1
);
assert
(
iFaninSkip
3
==
-
1
);
Gia_LutForEachFanin
(
p
->
pGia
,
iObj
,
iFanin
,
i
)
Gia_ManIffSelect_rec
(
p
,
iFanin
,
vPacking
);
Vec_IntPush
(
vPacking
,
1
);
Vec_IntPush
(
vPacking
,
iObj
);
}
else
if
(
iFaninSkip
2
==
-
1
)
else
if
(
iFaninSkip
3
==
-
1
)
{
assert
(
iFaninSkip
>
0
);
assert
(
iFaninSkip
2
>
0
);
Gia_LutForEachFanin
(
p
->
pGia
,
iObj
,
iFanin
,
i
)
if
(
iFanin
!=
iFaninSkip
)
if
(
iFanin
!=
iFaninSkip
2
)
Gia_ManIffSelect_rec
(
p
,
iFanin
,
vPacking
);
Gia_LutForEachFanin
(
p
->
pGia
,
iFaninSkip
,
iFanin
,
i
)
Gia_LutForEachFanin
(
p
->
pGia
,
iFaninSkip
2
,
iFanin
,
i
)
Gia_ManIffSelect_rec
(
p
,
iFanin
,
vPacking
);
Vec_IntPush
(
vPacking
,
2
);
Vec_IntPush
(
vPacking
,
iFaninSkip
);
Vec_IntPush
(
vPacking
,
iFaninSkip
2
);
Vec_IntPush
(
vPacking
,
iObj
);
}
else
{
assert
(
iFaninSkip
>
0
&&
iFaninSkip2
>
0
);
assert
(
iFaninSkip
2
>
0
&&
iFaninSkip3
>
0
);
Gia_LutForEachFanin
(
p
->
pGia
,
iObj
,
iFanin
,
i
)
if
(
iFanin
!=
iFaninSkip
&&
iFanin
!=
iFaninSkip2
)
Gia_ManIffSelect_rec
(
p
,
iFanin
,
vPacking
);
Gia_LutForEachFanin
(
p
->
pGia
,
iFaninSkip
,
iFanin
,
i
)
if
(
iFanin
!=
iFaninSkip2
)
if
(
iFanin
!=
iFaninSkip2
&&
iFanin
!=
iFaninSkip3
)
Gia_ManIffSelect_rec
(
p
,
iFanin
,
vPacking
);
Gia_LutForEachFanin
(
p
->
pGia
,
iFaninSkip2
,
iFanin
,
i
)
if
(
iFanin
!=
iFaninSkip
)
if
(
iFanin
!=
iFaninSkip3
)
Gia_ManIffSelect_rec
(
p
,
iFanin
,
vPacking
);
Gia_LutForEachFanin
(
p
->
pGia
,
iFaninSkip3
,
iFanin
,
i
)
if
(
iFanin
!=
iFaninSkip2
)
Gia_ManIffSelect_rec
(
p
,
iFanin
,
vPacking
);
Vec_IntPush
(
vPacking
,
3
);
Vec_IntPush
(
vPacking
,
iFaninSkip
);
Vec_IntPush
(
vPacking
,
iFaninSkip2
);
Vec_IntPush
(
vPacking
,
iFaninSkip3
);
Vec_IntPush
(
vPacking
,
iObj
);
}
Vec_IntAddToEntry
(
vPacking
,
0
,
1
);
...
...
@@ -357,7 +364,7 @@ Vec_Int_t * Gia_ManIffSelect( Iff_Man_t * p )
Vec_IntPush
(
vPacking
,
0
);
// mark const0 and PIs
Gia_ManIncrementTravId
(
p
->
pGia
);
Gia_ObjSetTravIdCurrent
(
p
->
pGia
,
Gia_ManConst0
(
p
->
pGia
)
);
Gia_ObjSetTravIdCurrent
Id
(
p
->
pGia
,
0
);
Gia_ManForEachCi
(
p
->
pGia
,
pObj
,
i
)
Gia_ObjSetTravIdCurrent
(
p
->
pGia
,
pObj
);
// recursively collect internal nodes
...
...
@@ -380,6 +387,7 @@ Vec_Int_t * Gia_ManIffSelect( Iff_Man_t * p )
void
Gia_ManIffTest
(
Gia_Man_t
*
pGia
,
If_LibLut_t
*
pLib
,
int
fVerbose
)
{
Iff_Man_t
*
p
;
Tim_Man_t
*
pTemp
=
NULL
;
int
nDegree
=
-
1
;
int
nLutSize
=
Gia_ManLutSizeMax
(
pGia
);
if
(
nLutSize
<=
4
)
...
...
@@ -411,10 +419,13 @@ void Gia_ManIffTest( Gia_Man_t * pGia, If_LibLut_t * pLib, int fVerbose )
printf
(
"Performing %d-clustering with %d-LUTs:
\n
"
,
nDegree
,
nLutSize
);
// create timing manager
if
(
pGia
->
pManTime
==
NULL
)
pGia
->
pManTime
=
Tim_ManStart
(
Gia_ManCiNum
(
pGia
),
Gia_ManCoNum
(
pGia
)
);
pGia
->
pManTime
=
pTemp
=
Tim_ManStart
(
Gia_ManCiNum
(
pGia
),
Gia_ManCoNum
(
pGia
)
);
// perform timing computation
p
=
Gia_ManIffPerform
(
pGia
,
pLib
,
pGia
->
pManTime
,
nLutSize
,
nDegree
);
Tim_ManStopP
(
(
Tim_Man_t
**
)
&
pGia
->
pManTime
);
// remove timing manager
if
(
pGia
->
pManTime
==
pTemp
)
pGia
->
pManTime
=
NULL
;
Tim_ManStopP
(
(
Tim_Man_t
**
)
&
pTemp
);
// derive clustering
Vec_IntFreeP
(
&
pGia
->
vPacking
);
pGia
->
vPacking
=
Gia_ManIffSelect
(
p
);
...
...
src/base/abci/abc.c
View file @
ee50e84e
...
...
@@ -29833,7 +29833,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
}
pPars
->
pLutLib
=
(
If_LibLut_t
*
)
pAbc
->
pLibLut
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"KCFAGRDEWSqalepmrsdbgyojikfuztvh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"KCFAGRDEWS
T
qalepmrsdbgyojikfuztvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
...
...
@@ -29952,6 +29952,17 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
goto
usage
;
}
break
;
case
'T'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-T
\"
should be followed by a positive integer 0,1,or 2.
\n
"
);
goto
usage
;
}
pPars
->
nStructType
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
pPars
->
nStructType
<
0
||
pPars
->
nStructType
>
2
)
goto
usage
;
break
;
case
'q'
:
pPars
->
fPreprocess
^=
1
;
break
;
...
...
@@ -30212,7 +30223,7 @@ usage:
sprintf
(
LutSize
,
"library"
);
else
sprintf
(
LutSize
,
"%d"
,
pPars
->
nLutSize
);
Abc_Print
(
-
2
,
"usage: &if [-KCFAGR num] [-DEW float] [-S str] [-qarlepmsdbgyojikfucztvh]
\n
"
);
Abc_Print
(
-
2
,
"usage: &if [-KCFAGR
T
num] [-DEW float] [-S str] [-qarlepmsdbgyojikfucztvh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs FPGA technology mapping of the network
\n
"
);
Abc_Print
(
-
2
,
"
\t
-K num : the number of LUT inputs (2 < num < %d) [default = %s]
\n
"
,
IF_MAX_LUTSIZE
+
1
,
LutSize
);
Abc_Print
(
-
2
,
"
\t
-C num : the max number of priority cuts (0 < num < 2^12) [default = %d]
\n
"
,
pPars
->
nCutsMax
);
...
...
@@ -30224,6 +30235,7 @@ usage:
Abc_Print
(
-
2
,
"
\t
-E float : sets epsilon used for tie-breaking [default = %f]
\n
"
,
pPars
->
Epsilon
);
Abc_Print
(
-
2
,
"
\t
-W float : sets wire delay between adjects LUTs [default = %f]
\n
"
,
pPars
->
WireDelay
);
Abc_Print
(
-
2
,
"
\t
-S str : string representing the LUT structure [default = %s]
\n
"
,
pPars
->
pLutStruct
?
pPars
->
pLutStruct
:
"not used"
);
Abc_Print
(
-
2
,
"
\t
-T num : the type of LUT structures [default = any]
\n
"
,
pPars
->
nStructType
);
Abc_Print
(
-
2
,
"
\t
-q : toggles preprocessing using several starting points [default = %s]
\n
"
,
pPars
->
fPreprocess
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-a : toggles area-oriented mapping [default = %s]
\n
"
,
pPars
->
fArea
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-r : enables expansion/reduction of the best cuts [default = %s]
\n
"
,
pPars
->
fExpRed
?
"yes"
:
"no"
);
...
...
@@ -30263,7 +30275,7 @@ usage:
int
Abc_CommandAbc9Iff
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
extern
void
Gia_ManIffTest
(
Gia_Man_t
*
pGia
,
If_LibLut_t
*
pLib
,
int
fVerbose
);
int
c
,
fVerbose
=
1
;
int
c
,
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"vh"
)
)
!=
EOF
)
{
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