summaryrefslogtreecommitdiffstats
path: root/src/base/wlc
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2015-09-23 16:04:06 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2015-09-23 16:04:06 -0700
commita84c8174e73882f0cdd6433ca27b8222e87dbaa2 (patch)
tree60f0ecc552d84366b3971379051b4fbc1d5b1db4 /src/base/wlc
parent19a4bb930edcfc7910388bb08fd86482b9dd35e7 (diff)
downloadabc-a84c8174e73882f0cdd6433ca27b8222e87dbaa2.tar.gz
abc-a84c8174e73882f0cdd6433ca27b8222e87dbaa2.tar.bz2
abc-a84c8174e73882f0cdd6433ca27b8222e87dbaa2.zip
Improving bit-blasting of full-adder.
Diffstat (limited to 'src/base/wlc')
-rw-r--r--src/base/wlc/wlcBlast.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/base/wlc/wlcBlast.c b/src/base/wlc/wlcBlast.c
index 46fa8d78..757a8005 100644
--- a/src/base/wlc/wlcBlast.c
+++ b/src/base/wlc/wlcBlast.c
@@ -242,11 +242,25 @@ int Wlc_BlastLessSigned( Gia_Man_t * pNew, int * pArg0, int * pArg1, int nBits )
}
void Wlc_BlastFullAdder( Gia_Man_t * pNew, int a, int b, int c, int * pc, int * ps )
{
- int Xor = Gia_ManHashXor(pNew, a, b);
- int And1 = Gia_ManHashAnd(pNew, a, b);
- int And2 = Gia_ManHashAnd(pNew, c, Xor);
- *ps = Gia_ManHashXor(pNew, c, Xor);
- *pc = Gia_ManHashOr (pNew, And1, And2);
+ int fUseXor = 0;
+ if ( fUseXor )
+ {
+ int Xor = Gia_ManHashXor(pNew, a, b);
+ int And1 = Gia_ManHashAnd(pNew, a, b);
+ int And2 = Gia_ManHashAnd(pNew, c, Xor);
+ *ps = Gia_ManHashXor(pNew, c, Xor);
+ *pc = Gia_ManHashOr (pNew, And1, And2);
+ }
+ else
+ {
+ int And1 = Gia_ManHashAnd(pNew, a, b);
+ int And1_= Gia_ManHashAnd(pNew, Abc_LitNot(a), Abc_LitNot(b));
+ int Xor = Abc_LitNot(Gia_ManHashOr(pNew, And1, And1_));
+ int And2 = Gia_ManHashAnd(pNew, c, Xor);
+ int And2_= Gia_ManHashAnd(pNew, Abc_LitNot(c), Abc_LitNot(Xor));
+ *ps = Abc_LitNot(Gia_ManHashOr(pNew, And2, And2_));
+ *pc = Gia_ManHashOr (pNew, And1, And2);
+ }
}
void Wlc_BlastAdder( Gia_Man_t * pNew, int * pAdd0, int * pAdd1, int nBits ) // result is in pAdd0
{