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
423d929d
Commit
423d929d
authored
Apr 13, 2020
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QBF-based code generation (extending beyond 32 bits).
parent
de82737e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
20 deletions
+39
-20
src/aig/gia/giaQbf.c
+39
-20
No files found.
src/aig/gia/giaQbf.c
View file @
423d929d
...
...
@@ -23,6 +23,7 @@
#include "sat/bsat/satStore.h"
#include "misc/extra/extra.h"
#include "sat/glucose/AbcGlucose.h"
#include "misc/util/utilTruth.h"
ABC_NAMESPACE_IMPL_START
...
...
@@ -282,7 +283,7 @@ Gia_Man_t * Gia_Gen2CreateMiter( int nLutSize, int nLutNum )
pNew
=
Gia_ManCleanup
(
pTemp
=
pNew
);
Gia_ManStop
(
pTemp
);
printf
(
"Generated QBF miter with %d parameters, %d functional variables, and %d AIG nodes.
\n
"
,
nLutNum
*
(
1
<<
nLutSize
),
2
*
nLut
Num
,
Gia_ManAndNum
(
pNew
)
);
nLutNum
*
(
1
<<
nLutSize
),
2
*
nLut
Size
,
Gia_ManAndNum
(
pNew
)
);
return
pNew
;
}
int
Gia_Gen2CodeOne
(
int
nLutSize
,
int
nLutNum
,
Vec_Int_t
*
vCode
,
int
x
)
...
...
@@ -293,6 +294,15 @@ int Gia_Gen2CodeOne( int nLutSize, int nLutNum, Vec_Int_t * vCode, int x )
Code
|=
(
1
<<
k
);
return
Code
;
}
word
*
Gia_Gen2CodeOneP
(
int
nLutSize
,
int
nLutNum
,
Vec_Int_t
*
vCode
,
int
x
)
{
word
*
pRes
=
ABC_CALLOC
(
word
,
Abc_Bit6WordNum
(
nLutNum
)
);
int
k
;
for
(
k
=
0
;
k
<
nLutNum
;
k
++
)
if
(
Vec_IntEntry
(
vCode
,
k
*
(
1
<<
nLutSize
)
+
x
)
)
Abc_InfoSetBit
(
(
unsigned
*
)
pRes
,
k
);
return
pRes
;
}
void
Gia_Gen2CodePrint
(
int
nLutSize
,
int
nLutNum
,
Vec_Int_t
*
vCode
)
{
// |<-- PVars(0)-->|...|<-- PVars(nLutNum-1)-->|
...
...
@@ -300,13 +310,15 @@ void Gia_Gen2CodePrint( int nLutSize, int nLutNum, Vec_Int_t * vCode )
printf
(
"%d-input %d-output code table:
\n
"
,
nLutSize
,
nLutNum
);
for
(
i
=
0
;
i
<
(
1
<<
nLutSize
);
i
++
)
{
int
Code
=
Gia_Gen2CodeOne
(
nLutSize
,
nLutNum
,
vCode
,
i
);
word
*
CodeX
=
Gia_Gen2CodeOneP
(
nLutSize
,
nLutNum
,
vCode
,
i
);
printf
(
"%3d "
,
i
);
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
&
i
,
nLutSize
);
printf
(
" --> "
);
printf
(
"%3d "
,
Code
);
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
&
Code
,
nLutNum
);
if
(
nLutNum
<=
16
)
printf
(
"%5d "
,
(
int
)
CodeX
[
0
]
);
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
CodeX
,
nLutNum
);
printf
(
"
\n
"
);
ABC_FREE
(
CodeX
);
}
// create several different pairs
srand
(
time
(
NULL
)
);
...
...
@@ -314,19 +326,21 @@ void Gia_Gen2CodePrint( int nLutSize, int nLutNum, Vec_Int_t * vCode )
for
(
n
=
0
;
n
<
nPairs
;
n
++
)
{
unsigned
MaskIn
=
Abc_InfoMask
(
nLutSize
);
unsigned
MaskOut
=
Abc_InfoMask
(
nLutNum
);
int
CodeX
,
CodeY
,
CodeXY
,
CodeXCode
Y
;
int
NumX
=
0
,
NumY
=
0
,
NumXY
;
int
NumX
=
0
,
NumY
=
0
,
NumXY
,
nWords
=
Abc_Bit6WordNum
(
nLutNum
);
word
*
CodeX
,
*
CodeY
,
*
CodeX
Y
;
word
*
CodeXCodeY
=
ABC_CALLOC
(
word
,
nWords
)
;
while
(
NumX
==
NumY
)
{
NumX
=
rand
()
%
(
1
<<
nLutSize
);
NumY
=
rand
()
%
(
1
<<
nLutSize
);
NumXY
=
MaskIn
&
~
(
NumX
&
NumY
);
}
CodeX
=
Gia_Gen2CodeOne
(
nLutSize
,
nLutNum
,
vCode
,
NumX
);
CodeY
=
Gia_Gen2CodeOne
(
nLutSize
,
nLutNum
,
vCode
,
NumY
);
CodeXY
=
Gia_Gen2CodeOne
(
nLutSize
,
nLutNum
,
vCode
,
NumXY
);
CodeXCodeY
=
MaskOut
&
~
(
CodeX
&
CodeY
);
CodeX
=
Gia_Gen2CodeOneP
(
nLutSize
,
nLutNum
,
vCode
,
NumX
);
CodeY
=
Gia_Gen2CodeOneP
(
nLutSize
,
nLutNum
,
vCode
,
NumY
);
CodeXY
=
Gia_Gen2CodeOneP
(
nLutSize
,
nLutNum
,
vCode
,
NumXY
);
Abc_TtAnd
(
CodeXCodeY
,
CodeX
,
CodeY
,
nWords
,
1
);
if
(
nLutNum
<
64
*
nWords
)
CodeXCodeY
[
nWords
-
1
]
&=
Abc_Tt6Mask
(
nLutNum
%
64
);
printf
(
"%2d :"
,
n
);
printf
(
" x =%3d "
,
NumX
);
...
...
@@ -337,18 +351,23 @@ void Gia_Gen2CodePrint( int nLutSize, int nLutNum, Vec_Int_t * vCode )
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
&
NumXY
,
nLutSize
);
printf
(
" "
);
printf
(
"
c(x) =%3d "
,
CodeX
);
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
&
CodeX
,
nLutNum
);
printf
(
"
c(y) =%3d "
,
CodeY
);
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
&
CodeY
,
nLutNum
);
printf
(
"
c(nand) =%3d "
,
CodeXY
);
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
&
CodeXY
,
nLutNum
);
printf
(
"
nand(c(x), c(y)) =%3d "
,
CodeXCodeY
);
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
&
CodeXCodeY
,
nLutNum
);
printf
(
"
c(x) = "
);
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
CodeX
,
nLutNum
);
printf
(
"
c(y) = "
);
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
CodeY
,
nLutNum
);
printf
(
"
c(nand) = "
);
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
CodeXY
,
nLutNum
);
printf
(
"
nand(c(x),c(y)) = "
);
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
CodeXCodeY
,
nLutNum
);
printf
(
" "
);
printf
(
"%s"
,
CodeXCodeY
==
CodeXY
?
"yes"
:
"no"
);
printf
(
"%s"
,
Abc_TtEqual
(
CodeXCodeY
,
CodeXY
,
nWords
)
?
"yes"
:
"no"
);
printf
(
"
\n
"
);
ABC_FREE
(
CodeX
);
ABC_FREE
(
CodeY
);
ABC_FREE
(
CodeXY
);
ABC_FREE
(
CodeXCodeY
);
}
}
void
Gia_Gen2CodeTest
()
...
...
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