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
02240391
Commit
02240391
authored
Feb 06, 2016
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added recursive bit-blasting of a carry-lookahead adder.
parent
355865e8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
src/base/wlc/wlcBlast.c
+51
-0
No files found.
src/base/wlc/wlcBlast.c
View file @
02240391
...
...
@@ -274,6 +274,56 @@ void Wlc_BlastSubtract( Gia_Man_t * pNew, int * pAdd0, int * pAdd1, int nBits )
for
(
b
=
0
;
b
<
nBits
;
b
++
)
Wlc_BlastFullAdder
(
pNew
,
pAdd0
[
b
],
Abc_LitNot
(
pAdd1
[
b
]),
Carry
,
&
Carry
,
&
pAdd0
[
b
]
);
}
void
Wlc_BlastAdderCLA_one
(
Gia_Man_t
*
pNew
,
int
*
pGen
,
int
*
pPro
,
int
*
pCar
,
int
*
pGen1
,
int
*
pPro1
,
int
*
pCar1
)
{
int
Temp
=
Gia_ManHashAnd
(
pNew
,
pGen
[
0
],
pPro
[
1
]
);
*
pPro1
=
Gia_ManHashAnd
(
pNew
,
pPro
[
0
],
pPro
[
1
]
);
*
pGen1
=
Gia_ManHashOr
(
pNew
,
Gia_ManHashOr
(
pNew
,
pGen
[
1
],
Temp
),
Gia_ManHashAnd
(
pNew
,
*
pPro1
,
pCar
[
0
])
);
*
pCar1
=
Gia_ManHashOr
(
pNew
,
pGen
[
0
],
Gia_ManHashAnd
(
pNew
,
pPro
[
0
],
pCar
[
0
])
);
}
void
Wlc_BlastAdderCLA_rec
(
Gia_Man_t
*
pNew
,
int
*
pGen
,
int
*
pPro
,
int
*
pCar
,
int
nBits
,
int
*
pGen1
,
int
*
pPro1
)
{
if
(
nBits
==
2
)
Wlc_BlastAdderCLA_one
(
pNew
,
pGen
,
pPro
,
pCar
,
pGen1
,
pPro1
,
pCar
+
1
);
// returns *pGen1, *pPro1, pCar[1]
else
{
int
pGen2
[
2
],
pPro2
[
2
];
assert
(
nBits
%
2
==
0
);
// call recursively
Wlc_BlastAdderCLA_rec
(
pNew
,
pGen
,
pPro
,
pCar
,
nBits
/
2
,
pGen2
,
pPro2
);
pCar
[
nBits
/
2
]
=
*
pGen2
;
Wlc_BlastAdderCLA_rec
(
pNew
,
pGen
+
nBits
/
2
,
pPro
+
nBits
/
2
,
pCar
+
nBits
/
2
,
nBits
/
2
,
pGen2
+
1
,
pPro2
+
1
);
// create structure
Wlc_BlastAdderCLA_one
(
pNew
,
pGen2
,
pPro2
,
pCar
,
pGen1
,
pPro1
,
pCar
+
nBits
/
2
);
// returns *pGen1, *pPro1, pCar[nBits/2]
}
}
void
Wlc_BlastAdderCLA
(
Gia_Man_t
*
pNew
,
int
*
pAdd0
,
int
*
pAdd1
,
int
nBits
)
// result is in pAdd0
{
int
*
pGen
=
ABC_CALLOC
(
int
,
nBits
);
int
*
pPro
=
ABC_CALLOC
(
int
,
nBits
);
int
*
pCar
=
ABC_CALLOC
(
int
,
nBits
+
1
);
int
b
,
Gen
,
Pro
;
if
(
nBits
==
1
)
{
int
Carry
=
0
;
Wlc_BlastFullAdder
(
pNew
,
pAdd0
[
0
],
pAdd1
[
0
],
Carry
,
&
Carry
,
&
pAdd0
[
0
]
);
return
;
}
assert
(
nBits
>=
2
);
pCar
[
0
]
=
0
;
for
(
b
=
0
;
b
<
nBits
;
b
++
)
{
pGen
[
b
]
=
Gia_ManHashAnd
(
pNew
,
pAdd0
[
b
],
pAdd1
[
b
]);
pPro
[
b
]
=
Gia_ManHashXor
(
pNew
,
pAdd0
[
b
],
pAdd1
[
b
]);
}
Wlc_BlastAdderCLA_rec
(
pNew
,
pGen
,
pPro
,
pCar
,
nBits
,
&
Gen
,
&
Pro
);
for
(
b
=
0
;
b
<
nBits
;
b
++
)
pAdd0
[
b
]
=
Gia_ManHashXor
(
pNew
,
pPro
[
b
],
pCar
[
b
]);
ABC_FREE
(
pGen
);
ABC_FREE
(
pPro
);
ABC_FREE
(
pCar
);
}
void
Wlc_BlastMinus
(
Gia_Man_t
*
pNew
,
int
*
pNum
,
int
nNum
,
Vec_Int_t
*
vRes
)
{
int
*
pRes
=
Wlc_VecCopy
(
vRes
,
pNum
,
nNum
);
...
...
@@ -887,6 +937,7 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds )
int
*
pArg1
=
Wlc_VecLoadFanins
(
vTemp1
,
pFans1
,
nRange1
,
nRangeMax
,
Wlc_ObjIsSignedFanin01
(
p
,
pObj
)
);
if
(
pObj
->
Type
==
WLC_OBJ_ARI_ADD
)
Wlc_BlastAdder
(
pNew
,
pArg0
,
pArg1
,
nRange
);
// result is in pFan0 (vRes)
// Wlc_BlastAdderCLA( pNew, pArg0, pArg1, nRange ); // result is in pFan0 (vRes)
else
Wlc_BlastSubtract
(
pNew
,
pArg0
,
pArg1
,
nRange
);
// result is in pFan0 (vRes)
Vec_IntShrink
(
vRes
,
nRange
);
...
...
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