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
8c8f39ad
Commit
8c8f39ad
authored
Jan 27, 2020
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding several new utilities.
parent
8eb6aed5
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
111 additions
and
2 deletions
+111
-2
src/aig/gia/giaSim.c
+4
-2
src/misc/util/utilTruth.h
+102
-0
src/misc/vec/vecWec.h
+5
-0
No files found.
src/aig/gia/giaSim.c
View file @
8c8f39ad
...
@@ -1685,7 +1685,7 @@ word * Gia_SimRsbFunc( Gia_SimRsbMan_t * p, int iObj, Vec_Int_t * vFanins, int f
...
@@ -1685,7 +1685,7 @@ word * Gia_SimRsbFunc( Gia_SimRsbMan_t * p, int iObj, Vec_Int_t * vFanins, int f
pFanins
[
i
]
=
Vec_WrdEntryP
(
p
->
vSimsObj
,
p
->
nWords
*
iFanin
);
pFanins
[
i
]
=
Vec_WrdEntryP
(
p
->
vSimsObj
,
p
->
nWords
*
iFanin
);
for
(
s
=
0
;
s
<
64
*
p
->
nWords
;
s
++
)
for
(
s
=
0
;
s
<
64
*
p
->
nWords
;
s
++
)
{
{
if
(
!
Abc_TtGetBit
(
p
->
pFunc
[
2
],
s
)
||
!
Abc_TtGetBit
(
pFunc
,
s
)
=
=
fOnSet
)
if
(
!
Abc_TtGetBit
(
p
->
pFunc
[
2
],
s
)
||
Abc_TtGetBit
(
pFunc
,
s
)
!
=
fOnSet
)
continue
;
continue
;
iMint
=
0
;
iMint
=
0
;
for
(
b
=
0
;
b
<
Vec_IntSize
(
vFanins
);
b
++
)
for
(
b
=
0
;
b
<
Vec_IntSize
(
vFanins
);
b
++
)
...
@@ -1846,6 +1846,7 @@ Extra_PrintBinary( stdout, (unsigned *)p->pFunc[1], 64 ); printf( "\n" );
...
@@ -1846,6 +1846,7 @@ Extra_PrintBinary( stdout, (unsigned *)p->pFunc[1], 64 ); printf( "\n" );
int
Gia_ManSimRsb
(
Gia_Man_t
*
pGia
,
int
nCands
,
int
fVerbose
)
int
Gia_ManSimRsb
(
Gia_Man_t
*
pGia
,
int
nCands
,
int
fVerbose
)
{
{
abctime
clk
=
Abc_Clock
();
Gia_Obj_t
*
pObj
;
int
iObj
,
nCount
=
0
,
nBufs
=
0
,
nInvs
=
0
;
Gia_Obj_t
*
pObj
;
int
iObj
,
nCount
=
0
,
nBufs
=
0
,
nInvs
=
0
;
Gia_SimRsbMan_t
*
p
=
Gia_SimRsbAlloc
(
pGia
);
Gia_SimRsbMan_t
*
p
=
Gia_SimRsbAlloc
(
pGia
);
assert
(
pGia
->
vSimsPi
!=
NULL
);
assert
(
pGia
->
vSimsPi
!=
NULL
);
...
@@ -1853,8 +1854,9 @@ int Gia_ManSimRsb( Gia_Man_t * pGia, int nCands, int fVerbose )
...
@@ -1853,8 +1854,9 @@ int Gia_ManSimRsb( Gia_Man_t * pGia, int nCands, int fVerbose )
Gia_ManForEachAnd
(
pGia
,
pObj
,
iObj
)
Gia_ManForEachAnd
(
pGia
,
pObj
,
iObj
)
//if ( iObj == 6 )
//if ( iObj == 6 )
nCount
+=
Gia_ObjSimRsb
(
p
,
iObj
,
nCands
,
fVerbose
,
&
nBufs
,
&
nInvs
);
nCount
+=
Gia_ObjSimRsb
(
p
,
iObj
,
nCands
,
fVerbose
,
&
nBufs
,
&
nInvs
);
printf
(
"
Resubstitution is possible for %d nodes (%.2f %% out of %d) (Bufs = %d Invs = %d)
\n
"
,
printf
(
"
Can resubstitute %d nodes (%.2f %% out of %d) (Bufs = %d Invs = %d)
"
,
nCount
,
100
.
0
*
nCount
/
Gia_ManAndNum
(
pGia
),
Gia_ManAndNum
(
pGia
),
nBufs
,
nInvs
);
nCount
,
100
.
0
*
nCount
/
Gia_ManAndNum
(
pGia
),
Gia_ManAndNum
(
pGia
),
nBufs
,
nInvs
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
Gia_SimRsbFree
(
p
);
Gia_SimRsbFree
(
p
);
return
nCount
;
return
nCount
;
}
}
...
...
src/misc/util/utilTruth.h
View file @
8c8f39ad
...
@@ -443,6 +443,108 @@ static inline void Abc_TtIthVar( word * pOut, int iVar, int nVars )
...
@@ -443,6 +443,108 @@ static inline void Abc_TtIthVar( word * pOut, int iVar, int nVars )
/**Function*************************************************************
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
int
Abc_TtIsAndCompl
(
word
*
pOut
,
int
fCompl
,
word
*
pIn1
,
int
fCompl1
,
word
*
pIn2
,
int
fCompl2
,
word
*
pCare
,
int
nWords
)
{
int
w
;
if
(
fCompl
)
{
if
(
fCompl1
)
{
if
(
fCompl2
)
{
for
(
w
=
0
;
w
<
nWords
;
w
++
)
if
(
(
~
pOut
[
w
]
&
pCare
[
w
])
!=
(
~
pIn1
[
w
]
&
~
pIn2
[
w
]
&
pCare
[
w
])
)
return
0
;
}
else
{
for
(
w
=
0
;
w
<
nWords
;
w
++
)
if
(
(
~
pOut
[
w
]
&
pCare
[
w
])
!=
(
~
pIn1
[
w
]
&
pIn2
[
w
]
&
pCare
[
w
])
)
return
0
;
}
}
else
{
if
(
fCompl2
)
{
for
(
w
=
0
;
w
<
nWords
;
w
++
)
if
(
(
~
pOut
[
w
]
&
pCare
[
w
])
!=
(
pIn1
[
w
]
&
~
pIn2
[
w
]
&
pCare
[
w
])
)
return
0
;
}
else
{
for
(
w
=
0
;
w
<
nWords
;
w
++
)
if
(
(
~
pOut
[
w
]
&
pCare
[
w
])
!=
(
pIn1
[
w
]
&
pIn2
[
w
]
&
pCare
[
w
])
)
return
0
;
}
}
}
else
{
if
(
fCompl1
)
{
if
(
fCompl2
)
{
for
(
w
=
0
;
w
<
nWords
;
w
++
)
if
(
(
pOut
[
w
]
&
pCare
[
w
])
!=
(
~
pIn1
[
w
]
&
~
pIn2
[
w
]
&
pCare
[
w
])
)
return
0
;
}
else
{
for
(
w
=
0
;
w
<
nWords
;
w
++
)
if
(
(
pOut
[
w
]
&
pCare
[
w
])
!=
(
~
pIn1
[
w
]
&
pIn2
[
w
]
&
pCare
[
w
])
)
return
0
;
}
}
else
{
if
(
fCompl2
)
{
for
(
w
=
0
;
w
<
nWords
;
w
++
)
if
(
(
pOut
[
w
]
&
pCare
[
w
])
!=
(
pIn1
[
w
]
&
~
pIn2
[
w
]
&
pCare
[
w
])
)
return
0
;
}
else
{
for
(
w
=
0
;
w
<
nWords
;
w
++
)
if
(
(
pOut
[
w
]
&
pCare
[
w
])
!=
(
pIn1
[
w
]
&
pIn2
[
w
]
&
pCare
[
w
])
)
return
0
;
}
}
}
return
1
;
}
static
inline
int
Abc_TtIsXorCompl
(
word
*
pOut
,
int
fCompl
,
word
*
pIn1
,
word
*
pIn2
,
word
*
pCare
,
int
nWords
)
{
int
w
;
if
(
fCompl
)
{
for
(
w
=
0
;
w
<
nWords
;
w
++
)
if
(
(
~
pOut
[
w
]
&
pCare
[
w
])
!=
((
pIn1
[
w
]
^
pIn2
[
w
])
&
pCare
[
w
])
)
return
0
;
}
else
{
for
(
w
=
0
;
w
<
nWords
;
w
++
)
if
(
(
pOut
[
w
]
&
pCare
[
w
])
!=
((
pIn1
[
w
]
^
pIn2
[
w
])
&
pCare
[
w
])
)
return
0
;
}
return
1
;
}
/**Function*************************************************************
Synopsis [Compares Cof0 and Cof1.]
Synopsis [Compares Cof0 and Cof1.]
Description []
Description []
...
...
src/misc/vec/vecWec.h
View file @
8c8f39ad
...
@@ -68,6 +68,8 @@ struct Vec_Wec_t_
...
@@ -68,6 +68,8 @@ struct Vec_Wec_t_
for ( i = LevelStart-1; (i >= LevelStop) && (((vVec) = Vec_WecEntry(vGlob, i)), 1); i-- )
for ( i = LevelStart-1; (i >= LevelStop) && (((vVec) = Vec_WecEntry(vGlob, i)), 1); i-- )
#define Vec_WecForEachLevelTwo( vGlob1, vGlob2, vVec1, vVec2, i ) \
#define Vec_WecForEachLevelTwo( vGlob1, vGlob2, vVec1, vVec2, i ) \
for ( i = 0; (i < Vec_WecSize(vGlob1)) && (((vVec1) = Vec_WecEntry(vGlob1, i)), 1) && (((vVec2) = Vec_WecEntry(vGlob2, i)), 1); i++ )
for ( i = 0; (i < Vec_WecSize(vGlob1)) && (((vVec1) = Vec_WecEntry(vGlob1, i)), 1) && (((vVec2) = Vec_WecEntry(vGlob2, i)), 1); i++ )
#define Vec_WecForEachLevelDouble( vGlob, vVec1, vVec2, i ) \
for ( i = 0; (i < Vec_WecSize(vGlob)) && (((vVec1) = Vec_WecEntry(vGlob, i)), 1) && (((vVec2) = Vec_WecEntry(vGlob, i+1)), 1); i += 2 )
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
/// FUNCTION DEFINITIONS ///
...
@@ -247,6 +249,9 @@ static inline int Vec_WecSizeUsedLimits( Vec_Wec_t * p, int iStart, int iStop )
...
@@ -247,6 +249,9 @@ static inline int Vec_WecSizeUsedLimits( Vec_Wec_t * p, int iStart, int iStop )
***********************************************************************/
***********************************************************************/
static
inline
void
Vec_WecShrink
(
Vec_Wec_t
*
p
,
int
nSizeNew
)
static
inline
void
Vec_WecShrink
(
Vec_Wec_t
*
p
,
int
nSizeNew
)
{
{
Vec_Int_t
*
vVec
;
int
i
;
Vec_WecForEachLevelStart
(
p
,
vVec
,
i
,
nSizeNew
)
Vec_IntShrink
(
vVec
,
0
);
assert
(
p
->
nSize
>=
nSizeNew
);
assert
(
p
->
nSize
>=
nSizeNew
);
p
->
nSize
=
nSizeNew
;
p
->
nSize
=
nSizeNew
;
}
}
...
...
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