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
caa2227b
Commit
caa2227b
authored
Feb 25, 2014
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes to LUT mappers.
parent
15a1c4b9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
65 additions
and
26 deletions
+65
-26
src/base/abci/abc.c
+2
-2
src/base/abci/abcDec.c
+6
-3
src/map/if/if.h
+6
-4
src/map/if/ifDsd.c
+0
-0
src/map/if/ifMan.c
+9
-3
src/map/if/ifMap.c
+20
-2
src/opt/dau/dau.h
+5
-0
src/opt/dau/dauNonDsd.c
+17
-12
No files found.
src/base/abci/abc.c
View file @
caa2227b
...
...
@@ -2201,7 +2201,7 @@ int Abc_CommandPrintDsd( Abc_Frame_t * pAbc, int argc, char ** argv )
extern
void
Kit_DsdTest
(
unsigned
*
pTruth
,
int
nVars
);
extern
void
Kit_DsdPrintCofactors
(
unsigned
*
pTruth
,
int
nVars
,
int
nCofLevel
,
int
fVerbose
);
extern
void
Dau_DecTrySets
(
word
*
p
,
int
nVars
);
extern
void
Dau_DecTrySets
(
word
*
p
,
int
nVars
,
int
fVerbose
);
// set defaults
nCofLevel
=
1
;
...
...
@@ -2274,7 +2274,7 @@ int Abc_CommandPrintDsd( Abc_Frame_t * pAbc, int argc, char ** argv )
// Extra_PrintBinary( stdout, pTruth, 1 << Abc_ObjFaninNum(pObj) );
// Abc_Print( -1, "\n" );
if
(
fPrintDec
)
//&&Abc_ObjFaninNum(pObj) <= 6 )
Dau_DecTrySets
(
(
word
*
)
pTruth
,
Abc_ObjFaninNum
(
pObj
)
);
Dau_DecTrySets
(
(
word
*
)
pTruth
,
Abc_ObjFaninNum
(
pObj
)
,
1
);
if
(
fProfile
)
Kit_TruthPrintProfile
(
pTruth
,
Abc_ObjFaninNum
(
pObj
)
);
else
if
(
fCofactor
)
src/base/abci/abcDec.c
View file @
caa2227b
...
...
@@ -25,6 +25,7 @@
#include "bool/dec/dec.h"
#include "bool/kit/kit.h"
#include "opt/dau/dau.h"
#include "misc/util/utilTruth.h"
ABC_NAMESPACE_IMPL_START
...
...
@@ -564,11 +565,13 @@ void Abc_TruthDecPerform( Abc_TtStore_t * p, int DecType, int fVerbose )
{
for
(
i
=
0
;
i
<
p
->
nFuncs
;
i
++
)
{
extern
void
Dau_DecTrySets
(
word
*
pInit
,
int
nVars
);
extern
void
Dau_DecTrySets
(
word
*
pInit
,
int
nVars
,
int
fVerbose
);
int
nSuppSize
=
Abc_TtSupportSize
(
p
->
pFuncs
[
i
],
p
->
nVars
);
if
(
fVerbose
)
printf
(
"%7d : "
,
i
);
Dau_DecTrySets
(
p
->
pFuncs
[
i
],
p
->
nVars
);
printf
(
"
\n
"
);
Dau_DecTrySets
(
p
->
pFuncs
[
i
],
nSuppSize
,
fVerbose
);
if
(
fVerbose
)
printf
(
"
\n
"
);
}
}
else
assert
(
0
);
...
...
src/map/if/if.h
View file @
caa2227b
...
...
@@ -35,9 +35,9 @@
#include "misc/mem/mem.h"
#include "misc/tim/tim.h"
#include "misc/util/utilNam.h"
#include "opt/dau/dau.h"
#include "misc/vec/vecMem.h"
#include "misc/util/utilTruth.h"
#include "opt/dau/dau.h"
ABC_NAMESPACE_HEADER_START
...
...
@@ -153,8 +153,8 @@ struct If_Par_t_
float
*
pTimesArr
;
// arrival times
float
*
pTimesReq
;
// required times
int
(
*
pFuncCost
)
(
If_Man_t
*
,
If_Cut_t
*
);
// procedure to compute the user's cost of a cut
int
(
*
pFuncUser
)
(
If_Man_t
*
,
If_Obj_t
*
,
If_Cut_t
*
);
// procedure called for each cut when cut computation is finished
int
(
*
pFuncCell
)
(
If_Man_t
*
,
unsigned
*
,
int
,
int
,
char
*
);
// procedure called for cut functions
int
(
*
pFuncUser
)
(
If_Man_t
*
,
If_Obj_t
*
,
If_Cut_t
*
);
// procedure called for each cut when cut computation is finished
int
(
*
pFuncCell
)
(
If_Man_t
*
,
unsigned
*
,
int
,
int
,
char
*
);
// procedure called for cut functions
void
*
pReoMan
;
// reordering manager
};
...
...
@@ -233,6 +233,7 @@ struct If_Man_t_
int
nCuts5
,
nCuts5a
;
If_DsdMan_t
*
pIfDsdMan
;
Vec_Mem_t
*
vTtMem
;
// truth table memory and hash table
Vec_Int_t
*
vDsds
;
// mapping of truth table into DSD
int
nBestCutSmall
[
2
];
// timing manager
...
...
@@ -518,7 +519,8 @@ extern If_DsdMan_t * If_DsdManAlloc( int nLutSize );
extern
void
If_DsdManDump
(
If_DsdMan_t
*
p
);
extern
void
If_DsdManPrint
(
If_DsdMan_t
*
p
,
char
*
pFileName
,
int
fVerbose
);
extern
void
If_DsdManFree
(
If_DsdMan_t
*
p
);
extern
int
If_DsdManCompute
(
If_DsdMan_t
*
p
,
word
*
pTruth
,
int
nLeaves
,
unsigned
char
*
pPerm
);
extern
int
If_DsdManCompute
(
If_DsdMan_t
*
p
,
word
*
pTruth
,
int
nLeaves
,
unsigned
char
*
pPerm
,
char
*
pLutStruct
);
extern
int
If_DsdManCheckDec
(
If_DsdMan_t
*
pIfMan
,
int
iDsd
);
/*=== ifLib.c =============================================================*/
extern
If_LibLut_t
*
If_LibLutRead
(
char
*
FileName
);
extern
If_LibLut_t
*
If_LibLutDup
(
If_LibLut_t
*
p
);
...
...
src/map/if/ifDsd.c
View file @
caa2227b
This diff is collapsed.
Click to expand it.
src/map/if/ifMan.c
View file @
caa2227b
...
...
@@ -84,7 +84,12 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
p
->
puTemp
[
3
]
=
p
->
puTemp
[
2
]
+
p
->
nTruth6Words
*
2
;
p
->
puTempW
=
p
->
pPars
->
fTruth
?
ABC_ALLOC
(
word
,
p
->
nTruth6Words
)
:
NULL
;
if
(
pPars
->
fUseDsd
)
{
p
->
pIfDsdMan
=
If_DsdManAlloc
(
pPars
->
nLutSize
);
p
->
vDsds
=
Vec_IntAlloc
(
1000
);
Vec_IntPush
(
p
->
vDsds
,
0
);
Vec_IntPush
(
p
->
vDsds
,
2
);
}
// create the constant node
p
->
pConst1
=
If_ManSetupObj
(
p
);
p
->
pConst1
->
Type
=
IF_CONST1
;
...
...
@@ -165,9 +170,10 @@ void If_ManStop( If_Man_t * p )
Vec_WrdFreeP
(
&
p
->
vAnds
);
Vec_WrdFreeP
(
&
p
->
vAndGate
);
Vec_WrdFreeP
(
&
p
->
vOrGate
);
if
(
p
->
vObjsRev
)
Vec_PtrFree
(
p
->
vObjsRev
);
if
(
p
->
vLatchOrder
)
Vec_PtrFree
(
p
->
vLatchOrder
);
if
(
p
->
vLags
)
Vec_IntFree
(
p
->
vLags
);
Vec_PtrFreeP
(
&
p
->
vObjsRev
);
Vec_PtrFreeP
(
&
p
->
vLatchOrder
);
Vec_IntFreeP
(
&
p
->
vLags
);
Vec_IntFreeP
(
&
p
->
vDsds
);
Vec_MemHashFree
(
p
->
vTtMem
);
Vec_MemFreeP
(
&
p
->
vTtMem
);
Mem_FixedStop
(
p
->
pMemObj
,
0
);
...
...
src/map/if/ifMap.c
View file @
caa2227b
...
...
@@ -217,6 +217,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
// abctime clk = Abc_Clock();
If_CutComputeTruth
(
p
,
pCut
,
pCut0
,
pCut1
,
pObj
->
fCompl0
,
pObj
->
fCompl1
);
// p->timeTruth += Abc_Clock() - clk;
// run user functions
pCut
->
fUseless
=
0
;
if
(
p
->
pPars
->
pFuncCell
)
{
...
...
@@ -250,9 +251,26 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
p
->
nCuts5a
++
;
}
}
if
(
p
->
pPars
->
fUseDsd
)
{
int
truthId
=
Abc_Lit2Var
(
pCut
->
iCutFunc
);
if
(
Vec_IntSize
(
p
->
vDsds
)
<=
truthId
||
Vec_IntEntry
(
p
->
vDsds
,
truthId
)
==
-
1
)
{
pCut
->
iCutDsd
=
If_DsdManCompute
(
p
->
pIfDsdMan
,
If_CutTruthW
(
p
,
pCut
),
pCut
->
nLeaves
,
(
unsigned
char
*
)
pCut
->
pPerm
,
p
->
pPars
->
pLutStruct
);
while
(
Vec_IntSize
(
p
->
vDsds
)
<=
truthId
)
Vec_IntPush
(
p
->
vDsds
,
-
1
);
Vec_IntWriteEntry
(
p
->
vDsds
,
truthId
,
Abc_LitNotCond
(
pCut
->
iCutDsd
,
Abc_LitIsCompl
(
pCut
->
iCutFunc
))
);
}
else
pCut
->
iCutDsd
=
Abc_LitNotCond
(
Vec_IntEntry
(
p
->
vDsds
,
truthId
),
Abc_LitIsCompl
(
pCut
->
iCutFunc
)
);
if
(
p
->
pPars
->
pLutStruct
)
{
int
Value
=
If_DsdManCheckDec
(
p
->
pIfDsdMan
,
pCut
->
iCutDsd
);
if
(
Value
!=
(
int
)
pCut
->
fUseless
)
printf
(
"Difference
\n
"
);
}
}
}
if
(
p
->
pPars
->
fUseDsd
&&
Abc_Lit2Var
(
pCut
->
iCutFunc
)
==
Vec_MemEntryNum
(
p
->
vTtMem
)
-
1
)
pCut
->
iCutDsd
=
If_DsdManCompute
(
p
->
pIfDsdMan
,
If_CutTruthW
(
p
,
pCut
),
pCut
->
nLeaves
,
(
unsigned
char
*
)
pCut
->
pPerm
);
// compute the application-specific cost and depth
pCut
->
fUser
=
(
p
->
pPars
->
pFuncCost
!=
NULL
);
...
...
src/opt/dau/dau.h
View file @
caa2227b
...
...
@@ -97,6 +97,11 @@ extern void * Dsm_ManDeriveGia( void * p, int fUseMuxes );
extern
void
Dau_DsdRemoveBraces
(
char
*
pDsd
,
int
*
pMatches
);
extern
char
*
Dau_DsdMerge
(
char
*
pDsd0i
,
int
*
pPerm0
,
char
*
pDsd1i
,
int
*
pPerm1
,
int
fCompl0
,
int
fCompl1
,
int
nVars
);
/*=== dauNonDsd.c ==========================================================*/
extern
Vec_Int_t
*
Dau_DecFindSets
(
word
*
pInit
,
int
nVars
);
extern
void
Dau_DecPrintSets
(
Vec_Int_t
*
vSets
,
int
nVars
);
extern
void
Dau_DecPrintSet
(
unsigned
set
,
int
nVars
,
int
fNewLine
);
/*=== dauTree.c ==========================================================*/
extern
Dss_Man_t
*
Dss_ManAlloc
(
int
nVars
,
int
nNonDecLimit
);
extern
void
Dss_ManFree
(
Dss_Man_t
*
p
);
...
...
src/opt/dau/dauNonDsd.c
View file @
caa2227b
...
...
@@ -459,7 +459,7 @@ void Dau_DecMoveFreeToLSB( word * p, int nVars, int * V2P, int * P2V, int maskB,
Abc_TtMoveVar
(
p
,
nVars
,
V2P
,
P2V
,
v
,
c
++
);
assert
(
c
==
nVars
-
sizeB
);
}
Vec_Int_t
*
Dau_DecFindSets
(
word
*
p
,
int
nVars
)
Vec_Int_t
*
Dau_DecFindSets
(
word
*
p
Init
,
int
nVars
)
{
Vec_Int_t
*
vSets
=
Vec_IntAlloc
(
32
);
int
V2P
[
16
],
P2V
[
16
],
pVarsB
[
16
];
...
...
@@ -467,6 +467,8 @@ Vec_Int_t * Dau_DecFindSets( word * p, int nVars )
int
c
,
v
,
sizeB
,
sizeS
,
maskB
,
maskS
;
int
*
pSched
[
16
]
=
{
NULL
};
unsigned
setMixed
;
word
p
[
1
<<
10
];
memcpy
(
p
,
pInit
,
sizeof
(
word
)
*
Abc_TtWordNum
(
nVars
)
);
for
(
v
=
0
;
v
<
nVars
;
v
++
)
assert
(
Abc_TtHasVar
(
p
,
nVars
,
v
)
);
for
(
v
=
2
;
v
<
nVars
;
v
++
)
...
...
@@ -703,7 +705,7 @@ int Dau_DecVerify( word * pInit, int nVars, char * pDsdC, char * pDsdD )
printf
(
"
\n
"
);
return
1
;
}
int
Dau_DecPerform
(
word
*
p
,
int
nVars
,
unsigned
uSet
)
int
Dau_DecPerform
6
(
word
*
p
,
int
nVars
,
unsigned
uSet
)
{
word
tComp
=
0
,
tDec
=
0
,
tDec0
,
tComp0
,
tComp1
,
FuncC
,
FuncD
;
char
pDsdC
[
1000
],
pDsdD
[
1000
];
...
...
@@ -760,7 +762,7 @@ int Dau_DecPerform( word * p, int nVars, unsigned uSet )
return
1
;
}
int
Dau_DecPerform
2
(
word
*
pInit
,
int
nVars
,
unsigned
uSet
)
int
Dau_DecPerform
(
word
*
pInit
,
int
nVars
,
unsigned
uSet
)
{
word
p
[
1
<<
10
],
pDec
[
1
<<
10
],
pComp
[
1
<<
10
];
// at most 2^10 words
char
pDsdC
[
5000
],
pDsdD
[
5000
];
// at most 2^12 hex digits
...
...
@@ -820,15 +822,18 @@ int Dau_DecPerform2( word * pInit, int nVars, unsigned uSet )
Dau_DecVerify
(
pInit
,
nVars
,
pDsdC
,
pDsdD
);
return
1
;
}
void
Dau_DecTrySets
(
word
*
pInit
,
int
nVars
)
void
Dau_DecTrySets
(
word
*
pInit
,
int
nVars
,
int
fVerbose
)
{
word
p
[
1
<<
10
];
Vec_Int_t
*
vSets
;
int
i
,
Entry
;
assert
(
nVars
<=
16
);
memcpy
(
p
,
pInit
,
sizeof
(
word
)
*
Abc_TtWordNum
(
nVars
)
);
vSets
=
Dau_DecFindSets
(
p
,
nVars
);
Dau_DsdPrintFromTruth
(
p
,
nVars
);
vSets
=
Dau_DecFindSets
(
pInit
,
nVars
);
if
(
!
fVerbose
)
{
Vec_IntFree
(
vSets
);
return
;
}
Dau_DsdPrintFromTruth
(
pInit
,
nVars
);
printf
(
"This %d-variable function has %d decomposable variable sets:
\n
"
,
nVars
,
Vec_IntSize
(
vSets
)
);
Vec_IntForEachEntry
(
vSets
,
Entry
,
i
)
{
...
...
@@ -837,12 +842,12 @@ void Dau_DecTrySets( word * pInit, int nVars )
if
(
nVars
>
6
)
{
Dau_DecPrintSet
(
uSet
,
nVars
,
0
);
Dau_DecPerform
2
(
pInit
,
nVars
,
uSet
);
Dau_DecPerform
(
pInit
,
nVars
,
uSet
);
}
else
{
Dau_DecPrintSet
(
uSet
,
nVars
,
1
);
Dau_DecPerform
(
pInit
,
nVars
,
uSet
);
Dau_DecPerform
6
(
pInit
,
nVars
,
uSet
);
}
}
Vec_IntFree
(
vSets
);
...
...
@@ -860,7 +865,7 @@ void Dau_DecFindSetsTest3()
// char * pStr = "Abcd";
// char * pStr = "ab";
unsigned
uSet
=
Dau_DecReadSet
(
pStr
);
Dau_DecPerform
(
&
t
,
nVars
,
uSet
);
Dau_DecPerform
6
(
&
t
,
nVars
,
uSet
);
}
void
Dau_DecFindSetsTest
()
...
...
@@ -879,7 +884,7 @@ void Dau_DecFindSetsTest()
// word t = ABC_CONST(0x2B0228022B022802); // 5-var non-dec0x0F7700000F770000
// word t = ABC_CONST(0x0F7700000F770000); // (!<(ab)cd>e)
// word t = ABC_CONST(0x7F00000000000000); // (!(abc)def)
Dau_DecTrySets
(
&
t
,
nVars
);
Dau_DecTrySets
(
&
t
,
nVars
,
1
);
}
...
...
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