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
2ee26b00
Commit
2ee26b00
authored
Jul 11, 2013
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Precomputing DSD functions.
parent
773b1c13
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
10 deletions
+86
-10
src/map/if/ifDsd.c
+73
-10
src/misc/vec/vecHsh.h
+13
-0
No files found.
src/map/if/ifDsd.c
View file @
2ee26b00
...
@@ -327,7 +327,8 @@ int Ifd_ManHashFindOrAdd( Ifd_Man_t * p, int iDsd0, int iDsd1, int iDsdC, int Ty
...
@@ -327,7 +327,8 @@ int Ifd_ManHashFindOrAdd( Ifd_Man_t * p, int iDsd0, int iDsd1, int iDsdC, int Ty
else
if
(
Type
==
2
)
else
if
(
Type
==
2
)
pObj
->
fWay
=
Ifd_ManObjFromLit
(
p
,
iDsd0
)
->
fWay
||
Ifd_ManObjFromLit
(
p
,
iDsd1
)
->
fWay
;
pObj
->
fWay
=
Ifd_ManObjFromLit
(
p
,
iDsd0
)
->
fWay
||
Ifd_ManObjFromLit
(
p
,
iDsd1
)
->
fWay
;
else
if
(
Type
==
3
)
else
if
(
Type
==
3
)
pObj
->
fWay
=
(
Ifd_ManObjFromLit
(
p
,
iDsd0
)
->
fWay
&&
Ifd_ManObjFromLit
(
p
,
iDsd1
)
->
fWay
)
||
(
iDsd0
==
iDsd1
&&
Ifd_ManObjFromLit
(
p
,
iDsdC
)
->
fWay
);
// pObj->fWay = (Ifd_ManObjFromLit(p, iDsd0)->fWay && Ifd_ManObjFromLit(p, iDsd1)->fWay) || (Abc_Lit2Var(iDsd0) == Abc_Lit2Var(iDsd1) && Ifd_ManObjFromLit(p, iDsdC)->fWay);
pObj
->
fWay
=
(
Ifd_ManObjFromLit
(
p
,
iDsd0
)
->
fWay
&&
Ifd_ManObjFromLit
(
p
,
iDsd1
)
->
fWay
)
||
(
iDsd0
==
Abc_LitNot
(
iDsd1
)
&&
Ifd_ManObjFromLit
(
p
,
iDsdC
)
->
fWay
);
else
assert
(
0
);
else
assert
(
0
);
pObj
->
pFans
[
0
]
=
iDsd0
;
pObj
->
pFans
[
0
]
=
iDsd0
;
pObj
->
pFans
[
1
]
=
iDsd1
;
pObj
->
pFans
[
1
]
=
iDsd1
;
...
@@ -776,36 +777,98 @@ Vec_Wrd_t * Extra_Truth6AllConfigs( word t, int * pComp, int * pPerm, int nVars
...
@@ -776,36 +777,98 @@ Vec_Wrd_t * Extra_Truth6AllConfigs( word t, int * pComp, int * pPerm, int nVars
}
}
return
vTruths
;
return
vTruths
;
}
}
int
Ifd_ManDsdTest
()
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Ifd_ManDsdTest33
()
{
{
int
nVars
=
6
;
int
nVars
=
6
;
FILE
*
pFile
;
char
pFileName
[
32
];
Vec_Wrd_t
*
vTruths
=
Ifd_ManDsdTruths
(
nVars
);
Vec_Wrd_t
*
vTruths
=
Ifd_ManDsdTruths
(
nVars
);
Vec_Wrd_t
*
v
Config
s
;
Vec_Wrd_t
*
v
Variant
s
;
Vec_Int_t
*
vUniques
;
Vec_Int_t
*
vUniques
;
Vec_Wrd_t
*
vTruthRes
=
Vec_WrdAlloc
(
4000000
);
Vec_Int_t
*
vConfgRes
=
Vec_IntAlloc
(
4000000
);
int
*
pComp
,
*
pPerm
;
int
*
pComp
,
*
pPerm
;
word
Truth
;
word
Truth
,
Variant
;
int
i
,
Counter
=
0
;
int
i
,
k
,
Uniq
,
Runner
,
Counter
=
0
;
assert
(
nVars
>=
3
&&
nVars
<=
6
);
assert
(
Vec_WrdSize
(
vTruths
)
<
(
1
<<
10
)
);
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
)
{
{
vConfigs
=
Extra_Truth6AllConfigs
(
Truth
,
pComp
,
pPerm
,
nVars
);
vVariants
=
Extra_Truth6AllConfigs
(
Truth
,
pComp
,
pPerm
,
nVars
);
vUniques
=
Hsh_WrdManHashArray
(
vConfigs
,
1
);
vUniques
=
Hsh_WrdManHashArray
(
vVariants
,
1
);
Runner
=
0
;
Vec_IntForEachEntry
(
vUniques
,
Uniq
,
k
)
if
(
Runner
==
Uniq
)
{
Variant
=
Vec_WrdEntry
(
vVariants
,
k
);
Vec_WrdPush
(
vTruthRes
,
Variant
);
Vec_IntPush
(
vConfgRes
,
(
Extra_TruthSupportSize
((
unsigned
*
)
&
Variant
,
6
)
<<
26
)
|
(
i
<<
16
)
|
k
);
Runner
++
;
}
Vec_IntUniqify
(
vUniques
);
Vec_IntUniqify
(
vUniques
);
assert
(
Runner
==
Vec_IntSize
(
vUniques
)
);
Counter
+=
Vec_IntSize
(
vUniques
);
Counter
+=
Vec_IntSize
(
vUniques
);
//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
(
v
Config
s
);
Vec_WrdFree
(
v
Variant
s
);
}
}
Vec_WrdFree
(
vTruths
);
Vec_WrdFree
(
vTruths
);
ABC_FREE
(
pPerm
);
ABC_FREE
(
pPerm
);
ABC_FREE
(
pComp
);
ABC_FREE
(
pComp
);
printf
(
"Total = %d.
\n
"
,
Counter
);
printf
(
"Total = %d.
\n
"
,
Counter
);
assert
(
Vec_WrdSize
(
vTruthRes
)
==
Counter
);
// write the data into a file
sprintf
(
pFileName
,
"dsdfuncs%d.dat"
,
nVars
);
pFile
=
fopen
(
pFileName
,
"wb"
);
fwrite
(
Vec_WrdArray
(
vTruthRes
),
sizeof
(
word
),
Vec_WrdSize
(
vTruthRes
),
pFile
);
fwrite
(
Vec_IntArray
(
vConfgRes
),
sizeof
(
int
),
Vec_IntSize
(
vConfgRes
),
pFile
);
fclose
(
pFile
);
printf
(
"File
\"
%s
\"
with %d 6-input functions has been written out.
\n
"
,
pFileName
,
Vec_IntSize
(
vConfgRes
)
);
Vec_WrdFree
(
vTruthRes
);
Vec_IntFree
(
vConfgRes
);
return
1
;
return
1
;
}
}
int
Ifd_ManDsdTest
()
{
abctime
clk
=
Abc_Clock
();
FILE
*
pFile
;
char
*
pFileName
=
"dsdfuncs6.dat"
;
int
size
=
Extra_FileSize
(
pFileName
)
/
12
;
// 3504275
Vec_Wrd_t
*
vTruthRes
=
Vec_WrdAlloc
(
size
+
1
);
Vec_Int_t
*
vConfgRes
=
Vec_IntAlloc
(
size
);
Hsh_IntMan_t
*
pHash
;
pFile
=
fopen
(
pFileName
,
"rb"
);
fread
(
Vec_WrdArray
(
vTruthRes
),
sizeof
(
word
),
size
,
pFile
);
fread
(
Vec_IntArray
(
vConfgRes
),
sizeof
(
int
),
size
,
pFile
);
vTruthRes
->
nSize
=
size
;
vConfgRes
->
nSize
=
size
;
// create hash table
pHash
=
Hsh_WrdManHashArrayStart
(
vTruthRes
,
1
);
// experiment with functions
// cleanup
Hsh_IntManStop
(
pHash
);
Vec_WrdFree
(
vTruthRes
);
Vec_IntFree
(
vConfgRes
);
Abc_PrintTime
(
1
,
"Reading file"
,
Abc_Clock
()
-
clk
);
return
1
;
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
...
src/misc/vec/vecHsh.h
View file @
2ee26b00
...
@@ -207,6 +207,19 @@ static inline Vec_Int_t * Hsh_WrdManHashArray( Vec_Wrd_t * vDataW, int nSize )
...
@@ -207,6 +207,19 @@ static inline Vec_Int_t * Hsh_WrdManHashArray( Vec_Wrd_t * vDataW, int nSize )
Hsh_IntManStop
(
p
);
Hsh_IntManStop
(
p
);
return
vRes
;
return
vRes
;
}
}
static
inline
Hsh_IntMan_t
*
Hsh_WrdManHashArrayStart
(
Vec_Wrd_t
*
vDataW
,
int
nSize
)
{
Hsh_IntMan_t
*
p
;
Vec_Int_t
Data
=
{
2
*
Vec_WrdCap
(
vDataW
),
2
*
Vec_WrdSize
(
vDataW
),
(
int
*
)
Vec_WrdArray
(
vDataW
)
};
Vec_Int_t
*
vData
=
&
Data
;
int
i
,
nEntries
=
Vec_IntSize
(
vData
)
/
(
2
*
nSize
);
assert
(
Vec_IntSize
(
vData
)
%
(
2
*
nSize
)
==
0
);
p
=
Hsh_IntManStart
(
vData
,
(
2
*
nSize
),
nEntries
);
for
(
i
=
0
;
i
<
nEntries
;
i
++
)
Hsh_IntManAdd
(
p
,
i
);
assert
(
Vec_WrdSize
(
p
->
vObjs
)
==
nEntries
);
return
p
;
}
/**Function*************************************************************
/**Function*************************************************************
...
...
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