Commit 65ee47c5 by Alan Mishchenko

Supporting bit-wise XNOR operator in Wlc_Ntk_t.

parent b2ad140a
...@@ -61,6 +61,7 @@ typedef enum { ...@@ -61,6 +61,7 @@ typedef enum {
WLC_OBJ_BIT_AND, // 16: bitwise AND WLC_OBJ_BIT_AND, // 16: bitwise AND
WLC_OBJ_BIT_OR, // 17: bitwise OR WLC_OBJ_BIT_OR, // 17: bitwise OR
WLC_OBJ_BIT_XOR, // 18: bitwise XOR WLC_OBJ_BIT_XOR, // 18: bitwise XOR
WLC_OBJ_BIT_NXOR, // 18: bitwise NXOR
WLC_OBJ_BIT_SELECT, // 19: bit selection WLC_OBJ_BIT_SELECT, // 19: bit selection
WLC_OBJ_BIT_CONCAT, // 20: bit concatenation WLC_OBJ_BIT_CONCAT, // 20: bit concatenation
WLC_OBJ_BIT_ZEROPAD, // 21: zero padding WLC_OBJ_BIT_ZEROPAD, // 21: zero padding
......
...@@ -930,13 +930,13 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds ) ...@@ -930,13 +930,13 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds )
for ( k = 0; k < nRange; k++ ) for ( k = 0; k < nRange; k++ )
Vec_IntPush( vRes, Gia_ManHashOr(pNew, pArg0[k], pArg1[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 nRangeMax = Abc_MaxInt( nRange, Abc_MaxInt(nRange0, nRange1) );
int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) ); int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) ); int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
for ( k = 0; k < nRange; k++ ) 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 ) else if ( pObj->Type == WLC_OBJ_BIT_SELECT )
{ {
......
...@@ -50,6 +50,7 @@ static char * Wlc_Names[WLC_OBJ_NUMBER+1] = { ...@@ -50,6 +50,7 @@ static char * Wlc_Names[WLC_OBJ_NUMBER+1] = {
"&", // 16: bitwise AND "&", // 16: bitwise AND
"|", // 17: bitwise OR "|", // 17: bitwise OR
"^", // 18: bitwise XOR "^", // 18: bitwise XOR
"~|", // 18: bitwise NXOR
"[:]", // 19: bit selection "[:]", // 19: bit selection
"{,}", // 20: bit concatenation "{,}", // 20: bit concatenation
"zeroPad", // 21: zero padding "zeroPad", // 21: zero padding
...@@ -360,6 +361,8 @@ void Wlc_NtkPrintDistrib( Wlc_Ntk_t * p, int fVerbose ) ...@@ -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)) ); Vec_IntAddToEntry( vAnds, WLC_OBJ_BIT_OR, Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) );
else if ( pObj->Type == WLC_OBJ_BIT_XOR ) else if ( pObj->Type == WLC_OBJ_BIT_XOR )
Vec_IntAddToEntry( vAnds, WLC_OBJ_BIT_XOR, 3 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) ); 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 ) else if ( pObj->Type == WLC_OBJ_BIT_SELECT )
Vec_IntAddToEntry( vAnds, WLC_OBJ_BIT_SELECT, 0 ); Vec_IntAddToEntry( vAnds, WLC_OBJ_BIT_SELECT, 0 );
else if ( pObj->Type == WLC_OBJ_BIT_CONCAT ) else if ( pObj->Type == WLC_OBJ_BIT_CONCAT )
......
...@@ -782,10 +782,10 @@ static inline int Wlc_PrsFindDefinition( Wlc_Prs_t * p, char * pStr, Vec_Int_t * ...@@ -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_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_OR;
else if ( pStr[0] == '^' && pStr[1] != '^' ) pStr += 1, Type = WLC_OBJ_BIT_XOR; 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_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_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_EQU;
else if ( pStr[0] == '!' && pStr[1] == '=' ) pStr += 2, Type = WLC_OBJ_COMP_NOTEQU; 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_LESS;
else if ( pStr[0] == '>' && pStr[1] != '=' ) pStr += 1, Type = WLC_OBJ_COMP_MORE; else if ( pStr[0] == '>' && pStr[1] != '=' ) pStr += 1, Type = WLC_OBJ_COMP_MORE;
......
...@@ -308,6 +308,8 @@ void Wlc_WriteVerInt( FILE * pFile, Wlc_Ntk_t * p, int fNoFlops ) ...@@ -308,6 +308,8 @@ void Wlc_WriteVerInt( FILE * pFile, Wlc_Ntk_t * p, int fNoFlops )
fprintf( pFile, "|" ); fprintf( pFile, "|" );
else if ( pObj->Type == WLC_OBJ_BIT_XOR ) else if ( pObj->Type == WLC_OBJ_BIT_XOR )
fprintf( pFile, "^" ); fprintf( pFile, "^" );
else if ( pObj->Type == WLC_OBJ_BIT_NXOR )
fprintf( pFile, "~^" );
else if ( pObj->Type == WLC_OBJ_LOGIC_AND ) else if ( pObj->Type == WLC_OBJ_LOGIC_AND )
fprintf( pFile, "&&" ); fprintf( pFile, "&&" );
else if ( pObj->Type == WLC_OBJ_LOGIC_OR ) else if ( pObj->Type == WLC_OBJ_LOGIC_OR )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment