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
8e5af90c
Commit
8e5af90c
authored
Jun 18, 2016
by
Ana Petkovska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return the class representative of each function.
parent
6842b8cd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
18 deletions
+62
-18
src/base/abci/abcNpn.c
+3
-3
src/opt/dau/dauCanon.c
+59
-15
No files found.
src/base/abci/abcNpn.c
View file @
8e5af90c
...
...
@@ -181,7 +181,7 @@ void Abc_TruthNpnPerform( Abc_TtStore_t * p, int NpnType, int fVerbose )
char
pCanonPerm
[
16
];
unsigned
uCanonPhase
=
0
;
abctime
clk
=
Abc_Clock
();
int
i
,
nClasses
=
-
1
;
int
i
;
char
*
pAlgoName
=
NULL
;
if
(
NpnType
==
0
)
...
...
@@ -309,12 +309,12 @@ void Abc_TruthNpnPerform( Abc_TtStore_t * p, int NpnType, int fVerbose )
// Extra_PrintHex( stdout, (unsigned *)p->pFuncs[i], p->nVars ), Abc_TruthNpnPrint(NULL, uCanonPhase, p->nVars), printf( "\n" );
printf
(
"
\n
"
);
}
nClasses
=
Abc_TtManNumClasses
(
pMan
);
//
nClasses = Abc_TtManNumClasses( pMan );
Abc_TtManStop
(
pMan
);
}
else
assert
(
0
);
clk
=
Abc_Clock
()
-
clk
;
printf
(
"Classes =%9d "
,
nClasses
==
-
1
?
Abc_TruthNpnCountUnique
(
p
)
:
nClasses
);
printf
(
"Classes =%9d "
,
Abc_TruthNpnCountUnique
(
p
)
);
Abc_PrintTime
(
1
,
"Time"
,
clk
);
}
...
...
src/opt/dau/dauCanon.c
View file @
8e5af90c
...
...
@@ -1059,8 +1059,27 @@ unsigned Abc_TtCanonicizePhase( word * pTruth, int nVars )
struct
Abc_TtMan_t_
{
Vec_Mem_t
*
vTtMem
[
TT_NUM_TABLES
];
// truth table memory and hash tables
Vec_Int_t
**
vRepres
;
// pointers to the representatives from the last hierarchical level
};
Vec_Int_t
**
Abc_TtRepresStart
()
{
Vec_Int_t
**
vRepres
=
ABC_ALLOC
(
Vec_Int_t
*
,
TT_NUM_TABLES
-
1
);
int
i
;
// create a list of pointers for each level of the hierarchy
for
(
i
=
0
;
i
<
(
TT_NUM_TABLES
-
1
);
i
++
)
{
vRepres
[
i
]
=
Vec_IntAlloc
(
1
);
}
return
vRepres
;
}
void
Abc_TtRepresStop
(
Vec_Int_t
**
vRepres
)
{
int
i
;
for
(
i
=
0
;
i
<
(
TT_NUM_TABLES
-
1
);
i
++
)
{
Vec_IntFree
(
vRepres
[
i
]);
}
ABC_FREE
(
vRepres
);
}
Abc_TtMan_t
*
Abc_TtManStart
(
int
nVars
)
{
Abc_TtMan_t
*
p
=
ABC_CALLOC
(
Abc_TtMan_t
,
1
);
...
...
@@ -1070,6 +1089,7 @@ Abc_TtMan_t * Abc_TtManStart( int nVars )
p
->
vTtMem
[
i
]
=
Vec_MemAlloc
(
nWords
,
12
);
Vec_MemHashAlloc
(
p
->
vTtMem
[
i
],
10000
);
}
p
->
vRepres
=
Abc_TtRepresStart
();
return
p
;
}
void
Abc_TtManStop
(
Abc_TtMan_t
*
p
)
...
...
@@ -1080,6 +1100,7 @@ void Abc_TtManStop( Abc_TtMan_t * p )
Vec_MemHashFree
(
p
->
vTtMem
[
i
]
);
Vec_MemFreeP
(
&
p
->
vTtMem
[
i
]
);
}
Abc_TtRepresStop
(
p
->
vRepres
);
ABC_FREE
(
p
);
}
int
Abc_TtManNumClasses
(
Abc_TtMan_t
*
p
)
...
...
@@ -1096,6 +1117,9 @@ unsigned Abc_TtCanonicizeHie( Abc_TtMan_t * p, word * pTruthInit, int nVars, cha
int
nOnes
,
nWords
=
Abc_TtWordNum
(
nVars
);
int
i
,
k
,
truthId
;
int
*
pSpot
;
int
vTruthId
[
TT_NUM_TABLES
-
1
];
int
fLevelFound
;
word
*
pRepTruth
;
assert
(
nVars
<=
16
);
Abc_TtCopy
(
pTruth
,
pTruthInit
,
nWords
,
0
);
...
...
@@ -1113,9 +1137,11 @@ unsigned Abc_TtCanonicizeHie( Abc_TtMan_t * p, word * pTruthInit, int nVars, cha
}
// check cache
pSpot
=
Vec_MemHashLookup
(
p
->
vTtMem
[
0
],
pTruth
);
if
(
*
pSpot
!=
-
1
)
return
0
;
truthId
=
Vec_MemHashInsert
(
p
->
vTtMem
[
0
],
pTruth
);
if
(
*
pSpot
!=
-
1
)
{
fLevelFound
=
0
;
goto
end_repres
;
}
vTruthId
[
0
]
=
Vec_MemHashInsert
(
p
->
vTtMem
[
0
],
pTruth
);
// normalize phase
Abc_TtCountOnesInCofs
(
pTruth
,
nVars
,
pStore
);
...
...
@@ -1130,9 +1156,11 @@ unsigned Abc_TtCanonicizeHie( Abc_TtMan_t * p, word * pTruthInit, int nVars, cha
}
// check cache
pSpot
=
Vec_MemHashLookup
(
p
->
vTtMem
[
1
],
pTruth
);
if
(
*
pSpot
!=
-
1
)
return
0
;
truthId
=
Vec_MemHashInsert
(
p
->
vTtMem
[
1
],
pTruth
);
if
(
*
pSpot
!=
-
1
)
{
fLevelFound
=
1
;
goto
end_repres
;
}
vTruthId
[
1
]
=
Vec_MemHashInsert
(
p
->
vTtMem
[
1
],
pTruth
);
// normalize permutation
{
...
...
@@ -1157,9 +1185,11 @@ unsigned Abc_TtCanonicizeHie( Abc_TtMan_t * p, word * pTruthInit, int nVars, cha
}
// check cache
pSpot
=
Vec_MemHashLookup
(
p
->
vTtMem
[
2
],
pTruth
);
if
(
*
pSpot
!=
-
1
)
return
0
;
truthId
=
Vec_MemHashInsert
(
p
->
vTtMem
[
2
],
pTruth
);
if
(
*
pSpot
!=
-
1
)
{
fLevelFound
=
2
;
goto
end_repres
;
}
vTruthId
[
2
]
=
Vec_MemHashInsert
(
p
->
vTtMem
[
2
],
pTruth
);
// iterate TT permutations for tied variables
for
(
k
=
0
;
k
<
5
;
k
++
)
...
...
@@ -1179,9 +1209,11 @@ unsigned Abc_TtCanonicizeHie( Abc_TtMan_t * p, word * pTruthInit, int nVars, cha
}
// check cache
pSpot
=
Vec_MemHashLookup
(
p
->
vTtMem
[
3
],
pTruth
);
if
(
*
pSpot
!=
-
1
)
return
0
;
truthId
=
Vec_MemHashInsert
(
p
->
vTtMem
[
3
],
pTruth
);
if
(
*
pSpot
!=
-
1
)
{
fLevelFound
=
3
;
goto
end_repres
;
}
vTruthId
[
3
]
=
Vec_MemHashInsert
(
p
->
vTtMem
[
3
],
pTruth
);
// perform exact NPN using groups
if
(
fExact
)
{
...
...
@@ -1224,9 +1256,21 @@ unsigned Abc_TtCanonicizeHie( Abc_TtMan_t * p, word * pTruthInit, int nVars, cha
}
// check cache
pSpot
=
Vec_MemHashLookup
(
p
->
vTtMem
[
4
],
pTruth
);
if
(
*
pSpot
!=
-
1
)
return
0
;
truthId
=
Vec_MemHashInsert
(
p
->
vTtMem
[
4
],
pTruth
);
fLevelFound
=
4
;
if
(
*
pSpot
!=
-
1
)
{
goto
end_repres
;
}
*
pSpot
=
Vec_MemHashInsert
(
p
->
vTtMem
[
4
],
pTruth
);
end_repres:
// return the class representative
if
(
fLevelFound
<
(
TT_NUM_TABLES
-
1
))
truthId
=
Vec_IntEntry
(
p
->
vRepres
[
fLevelFound
],
*
pSpot
);
else
truthId
=
*
pSpot
;
for
(
i
=
0
;
i
<
fLevelFound
;
i
++
)
Vec_IntSetEntry
(
p
->
vRepres
[
i
],
vTruthId
[
i
],
truthId
);
pRepTruth
=
Vec_MemReadEntry
(
p
->
vTtMem
[
TT_NUM_TABLES
-
1
],
truthId
);
Abc_TtCopy
(
pTruthInit
,
pRepTruth
,
nWords
,
0
);
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