Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
abc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kestrel Collaboration
Kestrel Tooling
abc
Commits
f543d39e
Commit
f543d39e
authored
May 03, 2020
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experiment with permutations.
parent
f026e653
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
1 deletion
+97
-1
src/aig/gia/gia.c
src/aig/gia/gia.c
+95
-0
src/base/abci/abc.c
src/base/abci/abc.c
+2
-1
No files found.
src/aig/gia/gia.c
View file @
f543d39e
...
...
@@ -297,6 +297,101 @@ void Gia_ManStructExperiment( Gia_Man_t * p )
Vec_PtrFree
(
vGias
);
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Gia_EnumFirstUnused
(
int
*
pUsed
,
int
nVars
)
{
int
i
;
for
(
i
=
0
;
i
<
nVars
;
i
++
)
if
(
pUsed
[
i
]
==
0
)
return
i
;
return
-
1
;
}
void
Gia_EnumPerms_rec
(
int
*
pUsed
,
int
nVars
,
int
*
pPerm
,
int
nPerm
,
int
*
pCount
,
FILE
*
pFile
,
int
nLogVars
)
{
int
i
,
k
,
New
;
if
(
nPerm
==
nVars
)
{
if
(
pFile
)
{
for
(
i
=
0
;
i
<
nLogVars
;
i
++
)
fprintf
(
pFile
,
"%c"
,
'0'
+
((
*
pCount
)
>>
(
nLogVars
-
1
-
i
)
&
1
)
);
fprintf
(
pFile
,
" "
);
for
(
i
=
0
;
i
<
nVars
;
i
++
)
for
(
k
=
0
;
k
<
nVars
;
k
++
)
fprintf
(
pFile
,
"%c"
,
'0'
+
(
pPerm
[
i
]
==
k
)
);
fprintf
(
pFile
,
"
\n
"
);
}
else
{
if
(
*
pCount
<
20
)
{
printf
(
"%5d : "
,
(
*
pCount
)
);
for
(
i
=
0
;
i
<
nVars
;
i
+=
2
)
printf
(
"%d %d "
,
pPerm
[
i
],
pPerm
[
i
+
1
]
);
printf
(
"
\n
"
);
}
}
(
*
pCount
)
++
;
return
;
}
New
=
Gia_EnumFirstUnused
(
pUsed
,
nVars
);
assert
(
New
>=
0
);
pPerm
[
nPerm
]
=
New
;
assert
(
pUsed
[
New
]
==
0
);
pUsed
[
New
]
=
1
;
// try remaining ones
for
(
i
=
0
;
i
<
nVars
;
i
++
)
{
if
(
pUsed
[
i
]
==
1
)
continue
;
pPerm
[
nPerm
+
1
]
=
i
;
assert
(
pUsed
[
i
]
==
0
);
pUsed
[
i
]
=
1
;
Gia_EnumPerms_rec
(
pUsed
,
nVars
,
pPerm
,
nPerm
+
2
,
pCount
,
pFile
,
nLogVars
);
assert
(
pUsed
[
i
]
==
1
);
pUsed
[
i
]
=
0
;
}
assert
(
pUsed
[
New
]
==
1
);
pUsed
[
New
]
=
0
;
}
void
Gia_EnumPerms
(
int
nVars
)
{
int
nLogVars
=
0
,
Count
=
0
;
int
*
pUsed
=
ABC_CALLOC
(
int
,
nVars
);
int
*
pPerm
=
ABC_CALLOC
(
int
,
nVars
);
FILE
*
pFile
=
fopen
(
"pairset.pla"
,
"wb"
);
assert
(
nVars
%
2
==
0
);
printf
(
"Printing sets of pairs for %d objects:
\n
"
,
nVars
);
Gia_EnumPerms_rec
(
pUsed
,
nVars
,
pPerm
,
0
,
&
Count
,
NULL
,
-
1
);
if
(
Count
>
20
)
printf
(
"...
\n
"
);
printf
(
"Finished enumerating %d sets of pairs.
\n
"
,
Count
);
nLogVars
=
Abc_Base2Log
(
Count
);
printf
(
"Need %d variables to encode %d sets.
\n
"
,
nLogVars
,
Count
);
Count
=
0
;
fprintf
(
pFile
,
".i %d
\n
"
,
10
);
fprintf
(
pFile
,
".o %d
\n
"
,
nVars
*
nVars
);
Gia_EnumPerms_rec
(
pUsed
,
nVars
,
pPerm
,
0
,
&
Count
,
pFile
,
nLogVars
);
fprintf
(
pFile
,
".e
\n
"
);
fclose
(
pFile
);
printf
(
"Finished dumping file
\"
%s
\"
.
\n
"
,
"pairset.pla"
);
ABC_FREE
(
pUsed
);
ABC_FREE
(
pPerm
);
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...
...
src/base/abci/abc.c
View file @
f543d39e
...
...
@@ -13895,7 +13895,8 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
//Dau_NetworkEnumTest();
//Extra_SimulationTest( nDivMax, nNumOnes, fNewOrder );
//Mnist_ExperimentWithScaling( nDecMax );
Gia_Gen2CodeTest();
//Gia_Gen2CodeTest();
Gia_EnumPerms( nDecMax );
return 0;
usage:
Abc_Print( -2, "usage: test [-CKDNM] [-aovwh] <file_name>\n" );
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