Commit ec0b9b6b by Alan Mishchenko

Improvements to word-level Verilog parser.

parent 6d0b555d
......@@ -80,7 +80,8 @@ typedef enum {
WLC_OBJ_ARI_DIVIDE, // 36: arithmetic division
WLC_OBJ_ARI_MODULUS, // 37: arithmetic modulus
WLC_OBJ_ARI_POWER, // 38: arithmetic power
WLC_OBJ_NUMBER // 39: unused
WLC_OBJ_TABLE, // 39: arithmetic power
WLC_OBJ_NUMBER // 40: unused
} Wlc_ObjType_t;
......@@ -117,6 +118,8 @@ struct Wlc_Ntk_t_
int iObj;
int nObjsAlloc;
Mem_Flex_t * pMemFanin;
Mem_Flex_t * pMemTable;
Vec_Ptr_t * vTables;
// object names
Abc_Nam_t * pManName; // object names
Vec_Int_t vNameIds; // object name IDs
......@@ -159,6 +162,7 @@ static inline int Wlc_ObjRange( Wlc_Obj_t * p )
static inline int Wlc_ObjRangeEnd( Wlc_Obj_t * p ) { assert(p->Type == WLC_OBJ_BIT_SELECT); return p->Fanins[1] >> 16; }
static inline int Wlc_ObjRangeBeg( Wlc_Obj_t * p ) { assert(p->Type == WLC_OBJ_BIT_SELECT); return p->Fanins[1] & 0xFFFF; }
static inline int * Wlc_ObjConstValue( Wlc_Obj_t * p ) { assert(p->Type == WLC_OBJ_CONST); return Wlc_ObjFanins(p); }
static inline int Wlc_ObjTableId( Wlc_Obj_t * p ) { assert(p->Type == WLC_OBJ_TABLE); return p->Fanins[1]; }
static inline void Wlc_NtkCleanCopy( Wlc_Ntk_t * p ) { Vec_IntFill( &p->vCopies, p->nObjsAlloc, 0 ); }
static inline int Wlc_NtkHasCopy( Wlc_Ntk_t * p ) { return Vec_IntSize( &p->vCopies ) > 0; }
......
......@@ -328,6 +328,12 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p )
assert( Vec_IntSize(vTemp3) == nRange );
Vec_IntAppend( vBits, vTemp3 );
}
else if ( pObj->Type == WLC_OBJ_TABLE )
{
assert( pObj->Type != WLC_OBJ_TABLE );
for ( k = 0; k < nRange; k++ )
Vec_IntPush( vBits, 0 );
}
else assert( 0 );
}
assert( nBits == Vec_IntSize(vBits) );
......
......@@ -68,7 +68,8 @@ static char * Wlc_Names[WLC_OBJ_NUMBER+1] = {
"//", // 36: arithmetic division
"%%", // 37: arithmetic modulus
"**", // 38: arithmetic power
NULL // 39: unused
"table", // 39: lookup table
NULL // 40: unused
};
////////////////////////////////////////////////////////////////////////
......@@ -155,10 +156,10 @@ void Wlc_ObjAddFanins( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, Vec_Int_t * vFanins )
if ( Wlc_ObjHasArray(pObj) )
pObj->pFanins[0] = (int *)Mem_FlexEntryFetch( p->pMemFanin, Vec_IntSize(vFanins) * sizeof(int) );
memcpy( Wlc_ObjFanins(pObj), Vec_IntArray(vFanins), sizeof(int) * Vec_IntSize(vFanins) );
// special treatment of CONST and SELECT
// special treatment of CONST, SELECT and TABLE
if ( pObj->Type == WLC_OBJ_CONST )
pObj->nFanins = 0;
else if ( pObj->Type == WLC_OBJ_BIT_SELECT )
else if ( pObj->Type == WLC_OBJ_BIT_SELECT || pObj->Type == WLC_OBJ_TABLE )
pObj->nFanins = 1;
}
void Wlc_NtkFree( Wlc_Ntk_t * p )
......@@ -167,6 +168,9 @@ void Wlc_NtkFree( Wlc_Ntk_t * p )
Abc_NamStop( p->pManName );
if ( p->pMemFanin )
Mem_FlexStop( p->pMemFanin, 0 );
if ( p->pMemTable )
Mem_FlexStop( p->pMemTable, 0 );
Vec_PtrFreeP( &p->vTables );
ABC_FREE( p->vPis.pArray );
ABC_FREE( p->vPos.pArray );
ABC_FREE( p->vCis.pArray );
......@@ -258,7 +262,7 @@ void Wlc_ObjCollectCopyFanins( Wlc_Ntk_t * p, int iObj, Vec_Int_t * vFanins )
for ( i = 0; i < nInts; i++ )
Vec_IntPush( vFanins, pInts[i] );
}
else if ( pObj->Type == WLC_OBJ_BIT_SELECT )
else if ( pObj->Type == WLC_OBJ_BIT_SELECT || pObj->Type == WLC_OBJ_TABLE )
{
assert( Vec_IntSize(vFanins) == 1 );
Vec_IntPush( vFanins, pObj->Fanins[1] );
......@@ -316,6 +320,9 @@ void Wlc_NtkTransferNames( Wlc_Ntk_t * pNew, Wlc_Ntk_t * p )
pNew->pManName = p->pManName;
p->pManName = NULL;
Vec_IntErase( &p->vNameIds );
// transfer table
pNew->pMemTable = p->pMemTable; p->pMemTable = NULL;
pNew->vTables = p->vTables; p->vTables = NULL;
}
////////////////////////////////////////////////////////////////////////
......
......@@ -87,6 +87,7 @@ void Wlc_WriteVerInt( FILE * pFile, Wlc_Ntk_t * p )
int nDigits = Abc_Base10Log(pObj->End+1) + Abc_Base10Log(pObj->Beg+1);
sprintf( Range, "%s[%d:%d]%*s", pObj->Signed ? "signed ":" ", pObj->End, pObj->Beg, 8-nDigits, "" );
fprintf( pFile, " " );
assert( pObj->Type != WLC_OBJ_TABLE );
if ( pObj->Type == WLC_OBJ_PI )
fprintf( pFile, "input wire %s %-16s", Range, pName );
else if ( pObj->Type == WLC_OBJ_PO )
......
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