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
b3e0f5b2
Commit
b3e0f5b2
authored
Jul 13, 2013
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New technology mapper.
parent
118e40b8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
176 additions
and
111 deletions
+176
-111
src/base/abci/abc.c
+8
-3
src/map/mpm/mpm.h
+1
-0
src/map/mpm/mpmAbc.c
+6
-2
src/map/mpm/mpmCore.c
+1
-0
src/map/mpm/mpmDsd.c
+0
-0
src/map/mpm/mpmInt.h
+28
-4
src/map/mpm/mpmMan.c
+21
-7
src/map/mpm/mpmMap.c
+44
-66
src/map/mpm/mpmPre.c
+52
-25
src/map/mpm/mpmTruth.c
+3
-1
src/misc/vec/vecHsh.h
+12
-3
No files found.
src/base/abci/abc.c
View file @
b3e0f5b2
...
@@ -29522,7 +29522,7 @@ int Abc_CommandAbc9If2( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -29522,7 +29522,7 @@ int Abc_CommandAbc9If2( Abc_Frame_t * pAbc, int argc, char ** argv )
// set defaults
// set defaults
Mpm_ManSetParsDefault
(
pPars
);
Mpm_ManSetParsDefault
(
pPars
);
Extra_UtilGetoptReset
();
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"KDtmzvh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"KDtmzv
w
h"
)
)
!=
EOF
)
{
{
switch
(
c
)
switch
(
c
)
{
{
...
@@ -29565,6 +29565,9 @@ int Abc_CommandAbc9If2( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -29565,6 +29565,9 @@ int Abc_CommandAbc9If2( Abc_Frame_t * pAbc, int argc, char ** argv )
case
'v'
:
case
'v'
:
pPars
->
fVerbose
^=
1
;
pPars
->
fVerbose
^=
1
;
break
;
break
;
case
'w'
:
pPars
->
fVeryVerbose
^=
1
;
break
;
case
'h'
:
case
'h'
:
default:
default:
goto
usage
;
goto
usage
;
...
@@ -29573,7 +29576,8 @@ int Abc_CommandAbc9If2( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -29573,7 +29576,8 @@ int Abc_CommandAbc9If2( Abc_Frame_t * pAbc, int argc, char ** argv )
if
(
pPars
->
pLib
==
NULL
)
if
(
pPars
->
pLib
==
NULL
)
pPars
->
pLib
=
Mpm_LibLutSetSimple
(
nLutSize
);
pPars
->
pLib
=
Mpm_LibLutSetSimple
(
nLutSize
);
if
(
pPars
->
fCutMin
)
if
(
pPars
->
fCutMin
)
pPars
->
fUseTruth
=
1
;
// pPars->fUseTruth = 1;
pPars
->
fUseDsd
=
1
;
// perform mapping
// perform mapping
pNew
=
Mpm_ManMappingTest
(
pAbc
->
pGia
,
pPars
);
pNew
=
Mpm_ManMappingTest
(
pAbc
->
pGia
,
pPars
);
Mpm_LibLutFree
(
pPars
->
pLib
);
Mpm_LibLutFree
(
pPars
->
pLib
);
...
@@ -29590,7 +29594,7 @@ usage:
...
@@ -29590,7 +29594,7 @@ usage:
sprintf
(
Buffer
,
"best possible"
);
sprintf
(
Buffer
,
"best possible"
);
else
else
sprintf
(
Buffer
,
"%d"
,
pPars
->
DelayTarget
);
sprintf
(
Buffer
,
"%d"
,
pPars
->
DelayTarget
);
Abc_Print
(
-
2
,
"usage: &if2 [-KD num] [-tmzvh]
\n
"
);
Abc_Print
(
-
2
,
"usage: &if2 [-KD num] [-tmzv
w
h]
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs technology mapping of the network
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs technology mapping of the network
\n
"
);
Abc_Print
(
-
2
,
"
\t
-K num : sets the LUT size for the mapping [default = %d]
\n
"
,
nLutSize
);
Abc_Print
(
-
2
,
"
\t
-K num : sets the LUT size for the mapping [default = %d]
\n
"
,
nLutSize
);
Abc_Print
(
-
2
,
"
\t
-D num : sets the delay constraint for the mapping [default = %s]
\n
"
,
Buffer
);
Abc_Print
(
-
2
,
"
\t
-D num : sets the delay constraint for the mapping [default = %s]
\n
"
,
Buffer
);
...
@@ -29598,6 +29602,7 @@ usage:
...
@@ -29598,6 +29602,7 @@ usage:
Abc_Print
(
-
2
,
"
\t
-m : enables cut minimization by removing vacuous variables [default = %s]
\n
"
,
pPars
->
fCutMin
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-m : enables cut minimization by removing vacuous variables [default = %s]
\n
"
,
pPars
->
fCutMin
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-z : toggles deriving LUTs when mapping into LUT structures [default = %s]
\n
"
,
pPars
->
fDeriveLuts
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-z : toggles deriving LUTs when mapping into LUT structures [default = %s]
\n
"
,
pPars
->
fDeriveLuts
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-v : toggles verbose output [default = %s]
\n
"
,
pPars
->
fVerbose
?
"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
"
);
Abc_Print
(
-
2
,
"
\t
-h : prints the command usage
\n
"
);
return
1
;
return
1
;
}
}
src/map/mpm/mpm.h
View file @
b3e0f5b2
...
@@ -65,6 +65,7 @@ struct Mpm_Par_t_
...
@@ -65,6 +65,7 @@ struct Mpm_Par_t_
int
fCutMin
;
int
fCutMin
;
int
fDeriveLuts
;
int
fDeriveLuts
;
int
fVerbose
;
int
fVerbose
;
int
fVeryVerbose
;
};
};
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
...
src/map/mpm/mpmAbc.c
View file @
b3e0f5b2
...
@@ -183,6 +183,7 @@ void * Mpm_ManFromIfLogic( Mpm_Man_t * pMan )
...
@@ -183,6 +183,7 @@ void * Mpm_ManFromIfLogic( Mpm_Man_t * pMan )
Mig_Obj_t
*
pObj
,
*
pFanin
;
Mig_Obj_t
*
pObj
,
*
pFanin
;
Vec_Int_t
*
vMapping
,
*
vMapping2
,
*
vPacking
=
NULL
;
Vec_Int_t
*
vMapping
,
*
vMapping2
,
*
vPacking
=
NULL
;
Vec_Int_t
*
vLeaves
,
*
vLeaves2
,
*
vCover
;
Vec_Int_t
*
vLeaves
,
*
vLeaves2
,
*
vCover
;
word
uTruth
,
*
pTruth
=
&
uTruth
;
int
i
,
k
,
Entry
,
iLitNew
;
int
i
,
k
,
Entry
,
iLitNew
;
// assert( !pMan->pPars->fDeriveLuts || pMan->pPars->fTruth );
// assert( !pMan->pPars->fDeriveLuts || pMan->pPars->fTruth );
// start mapping and packing
// start mapping and packing
...
@@ -211,11 +212,14 @@ void * Mpm_ManFromIfLogic( Mpm_Man_t * pMan )
...
@@ -211,11 +212,14 @@ void * Mpm_ManFromIfLogic( Mpm_Man_t * pMan )
pCutBest
=
Mpm_ObjCutBestP
(
pMan
,
pObj
);
pCutBest
=
Mpm_ObjCutBestP
(
pMan
,
pObj
);
Mpm_CutForEachLeaf
(
pMan
->
pMig
,
pCutBest
,
pFanin
,
k
)
Mpm_CutForEachLeaf
(
pMan
->
pMig
,
pCutBest
,
pFanin
,
k
)
Vec_IntPush
(
vLeaves
,
Mig_ObjCopy
(
pFanin
)
);
Vec_IntPush
(
vLeaves
,
Mig_ObjCopy
(
pFanin
)
);
if
(
pMan
->
pPars
->
fDeriveLuts
&&
pMan
->
pPars
->
fUseTruth
)
if
(
pMan
->
pPars
->
fDeriveLuts
&&
(
pMan
->
pPars
->
fUseTruth
||
pMan
->
pPars
->
fUseDsd
)
)
{
{
extern
int
Gia_ManFromIfLogicNode
(
Gia_Man_t
*
pNew
,
int
iObj
,
Vec_Int_t
*
vLeaves
,
Vec_Int_t
*
vLeavesTemp
,
extern
int
Gia_ManFromIfLogicNode
(
Gia_Man_t
*
pNew
,
int
iObj
,
Vec_Int_t
*
vLeaves
,
Vec_Int_t
*
vLeavesTemp
,
word
*
pRes
,
char
*
pStr
,
Vec_Int_t
*
vCover
,
Vec_Int_t
*
vMapping
,
Vec_Int_t
*
vMapping2
,
Vec_Int_t
*
vPacking
);
word
*
pRes
,
char
*
pStr
,
Vec_Int_t
*
vCover
,
Vec_Int_t
*
vMapping
,
Vec_Int_t
*
vMapping2
,
Vec_Int_t
*
vPacking
);
word
*
pTruth
=
Mpm_CutTruth
(
pMan
,
Abc_Lit2Var
(
pCutBest
->
iFunc
));
if
(
pMan
->
pPars
->
fUseTruth
)
pTruth
=
Mpm_CutTruth
(
pMan
,
Abc_Lit2Var
(
pCutBest
->
iFunc
));
else
uTruth
=
Mpm_CutTruthFromDsd
(
pMan
,
pCutBest
,
Abc_Lit2Var
(
pCutBest
->
iFunc
)
);
// Kit_DsdPrintFromTruth( pTruth, Vec_IntSize(vLeaves) ); printf( "\n" );
// Kit_DsdPrintFromTruth( pTruth, Vec_IntSize(vLeaves) ); printf( "\n" );
// perform decomposition of the cut
// perform decomposition of the cut
iLitNew
=
Gia_ManFromIfLogicNode
(
pNew
,
Mig_ObjId
(
pObj
),
vLeaves
,
vLeaves2
,
pTruth
,
NULL
,
vCover
,
vMapping
,
vMapping2
,
vPacking
);
iLitNew
=
Gia_ManFromIfLogicNode
(
pNew
,
Mig_ObjId
(
pObj
),
vLeaves
,
vLeaves2
,
pTruth
,
NULL
,
vCover
,
vMapping
,
vMapping2
,
vPacking
);
...
...
src/map/mpm/mpmCore.c
View file @
b3e0f5b2
...
@@ -54,6 +54,7 @@ void Mpm_ManSetParsDefault( Mpm_Par_t * p )
...
@@ -54,6 +54,7 @@ void Mpm_ManSetParsDefault( Mpm_Par_t * p )
p
->
DelayTarget
=
-
1
;
// delay target
p
->
DelayTarget
=
-
1
;
// delay target
p
->
fDeriveLuts
=
0
;
// use truth tables to derive AIG structure
p
->
fDeriveLuts
=
0
;
// use truth tables to derive AIG structure
p
->
fVerbose
=
0
;
// verbose output
p
->
fVerbose
=
0
;
// verbose output
p
->
fVeryVerbose
=
0
;
// verbose output
}
}
/**Function*************************************************************
/**Function*************************************************************
...
...
src/map/mpm/mpmDsd.c
View file @
b3e0f5b2
This diff is collapsed.
Click to expand it.
src/map/mpm/mpmInt.h
View file @
b3e0f5b2
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
//#include "misc/tim/tim.h"
//#include "misc/tim/tim.h"
#include "misc/vec/vec.h"
#include "misc/vec/vec.h"
#include "misc/vec/vecMem.h"
#include "misc/vec/vecMem.h"
#include "misc/vec/vecHsh.h"
#include "misc/mem/mem2.h"
#include "misc/mem/mem2.h"
#include "mpmMig.h"
#include "mpmMig.h"
#include "mpm.h"
#include "mpm.h"
...
@@ -78,6 +79,14 @@ struct Mpm_Uni_t_
...
@@ -78,6 +79,14 @@ struct Mpm_Uni_t_
int
Data
[
MPM_VAR_MAX
];
// padding
int
Data
[
MPM_VAR_MAX
];
// padding
};
};
typedef
struct
Mpm_Dsd_t_
Mpm_Dsd_t
;
struct
Mpm_Dsd_t_
{
int
nVars
;
// support size
word
uTruth
;
// truth table
char
*
pStr
;
// description
};
typedef
struct
Mpm_Man_t_
Mpm_Man_t
;
typedef
struct
Mpm_Man_t_
Mpm_Man_t
;
struct
Mpm_Man_t_
struct
Mpm_Man_t_
{
{
...
@@ -111,14 +120,19 @@ struct Mpm_Man_t_
...
@@ -111,14 +120,19 @@ struct Mpm_Man_t_
int
nCuts
[
3
];
// fanin cut counts
int
nCuts
[
3
];
// fanin cut counts
Mpm_Cut_t
*
pCuts
[
3
][
MPM_CUT_MAX
+
1
];
// fanin cuts
Mpm_Cut_t
*
pCuts
[
3
][
MPM_CUT_MAX
+
1
];
// fanin cuts
word
pSigns
[
3
][
MPM_CUT_MAX
+
1
];
// fanin cut signatures
word
pSigns
[
3
][
MPM_CUT_MAX
+
1
];
// fanin cut signatures
// functionality
// truth tables
// Dsd_Man_t * pManDsd;
void
*
pManDsd
;
int
pPerm
[
MPM_VAR_MAX
];
Vec_Mem_t
*
vTtMem
;
// truth table memory and hash table
Vec_Mem_t
*
vTtMem
;
// truth table memory and hash table
int
funcCst0
;
// constant 0
int
funcCst0
;
// constant 0
int
funcVar0
;
// variable 0
int
funcVar0
;
// variable 0
// DSD
Mpm_Dsd_t
*
pDsd6
;
// NPN class information
Hsh_IntMan_t
*
pHash
;
// maps DSD functions into NPN classes
Vec_Int_t
*
vConfgRes
;
// configurations
Vec_Wrd_t
*
vPerm6
;
// permutations of DSD classes
char
Perm6
[
720
][
6
];
// permutations
Vec_Int_t
*
vMap2Perm
;
// maps number into its permutation
unsigned
uPermMask
[
3
];
unsigned
uPermMask
[
3
];
unsigned
uComplMask
[
3
];
// mapping attributes
// mapping attributes
Vec_Int_t
vCutBests
;
// cut best
Vec_Int_t
vCutBests
;
// cut best
Vec_Int_t
vCutLists
;
// cut list
Vec_Int_t
vCutLists
;
// cut list
...
@@ -129,8 +143,11 @@ struct Mpm_Man_t_
...
@@ -129,8 +143,11 @@ struct Mpm_Man_t_
Vec_Int_t
vTimes
;
// arrival time
Vec_Int_t
vTimes
;
// arrival time
Vec_Int_t
vAreas
;
// area
Vec_Int_t
vAreas
;
// area
Vec_Int_t
vEdges
;
// edge
Vec_Int_t
vEdges
;
// edge
int
nCountDsd
[
600
];
int
nNonDsd
;
// statistics
// statistics
int
nCutsMerged
;
int
nCutsMerged
;
int
nCutsMergedAll
;
int
nSmallSupp
;
int
nSmallSupp
;
abctime
timeFanin
;
abctime
timeFanin
;
abctime
timeDerive
;
abctime
timeDerive
;
...
@@ -212,15 +229,22 @@ extern void Mpm_ManStop( Mpm_Man_t * p );
...
@@ -212,15 +229,22 @@ extern void Mpm_ManStop( Mpm_Man_t * p );
extern
void
Mpm_ManPrintStatsInit
(
Mpm_Man_t
*
p
);
extern
void
Mpm_ManPrintStatsInit
(
Mpm_Man_t
*
p
);
extern
void
Mpm_ManPrintStats
(
Mpm_Man_t
*
p
);
extern
void
Mpm_ManPrintStats
(
Mpm_Man_t
*
p
);
/*=== mpmDsd.c ===========================================================*/
/*=== mpmDsd.c ===========================================================*/
extern
void
Mpm_ManPrintDsdStats
(
Mpm_Man_t
*
p
);
extern
void
Mpm_ManPrintPerm
(
unsigned
s
);
extern
void
Mpm_ManPrecomputePerms
(
Mpm_Man_t
*
p
);
extern
word
Mpm_CutTruthFromDsd
(
Mpm_Man_t
*
pMan
,
Mpm_Cut_t
*
pCut
,
int
iDsdLit
);
extern
int
Mpm_CutComputeDsd6
(
Mpm_Man_t
*
p
,
Mpm_Cut_t
*
pCut
,
Mpm_Cut_t
*
pCut0
,
Mpm_Cut_t
*
pCut1
,
Mpm_Cut_t
*
pCutC
,
int
fCompl0
,
int
fCompl1
,
int
fComplC
,
int
Type
);
/*=== mpmLib.c ===========================================================*/
/*=== mpmLib.c ===========================================================*/
extern
Mpm_LibLut_t
*
Mpm_LibLutSetSimple
(
int
nLutSize
);
extern
Mpm_LibLut_t
*
Mpm_LibLutSetSimple
(
int
nLutSize
);
extern
void
Mpm_LibLutFree
(
Mpm_LibLut_t
*
pLib
);
extern
void
Mpm_LibLutFree
(
Mpm_LibLut_t
*
pLib
);
/*=== mpmMap.c ===========================================================*/
/*=== mpmMap.c ===========================================================*/
extern
void
Mpm_CutPrint
(
Mpm_Cut_t
*
pCut
);
extern
void
Mpm_ManPrepare
(
Mpm_Man_t
*
p
);
extern
void
Mpm_ManPrepare
(
Mpm_Man_t
*
p
);
extern
void
Mpm_ManPerform
(
Mpm_Man_t
*
p
);
extern
void
Mpm_ManPerform
(
Mpm_Man_t
*
p
);
/*=== mpmTruth.c ===========================================================*/
/*=== mpmTruth.c ===========================================================*/
extern
int
Mpm_CutComputeTruth6
(
Mpm_Man_t
*
p
,
Mpm_Cut_t
*
pCut
,
Mpm_Cut_t
*
pCut0
,
Mpm_Cut_t
*
pCut1
,
Mpm_Cut_t
*
pCutC
,
int
fCompl0
,
int
fCompl1
,
int
fComplC
,
int
Type
);
extern
int
Mpm_CutComputeTruth6
(
Mpm_Man_t
*
p
,
Mpm_Cut_t
*
pCut
,
Mpm_Cut_t
*
pCut0
,
Mpm_Cut_t
*
pCut1
,
Mpm_Cut_t
*
pCutC
,
int
fCompl0
,
int
fCompl1
,
int
fComplC
,
int
Type
);
extern
void
Kit_DsdPrintFromTruth
(
unsigned
*
pTruth
,
int
nVars
);
ABC_NAMESPACE_HEADER_END
ABC_NAMESPACE_HEADER_END
...
...
src/map/mpm/mpmMan.c
View file @
b3e0f5b2
...
@@ -57,7 +57,6 @@ Mpm_Man_t * Mpm_ManStart( Mig_Man_t * pMig, Mpm_Par_t * pPars )
...
@@ -57,7 +57,6 @@ Mpm_Man_t * Mpm_ManStart( Mig_Man_t * pMig, Mpm_Par_t * pPars )
p
->
nLutSize
=
pPars
->
pLib
->
LutMax
;
p
->
nLutSize
=
pPars
->
pLib
->
LutMax
;
p
->
nTruWords
=
pPars
->
fUseTruth
?
Abc_Truth6WordNum
(
p
->
nLutSize
)
:
0
;
p
->
nTruWords
=
pPars
->
fUseTruth
?
Abc_Truth6WordNum
(
p
->
nLutSize
)
:
0
;
p
->
nNumCuts
=
pPars
->
nNumCuts
;
p
->
nNumCuts
=
pPars
->
nNumCuts
;
p
->
timeTotal
=
Abc_Clock
();
// cuts
// cuts
assert
(
Mpm_CutWordNum
(
32
)
<
32
);
// using 5 bits for word count
assert
(
Mpm_CutWordNum
(
32
)
<
32
);
// using 5 bits for word count
p
->
pManCuts
=
Mmr_StepStart
(
13
,
Abc_Base2Log
(
Mpm_CutWordNum
(
p
->
nLutSize
)
+
1
)
);
p
->
pManCuts
=
Mmr_StepStart
(
13
,
Abc_Base2Log
(
Mpm_CutWordNum
(
p
->
nLutSize
)
+
1
)
);
...
@@ -79,10 +78,9 @@ Mpm_Man_t * Mpm_ManStart( Mig_Man_t * pMig, Mpm_Par_t * pPars )
...
@@ -79,10 +78,9 @@ Mpm_Man_t * Mpm_ManStart( Mig_Man_t * pMig, Mpm_Par_t * pPars )
Vec_IntFill
(
&
p
->
vAreas
,
Mig_ManObjNum
(
pMig
),
0
);
Vec_IntFill
(
&
p
->
vAreas
,
Mig_ManObjNum
(
pMig
),
0
);
Vec_IntFill
(
&
p
->
vEdges
,
Mig_ManObjNum
(
pMig
),
0
);
Vec_IntFill
(
&
p
->
vEdges
,
Mig_ManObjNum
(
pMig
),
0
);
// start DSD manager
// start DSD manager
p
->
pManDsd
=
NULL
;
assert
(
!
p
->
pPars
->
fUseTruth
||
!
p
->
pPars
->
fUseDsd
);
pMig
->
pMan
=
p
;
if
(
p
->
pPars
->
fUseTruth
)
if
(
p
->
pPars
->
fUseTruth
)
{
{
word
Truth
=
0
;
word
Truth
=
0
;
p
->
vTtMem
=
Vec_MemAlloc
(
p
->
nTruWords
,
12
);
// 32 KB/page for 6-var functions
p
->
vTtMem
=
Vec_MemAlloc
(
p
->
nTruWords
,
12
);
// 32 KB/page for 6-var functions
Vec_MemHashAlloc
(
p
->
vTtMem
,
10000
);
Vec_MemHashAlloc
(
p
->
vTtMem
,
10000
);
...
@@ -90,8 +88,14 @@ Mpm_Man_t * Mpm_ManStart( Mig_Man_t * pMig, Mpm_Par_t * pPars )
...
@@ -90,8 +88,14 @@ Mpm_Man_t * Mpm_ManStart( Mig_Man_t * pMig, Mpm_Par_t * pPars )
Truth
=
ABC_CONST
(
0xAAAAAAAAAAAAAAAA
);
Truth
=
ABC_CONST
(
0xAAAAAAAAAAAAAAAA
);
p
->
funcVar0
=
Vec_MemHashInsert
(
p
->
vTtMem
,
&
Truth
);
p
->
funcVar0
=
Vec_MemHashInsert
(
p
->
vTtMem
,
&
Truth
);
}
}
else
else
if
(
p
->
pPars
->
fUseDsd
)
{
Mpm_ManPrecomputePerms
(
p
);
p
->
funcVar0
=
1
;
p
->
funcVar0
=
1
;
}
// finish
p
->
timeTotal
=
Abc_Clock
();
pMig
->
pMan
=
p
;
return
p
;
return
p
;
}
}
...
@@ -108,11 +112,21 @@ Mpm_Man_t * Mpm_ManStart( Mig_Man_t * pMig, Mpm_Par_t * pPars )
...
@@ -108,11 +112,21 @@ Mpm_Man_t * Mpm_ManStart( Mig_Man_t * pMig, Mpm_Par_t * pPars )
***********************************************************************/
***********************************************************************/
void
Mpm_ManStop
(
Mpm_Man_t
*
p
)
void
Mpm_ManStop
(
Mpm_Man_t
*
p
)
{
{
if
(
p
->
pPars
->
fUseDsd
)
Mpm_ManPrintDsdStats
(
p
);
if
(
p
->
vTtMem
)
if
(
p
->
vTtMem
)
{
{
Vec_MemHashFree
(
p
->
vTtMem
);
Vec_MemHashFree
(
p
->
vTtMem
);
Vec_MemFree
(
p
->
vTtMem
);
Vec_MemFree
(
p
->
vTtMem
);
}
}
if
(
p
->
pHash
)
{
Vec_WrdFree
(
p
->
vPerm6
);
Vec_IntFree
(
p
->
vMap2Perm
);
Vec_IntFree
(
p
->
vConfgRes
);
Vec_IntFree
(
p
->
pHash
->
vData
);
Hsh_IntManStop
(
p
->
pHash
);
}
Vec_PtrFree
(
p
->
vTemp
);
Vec_PtrFree
(
p
->
vTemp
);
Mmr_StepStop
(
p
->
pManCuts
);
Mmr_StepStop
(
p
->
pManCuts
);
ABC_FREE
(
p
->
vObjPresUsed
.
pArray
);
ABC_FREE
(
p
->
vObjPresUsed
.
pArray
);
...
@@ -145,11 +159,11 @@ void Mpm_ManStop( Mpm_Man_t * p )
...
@@ -145,11 +159,11 @@ void Mpm_ManStop( Mpm_Man_t * p )
***********************************************************************/
***********************************************************************/
void
Mpm_ManPrintStatsInit
(
Mpm_Man_t
*
p
)
void
Mpm_ManPrintStatsInit
(
Mpm_Man_t
*
p
)
{
{
printf
(
"K = %d. C = %d. Cand
s = %d. XOR = %d. MUX = %d. Choices = %d. CutMin = %d. Truth
= %d.
\n
"
,
printf
(
"K = %d. C = %d. Cand
= %d. XOR = %d. MUX = %d. Choice = %d. CutMin = %d. Truth = %d. DSD
= %d.
\n
"
,
p
->
nLutSize
,
p
->
nNumCuts
,
p
->
nLutSize
,
p
->
nNumCuts
,
Mig_ManCiNum
(
p
->
pMig
)
+
Mig_ManNodeNum
(
p
->
pMig
),
Mig_ManCiNum
(
p
->
pMig
)
+
Mig_ManNodeNum
(
p
->
pMig
),
Mig_ManXorNum
(
p
->
pMig
),
Mig_ManMuxNum
(
p
->
pMig
),
0
,
Mig_ManXorNum
(
p
->
pMig
),
Mig_ManMuxNum
(
p
->
pMig
),
0
,
p
->
pPars
->
fCutMin
,
p
->
pPars
->
fUseTruth
);
p
->
pPars
->
fCutMin
,
p
->
pPars
->
fUseTruth
,
p
->
pPars
->
fUseDsd
);
}
}
void
Mpm_ManPrintStats
(
Mpm_Man_t
*
p
)
void
Mpm_ManPrintStats
(
Mpm_Man_t
*
p
)
{
{
...
...
src/map/mpm/mpmMap.c
View file @
b3e0f5b2
...
@@ -31,63 +31,6 @@ ABC_NAMESPACE_IMPL_START
...
@@ -31,63 +31,6 @@ ABC_NAMESPACE_IMPL_START
/// FUNCTION DEFINITIONS ///
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/*
// check special cases
if ( fUseFunc )
{
pCut0 = p->pCuts[0][0]; pCut1 = p->pCuts[1][0];
if ( pCut0->iFunc < 2 || pCut1->iFunc < 2 )
{
assert( Mig_ObjIsAnd(pObj) );
if ( Abc_LitNotCond(pCut0->iFunc, Mig_ObjFaninC0(pObj)) == 0 ||
Abc_LitNotCond(pCut1->iFunc, Mig_ObjFaninC1(pObj)) == 0 ) // set the resulting cut to 0
Mig_ManObj(p, pObj)->hCutList = Mpm_CutCreateZero( p, pObj );
else if ( Abc_LitNotCond(pCut0->iFunc, Mig_ObjFaninC0(pObj)) == 1 ) // set the resulting set to be that of Fanin1
Mig_ManObj(p, pObj)->hCutList = Mpm_CutCopySet( p, Mig_ObjFanin1(pObj), 0 );
else if ( Abc_LitNotCond(pCut1->iFunc, Mig_ObjFaninC1(pObj)) == 1 ) // set the resulting set to be that of Fanin0
Mig_ManObj(p, pObj)->hCutList = Mpm_CutCopySet( p, Mig_ObjFanin0(pObj), 0 );
else assert( 0 );
goto finish;
}
}
// compute cut function
if ( fUseFunc )
{
extern int Mpm_FuncCompute( void * p, int iDsd0, int iDsd1, Vec_Str_t * vShared, int * pPerm, int * pnLeaves );
int nLeavesOld = p->pCutTemp->nLeaves;
int nLeaves = p->pCutTemp->nLeaves;
iDsd0 = Abc_LitNotCond( pCut0->iFunc, Mig_ObjFaninC0(pObj) );
iDsd1 = Abc_LitNotCond( pCut1->iFunc, Mig_ObjFaninC1(pObj) );
if ( iDsd0 > iDsd1 )
{
ABC_SWAP( int, iDsd0, iDsd1 );
ABC_SWAP( Mpm_Cut_t *, pCut0, pCut1 );
}
// compute functionality and filter cuts dominated by support-reduced cuts
p->pCutTemp->iFunc = Mpm_FuncCompute( p->pManDsd, iDsd0, iDsd1, &p->vObjShared, p->pPerm, &nLeaves );
Mpm_ObjUpdateCut( p->pCutTemp, p->pPerm, nLeaves );
// consider filtering based on functionality
if ( nLeaves == 0 ) // derived const cut
{
Mig_ManObj(p, pObj)->hCutList = Mpm_CutCreateZero( p, pObj );
goto finish;
}
if ( nLeaves == 1 ) // derived unit cut
{
pFanin = Mig_ManObj( p->pMig, Abc_Lit2Var(p->pCutTemp->pLeaves[0]) );
Mig_ManObj(p, pObj)->hCutList = Mpm_CutCopySet( p, pFanin, Abc_LitIsCompl(p->pCutTemp->pLeaves[0]) );
goto finish;
}
if ( nLeaves < nLeavesOld ) // reduced support of the cut
{
ArrTime = Mpm_CutGetArrTime( p, p->pCutTemp );
if ( ArrTime > pMapObj->mRequired )
continue;
}
}
*/
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Cut manipulation.]
Synopsis [Cut manipulation.]
...
@@ -170,7 +113,7 @@ static inline void Mpm_CutDeref( Mpm_Man_t * p, int * pLeaves, int nLeaves )
...
@@ -170,7 +113,7 @@ static inline void Mpm_CutDeref( Mpm_Man_t * p, int * pLeaves, int nLeaves )
Mig_ManObj( p->pMig, Abc_Lit2Var(pLeaves[i]) )->nMapRefs--;
Mig_ManObj( p->pMig, Abc_Lit2Var(pLeaves[i]) )->nMapRefs--;
}
}
*/
*/
static
inline
void
Mpm_CutPrint
(
Mpm_Cut_t
*
pCut
)
void
Mpm_CutPrint
(
Mpm_Cut_t
*
pCut
)
{
{
int
i
;
int
i
;
printf
(
"%d : { "
,
pCut
->
nLeaves
);
printf
(
"%d : { "
,
pCut
->
nLeaves
);
...
@@ -509,6 +452,14 @@ static inline int Mpm_ObjDeriveCut( Mpm_Man_t * p, Mpm_Cut_t ** pCuts, Mpm_Cut_t
...
@@ -509,6 +452,14 @@ static inline int Mpm_ObjDeriveCut( Mpm_Man_t * p, Mpm_Cut_t ** pCuts, Mpm_Cut_t
p
->
pObjPres
[
p
->
vObjPresUsed
.
pArray
[
i
]]
=
(
unsigned
char
)
0xFF
;
p
->
pObjPres
[
p
->
vObjPresUsed
.
pArray
[
i
]]
=
(
unsigned
char
)
0xFF
;
Vec_IntClear
(
&
p
->
vObjPresUsed
);
Vec_IntClear
(
&
p
->
vObjPresUsed
);
Vec_StrClear
(
&
p
->
vObjShared
);
Vec_StrClear
(
&
p
->
vObjShared
);
/*
if ( pCuts[0]->nLeaves == 5 && pCuts[1]->nLeaves == 5 )
{
int s = 0;
Mpm_CutPrint( pCuts[0] );
Mpm_CutPrint( pCuts[1] );
}
*/
// check present objects
// check present objects
// for ( i = 0; i < Mig_ManObjNum(p->pMig); i++ )
// for ( i = 0; i < Mig_ManObjNum(p->pMig); i++ )
// assert( p->pObjPres[i] == (unsigned char)0xFF );
// assert( p->pObjPres[i] == (unsigned char)0xFF );
...
@@ -524,23 +475,32 @@ static inline int Mpm_ObjDeriveCut( Mpm_Man_t * p, Mpm_Cut_t ** pCuts, Mpm_Cut_t
...
@@ -524,23 +475,32 @@ static inline int Mpm_ObjDeriveCut( Mpm_Man_t * p, Mpm_Cut_t ** pCuts, Mpm_Cut_t
// remaining cuts
// remaining cuts
for
(
c
=
1
;
pCuts
[
c
]
&&
c
<
3
;
c
++
)
for
(
c
=
1
;
pCuts
[
c
]
&&
c
<
3
;
c
++
)
{
{
p
->
uPermMask
[
c
]
=
0x3FFFF
;
// 18 bits
p
->
uComplMask
[
c
]
=
0
;
for
(
i
=
0
;
i
<
(
int
)
pCuts
[
c
]
->
nLeaves
;
i
++
)
for
(
i
=
0
;
i
<
(
int
)
pCuts
[
c
]
->
nLeaves
;
i
++
)
{
{
iObj
=
Abc_Lit2Var
(
pCuts
[
c
]
->
pLeaves
[
i
]);
iObj
=
Abc_Lit2Var
(
pCuts
[
c
]
->
pLeaves
[
i
]);
if
(
p
->
pObjPres
[
iObj
]
!=
(
unsigned
char
)
0xFF
)
if
(
p
->
pObjPres
[
iObj
]
==
(
unsigned
char
)
0xFF
)
continue
;
{
if
(
(
int
)
pCut
->
nLeaves
==
p
->
nLutSize
)
if
(
(
int
)
pCut
->
nLeaves
==
p
->
nLutSize
)
return
0
;
return
0
;
Vec_IntPush
(
&
p
->
vObjPresUsed
,
iObj
);
Vec_IntPush
(
&
p
->
vObjPresUsed
,
iObj
);
p
->
pObjPres
[
iObj
]
=
pCut
->
nLeaves
;
p
->
pObjPres
[
iObj
]
=
pCut
->
nLeaves
;
pCut
->
pLeaves
[
pCut
->
nLeaves
++
]
=
pCuts
[
c
]
->
pLeaves
[
i
];
pCut
->
pLeaves
[
pCut
->
nLeaves
++
]
=
pCuts
[
c
]
->
pLeaves
[
i
];
}
p
->
uPermMask
[
c
]
^=
(((
i
&
7
)
^
7
)
<<
(
3
*
p
->
pObjPres
[
iObj
]));
assert
(
Abc_Lit2Var
(
pCuts
[
c
]
->
pLeaves
[
i
])
==
Abc_Lit2Var
(
pCut
->
pLeaves
[
p
->
pObjPres
[
iObj
]])
);
if
(
pCuts
[
c
]
->
pLeaves
[
i
]
!=
pCut
->
pLeaves
[
p
->
pObjPres
[
iObj
]]
)
p
->
uComplMask
[
c
]
|=
(
1
<<
p
->
pObjPres
[
iObj
]);
}
}
// Mpm_ManPrintPerm( p->uPermMask[c] ); printf( "\n" );
}
}
pCut
->
hNext
=
0
;
pCut
->
hNext
=
0
;
pCut
->
iFunc
=
0
;
pCut
->
iFunc
=
~
pCut
->
iFunc
;
pCut
->
iFunc
=
0
;
pCut
->
iFunc
=
~
pCut
->
iFunc
;
pCut
->
fUseless
=
0
;
pCut
->
fUseless
=
0
;
pCut
->
fCompl
=
0
;
pCut
->
fCompl
=
0
;
p
->
nCutsMerged
++
;
p
->
nCutsMerged
++
;
p
->
nCutsMergedAll
++
;
if
(
p
->
pPars
->
fUseTruth
)
if
(
p
->
pPars
->
fUseTruth
)
Vec_IntSelectSort
(
pCut
->
pLeaves
,
pCut
->
nLeaves
);
Vec_IntSelectSort
(
pCut
->
pLeaves
,
pCut
->
nLeaves
);
return
1
;
return
1
;
...
@@ -566,6 +526,11 @@ p->timeMerge += clock() - clk;
...
@@ -566,6 +526,11 @@ p->timeMerge += clock() - clk;
// derive truth table
// derive truth table
if
(
p
->
pPars
->
fUseTruth
)
if
(
p
->
pPars
->
fUseTruth
)
Mpm_CutComputeTruth6
(
p
,
pCut
,
pCuts
[
0
],
pCuts
[
1
],
pCuts
[
2
],
Mig_ObjFaninC0
(
pObj
),
Mig_ObjFaninC1
(
pObj
),
Mig_ObjFaninC2
(
pObj
),
Mig_ObjNodeType
(
pObj
)
);
Mpm_CutComputeTruth6
(
p
,
pCut
,
pCuts
[
0
],
pCuts
[
1
],
pCuts
[
2
],
Mig_ObjFaninC0
(
pObj
),
Mig_ObjFaninC1
(
pObj
),
Mig_ObjFaninC2
(
pObj
),
Mig_ObjNodeType
(
pObj
)
);
else
if
(
p
->
pPars
->
fUseDsd
)
{
if
(
!
Mpm_CutComputeDsd6
(
p
,
pCut
,
pCuts
[
0
],
pCuts
[
1
],
pCuts
[
2
],
Mig_ObjFaninC0
(
pObj
),
Mig_ObjFaninC1
(
pObj
),
Mig_ObjFaninC2
(
pObj
),
Mig_ObjNodeType
(
pObj
)
)
)
return
1
;
}
#ifdef MIG_RUNTIME
#ifdef MIG_RUNTIME
p
->
timeMerge
+=
clock
()
-
clk
;
p
->
timeMerge
+=
clock
()
-
clk
;
...
@@ -587,8 +552,21 @@ clk = Abc_Clock();
...
@@ -587,8 +552,21 @@ clk = Abc_Clock();
p
->
timeStore
+=
Abc_Clock
()
-
clk
;
p
->
timeStore
+=
Abc_Clock
()
-
clk
;
#endif
#endif
return
1
;
// return 0 if const or buffer cut is derived - reset all cuts to contain only one
// return 0 if const or buffer cut is derived - reset all cuts to contain only one
// if ( pCut->nLeaves < 2 && p->nCutStore == 1 )
// return 0;
/*
if ( pCut->nLeaves < 2 )
{
int i;
assert( p->nCutStore >= 1 );
for ( i = 1; i < p->nCutStore; i++ )
Vec_PtrPush( &p->vFreeUnits, p->pCutStore[i] );
p->nCutStore = 1;
return 0;
}
*/
return
1
;
}
}
int
Mpm_ManDeriveCuts
(
Mpm_Man_t
*
p
,
Mig_Obj_t
*
pObj
)
int
Mpm_ManDeriveCuts
(
Mpm_Man_t
*
p
,
Mig_Obj_t
*
pObj
)
{
{
...
...
src/map/mpm/mpmPre.c
View file @
b3e0f5b2
...
@@ -172,19 +172,32 @@ void Ifd_ObjPrint( Ifd_Man_t * p, int iLit )
...
@@ -172,19 +172,32 @@ void Ifd_ObjPrint( Ifd_Man_t * p, int iLit )
{
{
int
Counter
=
0
;
int
Counter
=
0
;
if
(
iLit
==
0
)
if
(
iLit
==
0
)
{
printf
(
"0
\n
"
);
return
;
}
{
printf
(
"0"
);
return
;
}
if
(
iLit
==
1
)
if
(
iLit
==
1
)
{
printf
(
"1
\n
"
);
return
;
}
{
printf
(
"1"
);
return
;
}
Ifd_ObjPrint_rec
(
p
,
iLit
,
&
Counter
,
1
);
Ifd_ObjPrint_rec
(
p
,
iLit
,
&
Counter
,
1
);
printf
(
"
\n
"
);
}
}
void
Ifd_ManPrint
(
Ifd_Man_t
*
p
)
void
Ifd_ManPrint
2
(
Ifd_Man_t
*
p
)
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
p
->
nObjs
;
i
++
)
for
(
i
=
0
;
i
<
p
->
nObjs
;
i
++
)
{
{
printf
(
"%4d : "
,
i
);
printf
(
"%4d : "
,
i
);
Ifd_ObjPrint
(
p
,
Abc_Var2Lit
(
i
,
0
)
);
Ifd_ObjPrint
(
p
,
Abc_Var2Lit
(
i
,
0
)
);
printf
(
"
\n
"
);
}
}
void
Ifd_ManPrint
(
Ifd_Man_t
*
p
)
{
int
i
;
for
(
i
=
0
;
i
<
p
->
nObjs
;
i
++
)
{
word
Fun
=
Vec_WrdEntry
(
p
->
vTruths
,
i
);
printf
(
" { %d, ABC_CONST("
,
Extra_TruthSupportSize
((
unsigned
*
)
&
Fun
,
6
)
);
Extra_PrintHex
(
stdout
,
(
unsigned
*
)
&
Fun
,
6
);
printf
(
"),
\"
"
);
Ifd_ObjPrint
(
p
,
Abc_Var2Lit
(
i
,
0
)
);
printf
(
"
\"
}, // %4d
\n
"
,
i
);
}
}
}
}
...
@@ -532,6 +545,7 @@ void Ifd_ManDsdTest2()
...
@@ -532,6 +545,7 @@ void Ifd_ManDsdTest2()
int
iLit
=
Ifd_ManFindDsd
(
pMan
,
p
);
int
iLit
=
Ifd_ManFindDsd
(
pMan
,
p
);
Ifd_ObjPrint
(
pMan
,
iLit
);
Ifd_ObjPrint
(
pMan
,
iLit
);
Ifd_ManStop
(
pMan
);
Ifd_ManStop
(
pMan
);
printf
(
"
\n
"
);
}
}
/**Function*************************************************************
/**Function*************************************************************
...
@@ -600,8 +614,8 @@ Vec_Wrd_t * Ifd_ManDsdTruths( int nVars )
...
@@ -600,8 +614,8 @@ Vec_Wrd_t * Ifd_ManDsdTruths( int nVars )
// bookmark
// bookmark
Vec_IntPush
(
pMan
->
vMarks
,
pMan
->
nObjs
);
Vec_IntPush
(
pMan
->
vMarks
,
pMan
->
nObjs
);
}
}
// Ifd_ManPrint( pMan );
Ifd_ManTruthAll
(
pMan
);
Ifd_ManTruthAll
(
pMan
);
// Ifd_ManPrint( pMan );
vTruths
=
pMan
->
vTruths
;
pMan
->
vTruths
=
NULL
;
vTruths
=
pMan
->
vTruths
;
pMan
->
vTruths
=
NULL
;
Ifd_ManStop
(
pMan
);
Ifd_ManStop
(
pMan
);
return
vTruths
;
return
vTruths
;
...
@@ -753,25 +767,26 @@ Vec_Wrd_t * Extra_Truth6AllConfigs( word t, int * pComp, int * pPerm, int nVars
...
@@ -753,25 +767,26 @@ Vec_Wrd_t * Extra_Truth6AllConfigs( word t, int * pComp, int * pPerm, int nVars
int
nPerms
=
Extra_Factorial
(
nVars
);
int
nPerms
=
Extra_Factorial
(
nVars
);
int
nSwaps
=
(
1
<<
nVars
);
int
nSwaps
=
(
1
<<
nVars
);
Vec_Wrd_t
*
vTruths
=
Vec_WrdStart
(
nPerms
*
nSwaps
);
Vec_Wrd_t
*
vTruths
=
Vec_WrdStart
(
nPerms
*
nSwaps
);
word
tCur
,
tTemp1
,
tTemp2
;
word
tCur
=
t
,
tTemp1
,
tTemp2
;
int
i
,
p
,
c
;
int
p
,
c
,
Config
;
for
(
i
=
1
;
i
<
2
;
i
++
)
tTemp1
=
tCur
;
for
(
p
=
0
;
p
<
nPerms
;
p
++
)
{
{
tCur
=
i
?
~
t
:
t
;
tCur
=
Extra_Truth6SwapAdjacent
(
tCur
,
pPerm
[
p
]
);
tTemp1
=
tCur
;
Config
=
0
;
for
(
p
=
0
;
p
<
nPerms
;
p
++
)
tTemp2
=
tCur
;
for
(
c
=
0
;
c
<
nSwaps
;
c
++
)
{
{
tTemp2
=
tCur
;
Vec_WrdWriteEntry
(
vTruths
,
(
p
<<
nVars
)
|
Config
,
tCur
);
for
(
c
=
0
;
c
<
nSwaps
;
c
++
)
tCur
=
Extra_Truth6ChangePhase
(
tCur
,
pComp
[
c
]
);
{
Config
^=
(
1
<<
pComp
[
c
]);
Vec_WrdWriteEntry
(
vTruths
,
(
p
<<
(
nVars
))
|
c
,
tCur
);
tCur
=
Extra_Truth6ChangePhase
(
tCur
,
pComp
[
c
]
);
}
assert
(
tTemp2
==
tCur
);
tCur
=
Extra_Truth6SwapAdjacent
(
tCur
,
pPerm
[
p
]
);
}
}
assert
(
tTemp1
==
tCur
);
assert
(
Config
==
0
);
assert
(
tTemp2
==
tCur
);
}
}
assert
(
tTemp1
==
tCur
);
if
(
t
)
if
(
t
)
{
{
int
i
;
int
i
;
...
@@ -793,7 +808,7 @@ Vec_Wrd_t * Extra_Truth6AllConfigs( word t, int * pComp, int * pPerm, int nVars
...
@@ -793,7 +808,7 @@ Vec_Wrd_t * Extra_Truth6AllConfigs( word t, int * pComp, int * pPerm, int nVars
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
int
Ifd_ManDsdTest
33
()
int
Ifd_ManDsdTest
()
{
{
int
nVars
=
6
;
int
nVars
=
6
;
FILE
*
pFile
;
FILE
*
pFile
;
...
@@ -801,6 +816,7 @@ int Ifd_ManDsdTest33()
...
@@ -801,6 +816,7 @@ int Ifd_ManDsdTest33()
Vec_Wrd_t
*
vTruths
=
Ifd_ManDsdTruths
(
nVars
);
Vec_Wrd_t
*
vTruths
=
Ifd_ManDsdTruths
(
nVars
);
Vec_Wrd_t
*
vVariants
;
Vec_Wrd_t
*
vVariants
;
Vec_Int_t
*
vUniques
;
Vec_Int_t
*
vUniques
;
Vec_Int_t
*
vCompls
;
Vec_Wrd_t
*
vTruthRes
=
Vec_WrdAlloc
(
4000000
);
Vec_Wrd_t
*
vTruthRes
=
Vec_WrdAlloc
(
4000000
);
Vec_Int_t
*
vConfgRes
=
Vec_IntAlloc
(
4000000
);
Vec_Int_t
*
vConfgRes
=
Vec_IntAlloc
(
4000000
);
int
*
pComp
,
*
pPerm
;
int
*
pComp
,
*
pPerm
;
...
@@ -808,19 +824,29 @@ int Ifd_ManDsdTest33()
...
@@ -808,19 +824,29 @@ int Ifd_ManDsdTest33()
int
i
,
k
,
Uniq
,
Runner
,
Counter
=
0
;
int
i
,
k
,
Uniq
,
Runner
,
Counter
=
0
;
assert
(
nVars
>=
3
&&
nVars
<=
6
);
assert
(
nVars
>=
3
&&
nVars
<=
6
);
assert
(
Vec_WrdSize
(
vTruths
)
<
(
1
<<
10
)
);
assert
(
Vec_WrdSize
(
vTruths
)
<
(
1
<<
10
)
);
vCompls
=
Vec_IntAlloc
(
720
*
64
);
pComp
=
Extra_GreyCodeSchedule
(
nVars
);
pComp
=
Extra_GreyCodeSchedule
(
nVars
);
pPerm
=
Extra_PermSchedule
(
nVars
);
pPerm
=
Extra_PermSchedule
(
nVars
);
Vec_WrdForEachEntry
(
vTruths
,
Truth
,
i
)
Vec_WrdForEachEntry
(
vTruths
,
Truth
,
i
)
{
{
vVariants
=
Extra_Truth6AllConfigs
(
Truth
,
pComp
,
pPerm
,
nVars
);
vVariants
=
Extra_Truth6AllConfigs
(
Truth
,
pComp
,
pPerm
,
nVars
);
// save compl bits
Vec_IntClear
(
vCompls
);
Vec_WrdForEachEntry
(
vVariants
,
Variant
,
k
)
{
Vec_IntPush
(
vCompls
,
(
int
)(
Variant
&
1
)
);
Vec_WrdWriteEntry
(
vVariants
,
k
,
Variant
&
1
?
~
Variant
:
Variant
);
}
// uniqify
vUniques
=
Hsh_WrdManHashArray
(
vVariants
,
1
);
vUniques
=
Hsh_WrdManHashArray
(
vVariants
,
1
);
Runner
=
0
;
Runner
=
0
;
Vec_IntForEachEntry
(
vUniques
,
Uniq
,
k
)
Vec_IntForEachEntry
(
vUniques
,
Uniq
,
k
)
if
(
Runner
==
Uniq
)
if
(
Runner
==
Uniq
)
{
{
Variant
=
Vec_WrdEntry
(
vVariants
,
k
);
Variant
=
Vec_WrdEntry
(
vVariants
,
k
);
assert
(
(
Variant
&
1
)
==
0
);
Vec_WrdPush
(
vTruthRes
,
Variant
);
Vec_WrdPush
(
vTruthRes
,
Variant
);
Vec_IntPush
(
vConfgRes
,
(
Extra_TruthSupportSize
((
unsigned
*
)
&
Variant
,
6
)
<<
26
)
|
(
i
<<
16
)
|
k
);
Vec_IntPush
(
vConfgRes
,
(
i
<<
17
)
|
(
Vec_IntEntry
(
vCompls
,
k
)
<<
16
)
|
k
);
Runner
++
;
Runner
++
;
}
}
Vec_IntUniqify
(
vUniques
);
Vec_IntUniqify
(
vUniques
);
...
@@ -829,7 +855,8 @@ int Ifd_ManDsdTest33()
...
@@ -829,7 +855,8 @@ int Ifd_ManDsdTest33()
//printf( "%5d : ", i ); Kit_DsdPrintFromTruth( &Truth, nVars ), printf( " " ), Vec_IntPrint( vUniques ), printf( "\n" );
//printf( "%5d : ", i ); Kit_DsdPrintFromTruth( &Truth, nVars ), printf( " " ), Vec_IntPrint( vUniques ), printf( "\n" );
Vec_IntFree
(
vUniques
);
Vec_IntFree
(
vUniques
);
Vec_WrdFree
(
vVariants
);
Vec_WrdFree
(
vVariants
);
}
}
Vec_IntFree
(
vCompls
);
Vec_WrdFree
(
vTruths
);
Vec_WrdFree
(
vTruths
);
ABC_FREE
(
pPerm
);
ABC_FREE
(
pPerm
);
ABC_FREE
(
pComp
);
ABC_FREE
(
pComp
);
...
@@ -847,12 +874,12 @@ int Ifd_ManDsdTest33()
...
@@ -847,12 +874,12 @@ int Ifd_ManDsdTest33()
return
1
;
return
1
;
}
}
int
Ifd_ManDsdTest
()
int
Ifd_ManDsdTest
33
()
{
{
abctime
clk
=
Abc_Clock
();
abctime
clk
=
Abc_Clock
();
FILE
*
pFile
;
FILE
*
pFile
;
char
*
pFileName
=
"dsdfuncs6.dat"
;
char
*
pFileName
=
"dsdfuncs6.dat"
;
int
RetValue
,
size
=
Extra_FileSize
(
pFileName
)
/
12
;
//
3504275
int
RetValue
,
size
=
Extra_FileSize
(
pFileName
)
/
12
;
//
2866420
Vec_Wrd_t
*
vTruthRes
=
Vec_WrdAlloc
(
size
+
1
);
Vec_Wrd_t
*
vTruthRes
=
Vec_WrdAlloc
(
size
+
1
);
Vec_Int_t
*
vConfgRes
=
Vec_IntAlloc
(
size
);
Vec_Int_t
*
vConfgRes
=
Vec_IntAlloc
(
size
);
Hsh_IntMan_t
*
pHash
;
Hsh_IntMan_t
*
pHash
;
...
...
src/map/mpm/mpmTruth.c
View file @
b3e0f5b2
...
@@ -94,6 +94,7 @@ static inline word Mpm_TruthStretch6( word Truth, Mpm_Cut_t * pCut, Mpm_Cut_t *
...
@@ -94,6 +94,7 @@ static inline word Mpm_TruthStretch6( word Truth, Mpm_Cut_t * pCut, Mpm_Cut_t *
}
}
return
Truth
;
return
Truth
;
}
}
//#define MPM_TRY_NEW
int
Mpm_CutComputeTruth6
(
Mpm_Man_t
*
p
,
Mpm_Cut_t
*
pCut
,
Mpm_Cut_t
*
pCut0
,
Mpm_Cut_t
*
pCut1
,
Mpm_Cut_t
*
pCutC
,
int
fCompl0
,
int
fCompl1
,
int
fComplC
,
int
Type
)
int
Mpm_CutComputeTruth6
(
Mpm_Man_t
*
p
,
Mpm_Cut_t
*
pCut
,
Mpm_Cut_t
*
pCut0
,
Mpm_Cut_t
*
pCut1
,
Mpm_Cut_t
*
pCutC
,
int
fCompl0
,
int
fCompl1
,
int
fComplC
,
int
Type
)
{
{
word
*
pTruth0
=
Mpm_CutTruth
(
p
,
Abc_Lit2Var
(
pCut0
->
iFunc
)
);
word
*
pTruth0
=
Mpm_CutTruth
(
p
,
Abc_Lit2Var
(
pCut0
->
iFunc
)
);
...
@@ -129,9 +130,10 @@ int Mpm_CutComputeTruth6( Mpm_Man_t * p, Mpm_Cut_t * pCut, Mpm_Cut_t * pCut0, Mp
...
@@ -129,9 +130,10 @@ int Mpm_CutComputeTruth6( Mpm_Man_t * p, Mpm_Cut_t * pCut, Mpm_Cut_t * pCut0, Mp
#ifdef MPM_TRY_NEW
#ifdef MPM_TRY_NEW
{
{
extern
unsigned
Abc_TtCanonicize
(
word
*
pTruth
,
int
nVars
,
char
*
pCanonPerm
);
word
tCopy
=
t
;
word
tCopy
=
t
;
char
pCanonPerm
[
16
];
char
pCanonPerm
[
16
];
Abc_TtCanonicize
(
&
tCopy
,
p
Cut
->
nLimit
,
pCanonPerm
);
Abc_TtCanonicize
(
&
tCopy
,
p
->
nLutSize
,
pCanonPerm
);
}
}
#endif
#endif
...
...
src/misc/vec/vecHsh.h
View file @
b3e0f5b2
...
@@ -210,9 +210,18 @@ static inline Vec_Int_t * Hsh_WrdManHashArray( Vec_Wrd_t * vDataW, int nSize )
...
@@ -210,9 +210,18 @@ static inline Vec_Int_t * Hsh_WrdManHashArray( Vec_Wrd_t * vDataW, int nSize )
static
inline
Hsh_IntMan_t
*
Hsh_WrdManHashArrayStart
(
Vec_Wrd_t
*
vDataW
,
int
nSize
)
static
inline
Hsh_IntMan_t
*
Hsh_WrdManHashArrayStart
(
Vec_Wrd_t
*
vDataW
,
int
nSize
)
{
{
Hsh_IntMan_t
*
p
;
Hsh_IntMan_t
*
p
;
Vec_Int_t
Data
=
{
2
*
Vec_WrdCap
(
vDataW
),
2
*
Vec_WrdSize
(
vDataW
),
(
int
*
)
Vec_WrdArray
(
vDataW
)
};
int
i
,
nEntries
=
Vec_WrdSize
(
vDataW
)
/
nSize
;
Vec_Int_t
*
vData
=
&
Data
;
Vec_Int_t
*
vData
=
Vec_IntAlloc
(
2
*
Vec_WrdSize
(
vDataW
)
);
int
i
,
nEntries
=
Vec_IntSize
(
vData
)
/
(
2
*
nSize
);
memcpy
(
Vec_IntArray
(
vData
),
Vec_WrdArray
(
vDataW
),
sizeof
(
word
)
*
Vec_WrdSize
(
vDataW
)
);
vData
->
nSize
=
2
*
Vec_WrdSize
(
vDataW
);
/*
for ( i = 0; i < 30; i++ )
{
extern void Extra_PrintHex( FILE * pFile, unsigned * pTruth, int nVars );
Extra_PrintHex( stdout, (unsigned *) Vec_WrdEntryP(vDataW, i), 6 ); printf( " " );
Kit_DsdPrintFromTruth( (unsigned *) Vec_WrdEntryP(vDataW, i), 6 ); printf( "\n" );
}
*/
assert
(
Vec_IntSize
(
vData
)
%
(
2
*
nSize
)
==
0
);
assert
(
Vec_IntSize
(
vData
)
%
(
2
*
nSize
)
==
0
);
p
=
Hsh_IntManStart
(
vData
,
(
2
*
nSize
),
nEntries
);
p
=
Hsh_IntManStart
(
vData
,
(
2
*
nSize
),
nEntries
);
for
(
i
=
0
;
i
<
nEntries
;
i
++
)
for
(
i
=
0
;
i
<
nEntries
;
i
++
)
...
...
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