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
8110199a
Commit
8110199a
authored
Jul 04, 2018
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating command 'majgen'.
parent
76aa1d4f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
18 deletions
+24
-18
src/base/abci/abc.c
+9
-5
src/misc/extra/extraUtilMaj.c
+15
-13
No files found.
src/base/abci/abc.c
View file @
8110199a
...
...
@@ -8757,10 +8757,10 @@ usage:
***********************************************************************/
int
Abc_CommandMajGen
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
extern
int
Gem_Enumerate
(
int
nVars
,
int
fVerbose
);
int
c
,
nVars
=
8
,
fVerbose
=
0
;
extern
int
Gem_Enumerate
(
int
nVars
,
int
f
Dump
,
int
f
Verbose
);
int
c
,
nVars
=
8
,
f
Dump
=
0
,
f
Verbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"Nvh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"N
d
vh"
)
)
!=
EOF
)
{
switch
(
c
)
{
...
...
@@ -8775,6 +8775,9 @@ int Abc_CommandMajGen( Abc_Frame_t * pAbc, int argc, char ** argv )
if
(
nVars
<
0
)
goto
usage
;
break
;
case
'd'
:
fDump
^=
1
;
break
;
case
'v'
:
fVerbose
^=
1
;
break
;
...
...
@@ -8784,13 +8787,14 @@ int Abc_CommandMajGen( Abc_Frame_t * pAbc, int argc, char ** argv )
goto
usage
;
}
}
Gem_Enumerate
(
nVars
,
fVerbose
);
Gem_Enumerate
(
nVars
,
f
Dump
,
f
Verbose
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: majgen [-N <num>] [-vh]>
\n
"
);
Abc_Print
(
-
2
,
"usage: majgen [-N <num>] [-
d
vh]>
\n
"
);
Abc_Print
(
-
2
,
"
\t
generates networks for majority gates
\n
"
);
Abc_Print
(
-
2
,
"
\t
-N <num> : the maximum number of variables [default = %d]
\n
"
,
nVars
);
Abc_Print
(
-
2
,
"
\t
-d : toggle dumping functions into a file [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-v : toggle verbose printout [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
src/misc/extra/extraUtilMaj.c
View file @
8110199a
...
...
@@ -91,7 +91,7 @@ Gem_Man_t * Gem_ManAlloc( int nVars, int fVerbose )
p
=
ABC_CALLOC
(
Gem_Man_t
,
1
);
p
->
nVars
=
nVars
;
p
->
nWords
=
Abc_TtWordNum
(
nVars
);
p
->
nObjsAlloc
=
1000000
;
p
->
nObjsAlloc
=
1000000
0
;
p
->
nObjs
=
2
;
p
->
pObjs
=
ABC_CALLOC
(
Gem_Obj_t
,
p
->
nObjsAlloc
);
p
->
pObjs
[
1
].
nVars
=
p
->
pObjs
[
1
].
Groups
=
1
;
// buffer
...
...
@@ -274,12 +274,13 @@ int Gem_FuncCheckMajority( Gem_Man_t * p, int f )
int
Mask
=
Abc_Tt6Mask
(
nHalfVars
);
printf
(
"Found symmetric %d-variable function: "
,
pObj
->
nVars
);
Extra_PrintBinary2
(
stdout
,
(
unsigned
*
)
&
Polar
,
pObj
->
nVars
+
1
);
printf
(
"
\n
"
);
printf
(
"
"
);
if
(
(
pObj
->
nVars
&
1
)
&&
Polar
==
(
Mask
<<
nHalfVars
)
)
{
printf
(
"This
function
is majority-%d.
\n
"
,
pObj
->
nVars
);
printf
(
"This is majority-%d.
\n
"
,
pObj
->
nVars
);
return
0
;
}
printf
(
"
\n
"
);
}
return
0
;
}
...
...
@@ -341,26 +342,27 @@ int Gem_FuncReduce( Gem_Man_t * p, int f, int i, int j )
SeeAlso []
***********************************************************************/
int
Gem_Enumerate
(
int
nVars
,
int
fVerbose
)
int
Gem_Enumerate
(
int
nVars
,
int
f
Dump
,
int
f
Verbose
)
{
abctime
clk
=
Abc_Clock
();
Gem_Man_t
*
p
=
Gem_ManAlloc
(
nVars
,
fVerbose
);
int
v
,
f
,
i
,
j
;
int
v
,
f
,
i
,
j
,
nObjsStop
=
1
;
for
(
v
=
1
;
v
<=
nVars
-
2
;
v
++
)
{
// expand functions by adding a gate
int
nObjStop
=
p
->
nObjs
;
printf
(
"Expanding %d (functions = %10d) "
,
v
,
p
->
nObjs
);
int
nObjsStopPrev
=
nObjsStop
;
nObjsStop
=
p
->
nObjs
;
printf
(
"Expanding var %2d (functions = %10d) "
,
v
,
p
->
nObjs
);
Abc_PrintTime
(
0
,
"Time"
,
Abc_Clock
()
-
clk
);
for
(
f
=
0
;
f
<
nObjStop
;
f
++
)
if
(
v
==
(
int
)
p
->
pObjs
[
f
].
nVars
)
for
(
f
=
0
;
f
<
nObj
s
Stop
;
f
++
)
if
(
v
==
(
int
)
p
->
pObjs
[
f
].
nVars
||
(
v
>
(
int
)
p
->
pObjs
[
f
].
nVars
&&
f
>=
nObjsStopPrev
)
)
for
(
i
=
0
;
i
<
v
;
i
++
)
if
(
(
int
)
p
->
pObjs
[
f
].
Groups
&
(
1
<<
i
)
)
Gem_FuncExpand
(
p
,
f
,
i
);
// reduce functions by adding a crossbar
printf
(
"Connecting
%
d (functions = %10d) "
,
v
,
p
->
nObjs
);
printf
(
"Connecting
var %2
d (functions = %10d) "
,
v
,
p
->
nObjs
);
Abc_PrintTime
(
0
,
"Time"
,
Abc_Clock
()
-
clk
);
for
(
f
=
nObjStop
;
f
<
p
->
nObjs
;
f
++
)
for
(
f
=
nObj
s
Stop
;
f
<
p
->
nObjs
;
f
++
)
for
(
i
=
0
;
i
<
(
int
)
p
->
pObjs
[
f
].
nVars
;
i
++
)
if
(
(
int
)
p
->
pObjs
[
f
].
Groups
&
(
1
<<
i
)
)
for
(
j
=
i
+
1
;
j
<
(
int
)
p
->
pObjs
[
f
].
nVars
;
j
++
)
...
...
@@ -368,9 +370,9 @@ int Gem_Enumerate( int nVars, int fVerbose )
if
(
Gem_FuncReduce
(
p
,
f
,
i
,
j
)
)
return
Gem_ManFree
(
p
);
}
printf
(
"Finished
%d
(functions = %10d) "
,
v
,
p
->
nObjs
);
printf
(
"Finished
(functions = %10d) "
,
v
,
p
->
nObjs
);
Abc_PrintTime
(
0
,
"Time"
,
Abc_Clock
()
-
clk
);
Vec_MemDumpTruthTables
(
p
->
vTtMem
,
"enum"
,
nVars
);
if
(
fDump
)
Vec_MemDumpTruthTables
(
p
->
vTtMem
,
"enum"
,
nVars
);
Gem_ManFree
(
p
);
return
0
;
}
...
...
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