summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2016-03-18 13:58:22 +0800
committerAlan Mishchenko <alanmi@berkeley.edu>2016-03-18 13:58:22 +0800
commit65ee47c51522bd75a1aad0edac4ab10184436e92 (patch)
treef2f81d4af90af64f00f531e68951665ab0d21a23
parentb2ad140adb64fe5913e086b94aaa53d54d654f98 (diff)
downloadabc-65ee47c51522bd75a1aad0edac4ab10184436e92.tar.gz
abc-65ee47c51522bd75a1aad0edac4ab10184436e92.tar.bz2
abc-65ee47c51522bd75a1aad0edac4ab10184436e92.zip
Supporting bit-wise XNOR operator in Wlc_Ntk_t.
-rw-r--r--src/base/wlc/wlc.h1
-rw-r--r--src/base/wlc/wlcBlast.c4
-rw-r--r--src/base/wlc/wlcNtk.c3
-rw-r--r--src/base/wlc/wlcReadVer.c2
-rw-r--r--src/base/wlc/wlcWriteVer.c2
5 files changed, 9 insertions, 3 deletions
diff --git a/src/base/wlc/wlc.h b/src/base/wlc/wlc.h
index f800feb5..8f1b9440 100644
--- a/src/base/wlc/wlc.h
+++ b/src/base/wlc/wlc.h
@@ -61,6 +61,7 @@ typedef enum {
WLC_OBJ_BIT_AND, // 16: bitwise AND
WLC_OBJ_BIT_OR, // 17: bitwise OR
WLC_OBJ_BIT_XOR, // 18: bitwise XOR
+ WLC_OBJ_BIT_NXOR, // 18: bitwise NXOR
WLC_OBJ_BIT_SELECT, // 19: bit selection
WLC_OBJ_BIT_CONCAT, // 20: bit concatenation
WLC_OBJ_BIT_ZEROPAD, // 21: zero padding
diff --git a/src/base/wlc/wlcBlast.c b/src/base/wlc/wlcBlast.c
index 85301a16..a3181bd4 100644
--- a/src/base/wlc/wlcBlast.c
+++ b/src/base/wlc/wlcBlast.c
@@ -930,13 +930,13 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds )
for ( k = 0; k < nRange; k++ )
Vec_IntPush( vRes, Gia_ManHashOr(pNew, pArg0[k], pArg1[k]) );
}
- else if ( pObj->Type == WLC_OBJ_BIT_XOR )
+ else if ( pObj->Type == WLC_OBJ_BIT_XOR || pObj->Type == WLC_OBJ_BIT_NXOR )
{
int nRangeMax = Abc_MaxInt( nRange, Abc_MaxInt(nRange0, nRange1) );
int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
for ( k = 0; k < nRange; k++ )
- Vec_IntPush( vRes, Gia_ManHashXor(pNew, pArg0[k], pArg1[k]) );
+ Vec_IntPush( vRes, Abc_LitNotCond(Gia_ManHashXor(pNew, pArg0[k], pArg1[k]), pObj->Type == WLC_OBJ_BIT_NXOR) );
}
else if ( pObj->Type == WLC_OBJ_BIT_SELECT )
{
diff --git a/src/base/wlc/wlcNtk.c b/src/base/wlc/wlcNtk.c
index 0e4f24a2..852d8062 100644
--- a/src/base/wlc/wlcNtk.c
+++ b/src/base/wlc/wlcNtk.c
@@ -50,6 +50,7 @@ static char * Wlc_Names[WLC_OBJ_NUMBER+1] = {
"&", // 16: bitwise AND
"|", // 17: bitwise OR
"^", // 18: bitwise XOR
+ "~|", // 18: bitwise NXOR
"[:]", // 19: bit selection
"{,}", // 20: bit concatenation
"zeroPad", // 21: zero padding
@@ -360,6 +361,8 @@ void Wlc_NtkPrintDistrib( Wlc_Ntk_t * p, int fVerbose )
Vec_IntAddToEntry( vAnds, WLC_OBJ_BIT_OR, Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) );
else if ( pObj->Type == WLC_OBJ_BIT_XOR )
Vec_IntAddToEntry( vAnds, WLC_OBJ_BIT_XOR, 3 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) );
+ else if ( pObj->Type == WLC_OBJ_BIT_NXOR )
+ Vec_IntAddToEntry( vAnds, WLC_OBJ_BIT_NXOR, 3 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) );
else if ( pObj->Type == WLC_OBJ_BIT_SELECT )
Vec_IntAddToEntry( vAnds, WLC_OBJ_BIT_SELECT, 0 );
else if ( pObj->Type == WLC_OBJ_BIT_CONCAT )
diff --git a/src/base/wlc/wlcReadVer.c b/src/base/wlc/wlcReadVer.c
index 4b5bcac9..7347299c 100644
--- a/src/base/wlc/wlcReadVer.c
+++ b/src/base/wlc/wlcReadVer.c
@@ -782,10 +782,10 @@ static inline int Wlc_PrsFindDefinition( Wlc_Prs_t * p, char * pStr, Vec_Int_t *
else if ( pStr[0] == '&' && pStr[1] != '&' ) pStr += 1, Type = WLC_OBJ_BIT_AND;
else if ( pStr[0] == '|' && pStr[1] != '|' ) pStr += 1, Type = WLC_OBJ_BIT_OR;
else if ( pStr[0] == '^' && pStr[1] != '^' ) pStr += 1, Type = WLC_OBJ_BIT_XOR;
+ else if ( pStr[0] == '~' && pStr[1] == '^' ) pStr += 2, Type = WLC_OBJ_BIT_NXOR;
else if ( pStr[0] == '&' && pStr[1] == '&' ) pStr += 2, Type = WLC_OBJ_LOGIC_AND;
else if ( pStr[0] == '|' && pStr[1] == '|' ) pStr += 2, Type = WLC_OBJ_LOGIC_OR;
else if ( pStr[0] == '=' && pStr[1] == '=' ) pStr += 2, Type = WLC_OBJ_COMP_EQU;
- else if ( pStr[0] == '~' && pStr[1] == '^' ) pStr += 2, Type = WLC_OBJ_COMP_EQU;
else if ( pStr[0] == '!' && pStr[1] == '=' ) pStr += 2, Type = WLC_OBJ_COMP_NOTEQU;
else if ( pStr[0] == '<' && pStr[1] != '=' ) pStr += 1, Type = WLC_OBJ_COMP_LESS;
else if ( pStr[0] == '>' && pStr[1] != '=' ) pStr += 1, Type = WLC_OBJ_COMP_MORE;
diff --git a/src/base/wlc/wlcWriteVer.c b/src/base/wlc/wlcWriteVer.c
index a8e225ff..8fa0ddf6 100644
--- a/src/base/wlc/wlcWriteVer.c
+++ b/src/base/wlc/wlcWriteVer.c
@@ -308,6 +308,8 @@ void Wlc_WriteVerInt( FILE * pFile, Wlc_Ntk_t * p, int fNoFlops )
fprintf( pFile, "|" );
else if ( pObj->Type == WLC_OBJ_BIT_XOR )
fprintf( pFile, "^" );
+ else if ( pObj->Type == WLC_OBJ_BIT_NXOR )
+ fprintf( pFile, "~^" );
else if ( pObj->Type == WLC_OBJ_LOGIC_AND )
fprintf( pFile, "&&" );
else if ( pObj->Type == WLC_OBJ_LOGIC_OR )