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
d4f073ba
Commit
d4f073ba
authored
Oct 22, 2021
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various changes.
parent
abc54a2d
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
127 additions
and
35 deletions
+127
-35
src/aig/gia/gia.h
+7
-0
src/aig/gia/giaMan.c
+1
-0
src/aig/gia/giaPat2.c
+0
-0
src/aig/gia/giaSimBase.c
+78
-0
src/aig/gia/giaStoch.c
+0
-20
src/base/acb/acbFunc.c
+2
-0
src/misc/util/utilTruth.h
+15
-15
src/misc/vec/vecPtr.h
+20
-0
src/misc/vec/vecWrd.h
+4
-0
No files found.
src/aig/gia/gia.h
View file @
d4f073ba
...
...
@@ -217,6 +217,7 @@ struct Gia_Man_t_
Vec_Int_t
*
vClassOld
;
Vec_Int_t
*
vClassNew
;
Vec_Int_t
*
vPats
;
Vec_Bit_t
*
vPolars
;
// incremental simulation
int
fIncrSim
;
int
iNextPi
;
...
...
@@ -1592,6 +1593,12 @@ extern int Gia_ManIncrSimCheckEqual( Gia_Man_t * p, int iLit0, i
/*=== giaSimBase.c ============================================================*/
extern
Vec_Wrd_t
*
Gia_ManSimPatSim
(
Gia_Man_t
*
p
);
extern
Vec_Wrd_t
*
Gia_ManSimPatSimOut
(
Gia_Man_t
*
pGia
,
Vec_Wrd_t
*
vSimsPi
,
int
fOuts
);
extern
void
Gia_ManSim2ArrayOne
(
Vec_Wrd_t
*
vSimsPi
,
Vec_Int_t
*
vRes
);
extern
Vec_Wec_t
*
Gia_ManSim2Array
(
Vec_Ptr_t
*
vSims
);
extern
Vec_Wrd_t
*
Gia_ManArray2SimOne
(
Vec_Int_t
*
vRes
);
extern
Vec_Ptr_t
*
Gia_ManArray2Sim
(
Vec_Wec_t
*
vRes
);
extern
void
Gia_ManPtrWrdDumpBin
(
char
*
pFileName
,
Vec_Ptr_t
*
p
,
int
fVerbose
);
extern
Vec_Ptr_t
*
Gia_ManPtrWrdReadBin
(
char
*
pFileName
,
int
fVerbose
);
/*=== giaSpeedup.c ============================================================*/
extern
float
Gia_ManDelayTraceLut
(
Gia_Man_t
*
p
);
extern
float
Gia_ManDelayTraceLutPrint
(
Gia_Man_t
*
p
,
int
fVerbose
);
...
...
src/aig/gia/giaMan.c
View file @
d4f073ba
...
...
@@ -95,6 +95,7 @@ void Gia_ManStop( Gia_Man_t * p )
Vec_IntFreeP
(
&
p
->
vClassNew
);
Vec_IntFreeP
(
&
p
->
vClassOld
);
Vec_IntFreeP
(
&
p
->
vPats
);
Vec_BitFreeP
(
&
p
->
vPolars
);
Vec_WrdFreeP
(
&
p
->
vSims
);
Vec_WrdFreeP
(
&
p
->
vSimsT
);
Vec_WrdFreeP
(
&
p
->
vSimsPi
);
...
...
src/aig/gia/giaPat2.c
View file @
d4f073ba
This diff is collapsed.
Click to expand it.
src/aig/gia/giaSimBase.c
View file @
d4f073ba
...
...
@@ -2622,6 +2622,84 @@ void Gia_ManSimArrayTest( Vec_Wrd_t * vSimsPi )
}
Vec_PtrFree
(
vTemp
);
}
/**Function*************************************************************
Synopsis [Serialization.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Gia_ManPtrWrdDumpBin
(
char
*
pFileName
,
Vec_Ptr_t
*
p
,
int
fVerbose
)
{
Vec_Wrd_t
*
vLevel
;
int
i
,
nSize
,
RetValue
;
FILE
*
pFile
=
fopen
(
pFileName
,
"wb"
);
if
(
pFile
==
NULL
)
{
printf
(
"Cannot open file
\"
%s
\"
for writing.
\n
"
,
pFileName
);
return
;
}
nSize
=
Vec_PtrSize
(
p
);
RetValue
=
fwrite
(
&
nSize
,
1
,
sizeof
(
int
),
pFile
);
Vec_PtrForEachEntry
(
Vec_Wrd_t
*
,
p
,
vLevel
,
i
)
{
nSize
=
Vec_WrdSize
(
vLevel
);
RetValue
+=
fwrite
(
&
nSize
,
1
,
sizeof
(
int
),
pFile
);
RetValue
+=
fwrite
(
Vec_WrdArray
(
vLevel
),
1
,
sizeof
(
word
)
*
nSize
,
pFile
);
}
fclose
(
pFile
);
if
(
fVerbose
)
printf
(
"Written %d arrays into file
\"
%s
\"
.
\n
"
,
Vec_PtrSize
(
p
),
pFileName
);
}
Vec_Ptr_t
*
Gia_ManPtrWrdReadBin
(
char
*
pFileName
,
int
fVerbose
)
{
Vec_Ptr_t
*
p
=
NULL
;
Vec_Wrd_t
*
vLevel
;
int
i
,
nSize
,
RetValue
;
FILE
*
pFile
=
fopen
(
pFileName
,
"rb"
);
if
(
pFile
==
NULL
)
{
printf
(
"Cannot open file
\"
%s
\"
for reading.
\n
"
,
pFileName
);
return
NULL
;
}
fseek
(
pFile
,
0
,
SEEK_END
);
nSize
=
ftell
(
pFile
);
if
(
nSize
==
0
)
{
printf
(
"The input file is empty.
\n
"
);
fclose
(
pFile
);
return
NULL
;
}
if
(
nSize
%
(
int
)
sizeof
(
int
)
>
0
)
{
printf
(
"Cannot read file with integers because it is not aligned at 4 bytes (remainder = %d).
\n
"
,
nSize
%
(
int
)
sizeof
(
int
)
);
fclose
(
pFile
);
return
NULL
;
}
rewind
(
pFile
);
RetValue
=
fread
(
&
nSize
,
1
,
sizeof
(
int
),
pFile
);
assert
(
RetValue
==
4
);
p
=
Vec_PtrAlloc
(
nSize
);
for
(
i
=
0
;
i
<
nSize
;
i
++
)
Vec_PtrPush
(
p
,
Vec_WrdAlloc
(
100
)
);
Vec_PtrForEachEntry
(
Vec_Wrd_t
*
,
p
,
vLevel
,
i
)
{
RetValue
=
fread
(
&
nSize
,
1
,
sizeof
(
int
),
pFile
);
assert
(
RetValue
==
4
);
Vec_WrdFill
(
vLevel
,
nSize
,
0
);
RetValue
=
fread
(
Vec_WrdArray
(
vLevel
),
1
,
sizeof
(
word
)
*
nSize
,
pFile
);
assert
(
RetValue
==
8
*
nSize
);
}
fclose
(
pFile
);
if
(
fVerbose
)
printf
(
"Read %d arrays from file
\"
%s
\"
.
\n
"
,
Vec_PtrSize
(
p
),
pFileName
);
return
p
;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...
...
src/aig/gia/giaStoch.c
View file @
d4f073ba
...
...
@@ -43,26 +43,6 @@ ABC_NAMESPACE_IMPL_START
SeeAlso []
***********************************************************************/
static
void
Vec_PtrFreeFunc
(
Vec_Ptr_t
*
p
,
void
(
*
pFuncItemFree
)(
void
*
)
)
___unused
;
static
void
Vec_PtrFreeFunc
(
Vec_Ptr_t
*
p
,
void
(
*
pFuncItemFree
)(
void
*
)
)
{
void
*
pItem
;
int
i
;
Vec_PtrForEachEntry
(
void
*
,
p
,
pItem
,
i
)
pFuncItemFree
(
pItem
);
Vec_PtrFree
(
p
);
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Gia_ManDupMapping
(
Gia_Man_t
*
pNew
,
Gia_Man_t
*
p
)
{
Gia_Obj_t
*
pObj
,
*
pFanin
;
int
i
,
k
;
...
...
src/base/acb/acbFunc.c
View file @
d4f073ba
...
...
@@ -506,6 +506,7 @@ Gia_Man_t * Gia_FileSimpleParse( Vec_Int_t * vBuffer, Abc_Nam_t * pNames, int fN
// create names
if
(
fNames
)
{
pNew
->
vPolars
=
Vec_BitStart
(
Gia_ManObjNum
(
pNew
)
);
pNew
->
vNamesNode
=
Vec_PtrStart
(
Gia_ManObjNum
(
pNew
)
);
Vec_IntForEachEntry
(
vMap
,
iLit
,
Token
)
{
...
...
@@ -514,6 +515,7 @@ Gia_Man_t * Gia_FileSimpleParse( Vec_Int_t * vBuffer, Abc_Nam_t * pNames, int fN
sprintf
(
Buffer
,
"%c_%s"
,
Abc_LitIsCompl
(
iLit
)
?
'c'
:
'd'
,
Abc_NamStr
(
pNames
,
Token
)
);
assert
(
Vec_PtrEntry
(
pNew
->
vNamesNode
,
Abc_Lit2Var
(
iLit
))
==
NULL
);
Vec_PtrWriteEntry
(
pNew
->
vNamesNode
,
Abc_Lit2Var
(
iLit
),
Abc_UtilStrsav
(
Buffer
)
);
Vec_BitWriteEntry
(
pNew
->
vPolars
,
Abc_Lit2Var
(
iLit
),
Abc_LitIsCompl
(
iLit
)
);
}
}
else
...
...
src/misc/util/utilTruth.h
View file @
d4f073ba
...
...
@@ -2106,12 +2106,15 @@ static inline int Abc_TtCountOnes( word x )
x
=
x
+
(
x
>>
32
);
return
(
int
)(
x
&
0xFF
);
}
static
inline
int
Abc_TtCountOnes2
(
word
x
)
{
return
x
?
Abc_TtCountOnes
(
x
)
:
0
;
}
static
inline
int
Abc_TtCountOnesVec
(
word
*
x
,
int
nWords
)
{
int
w
,
Count
=
0
;
for
(
w
=
0
;
w
<
nWords
;
w
++
)
if
(
x
[
w
]
)
Count
+=
Abc_TtCountOnes
(
x
[
w
]
);
Count
+=
Abc_TtCountOnes2
(
x
[
w
]
);
return
Count
;
}
static
inline
int
Abc_TtCountOnesVecMask
(
word
*
x
,
word
*
pMask
,
int
nWords
,
int
fCompl
)
...
...
@@ -2120,14 +2123,12 @@ static inline int Abc_TtCountOnesVecMask( word * x, word * pMask, int nWords, in
if
(
fCompl
)
{
for
(
w
=
0
;
w
<
nWords
;
w
++
)
if
(
pMask
[
w
]
&
~
x
[
w
]
)
Count
+=
Abc_TtCountOnes
(
pMask
[
w
]
&
~
x
[
w
]
);
Count
+=
Abc_TtCountOnes2
(
pMask
[
w
]
&
~
x
[
w
]
);
}
else
{
for
(
w
=
0
;
w
<
nWords
;
w
++
)
if
(
pMask
[
w
]
&
x
[
w
]
)
Count
+=
Abc_TtCountOnes
(
pMask
[
w
]
&
x
[
w
]
);
Count
+=
Abc_TtCountOnes2
(
pMask
[
w
]
&
x
[
w
]
);
}
return
Count
;
}
...
...
@@ -2136,24 +2137,23 @@ static inline int Abc_TtCountOnesVecMask2( word * x0, word * x1, int fComp0, int
int
w
,
Count
=
0
;
if
(
!
fComp0
&&
!
fComp1
)
for
(
w
=
0
;
w
<
nWords
;
w
++
)
Count
+=
Abc_TtCountOnes
(
pMask
[
w
]
&
x0
[
w
]
&
x1
[
w
]
);
Count
+=
Abc_TtCountOnes
2
(
pMask
[
w
]
&
x0
[
w
]
&
x1
[
w
]
);
else
if
(
fComp0
&&
!
fComp1
)
for
(
w
=
0
;
w
<
nWords
;
w
++
)
Count
+=
Abc_TtCountOnes
(
pMask
[
w
]
&
~
x0
[
w
]
&
x1
[
w
]
);
Count
+=
Abc_TtCountOnes
2
(
pMask
[
w
]
&
~
x0
[
w
]
&
x1
[
w
]
);
else
if
(
!
fComp0
&&
fComp1
)
for
(
w
=
0
;
w
<
nWords
;
w
++
)
Count
+=
Abc_TtCountOnes
(
pMask
[
w
]
&
x0
[
w
]
&
~
x1
[
w
]
);
Count
+=
Abc_TtCountOnes
2
(
pMask
[
w
]
&
x0
[
w
]
&
~
x1
[
w
]
);
else
for
(
w
=
0
;
w
<
nWords
;
w
++
)
Count
+=
Abc_TtCountOnes
(
pMask
[
w
]
&
~
x0
[
w
]
&
~
x1
[
w
]
);
Count
+=
Abc_TtCountOnes
2
(
pMask
[
w
]
&
~
x0
[
w
]
&
~
x1
[
w
]
);
return
Count
;
}
static
inline
int
Abc_TtCountOnesVecXor
(
word
*
x
,
word
*
y
,
int
nWords
)
{
int
w
,
Count
=
0
;
for
(
w
=
0
;
w
<
nWords
;
w
++
)
if
(
x
[
w
]
^
y
[
w
]
)
Count
+=
Abc_TtCountOnes
(
x
[
w
]
^
y
[
w
]
);
Count
+=
Abc_TtCountOnes2
(
x
[
w
]
^
y
[
w
]
);
return
Count
;
}
static
inline
int
Abc_TtCountOnesVecXorMask
(
word
*
x
,
word
*
y
,
int
fCompl
,
word
*
pMask
,
int
nWords
)
...
...
@@ -2161,10 +2161,10 @@ static inline int Abc_TtCountOnesVecXorMask( word * x, word * y, int fCompl, wor
int
w
,
Count
=
0
;
if
(
fCompl
)
for
(
w
=
0
;
w
<
nWords
;
w
++
)
Count
+=
Abc_TtCountOnes
(
pMask
[
w
]
&
(
x
[
w
]
^
~
y
[
w
])
);
Count
+=
Abc_TtCountOnes
2
(
pMask
[
w
]
&
(
x
[
w
]
^
~
y
[
w
])
);
else
for
(
w
=
0
;
w
<
nWords
;
w
++
)
Count
+=
Abc_TtCountOnes
(
pMask
[
w
]
&
(
x
[
w
]
^
y
[
w
])
);
Count
+=
Abc_TtCountOnes
2
(
pMask
[
w
]
&
(
x
[
w
]
^
y
[
w
])
);
return
Count
;
}
static
inline
int
Abc_TtAndXorSum
(
word
*
pOut
,
word
*
pIn1
,
word
*
pIn2
,
int
nWords
)
...
...
@@ -2173,7 +2173,7 @@ static inline int Abc_TtAndXorSum( word * pOut, word * pIn1, word * pIn2, int nW
for
(
w
=
0
;
w
<
nWords
;
w
++
)
{
pOut
[
w
]
&=
pIn1
[
w
]
^
pIn2
[
w
];
Count
+=
Abc_TtCountOnes
(
pOut
[
w
]
);
Count
+=
Abc_TtCountOnes
2
(
pOut
[
w
]
);
}
return
Count
;
}
...
...
src/misc/vec/vecPtr.h
View file @
d4f073ba
...
...
@@ -607,6 +607,26 @@ static inline void Vec_PtrFreeFree( Vec_Ptr_t * p )
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
void
Vec_PtrFreeFunc
(
Vec_Ptr_t
*
p
,
void
(
*
pFuncItemFree
)(
void
*
)
)
___unused
;
static
void
Vec_PtrFreeFunc
(
Vec_Ptr_t
*
p
,
void
(
*
pFuncItemFree
)(
void
*
)
)
{
void
*
pItem
;
int
i
;
Vec_PtrForEachEntry
(
void
*
,
p
,
pItem
,
i
)
if
(
pItem
)
pFuncItemFree
(
pItem
);
Vec_PtrFree
(
p
);
}
/**Function*************************************************************
Synopsis [Copies the interger array.]
Description []
...
...
src/misc/vec/vecWrd.h
View file @
d4f073ba
...
...
@@ -382,6 +382,10 @@ static inline int Vec_WrdSize( Vec_Wrd_t * p )
{
return
p
->
nSize
;
}
static
inline
int
Vec_WrdChangeSize
(
Vec_Wrd_t
*
p
,
int
Shift
)
{
return
p
->
nSize
+=
Shift
;
}
/**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