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
f0b67951
Commit
f0b67951
authored
Mar 30, 2014
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improving cut computation.
parent
473c5845
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
106 additions
and
13 deletions
+106
-13
src/base/abci/abcIf.c
+6
-1
src/map/if/ifCut.c
+2
-1
src/map/if/ifMap.c
+1
-1
src/map/if/ifTruth.c
+97
-10
No files found.
src/base/abci/abcIf.c
View file @
f0b67951
...
@@ -497,7 +497,12 @@ Abc_Obj_t * Abc_NodeFromIf_rec( Abc_Ntk_t * pNtkNew, If_Man_t * pIfMan, If_Obj_t
...
@@ -497,7 +497,12 @@ Abc_Obj_t * Abc_NodeFromIf_rec( Abc_Ntk_t * pNtkNew, If_Man_t * pIfMan, If_Obj_t
else
else
{
{
extern
Hop_Obj_t
*
Kit_TruthToHop
(
Hop_Man_t
*
pMan
,
unsigned
*
pTruth
,
int
nVars
,
Vec_Int_t
*
vMemory
);
extern
Hop_Obj_t
*
Kit_TruthToHop
(
Hop_Man_t
*
pMan
,
unsigned
*
pTruth
,
int
nVars
,
Vec_Int_t
*
vMemory
);
pNodeNew
->
pData
=
Kit_TruthToHop
(
(
Hop_Man_t
*
)
pNtkNew
->
pManFunc
,
If_CutTruth
(
pIfMan
,
pCutBest
),
If_CutLeaveNum
(
pCutBest
),
vCover
);
word
*
pTruth
=
If_CutTruthW
(
pIfMan
,
pCutBest
);
if
(
pIfMan
->
pPars
->
fUseTtPerm
)
for
(
i
=
0
;
i
<
(
int
)
pCutBest
->
nLeaves
;
i
++
)
if
(
(
pCutBest
->
iCutDsd
>>
i
)
&
1
)
Abc_TtFlip
(
pTruth
,
Abc_TtWordNum
(
pCutBest
->
nLimit
),
i
);
pNodeNew
->
pData
=
Kit_TruthToHop
(
(
Hop_Man_t
*
)
pNtkNew
->
pManFunc
,
(
unsigned
*
)
pTruth
,
If_CutLeaveNum
(
pCutBest
),
vCover
);
}
}
// complement the node if the cut was complemented
// complement the node if the cut was complemented
if
(
pCutBest
->
fCompl
)
if
(
pCutBest
->
fCompl
)
...
...
src/map/if/ifCut.c
View file @
f0b67951
...
@@ -68,6 +68,7 @@ int If_CutVerifyCuts( If_Set_t * pCutSet, int fOrdered )
...
@@ -68,6 +68,7 @@ int If_CutVerifyCuts( If_Set_t * pCutSet, int fOrdered )
for
(
i
=
0
;
i
<
pCutSet
->
nCuts
;
i
++
)
for
(
i
=
0
;
i
<
pCutSet
->
nCuts
;
i
++
)
{
{
pCut0
=
pCutSet
->
ppCuts
[
i
];
pCut0
=
pCutSet
->
ppCuts
[
i
];
assert
(
pCut0
->
uSign
==
If_ObjCutSignCompute
(
pCut0
)
);
if
(
fOrdered
)
if
(
fOrdered
)
{
{
// check duplicates
// check duplicates
...
@@ -862,7 +863,7 @@ void If_CutPrint( If_Cut_t * pCut )
...
@@ -862,7 +863,7 @@ void If_CutPrint( If_Cut_t * pCut )
unsigned
i
;
unsigned
i
;
Abc_Print
(
1
,
"{"
);
Abc_Print
(
1
,
"{"
);
for
(
i
=
0
;
i
<
pCut
->
nLeaves
;
i
++
)
for
(
i
=
0
;
i
<
pCut
->
nLeaves
;
i
++
)
Abc_Print
(
1
,
" %
d
"
,
pCut
->
pLeaves
[
i
]
);
Abc_Print
(
1
,
" %
s%d"
,
((
pCut
->
iCutDsd
>>
i
)
&
1
)
?
"!"
:
"
"
,
pCut
->
pLeaves
[
i
]
);
Abc_Print
(
1
,
" }
\n
"
);
Abc_Print
(
1
,
" }
\n
"
);
}
}
...
...
src/map/if/ifMap.c
View file @
f0b67951
...
@@ -218,7 +218,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
...
@@ -218,7 +218,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
pCut
->
fCompl
=
0
;
pCut
->
fCompl
=
0
;
pCut
->
iCutFunc
=
-
1
;
pCut
->
iCutFunc
=
-
1
;
pCut
->
iCutDsd
=
-
1
;
pCut
->
iCutDsd
=
-
1
;
if
(
p
->
pPars
->
fTruth
&&
!
p
->
pPars
->
fUseTtPerm
)
if
(
p
->
pPars
->
fTruth
)
//
&& !p->pPars->fUseTtPerm )
{
{
// abctime clk = Abc_Clock();
// abctime clk = Abc_Clock();
if
(
p
->
pPars
->
fUseTtPerm
)
if
(
p
->
pPars
->
fUseTtPerm
)
...
...
src/map/if/ifTruth.c
View file @
f0b67951
...
@@ -97,16 +97,14 @@ void If_CutRotatePins( If_Man_t * p, If_Cut_t * pCut )
...
@@ -97,16 +97,14 @@ void If_CutRotatePins( If_Man_t * p, If_Cut_t * pCut )
int
If_CutComputeTruth
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
,
If_Cut_t
*
pCut0
,
If_Cut_t
*
pCut1
,
int
fCompl0
,
int
fCompl1
)
int
If_CutComputeTruth
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
,
If_Cut_t
*
pCut0
,
If_Cut_t
*
pCut1
,
int
fCompl0
,
int
fCompl1
)
{
{
int
fCompl
,
truthId
,
nLeavesNew
,
RetValue
=
0
;
int
fCompl
,
truthId
,
nLeavesNew
,
RetValue
=
0
;
int
iFuncLit0
=
pCut0
->
iCutFunc
;
int
iFuncLit1
=
pCut1
->
iCutFunc
;
int
nWords
=
Abc_TtWordNum
(
pCut
->
nLimit
);
int
nWords
=
Abc_TtWordNum
(
pCut
->
nLimit
);
word
*
pTruth0s
=
Vec_MemReadEntry
(
p
->
vTtMem
,
Abc_Lit2Var
(
iFuncLit0
)
);
word
*
pTruth0s
=
Vec_MemReadEntry
(
p
->
vTtMem
,
Abc_Lit2Var
(
pCut0
->
iCutFunc
)
);
word
*
pTruth1s
=
Vec_MemReadEntry
(
p
->
vTtMem
,
Abc_Lit2Var
(
iFuncLit1
)
);
word
*
pTruth1s
=
Vec_MemReadEntry
(
p
->
vTtMem
,
Abc_Lit2Var
(
pCut1
->
iCutFunc
)
);
word
*
pTruth0
=
(
word
*
)
p
->
puTemp
[
0
];
word
*
pTruth0
=
(
word
*
)
p
->
puTemp
[
0
];
word
*
pTruth1
=
(
word
*
)
p
->
puTemp
[
1
];
word
*
pTruth1
=
(
word
*
)
p
->
puTemp
[
1
];
word
*
pTruth
=
(
word
*
)
p
->
puTemp
[
2
];
word
*
pTruth
=
(
word
*
)
p
->
puTemp
[
2
];
Abc_TtCopy
(
pTruth0
,
pTruth0s
,
nWords
,
fCompl0
^
pCut0
->
fCompl
^
Abc_LitIsCompl
(
iFuncLit0
)
);
Abc_TtCopy
(
pTruth0
,
pTruth0s
,
nWords
,
fCompl0
^
pCut0
->
fCompl
^
Abc_LitIsCompl
(
pCut0
->
iCutFunc
)
);
Abc_TtCopy
(
pTruth1
,
pTruth1s
,
nWords
,
fCompl1
^
pCut1
->
fCompl
^
Abc_LitIsCompl
(
iFuncLit1
)
);
Abc_TtCopy
(
pTruth1
,
pTruth1s
,
nWords
,
fCompl1
^
pCut1
->
fCompl
^
Abc_LitIsCompl
(
pCut1
->
iCutFunc
)
);
Abc_TtStretch
(
pTruth0
,
pCut
->
nLimit
,
pCut0
->
pLeaves
,
pCut0
->
nLeaves
,
pCut
->
pLeaves
,
pCut
->
nLeaves
);
Abc_TtStretch
(
pTruth0
,
pCut
->
nLimit
,
pCut0
->
pLeaves
,
pCut0
->
nLeaves
,
pCut
->
pLeaves
,
pCut
->
nLeaves
);
Abc_TtStretch
(
pTruth1
,
pCut
->
nLimit
,
pCut1
->
pLeaves
,
pCut1
->
nLeaves
,
pCut
->
pLeaves
,
pCut
->
nLeaves
);
Abc_TtStretch
(
pTruth1
,
pCut
->
nLimit
,
pCut1
->
pLeaves
,
pCut1
->
nLeaves
,
pCut
->
pLeaves
,
pCut
->
nLeaves
);
fCompl
=
(
pTruth0
[
0
]
&
pTruth1
[
0
]
&
1
);
fCompl
=
(
pTruth0
[
0
]
&
pTruth1
[
0
]
&
1
);
...
@@ -148,10 +146,99 @@ int If_CutComputeTruth( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_
...
@@ -148,10 +146,99 @@ int If_CutComputeTruth( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_
***********************************************************************/
***********************************************************************/
int
If_CutComputeTruthPerm
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
,
If_Cut_t
*
pCut0
,
If_Cut_t
*
pCut1
,
int
fCompl0
,
int
fCompl1
)
int
If_CutComputeTruthPerm
(
If_Man_t
*
p
,
If_Cut_t
*
pCut
,
If_Cut_t
*
pCut0
,
If_Cut_t
*
pCut1
,
int
fCompl0
,
int
fCompl1
)
{
{
int
i
;
int
fVerbose
=
0
;
for
(
i
=
0
;
i
<
(
int
)
pCut
->
nLeaves
;
i
++
)
int
pPerm
[
IF_MAX_LUTSIZE
];
pCut
->
pPerm
[
i
]
=
(
char
)
i
;
char
pCanonPerm
[
IF_MAX_LUTSIZE
];
return
0
;
int
v
,
Place
,
fCompl
,
truthId
,
nLeavesNew
,
uCanonPhase
,
RetValue
=
0
;
int
nWords
=
Abc_TtWordNum
(
pCut
->
nLimit
);
word
*
pTruth0s
=
Vec_MemReadEntry
(
p
->
vTtMem
,
Abc_Lit2Var
(
pCut0
->
iCutFunc
)
);
word
*
pTruth1s
=
Vec_MemReadEntry
(
p
->
vTtMem
,
Abc_Lit2Var
(
pCut1
->
iCutFunc
)
);
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
);
Abc_TtCopy
(
pTruth0
,
pTruth0s
,
nWords
,
fCompl0
^
pCut0
->
fCompl
^
Abc_LitIsCompl
(
pCut0
->
iCutFunc
)
);
Abc_TtCopy
(
pTruth1
,
pTruth1s
,
nWords
,
fCompl1
^
pCut1
->
fCompl
^
Abc_LitIsCompl
(
pCut1
->
iCutFunc
)
);
if
(
fVerbose
)
{
Kit_DsdPrintFromTruth
(
pTruth0
,
pCut0
->
nLeaves
);
printf
(
"
\n
"
);
Kit_DsdPrintFromTruth
(
pTruth1
,
pCut1
->
nLeaves
);
printf
(
"
\n
"
);
}
// create literals
for
(
v
=
0
;
v
<
(
int
)
pCut0
->
nLeaves
;
v
++
)
pCut
->
pLeaves
[
v
]
=
Abc_Var2Lit
(
pCut0
->
pLeaves
[
v
],
((
pCut0
->
iCutDsd
>>
v
)
&
1
)
);
for
(
v
=
0
;
v
<
(
int
)
pCut1
->
nLeaves
;
v
++
)
if
(
p
->
pPerm
[
1
][
v
]
>=
(
int
)
pCut0
->
nLeaves
)
pCut
->
pLeaves
[
p
->
pPerm
[
1
][
v
]]
=
Abc_Var2Lit
(
pCut1
->
pLeaves
[
v
],
((
pCut1
->
iCutDsd
>>
v
)
&
1
)
);
else
if
(
((
pCut0
->
iCutDsd
>>
p
->
pPerm
[
1
][
v
])
&
1
)
!=
((
pCut1
->
iCutDsd
>>
v
)
&
1
)
)
Abc_TtFlip
(
pTruth1
,
nWords
,
v
);
// permute variables
for
(
v
=
(
int
)
pCut1
->
nLeaves
;
v
<
(
int
)
pCut
->
nLeaves
;
v
++
)
p
->
pPerm
[
1
][
v
]
=
-
1
;
for
(
v
=
0
;
v
<
(
int
)
pCut1
->
nLeaves
;
v
++
)
{
Place
=
p
->
pPerm
[
1
][
v
];
if
(
Place
==
v
||
Place
==
-
1
)
continue
;
Abc_TtSwapVars
(
pTruth1
,
pCut
->
nLimit
,
v
,
Place
);
p
->
pPerm
[
1
][
v
]
=
p
->
pPerm
[
1
][
Place
];
p
->
pPerm
[
1
][
Place
]
=
Place
;
v
--
;
}
if
(
fVerbose
)
{
Kit_DsdPrintFromTruth
(
pTruth0
,
pCut0
->
nLeaves
);
printf
(
"
\n
"
);
Kit_DsdPrintFromTruth
(
pTruth1
,
pCut
->
nLeaves
);
printf
(
"
\n
"
);
}
// perform operation
Abc_TtAnd
(
pTruth
,
pTruth0
,
pTruth1
,
nWords
,
0
);
// minimize support
if
(
p
->
pPars
->
fCutMin
)
{
nLeavesNew
=
Abc_TtMinBase
(
pTruth
,
pCut
->
pLeaves
,
pCut
->
nLeaves
,
pCut
->
nLimit
);
if
(
nLeavesNew
<
If_CutLeaveNum
(
pCut
)
)
{
pCut
->
nLeaves
=
nLeavesNew
;
RetValue
=
1
;
}
}
// compute canonical form
uCanonPhase
=
Abc_TtCanonicize
(
pTruth
,
pCut
->
nLeaves
,
pCanonPerm
);
for
(
v
=
0
;
v
<
(
int
)
pCut
->
nLeaves
;
v
++
)
pPerm
[
v
]
=
Abc_LitNotCond
(
pCut
->
pLeaves
[(
int
)
pCanonPerm
[
v
]],
((
uCanonPhase
>>
v
)
&
1
)
);
pCut
->
iCutDsd
=
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
);
}
// create signature after lowering literals
if
(
RetValue
)
pCut
->
uSign
=
If_ObjCutSignCompute
(
pCut
);
else
assert
(
pCut
->
uSign
==
If_ObjCutSignCompute
(
pCut
)
);
// hash function
fCompl
=
((
uCanonPhase
>>
pCut
->
nLeaves
)
&
1
);
truthId
=
Vec_MemHashInsert
(
p
->
vTtMem
,
pTruth
);
pCut
->
iCutFunc
=
Abc_Var2Lit
(
truthId
,
fCompl
);
if
(
fVerbose
)
{
Kit_DsdPrintFromTruth
(
pTruth
,
pCut
->
nLeaves
);
printf
(
"
\n
"
);
If_CutPrint
(
pCut0
);
If_CutPrint
(
pCut1
);
If_CutPrint
(
pCut
);
printf
(
"%d
\n\n
"
,
pCut
->
iCutFunc
);
}
return
RetValue
;
}
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
...
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