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
76e35126
Commit
76e35126
authored
Mar 08, 2014
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes to LUT mappers.
parent
12c68e7e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
114 additions
and
7 deletions
+114
-7
src/base/abci/abc.c
+73
-0
src/map/if/if.h
+1
-0
src/map/if/ifDsd.c
+40
-7
No files found.
src/base/abci/abc.c
View file @
76e35126
...
...
@@ -237,6 +237,7 @@ static int Abc_CommandDsdLoad ( Abc_Frame_t * pAbc, int argc, cha
static
int
Abc_CommandDsdFree
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandDsdPs
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandDsdTune
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandDsdMerge
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandScut
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandInit
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
...
@@ -797,6 +798,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"DSD manager"
,
"dsd_free"
,
Abc_CommandDsdFree
,
0
);
Cmd_CommandAdd
(
pAbc
,
"DSD manager"
,
"dsd_ps"
,
Abc_CommandDsdPs
,
0
);
Cmd_CommandAdd
(
pAbc
,
"DSD manager"
,
"dsd_tune"
,
Abc_CommandDsdTune
,
0
);
Cmd_CommandAdd
(
pAbc
,
"DSD manager"
,
"dsd_merge"
,
Abc_CommandDsdMerge
,
0
);
// Cmd_CommandAdd( pAbc, "Sequential", "scut", Abc_CommandScut, 0 );
Cmd_CommandAdd
(
pAbc
,
"Sequential"
,
"init"
,
Abc_CommandInit
,
1
);
...
...
@@ -15648,6 +15650,77 @@ usage:
return
1
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Abc_CommandDsdMerge
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
char
*
FileName
,
*
pTemp
;
char
**
pArgvNew
;
int
c
,
nArgcNew
;
FILE
*
pFile
;
If_DsdMan_t
*
pDsdMan
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"h"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
if
(
!
Abc_FrameReadManDsd
()
)
{
Abc_Print
(
1
,
"The DSD manager is not started.
\n
"
);
return
0
;
}
pArgvNew
=
argv
+
globalUtilOptind
;
nArgcNew
=
argc
-
globalUtilOptind
;
if
(
nArgcNew
!=
1
)
{
Abc_Print
(
-
1
,
"File name is not given on the command line.
\n
"
);
return
1
;
}
// get the input file name
FileName
=
pArgvNew
[
0
];
// fix the wrong symbol
for
(
pTemp
=
FileName
;
*
pTemp
;
pTemp
++
)
if
(
*
pTemp
==
'>'
)
*
pTemp
=
'\\'
;
if
(
(
pFile
=
fopen
(
FileName
,
"r"
))
==
NULL
)
{
Abc_Print
(
-
1
,
"Cannot open input file
\"
%s
\"
. "
,
FileName
);
if
(
(
FileName
=
Extra_FileGetSimilarName
(
FileName
,
".aig"
,
NULL
,
NULL
,
NULL
,
NULL
))
)
Abc_Print
(
1
,
"Did you mean
\"
%s
\"
?"
,
FileName
);
Abc_Print
(
1
,
"
\n
"
);
return
1
;
}
fclose
(
pFile
);
pDsdMan
=
If_DsdManLoad
(
FileName
);
if
(
pDsdMan
==
NULL
)
return
1
;
If_DsdManMerge
(
Abc_FrameReadManDsd
(),
pDsdMan
);
If_DsdManFree
(
pDsdMan
,
0
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: dsd_merge [-h] <file>
\n
"
);
Abc_Print
(
-
2
,
"
\t
mermges DSD manager from file with the current one
\n
"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
Abc_Print
(
-
2
,
"
\t
<file> : file name to read
\n
"
);
return
1
;
}
/**Function*************************************************************
src/map/if/if.h
View file @
76e35126
...
...
@@ -524,6 +524,7 @@ extern void If_DsdManTune( If_DsdMan_t * p, int LutSize, int fFast, i
extern
void
If_DsdManFree
(
If_DsdMan_t
*
p
,
int
fVerbose
);
extern
void
If_DsdManSave
(
If_DsdMan_t
*
p
,
char
*
pFileName
);
extern
If_DsdMan_t
*
If_DsdManLoad
(
char
*
pFileName
);
extern
void
If_DsdManMerge
(
If_DsdMan_t
*
p
,
If_DsdMan_t
*
pNew
);
extern
int
If_DsdManCompute
(
If_DsdMan_t
*
p
,
word
*
pTruth
,
int
nLeaves
,
unsigned
char
*
pPerm
,
char
*
pLutStruct
);
extern
char
*
If_DsdManFileName
(
If_DsdMan_t
*
p
);
extern
int
If_DsdManVarNum
(
If_DsdMan_t
*
p
);
...
...
src/map/if/ifDsd.c
View file @
76e35126
...
...
@@ -445,13 +445,13 @@ void If_DsdManPrintDistrib( If_DsdMan_t * p )
{
printf
(
"%3d : "
,
i
);
printf
(
"All = %8d "
,
CountAll
[
i
]
);
printf
(
"Non = %8d
"
,
CountNon
[
i
]
);
printf
(
"Non = %8d
"
,
CountNon
[
i
]
);
printf
(
"(%6.2f %%)"
,
100
.
0
*
CountNon
[
i
]
/
CountAll
[
i
]
);
printf
(
"
\n
"
);
}
printf
(
"All : "
);
printf
(
"All = %8d "
,
Vec_PtrSize
(
p
->
vObjs
)
);
printf
(
"Non = %8d
"
,
CountNonTotal
);
printf
(
"Non = %8d
"
,
CountNonTotal
);
printf
(
"(%6.2f %%)"
,
100
.
0
*
CountNonTotal
/
Vec_PtrSize
(
p
->
vObjs
)
);
printf
(
"
\n
"
);
}
...
...
@@ -482,7 +482,8 @@ void If_DsdManPrint( If_DsdMan_t * p, char * pFileName, int Number, int fOccurs,
fprintf
(
pFile
,
"Unique table hits = %8d
\n
"
,
p
->
nUniqueHits
);
fprintf
(
pFile
,
"Unique table misses = %8d
\n
"
,
p
->
nUniqueMisses
);
fprintf
(
pFile
,
"Memory used for objects = %8.2f MB.
\n
"
,
1
.
0
*
Mem_FlexReadMemUsage
(
p
->
pMem
)
/
(
1
<<
20
)
);
fprintf
(
pFile
,
"Memory used for hash table = %8.2f MB.
\n
"
,
1
.
0
*
sizeof
(
int
)
*
p
->
nBins
/
(
1
<<
20
)
);
fprintf
(
pFile
,
"Memory used for functions = %8.2f MB.
\n
"
,
8
.
0
*
(
Vec_MemEntrySize
(
p
->
vTtMem
)
+
1
)
*
Vec_MemEntryNum
(
p
->
vTtMem
)
/
(
1
<<
20
)
);
fprintf
(
pFile
,
"Memory used for hash table = %8.2f MB.
\n
"
,
1
.
0
*
sizeof
(
int
)
*
(
p
->
nBins
+
Vec_IntCap
(
p
->
vNexts
))
/
(
1
<<
20
)
);
fprintf
(
pFile
,
"Memory used for array = %8.2f MB.
\n
"
,
1
.
0
*
sizeof
(
void
*
)
*
Vec_PtrCap
(
p
->
vObjs
)
/
(
1
<<
20
)
);
If_DsdManPrintDistrib
(
p
);
if
(
fOccurs
)
...
...
@@ -820,6 +821,35 @@ If_DsdMan_t * If_DsdManLoad( char * pFileName )
fclose
(
pFile
);
return
p
;
}
void
If_DsdManMerge
(
If_DsdMan_t
*
p
,
If_DsdMan_t
*
pNew
)
{
If_DsdObj_t
*
pObj
;
Vec_Int_t
*
vMap
;
int
pFanins
[
DAU_MAX_VAR
];
int
i
,
k
,
iFanin
,
Id
;
if
(
p
->
nVars
<
pNew
->
nVars
)
{
printf
(
"The number of variables should be the same or smaller.
\n
"
);
return
;
}
if
(
p
->
LutSize
!=
pNew
->
LutSize
)
{
printf
(
"LUT size should be the same.
\n
"
);
return
;
}
vMap
=
Vec_IntAlloc
(
Vec_PtrSize
(
pNew
->
vObjs
)
);
Vec_IntPush
(
vMap
,
0
);
Vec_IntPush
(
vMap
,
1
);
If_DsdVecForEachNode
(
pNew
->
vObjs
,
pObj
,
i
)
{
If_DsdObjForEachFaninLit
(
pNew
->
vObjs
,
pObj
,
iFanin
,
k
)
pFanins
[
k
]
=
Abc_Lit2LitV
(
Vec_IntArray
(
vMap
),
iFanin
);
Id
=
If_DsdObjFindOrAdd
(
p
,
pObj
->
Type
,
pFanins
,
pObj
->
nFans
,
pObj
->
Type
==
IF_DSD_PRIME
?
If_DsdObjTruth
(
pNew
,
pObj
)
:
NULL
);
Vec_IntPush
(
vMap
,
Id
);
}
assert
(
Vec_IntSize
(
vMap
)
==
Vec_PtrSize
(
pNew
->
vObjs
)
);
Vec_IntFree
(
vMap
);
}
/**Function*************************************************************
...
...
@@ -1636,15 +1666,18 @@ void If_DsdManTest()
void
If_DsdManTune
(
If_DsdMan_t
*
p
,
int
LutSize
,
int
fFast
,
int
fAdd
,
int
fSpec
,
int
fVerbose
)
{
ProgressBar
*
pProgress
=
NULL
;
If_DsdObj_t
*
pObj
;
sat_solver
*
pSat
=
NULL
;
Vec_Int_t
*
vLits
=
Vec_IntAlloc
(
1000
);
If_DsdObj_t
*
pObj
;
Vec_Int_t
*
vLits
;
int
i
,
Value
,
nVars
;
word
*
pTruth
;
pSat
=
(
sat_solver
*
)
If_ManSatBuildXY
(
LutSize
);
if
(
!
fAdd
)
if
(
!
fAdd
||
!
LutSize
)
If_DsdVecForEachObj
(
p
->
vObjs
,
pObj
,
i
)
pObj
->
fMark
=
0
;
if
(
LutSize
==
0
)
return
;
vLits
=
Vec_IntAlloc
(
1000
);
pSat
=
(
sat_solver
*
)
If_ManSatBuildXY
(
LutSize
);
pProgress
=
Extra_ProgressBarStart
(
stdout
,
Vec_PtrSize
(
p
->
vObjs
)
);
If_DsdVecForEachObj
(
p
->
vObjs
,
pObj
,
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