summaryrefslogtreecommitdiffstats
path: root/src/base/wlc/wlcNdr.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2019-11-18 00:17:40 +0800
committerAlan Mishchenko <alanmi@berkeley.edu>2019-11-18 00:17:40 +0800
commitdd5a1f5d3001429bc3abb6fd3a7fc04ff28ee6c5 (patch)
treeae6dbbb0f84d1a24e2a3e9490e4f1858d21f260a /src/base/wlc/wlcNdr.c
parent548fa9d45bb389fe388892ec7b2dd17727b06dc5 (diff)
downloadabc-dd5a1f5d3001429bc3abb6fd3a7fc04ff28ee6c5.tar.gz
abc-dd5a1f5d3001429bc3abb6fd3a7fc04ff28ee6c5.tar.bz2
abc-dd5a1f5d3001429bc3abb6fd3a7fc04ff28ee6c5.zip
Enable blasting LUTs in NDR.
Diffstat (limited to 'src/base/wlc/wlcNdr.c')
-rw-r--r--src/base/wlc/wlcNdr.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/base/wlc/wlcNdr.c b/src/base/wlc/wlcNdr.c
index c70e4a6d..e0be9002 100644
--- a/src/base/wlc/wlcNdr.c
+++ b/src/base/wlc/wlcNdr.c
@@ -368,6 +368,7 @@ Wlc_Ntk_t * Wlc_NtkFromNdr( void * pData )
Ndr_Data_t * p = (Ndr_Data_t *)pData;
Wlc_Obj_t * pObj; Vec_Int_t * vName2Obj, * vFanins = Vec_IntAlloc( 100 );
int Mod = 2, i, k, Obj, * pArray, nDigits, fFound, NameId, NameIdMax;
+ Vec_Wrd_t * vTruths = NULL;
Wlc_Ntk_t * pTemp, * pNtk = Wlc_NtkAlloc( "top", Ndr_DataObjNum(p, Mod)+1 );
Wlc_NtkCheckIntegrity( pData );
Vec_IntClear( &pNtk->vFfs );
@@ -412,6 +413,14 @@ Wlc_Ntk_t * Wlc_NtkFromNdr( void * pData )
}
if ( Type == ABC_OPER_DFFRSE )
Vec_IntPush( &pNtk->vFfs2, iObj );
+ if ( Type == ABC_OPER_LUT )
+ {
+ if ( vTruths == NULL )
+ vTruths = Vec_WrdStart( 1000 );
+ if ( NameId >= Vec_WrdSize(vTruths) )
+ Vec_WrdFillExtra( vTruths, 2*NameId, 0 );
+ Vec_WrdWriteEntry( vTruths, NameId, *((word *)Ndr_ObjReadBodyP(p, Obj, NDR_FUNCTION)) );
+ }
if ( Type == ABC_OPER_SLICE )
Vec_IntPushTwo( vFanins, End, Beg );
else if ( Type == ABC_OPER_CONST )
@@ -487,6 +496,22 @@ Wlc_Ntk_t * Wlc_NtkFromNdr( void * pData )
// derive topological order
pNtk = Wlc_NtkDupDfs( pTemp = pNtk, 0, 1 );
Wlc_NtkFree( pTemp );
+ // copy truth tables
+ if ( vTruths )
+ {
+ pNtk->vLutTruths = Vec_WrdStart( Wlc_NtkObjNumMax(pNtk) );
+ Wlc_NtkForEachObj( pNtk, pObj, i )
+ {
+ int iObj = Wlc_ObjId(pNtk, pObj);
+ int NameId = Wlc_ObjNameId(pNtk, iObj);
+ word Truth = Vec_WrdEntry(vTruths, NameId);
+ if ( pObj->Type != WLC_OBJ_LUT || NameId == 0 )
+ continue;
+ assert( sizeof(void *) == 8 || Wlc_ObjFaninNum(pObj) < 6 );
+ Vec_WrdWriteEntry( pNtk->vLutTruths, iObj, Truth );
+ }
+ Vec_WrdFreeP( &vTruths );
+ }
//Ndr_NtkPrintNodes( pNtk );
pNtk->fMemPorts = 1; // the network contains memory ports
pNtk->fEasyFfs = 1; // the network contains simple flops