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
d9aeaade
Commit
d9aeaade
authored
Jul 15, 2021
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Several unrelated changes.
parent
3e67d167
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
180 additions
and
3 deletions
+180
-3
src/aig/gia/giaMinLut.c
+0
-1
src/aig/gia/giaResub2.c
+13
-2
src/aig/gia/giaSim.c
+100
-0
src/base/wlc/wlc.c
+67
-0
No files found.
src/aig/gia/giaMinLut.c
View file @
d9aeaade
...
...
@@ -136,7 +136,6 @@ Gia_Man_t * Vec_WrdReadTest( char * pFileName )
Gia_Man_t
*
pPart
,
*
pNew
=
NULL
;
Gia_Obj_t
*
pObj
;
int
i
,
k
,
nIns
,
nOuts
,
iLit
;
Vec_Wec_t
*
vRes
=
Vec_WrdReadLayerText
(
pFileName
,
&
nIns
,
&
nOuts
);
int
nFiles
=
vRes
?
Vec_WecSize
(
vRes
)
:
0
;
int
nBitsI
=
vRes
?
Vec_WecMaxLevelSize
(
vRes
)
:
0
;
int
nBitsO
=
vRes
?
nOuts
/
Vec_WecSize
(
vRes
)
:
0
;
word
*
pFuncs
=
vRes
?
Vec_WrdReadTruthText
(
pFileName
,
nBitsI
,
nBitsO
,
Vec_WecSize
(
vRes
)
)
:
NULL
;
...
...
src/aig/gia/giaResub2.c
View file @
d9aeaade
...
...
@@ -1116,13 +1116,24 @@ int Gia_RsbFindFaninToAddToCut( Gia_Man_t * p, Vec_Int_t * vIns )
assert
(
nFanins
<
64
);
}
// find fanin with the highest count
if
(
p
->
vFanoutNums
!=
NULL
)
{
for
(
i
=
0
;
i
<
nFanins
;
i
++
)
// if ( CountMax < pFaninCounts[i] )
if
(
CountMax
<
pFaninCounts
[
i
]
||
(
CountMax
==
pFaninCounts
[
i
]
&&
(
Gia_ObjFanoutNumId
(
p
,
iFanMax
)
<
Gia_ObjFanoutNumId
(
p
,
pFanins
[
i
])))
)
{
CountMax
=
pFaninCounts
[
i
];
iFanMax
=
pFanins
[
i
];
}
}
else
{
for
(
i
=
0
;
i
<
nFanins
;
i
++
)
if
(
CountMax
<
pFaninCounts
[
i
]
||
(
CountMax
==
pFaninCounts
[
i
]
&&
(
Gia_ObjRefNumId
(
p
,
iFanMax
)
<
Gia_ObjRefNumId
(
p
,
pFanins
[
i
])))
)
{
CountMax
=
pFaninCounts
[
i
];
iFanMax
=
pFanins
[
i
];
}
}
return
iFanMax
;
}
// precondition: nodes in vWin and in vIns are marked with the current ID
...
...
@@ -1167,7 +1178,7 @@ void Gia_RsbWindowGrow2( Gia_Man_t * p, int iObj, Vec_Wec_t * vLevels, Vec_Int_t
else
assert
(
Vec_IntSize
(
vIns
)
>
nInputsMax
);
}
if
(
Vec_IntSize
(
vIns
)
<=
nInputsMax
)
if
(
vLevels
&&
Vec_IntSize
(
vIns
)
<=
nInputsMax
)
{
Vec_IntSort
(
vIns
,
0
);
Gia_WinCreateFromCut
(
p
,
iObj
,
vIns
,
vLevels
,
vWin
);
...
...
src/aig/gia/giaSim.c
View file @
d9aeaade
...
...
@@ -1222,6 +1222,106 @@ int Gia_ManIncrSimCheckEqual( Gia_Man_t * p, int iLit0, int iLit1 )
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Gia_ManSimOneBit
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vValues
)
{
Gia_Obj_t
*
pObj
;
int
k
;
assert
(
Vec_IntSize
(
vValues
)
==
Gia_ManCiNum
(
p
)
);
Gia_ManConst0
(
p
)
->
fMark0
=
0
;
Gia_ManForEachCi
(
p
,
pObj
,
k
)
pObj
->
fMark0
=
Vec_IntEntry
(
vValues
,
k
);
Gia_ManForEachAnd
(
p
,
pObj
,
k
)
pObj
->
fMark0
=
(
Gia_ObjFanin0
(
pObj
)
->
fMark0
^
Gia_ObjFaninC0
(
pObj
))
&
(
Gia_ObjFanin1
(
pObj
)
->
fMark0
^
Gia_ObjFaninC1
(
pObj
));
Gia_ManForEachCo
(
p
,
pObj
,
k
)
pObj
->
fMark0
=
Gia_ObjFanin0
(
pObj
)
->
fMark0
^
Gia_ObjFaninC0
(
pObj
);
Gia_ManForEachCo
(
p
,
pObj
,
k
)
printf
(
"%d"
,
k
%
10
);
printf
(
"
\n
"
);
Gia_ManForEachCo
(
p
,
pObj
,
k
)
printf
(
"%d"
,
pObj
->
fMark0
);
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
void
Gia_ManSimOneBitTest2
(
Gia_Man_t
*
p
)
{
Vec_Int_t
*
vValues
=
Vec_IntStart
(
Gia_ManCiNum
(
p
)
);
Vec_IntWriteEntry
(
vValues
,
0
,
1
);
Gia_ManSimOneBit
(
p
,
vValues
);
Vec_IntFill
(
vValues
,
Vec_IntSize
(
vValues
),
0
);
Vec_IntWriteEntry
(
vValues
,
0
,
1
);
Vec_IntWriteEntry
(
vValues
,
Gia_ManCiNum
(
p
)
/
2
,
1
);
Gia_ManSimOneBit
(
p
,
vValues
);
Vec_IntFill
(
vValues
,
Vec_IntSize
(
vValues
),
0
);
Vec_IntWriteEntry
(
vValues
,
0
,
1
);
Vec_IntWriteEntry
(
vValues
,
1
,
1
);
Vec_IntWriteEntry
(
vValues
,
Gia_ManCiNum
(
p
)
/
2
+
2
,
1
);
Gia_ManSimOneBit
(
p
,
vValues
);
Vec_IntFill
(
vValues
,
Vec_IntSize
(
vValues
),
0
);
Vec_IntWriteEntry
(
vValues
,
0
,
1
);
Vec_IntWriteEntry
(
vValues
,
1
,
1
);
Vec_IntWriteEntry
(
vValues
,
Gia_ManCiNum
(
p
)
/
2
,
1
);
Gia_ManSimOneBit
(
p
,
vValues
);
Vec_IntFill
(
vValues
,
Vec_IntSize
(
vValues
),
0
);
Vec_IntFill
(
vValues
,
Vec_IntSize
(
vValues
)
/
2
,
1
);
Vec_IntFillExtra
(
vValues
,
Gia_ManCiNum
(
p
),
0
);
Gia_ManSimOneBit
(
p
,
vValues
);
Vec_IntFill
(
vValues
,
Gia_ManCiNum
(
p
),
0
);
Vec_IntFill
(
vValues
,
Gia_ManCiNum
(
p
),
1
);
Gia_ManSimOneBit
(
p
,
vValues
);
Vec_IntFill
(
vValues
,
Gia_ManCiNum
(
p
),
0
);
Vec_IntFill
(
vValues
,
Gia_ManCiNum
(
p
),
1
);
Vec_IntWriteEntry
(
vValues
,
127
,
1
);
Vec_IntWriteEntry
(
vValues
,
255
,
0
);
Gia_ManSimOneBit
(
p
,
vValues
);
Vec_IntFill
(
vValues
,
Gia_ManCiNum
(
p
),
0
);
Vec_IntFill
(
vValues
,
Gia_ManCiNum
(
p
),
1
);
Vec_IntWriteEntry
(
vValues
,
127
,
0
);
Vec_IntWriteEntry
(
vValues
,
255
,
1
);
Gia_ManSimOneBit
(
p
,
vValues
);
Vec_IntFill
(
vValues
,
Gia_ManCiNum
(
p
),
0
);
Vec_IntFill
(
vValues
,
Gia_ManCiNum
(
p
),
1
);
Vec_IntWriteEntry
(
vValues
,
127
,
0
);
Vec_IntWriteEntry
(
vValues
,
255
,
0
);
Gia_ManSimOneBit
(
p
,
vValues
);
Vec_IntFill
(
vValues
,
Gia_ManCiNum
(
p
),
0
);
Vec_IntFree
(
vValues
);
}
void
Gia_ManSimOneBitTest
(
Gia_Man_t
*
p
)
{
Vec_Int_t
*
vValues
=
Vec_IntStart
(
Gia_ManCiNum
(
p
)
);
int
i
,
k
;
for
(
i
=
0
;
i
<
10
;
i
++
)
{
for
(
k
=
0
;
k
<
Vec_IntSize
(
vValues
);
k
++
)
Vec_IntWriteEntry
(
vValues
,
k
,
Vec_IntEntry
(
vValues
,
k
)
^
(
rand
()
&
1
)
);
printf
(
"Values = %d "
,
Vec_IntSum
(
vValues
)
);
Gia_ManSimOneBit
(
p
,
vValues
);
}
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
...
...
src/base/wlc/wlc.c
View file @
d9aeaade
...
...
@@ -265,6 +265,73 @@ void Wlc_BlastMultiplierCnfTest( int nBits )
sat_solver_delete
(
pSat
);
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Int_t
*
Wlc_ManGenAdderN
(
Gia_Man_t
*
p
,
int
nLits
,
int
*
pLitsA
,
int
*
pLitsB
,
int
Carry
)
{
extern
void
Wlc_BlastFullAdder
(
Gia_Man_t
*
pNew
,
int
a
,
int
b
,
int
c
,
int
*
pc
,
int
*
ps
);
Vec_Int_t
*
vRes
=
Vec_IntStart
(
nLits
+
1
);
int
i
,
*
pRes
=
Vec_IntArray
(
vRes
);
for
(
i
=
0
;
i
<
nLits
;
i
++
)
Wlc_BlastFullAdder
(
p
,
pLitsA
[
i
],
pLitsB
[
i
],
Carry
,
&
Carry
,
&
pRes
[
i
]
);
pRes
[
nLits
]
=
Carry
;
return
vRes
;
}
Vec_Int_t
*
Wlc_ManGenAdder_rec
(
Gia_Man_t
*
p
,
int
nLits
,
int
*
pLitsA
,
int
*
pLitsB
,
int
Carry
,
int
Size
)
{
Vec_Int_t
*
vRes
,
*
vRes0
,
*
vRes1
,
*
vRes2
;
int
i
,
iCtrl
;
if
(
nLits
==
Size
)
return
Wlc_ManGenAdderN
(
p
,
nLits
,
pLitsA
,
pLitsB
,
Carry
);
vRes0
=
Wlc_ManGenAdder_rec
(
p
,
nLits
/
2
,
pLitsA
,
pLitsB
,
Carry
,
Size
);
vRes1
=
Wlc_ManGenAdder_rec
(
p
,
nLits
/
2
,
pLitsA
+
nLits
/
2
,
pLitsB
+
nLits
/
2
,
0
,
Size
);
vRes2
=
Wlc_ManGenAdder_rec
(
p
,
nLits
/
2
,
pLitsA
+
nLits
/
2
,
pLitsB
+
nLits
/
2
,
1
,
Size
);
vRes
=
Vec_IntAlloc
(
nLits
+
1
);
Vec_IntAppend
(
vRes
,
vRes0
);
iCtrl
=
Vec_IntPop
(
vRes
);
for
(
i
=
0
;
i
<=
nLits
/
2
;
i
++
)
Vec_IntPush
(
vRes
,
Gia_ManHashMux
(
p
,
iCtrl
,
Vec_IntEntry
(
vRes2
,
i
),
Vec_IntEntry
(
vRes1
,
i
))
);
assert
(
Vec_IntSize
(
vRes
)
==
nLits
+
1
);
Vec_IntFree
(
vRes0
);
Vec_IntFree
(
vRes1
);
Vec_IntFree
(
vRes2
);
return
vRes
;
}
Gia_Man_t
*
Wlc_ManGenAdder
(
int
nBits
,
int
Size
,
int
fSigned
)
{
Gia_Man_t
*
pTemp
,
*
pNew
;
int
n
,
i
,
iLit
,
nBitsAll
;
Vec_Int_t
*
vOuts
,
*
vLits
=
Vec_IntAlloc
(
1000
);
pNew
=
Gia_ManStart
(
1000
);
pNew
->
pName
=
Abc_UtilStrsav
(
"adder"
);
for
(
nBitsAll
=
Size
;
nBitsAll
<
nBits
;
nBitsAll
*=
2
)
;
for
(
n
=
0
;
n
<
2
;
n
++
)
{
for
(
i
=
0
;
i
<
nBits
;
i
++
)
Vec_IntPush
(
vLits
,
Gia_ManAppendCi
(
pNew
)
);
for
(
;
i
<
nBitsAll
;
i
++
)
Vec_IntPush
(
vLits
,
fSigned
?
Vec_IntEntry
(
vLits
,
nBits
-
1
)
:
0
);
}
Gia_ManHashAlloc
(
pNew
);
vOuts
=
Wlc_ManGenAdder_rec
(
pNew
,
nBitsAll
,
Vec_IntEntryP
(
vLits
,
0
),
Vec_IntEntryP
(
vLits
,
Vec_IntSize
(
vLits
)
/
2
),
0
,
Size
);
Gia_ManHashStop
(
pNew
);
Vec_IntForEachEntry
(
vOuts
,
iLit
,
i
)
Gia_ManAppendCo
(
pNew
,
iLit
);
Vec_IntFree
(
vLits
);
Vec_IntFree
(
vOuts
);
pNew
=
Gia_ManCleanup
(
pTemp
=
pNew
);
Gia_ManStop
(
pTemp
);
return
pNew
;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...
...
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