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
c7bc6b63
Commit
c7bc6b63
authored
Mar 22, 2020
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experiments with simulation-based engines.
parent
a4518e6f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
60 deletions
+69
-60
src/aig/gia/gia.h
+2
-0
src/aig/gia/giaMan.c
+1
-0
src/aig/gia/giaSimBase.c
+0
-0
src/misc/extra/extraUtilFile.c
+7
-24
src/misc/extra/extraUtilMisc.c
+49
-36
src/misc/util/utilTruth.h
+10
-0
No files found.
src/aig/gia/gia.h
View file @
c7bc6b63
...
...
@@ -205,9 +205,11 @@ struct Gia_Man_t_
int
fBuiltInSim
;
int
iPatsPi
;
int
nSimWords
;
int
nSimWordsT
;
int
iPastPiMax
;
int
nSimWordsMax
;
Vec_Wrd_t
*
vSims
;
Vec_Wrd_t
*
vSimsT
;
Vec_Wrd_t
*
vSimsPi
;
Vec_Wrd_t
*
vSimsPo
;
Vec_Int_t
*
vClassOld
;
...
...
src/aig/gia/giaMan.c
View file @
c7bc6b63
...
...
@@ -96,6 +96,7 @@ void Gia_ManStop( Gia_Man_t * p )
Vec_IntFreeP
(
&
p
->
vClassNew
);
Vec_IntFreeP
(
&
p
->
vClassOld
);
Vec_WrdFreeP
(
&
p
->
vSims
);
Vec_WrdFreeP
(
&
p
->
vSimsT
);
Vec_WrdFreeP
(
&
p
->
vSimsPi
);
Vec_WrdFreeP
(
&
p
->
vSimsPo
);
Vec_IntFreeP
(
&
p
->
vTimeStamps
);
...
...
src/aig/gia/giaSimBase.c
View file @
c7bc6b63
This diff is collapsed.
Click to expand it.
src/misc/extra/extraUtilFile.c
View file @
c7bc6b63
...
...
@@ -496,33 +496,16 @@ unsigned Extra_ReadBinary( char * Buffer )
***********************************************************************/
void
Extra_PrintBinary
(
FILE
*
pFile
,
unsigned
Sign
[],
int
nBits
)
{
int
Remainder
,
nWords
;
int
w
,
i
;
Remainder
=
(
nBits
%
(
sizeof
(
unsigned
)
*
8
));
nWords
=
(
nBits
/
(
sizeof
(
unsigned
)
*
8
))
+
(
Remainder
>
0
);
for
(
w
=
nWords
-
1
;
w
>=
0
;
w
--
)
for
(
i
=
((
w
==
nWords
-
1
&&
Remainder
)
?
Remainder
-
1
:
31
);
i
>=
0
;
i
--
)
fprintf
(
pFile
,
"%c"
,
'0'
+
(
int
)((
Sign
[
w
]
&
(
1
<<
i
))
>
0
)
);
// fprintf( pFile, "\n" );
int
i
;
for
(
i
=
nBits
-
1
;
i
>=
0
;
i
--
)
fprintf
(
pFile
,
"%c"
,
'0'
+
Abc_InfoHasBit
(
Sign
,
i
)
);
// fprintf( pFile, "\n" );
}
void
Extra_PrintBinary2
(
FILE
*
pFile
,
unsigned
Sign
[],
int
nBits
)
{
int
Remainder
,
nWords
;
int
w
,
i
;
Remainder
=
(
nBits
%
(
sizeof
(
unsigned
)
*
8
));
nWords
=
(
nBits
/
(
sizeof
(
unsigned
)
*
8
))
+
(
Remainder
>
0
);
for
(
w
=
0
;
w
<
nWords
;
w
++
)
{
int
Limit
=
w
==
nWords
-
1
?
Remainder
:
32
;
for
(
i
=
0
;
i
<
Limit
;
i
++
)
fprintf
(
pFile
,
"%c"
,
'0'
+
(
int
)((
Sign
[
w
]
&
(
1
<<
i
))
>
0
)
);
}
int
i
;
for
(
i
=
0
;
i
<
nBits
;
i
++
)
fprintf
(
pFile
,
"%c"
,
'0'
+
Abc_InfoHasBit
(
Sign
,
i
)
);
// fprintf( pFile, "\n" );
}
...
...
src/misc/extra/extraUtilMisc.c
View file @
c7bc6b63
...
...
@@ -2594,6 +2594,19 @@ static inline void Extra_Transpose64Simple( word A[64], word B[64] )
if
(
(
A
[
i
]
>>
k
)
&
1
)
B
[
k
]
|=
((
word
)
1
<<
(
63
-
i
));
}
static
inline
void
Extra_BitMatrixTransposeSimple
(
Vec_Wrd_t
*
vSimsIn
,
int
nWordsIn
,
Vec_Wrd_t
*
vSimsOut
,
int
nWordsOut
)
{
int
i
,
k
;
assert
(
Vec_WrdSize
(
vSimsIn
)
==
nWordsIn
*
nWordsOut
*
64
);
assert
(
Vec_WrdSize
(
vSimsIn
)
==
Vec_WrdSize
(
vSimsOut
)
);
assert
(
Vec_WrdSize
(
vSimsIn
)
%
nWordsIn
==
0
);
assert
(
Vec_WrdSize
(
vSimsOut
)
%
nWordsOut
==
0
);
Vec_WrdFill
(
vSimsOut
,
Vec_WrdSize
(
vSimsOut
),
0
);
for
(
i
=
0
;
i
<
64
*
nWordsOut
;
i
++
)
for
(
k
=
0
;
k
<
64
*
nWordsIn
;
k
++
)
if
(
Abc_InfoHasBit
(
(
unsigned
*
)
Vec_WrdEntryP
(
vSimsIn
,
i
*
nWordsIn
),
k
)
)
Abc_InfoSetBit
(
(
unsigned
*
)
Vec_WrdEntryP
(
vSimsOut
,
k
*
nWordsOut
),
i
);
}
void
Extra_Transpose32
(
unsigned
a
[
32
]
)
{
int
j
,
k
;
...
...
@@ -2642,13 +2655,13 @@ void Extra_BitMatrixTransposeP( Vec_Wrd_t * vSimsIn, int nWordsIn, Vec_Wrd_t * v
assert
(
Vec_WrdSize
(
vSimsIn
)
==
Vec_WrdSize
(
vSimsOut
)
);
assert
(
Vec_WrdSize
(
vSimsIn
)
/
nWordsIn
==
64
*
nWordsOut
);
assert
(
Vec_WrdSize
(
vSimsOut
)
/
nWordsOut
==
64
*
nWordsIn
);
for
(
y
=
0
;
y
<
nWordsIn
;
y
++
)
for
(
x
=
0
;
x
<
nWordsOut
;
x
++
)
for
(
y
=
0
;
y
<
nWordsIn
;
y
++
)
{
for
(
i
=
0
;
i
<
64
;
i
++
)
{
pM
[
i
]
=
Vec_WrdEntryP
(
vSimsOut
,
(
64
*
y
+
i
)
*
nWordsOut
+
x
);
pM
[
i
][
0
]
=
Vec_WrdEntry
(
vSimsIn
,
(
64
*
x
+
i
)
*
nWordsIn
+
y
);
pM
[
i
]
=
Vec_WrdEntryP
(
vSimsOut
,
(
64
*
y
+
63
-
i
)
*
nWordsOut
+
x
);
pM
[
i
][
0
]
=
Vec_WrdEntry
(
vSimsIn
,
(
64
*
x
+
63
-
i
)
*
nWordsIn
+
y
);
}
Extra_Transpose64p
(
pM
);
}
...
...
@@ -2657,8 +2670,8 @@ void Extra_BitMatrixTransposePP( Vec_Ptr_t * vSimsIn, int nWordsIn, Vec_Wrd_t *
{
word
*
pM
[
64
];
int
i
,
y
,
x
;
assert
(
Vec_WrdSize
(
vSimsOut
)
/
nWordsOut
==
64
*
nWordsIn
);
for
(
y
=
0
;
y
<
nWordsIn
;
y
++
)
for
(
x
=
0
;
x
<
nWordsOut
;
x
++
)
for
(
y
=
0
;
y
<
nWordsIn
;
y
++
)
{
for
(
i
=
0
;
i
<
64
;
i
++
)
{
...
...
@@ -2668,51 +2681,51 @@ void Extra_BitMatrixTransposePP( Vec_Ptr_t * vSimsIn, int nWordsIn, Vec_Wrd_t *
Extra_Transpose64p
(
pM
);
}
}
void
Extra_BitMatrixTransposeTest
()
{
int
nWordsIn
=
1
;
int
nWordsOut
=
2
;
int
i
,
k
,
nItems
=
64
*
nWordsIn
*
nWordsOut
;
Vec_Wrd_t
*
vSimsIn
=
Vec_WrdStart
(
nItems
);
Vec_Wrd_t
*
vSimsOut
=
Vec_WrdStart
(
nItems
);
Abc_RandomW
(
1
);
for
(
i
=
0
;
i
<
nItems
;
i
++
)
Vec_WrdWriteEntry
(
vSimsIn
,
i
,
Abc_RandomW
(
0
)
);
Extra_BitMatrixTransposeP
(
vSimsIn
,
nWordsIn
,
vSimsOut
,
nWordsOut
);
nItems
=
Vec_WrdSize
(
vSimsIn
)
/
nWordsIn
;
for
(
i
=
0
;
i
<
nItems
;
i
++
)
void
Extra_BitMatrixShow
(
Vec_Wrd_t
*
vSims
,
int
nWords
)
{
int
i
,
k
,
nBits
=
Vec_WrdSize
(
vSims
)
/
nWords
;
for
(
i
=
0
;
i
<
nBits
;
i
++
)
{
if
(
i
%
64
==
0
)
Abc_Print
(
1
,
"
\n
"
);
for
(
k
=
0
;
k
<
nWords
In
;
k
++
)
for
(
k
=
0
;
k
<
nWords
;
k
++
)
{
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
Vec_WrdEntryP
(
vSimsIn
,
i
*
nWordsIn
+
k
),
64
);
Extra_PrintBinary
2
(
stdout
,
(
unsigned
*
)
Vec_WrdEntryP
(
vSims
,
i
*
nWords
+
k
),
64
);
Abc_Print
(
1
,
" "
);
}
Abc_Print
(
1
,
"
\n
"
);
}
Abc_Print
(
1
,
"
\n
"
);
}
void
Extra_BitMatrixTransposeTest
()
{
abctime
clk
=
Abc_Clock
();
nItems
=
Vec_WrdSize
(
vSimsOut
)
/
nWordsOut
;
for
(
i
=
0
;
i
<
nItems
;
i
++
)
{
if
(
i
%
64
==
0
)
Abc_Print
(
1
,
"
\n
"
);
for
(
k
=
0
;
k
<
nWordsOut
;
k
++
)
{
Extra_PrintBinary
(
stdout
,
(
unsigned
*
)
Vec_WrdEntryP
(
vSimsOut
,
i
*
nWordsOut
+
k
),
64
);
Abc_Print
(
1
,
" "
);
}
Abc_Print
(
1
,
"
\n
"
);
}
Abc_Print
(
1
,
"
\n
"
);
int
nWordsIn
=
100
;
int
nWordsOut
=
200
;
int
nItems
=
64
*
nWordsIn
*
nWordsOut
;
Vec_Wrd_t
*
vSimsIn
=
Vec_WrdStartRandom
(
nItems
);
Vec_Wrd_t
*
vSimsOut
=
Vec_WrdStart
(
nItems
);
Vec_Wrd_t
*
vSimsOut2
=
Vec_WrdStart
(
nItems
);
Extra_BitMatrixTransposeP
(
vSimsIn
,
nWordsIn
,
vSimsOut
,
nWordsOut
);
Extra_BitMatrixTransposeSimple
(
vSimsIn
,
nWordsIn
,
vSimsOut2
,
nWordsOut
);
if
(
memcmp
(
Vec_WrdArray
(
vSimsOut
),
Vec_WrdArray
(
vSimsOut2
),
sizeof
(
word
)
*
Vec_WrdSize
(
vSimsOut
)
)
)
printf
(
"Verification failed.
\n
"
);
else
printf
(
"Verification succeeded.
\n
"
);
//Extra_BitMatrixShow( vSimsIn, nWordsIn );
//Extra_BitMatrixShow( vSimsOut, nWordsOut );
//Extra_BitMatrixShow( vSimsOut2, nWordsOut );
Vec_WrdFree
(
vSimsIn
);
Vec_WrdFree
(
vSimsOut
);
Vec_WrdFree
(
vSimsOut2
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
}
////////////////////////////////////////////////////////////////////////
...
...
src/misc/util/utilTruth.h
View file @
c7bc6b63
...
...
@@ -1842,6 +1842,16 @@ static inline int Abc_TtCountOnesVecXor( word * x, word * y, int nWords )
Count
+=
Abc_TtCountOnes
(
x
[
w
]
^
y
[
w
]
);
return
Count
;
}
static
inline
int
Abc_TtAndXorSum
(
word
*
pOut
,
word
*
pIn1
,
word
*
pIn2
,
int
nWords
)
{
int
w
,
Count
=
0
;
for
(
w
=
0
;
w
<
nWords
;
w
++
)
{
pOut
[
w
]
&=
pIn1
[
w
]
^
pIn2
[
w
];
Count
+=
Abc_TtCountOnes
(
pOut
[
w
]
);
}
return
Count
;
}
/**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