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
b9274a07
Commit
b9274a07
authored
Apr 11, 2014
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements to DSD in technology mapping.
parent
116c35a0
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
26 deletions
+26
-26
src/aig/gia/giaIf.c
+2
-2
src/map/if/if.h
+4
-3
src/map/if/ifDsd.c
+6
-6
src/map/if/ifMan.c
+2
-1
src/map/if/ifMap.c
+6
-8
src/map/if/ifTruth.c
+6
-6
No files found.
src/aig/gia/giaIf.c
View file @
b9274a07
...
...
@@ -1200,9 +1200,9 @@ int Gia_ManFromIfLogicFindLut( If_Man_t * pIfMan, Gia_Man_t * pNew, If_Cut_t * p
}
return
RetValue
;
}
assert
(
If_DsdManSuppSize
(
pIfMan
->
pIfDsdMan
,
pCutBest
->
iCutDsd
)
==
(
int
)
pCutBest
->
nLeaves
);
assert
(
If_DsdManSuppSize
(
pIfMan
->
pIfDsdMan
,
If_CutDsdLit
(
pIfMan
,
pCutBest
)
)
==
(
int
)
pCutBest
->
nLeaves
);
// find the bound set
uSetOld
=
If_DsdManCheckXY
(
pIfMan
->
pIfDsdMan
,
pCutBest
->
iCutDsd
,
nLutSize
,
1
,
1
,
0
);
uSetOld
=
If_DsdManCheckXY
(
pIfMan
->
pIfDsdMan
,
If_CutDsdLit
(
pIfMan
,
pCutBest
)
,
nLutSize
,
1
,
1
,
0
);
// remap bound set
uSetNew
=
0
;
for
(
k
=
0
;
k
<
If_CutLeaveNum
(
pCutBest
);
k
++
)
...
...
src/map/if/if.h
View file @
b9274a07
...
...
@@ -274,7 +274,7 @@ struct If_Cut_t_
float
Power
;
// the power flow
float
Delay
;
// delay of the cut
int
iCutFunc
;
// TT ID of the cut
int
iCutDsd
;
// DSD ID of the cut
int
uMaskFunc
;
// polarity bitmask
unsigned
uSign
;
// cut signature
unsigned
Cost
:
13
;
// the user's cost of the cut (related to IF_COST_MAX)
unsigned
fCompl
:
1
;
// the complemented attribute
...
...
@@ -388,7 +388,7 @@ static inline int * If_CutLeaves( If_Cut_t * pCut ) { r
static
inline
unsigned
If_CutSuppMask
(
If_Cut_t
*
pCut
)
{
return
(
~
(
unsigned
)
0
)
>>
(
32
-
pCut
->
nLeaves
);
}
static
inline
int
If_CutTruthWords
(
int
nVarsMax
)
{
return
nVarsMax
<=
5
?
2
:
(
1
<<
(
nVarsMax
-
5
));
}
static
inline
int
If_CutPermWords
(
int
nVarsMax
)
{
return
nVarsMax
/
sizeof
(
int
)
+
((
nVarsMax
%
sizeof
(
int
))
>
0
);
}
static
inline
int
If_CutLeafBit
(
If_Cut_t
*
pCut
,
int
i
)
{
return
(
pCut
->
iCutDsd
>>
i
)
&
1
;
}
static
inline
int
If_CutLeafBit
(
If_Cut_t
*
pCut
,
int
i
)
{
return
(
pCut
->
uMaskFunc
>>
i
)
&
1
;
}
static
inline
If_Cut_t
*
If_ObjCutBest
(
If_Obj_t
*
pObj
)
{
return
&
pObj
->
CutBest
;
}
static
inline
unsigned
If_ObjCutSign
(
unsigned
ObjId
)
{
return
(
1
<<
(
ObjId
%
31
));
}
...
...
@@ -412,7 +412,8 @@ static inline word * If_CutTruthWR( If_Man_t * p, If_Cut_t * pCut ) { r
static
inline
unsigned
*
If_CutTruthUR
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
)
{
return
(
unsigned
*
)
If_CutTruthWR
(
p
,
pCut
);
}
static
inline
word
*
If_CutTruthW
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
)
{
if
(
p
->
vTtMem
==
NULL
)
return
NULL
;
assert
(
pCut
->
iCutFunc
>=
0
);
Abc_TtCopy
(
p
->
puTempW
,
If_CutTruthWR
(
p
,
pCut
),
p
->
nTruth6Words
[
pCut
->
nLeaves
],
If_CutTruthIsCompl
(
pCut
)
);
return
p
->
puTempW
;
}
static
inline
unsigned
*
If_CutTruth
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
)
{
return
(
unsigned
*
)
If_CutTruthW
(
p
,
pCut
);
}
static
inline
int
If_CutDsdLit
(
If_Cut_t
*
pCut
)
{
assert
(
pCut
->
iCutDsd
>=
0
);
return
pCut
->
iCutDsd
;
}
static
inline
int
If_CutDsdLit
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
)
{
return
Abc_Lit2LitL
(
Vec_IntArray
(
p
->
vTtDsds
[
pCut
->
nLeaves
]),
If_CutTruthLit
(
pCut
)
);
}
static
inline
int
If_CutDsdIsCompl
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
)
{
return
Abc_LitIsCompl
(
If_CutDsdLit
(
p
,
pCut
)
);
}
static
inline
If_Obj_t
*
If_CutLeaf
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
,
int
i
)
{
assert
(
i
>=
0
&&
i
<
(
int
)
pCut
->
nLeaves
);
return
If_ManObj
(
p
,
pCut
->
pLeaves
[
i
]);
}
static
inline
float
If_CutLutArea
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
)
{
return
pCut
->
fUser
?
(
float
)
pCut
->
Cost
:
(
p
->
pPars
->
pLutLib
?
p
->
pPars
->
pLutLib
->
pLutAreas
[
pCut
->
nLeaves
]
:
(
float
)
1
.
0
);
}
...
...
src/map/if/ifDsd.c
View file @
b9274a07
...
...
@@ -1905,7 +1905,7 @@ int If_CutDsdBalancePinDelays( If_Man_t * p, If_Cut_t * pCut, char * pPerm )
int
i
,
Delay
,
nSupp
=
0
,
pTimes
[
IF_MAX_FUNC_LUTSIZE
];
for
(
i
=
0
;
i
<
If_CutLeaveNum
(
pCut
);
i
++
)
pTimes
[
i
]
=
(
int
)
If_ObjCutBest
(
If_CutLeaf
(
p
,
pCut
,
i
))
->
Delay
;
Delay
=
If_CutDsdBalancePinDelays_rec
(
p
->
pIfDsdMan
,
Abc_Lit2Var
(
If_CutDsdLit
(
pCut
)),
pTimes
,
&
Result
,
&
nSupp
,
If_CutLeaveNum
(
pCut
),
pCut
->
pPerm
);
Delay
=
If_CutDsdBalancePinDelays_rec
(
p
->
pIfDsdMan
,
Abc_Lit2Var
(
If_CutDsdLit
(
p
,
p
Cut
)),
pTimes
,
&
Result
,
&
nSupp
,
If_CutLeaveNum
(
pCut
),
pCut
->
pPerm
);
assert
(
nSupp
==
If_CutLeaveNum
(
pCut
)
);
If_CutPinDelayTranslate
(
Result
,
If_CutLeaveNum
(
pCut
),
pPerm
);
return
Delay
;
...
...
@@ -1997,18 +1997,18 @@ int If_CutDsdBalanceEval( If_Man_t * p, If_Cut_t * pCut, Vec_Int_t * vAig )
Vec_IntClear
(
vAig
);
if
(
pCut
->
nLeaves
==
0
)
// const
{
assert
(
Abc_Lit2Var
(
If_CutDsdLit
(
pCut
))
==
0
);
assert
(
Abc_Lit2Var
(
If_CutDsdLit
(
p
,
p
Cut
))
==
0
);
if
(
vAig
)
Vec_IntPush
(
vAig
,
Abc_LitIsCompl
(
If_CutDsdLit
(
pCut
))
);
Vec_IntPush
(
vAig
,
Abc_LitIsCompl
(
If_CutDsdLit
(
p
,
p
Cut
))
);
return
0
;
}
if
(
pCut
->
nLeaves
==
1
)
// variable
{
assert
(
Abc_Lit2Var
(
If_CutDsdLit
(
pCut
))
==
1
);
assert
(
Abc_Lit2Var
(
If_CutDsdLit
(
p
,
p
Cut
))
==
1
);
if
(
vAig
)
Vec_IntPush
(
vAig
,
0
);
if
(
vAig
)
Vec_IntPush
(
vAig
,
Abc_LitIsCompl
(
If_CutDsdLit
(
pCut
))
);
Vec_IntPush
(
vAig
,
Abc_LitIsCompl
(
If_CutDsdLit
(
p
,
p
Cut
))
);
return
(
int
)
If_ObjCutBest
(
If_CutLeaf
(
p
,
pCut
,
0
))
->
Delay
;
}
else
...
...
@@ -2017,7 +2017,7 @@ int If_CutDsdBalanceEval( If_Man_t * p, If_Cut_t * pCut, Vec_Int_t * vAig )
int
Delay
,
Area
=
0
;
for
(
i
=
0
;
i
<
If_CutLeaveNum
(
pCut
);
i
++
)
pTimes
[
i
]
=
(
int
)
If_ObjCutBest
(
If_CutLeaf
(
p
,
pCut
,
i
))
->
Delay
;
Delay
=
If_CutDsdBalanceEvalInt
(
p
->
pIfDsdMan
,
If_CutDsdLit
(
pCut
),
pTimes
,
vAig
,
&
Area
,
pCut
->
pPerm
);
Delay
=
If_CutDsdBalanceEvalInt
(
p
->
pIfDsdMan
,
If_CutDsdLit
(
p
,
p
Cut
),
pTimes
,
vAig
,
&
Area
,
pCut
->
pPerm
);
pCut
->
Cost
=
Area
;
return
Delay
;
}
...
...
src/map/if/ifMan.c
View file @
b9274a07
...
...
@@ -484,7 +484,8 @@ void If_ManSetupCutTriv( If_Man_t * p, If_Cut_t * pCut, int ObjId )
pCut
->
pLeaves
[
0
]
=
p
->
pPars
->
fLiftLeaves
?
(
ObjId
<<
8
)
:
ObjId
;
pCut
->
uSign
=
If_ObjCutSign
(
pCut
->
pLeaves
[
0
]
);
pCut
->
iCutFunc
=
p
->
pPars
->
fUseTtPerm
?
3
:
(
p
->
pPars
->
fTruth
?
2
:
-
1
);
pCut
->
iCutDsd
=
p
->
pPars
->
fUseTtPerm
?
0
:
(
p
->
pPars
->
fUseDsd
?
2
:
-
1
);
// pCut->iCutDsd = p->pPars->fUseTtPerm ? 0 : (p->pPars->fUseDsd ? 2: -1);
pCut
->
uMaskFunc
=
0
;
assert
(
pCut
->
pLeaves
[
0
]
<
p
->
vObjs
->
nSize
);
if
(
p
->
pPars
->
fUseDsd
)
pCut
->
pPerm
[
0
]
=
0
;
...
...
src/map/if/ifMap.c
View file @
b9274a07
...
...
@@ -192,7 +192,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
continue
;
// compute the truth table
pCut
->
iCutFunc
=
-
1
;
pCut
->
iCutDsd
=
-
1
;
//
pCut->iCutDsd = -1;
pCut
->
fCompl
=
0
;
if
(
p
->
pPars
->
fTruth
)
{
...
...
@@ -214,26 +214,24 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
int
truthId
=
Abc_Lit2Var
(
pCut
->
iCutFunc
);
if
(
Vec_IntSize
(
p
->
vTtDsds
[
pCut
->
nLeaves
])
<=
truthId
||
Vec_IntEntry
(
p
->
vTtDsds
[
pCut
->
nLeaves
],
truthId
)
==
-
1
)
{
pCut
->
iCutDsd
=
If_DsdManCompute
(
p
->
pIfDsdMan
,
If_CutTruthWR
(
p
,
pCut
),
pCut
->
nLeaves
,
(
unsigned
char
*
)
pCut
->
pPerm
,
p
->
pPars
->
pLutStruct
);
int
iCutDsd
=
If_DsdManCompute
(
p
->
pIfDsdMan
,
If_CutTruthWR
(
p
,
pCut
),
pCut
->
nLeaves
,
(
unsigned
char
*
)
pCut
->
pPerm
,
p
->
pPars
->
pLutStruct
);
while
(
Vec_IntSize
(
p
->
vTtDsds
[
pCut
->
nLeaves
])
<=
truthId
)
{
Vec_IntPush
(
p
->
vTtDsds
[
pCut
->
nLeaves
],
-
1
);
for
(
v
=
0
;
v
<
Abc_MaxInt
(
6
,
pCut
->
nLeaves
);
v
++
)
Vec_StrPush
(
p
->
vTtPerms
[
pCut
->
nLeaves
],
IF_BIG_CHAR
);
}
Vec_IntWriteEntry
(
p
->
vTtDsds
[
pCut
->
nLeaves
],
truthId
,
pCut
->
iCutDsd
);
Vec_IntWriteEntry
(
p
->
vTtDsds
[
pCut
->
nLeaves
],
truthId
,
iCutDsd
);
for
(
v
=
0
;
v
<
(
int
)
pCut
->
nLeaves
;
v
++
)
Vec_StrWriteEntry
(
p
->
vTtPerms
[
pCut
->
nLeaves
],
truthId
*
Abc_MaxInt
(
6
,
pCut
->
nLeaves
)
+
v
,
(
char
)
pCut
->
pPerm
[
v
]
);
}
else
{
pCut
->
iCutDsd
=
Vec_IntEntry
(
p
->
vTtDsds
[
pCut
->
nLeaves
],
truthId
);
assert
(
If_DsdManSuppSize
(
p
->
pIfDsdMan
,
If_CutDsdLit
(
p
,
pCut
))
==
(
int
)
pCut
->
nLeaves
);
for
(
v
=
0
;
v
<
(
int
)
pCut
->
nLeaves
;
v
++
)
pCut
->
pPerm
[
v
]
=
(
unsigned
char
)
Vec_StrEntry
(
p
->
vTtPerms
[
pCut
->
nLeaves
],
truthId
*
Abc_MaxInt
(
6
,
pCut
->
nLeaves
)
+
v
);
// assert( If_DsdManSuppSize(p->pIfDsdMan, pCut->iCutDsd) == (int)pCut->nLeaves );
}
// If_ManCacheRecord( p, pCut0->iCutDsd, pCut1->iCutDsd, nShared, pCut->iCutDsd );
pCut
->
iCutDsd
=
Abc_LitNotCond
(
pCut
->
iCutDsd
,
Abc_LitIsCompl
(
pCut
->
iCutFunc
)
);
// If_ManCacheRecord( p, If_CutDsdLit(p, pCut0), If_CutDsdLit(p, pCut1), nShared, If_CutDsdLit(p, pCut) );
}
// run user functions
pCut
->
fUseless
=
0
;
...
...
@@ -242,7 +240,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
assert
(
p
->
pPars
->
fUseTtPerm
==
0
);
assert
(
pCut
->
nLimit
>=
4
&&
pCut
->
nLimit
<=
16
);
if
(
p
->
pPars
->
fUseDsd
)
pCut
->
fUseless
=
If_DsdManCheckDec
(
p
->
pIfDsdMan
,
pCut
->
iCutDsd
);
pCut
->
fUseless
=
If_DsdManCheckDec
(
p
->
pIfDsdMan
,
If_CutDsdLit
(
p
,
pCut
)
);
else
pCut
->
fUseless
=
!
p
->
pPars
->
pFuncCell
(
p
,
If_CutTruth
(
p
,
pCut
),
Abc_MaxInt
(
6
,
pCut
->
nLeaves
),
pCut
->
nLeaves
,
p
->
pPars
->
pLutStruct
);
p
->
nCutsUselessAll
+=
pCut
->
fUseless
;
...
...
src/map/if/ifTruth.c
View file @
b9274a07
...
...
@@ -173,8 +173,8 @@ int If_CutComputeTruthPerm_int( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0,
word
*
pTruth0
=
(
word
*
)
p
->
puTemp
[
0
];
word
*
pTruth1
=
(
word
*
)
p
->
puTemp
[
1
];
word
*
pTruth
=
(
word
*
)
p
->
puTemp
[
2
];
assert
(
pCut0
->
iCutDsd
>=
0
);
assert
(
pCut1
->
iCutDsd
>=
0
);
assert
(
pCut0
->
uMaskFunc
>=
0
);
assert
(
pCut1
->
uMaskFunc
>=
0
);
Abc_TtCopy
(
pTruth0
,
pTruth0s
,
nWords
,
Abc_LitIsCompl
(
iCutFunc0
)
);
Abc_TtCopy
(
pTruth1
,
pTruth1s
,
nWords
,
Abc_LitIsCompl
(
iCutFunc1
)
);
Abc_TtStretch6
(
pTruth0
,
pCut0
->
nLeaves
,
pCut
->
nLeaves
);
...
...
@@ -233,12 +233,12 @@ if ( p->pPars->fVerbose )
p
->
timeCache
[
3
]
+=
Abc_Clock
()
-
clk
;
for
(
v
=
0
;
v
<
(
int
)
pCut
->
nLeaves
;
v
++
)
pPerm
[
v
]
=
Abc_LitNotCond
(
pCut
->
pLeaves
[(
int
)
p
->
pCanonPerm
[
v
]],
((
p
->
uCanonPhase
>>
v
)
&
1
)
);
pCut
->
iCutDsd
=
0
;
pCut
->
uMaskFunc
=
0
;
for
(
v
=
0
;
v
<
(
int
)
pCut
->
nLeaves
;
v
++
)
{
pCut
->
pLeaves
[
v
]
=
Abc_Lit2Var
(
pPerm
[
v
]);
if
(
Abc_LitIsCompl
(
pPerm
[
v
])
)
pCut
->
iCutDsd
|=
(
1
<<
v
);
pCut
->
uMaskFunc
|=
(
1
<<
v
);
}
// create signature after lowering literals
if
(
RetValue
)
...
...
@@ -295,12 +295,12 @@ p->timeCache[0] += Abc_Clock() - clk;
for
(
v
=
0
;
v
<
(
int
)
pCut
->
nLeaves
;
v
++
)
pPerm
[
v
]
=
Abc_LitNotCond
(
pCut
->
pLeaves
[
Abc_Lit2Var
((
int
)
pCanonPerm
[
v
])],
Abc_LitIsCompl
((
int
)
pCanonPerm
[
v
])
);
// generate the result
pCut
->
iCutDsd
=
0
;
pCut
->
uMaskFunc
=
0
;
for
(
v
=
0
;
v
<
(
int
)
pCut
->
nLeaves
;
v
++
)
{
pCut
->
pLeaves
[
v
]
=
Abc_Lit2Var
(
pPerm
[
v
]);
if
(
Abc_LitIsCompl
(
pPerm
[
v
])
)
pCut
->
iCutDsd
|=
(
1
<<
v
);
pCut
->
uMaskFunc
|=
(
1
<<
v
);
}
// printf( "Found: %d(%d) %d(%d) -> %d(%d)\n", iCutFunc0, pCut0->nLeaves, iCutFunc1, pCut0->nLeaves, pCut->iCutFunc, pCut->nLeaves );
p
->
nCacheHits
++
;
...
...
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