193 int i, k, iFanin, iOutId, Type;
195 void * pDesign = Ndr_Create( 1 );
196 int ModId = Ndr_AddModule( pDesign, 1 );
198 Vec_Int_t * vFanins = Vec_IntAlloc( 10 );
201 iOutId = Wlc_ObjId(pNtk, pObj);
204 0, NULL, 1, &iOutId, NULL );
209 char * pFunction = NULL;
210 if ( Wlc_ObjIsPi(pObj) || pObj->
Type == 0 )
212 Vec_IntClear( vFanins );
214 Vec_IntPush( vFanins, iFanin );
217 if ( pObj->
Type ==
WLC_OBJ_MUX && Wlc_ObjRange(Wlc_ObjFanin0(pNtk, pObj)) > 1 )
221 Wlc_Obj_t * pFi = Wlc_ObjFo2Fi( pNtk, pObj );
222 assert( Vec_IntSize(vFanins) == 0 );
223 Vec_IntPush( vFanins, Wlc_ObjId(pNtk, pFi) );
224 Vec_IntFillExtra( vFanins, 7, 0 );
230 Ndr_AddObject( pDesign, ModId, Type, 0,
232 Vec_IntSize(vFanins), Vec_IntArray(vFanins), 1, &iOutId, pFunction );
237 if ( !Wlc_ObjIsPo(pObj) )
239 Vec_IntFill( vFanins, 1, iOutId );
242 1, Vec_IntArray(vFanins), 0, NULL, NULL );
244 Vec_IntFree( vFanins );
344 int NameId = Ndr_ObjReadBody(
p, Obj,
NDR_OUTPUT );
349 printf(
"Internal object %d of type %s has no output name.\n", Obj, Abc_OperName(Type) );
352 if ( Vec_IntGetEntry(vMap, NameId) > 0 )
353 printf(
"Output name %d is used more than once (obj %d and obj %d).\n", NameId, Vec_IntGetEntry(vMap, NameId), Obj );
354 Vec_IntSetEntry( vMap, NameId, Obj );
359 int i, * pArray, nArray = Ndr_ObjReadArray(
p, Obj,
NDR_INPUT, &pArray );
360 for ( i = 0; i < nArray; i++ )
361 if ( Vec_IntGetEntry(vMap, pArray[i]) == 0 && !(Type ==
ABC_OPER_DFFRSE && (i >= 5 && i <= 7)) )
362 printf(
"Input name %d appearing as fanin %d of obj %d is not used as output name in any object.\n", pArray[i], i, Obj );
370 int Mod = 2, i, k, Obj, * pArray, fFound, NameId, NameIdMax;
371 unsigned char nDigits;
372 Vec_Wrd_t * vTruths = NULL;
int nTruths[2] = {0};
375 Vec_IntClear( &pNtk->
vFfs );
378 Wlc_NtkCleanNameId( pNtk );
383 int NameId = Ndr_ObjReadBody(
p, Obj,
NDR_OUTPUT );
384 Wlc_ObjSetNameId( pNtk, iObj, NameId );
390 int nArray = Ndr_ObjReadArray(
p, Obj,
NDR_INPUT, &pArray );
391 Vec_Int_t F = {nArray, nArray, pArray}, * vTemp = &F;
393 int NameId = Ndr_ObjReadBody(
p, Obj,
NDR_OUTPUT );
394 Vec_IntClear( vFanins );
395 Vec_IntAppend( vFanins, vTemp );
399 if ( pNtk->
vInits == NULL )
400 pNtk->
vInits = Vec_IntAlloc( 100 );
401 if ( Vec_IntSize(vFanins) == 2 )
402 Vec_IntPush( pNtk->
vInits, Vec_IntPop(vFanins) );
404 Vec_IntPush( pNtk->
vInits, -(End-Beg+1) );
406 pObj = Wlc_NtkObj(pNtk, iObj);
408 Wlc_ObjSetNameId( pNtk, iObj, NameId );
409 Vec_IntPush( &pNtk->
vFfs, NameId );
411 assert( Vec_IntSize(vFanins) == 1 );
412 Vec_IntPush( &pNtk->
vFfs, Vec_IntEntry(vFanins, 0) );
416 Vec_IntPush( &pNtk->
vFfs2, iObj );
420 if ( vTruths == NULL )
421 vTruths = Vec_WrdStart( 1000 );
422 if ( NameId >= Vec_WrdSize(vTruths) )
423 Vec_WrdFillExtra( vTruths, 2*NameId, 0 );
425 Vec_WrdWriteEntry( vTruths, NameId, pTruth ? *pTruth : 0 );
426 nTruths[ pTruth != NULL ]++;
429 Vec_IntPushTwo( vFanins, End, Beg );
433 ABC_SWAP(
int, Vec_IntEntryP(vFanins, 1)[0], Vec_IntEntryP(vFanins, 2)[0] );
435 Wlc_ObjSetNameId( pNtk, iObj, NameId );
438 pObj = Wlc_NtkObj(pNtk, iObj);
439 assert( Wlc_ObjFaninNum(pObj) == 2 );
440 Wlc_ObjFanin0(pNtk, pObj)->Signed = 1;
441 Wlc_ObjFanin1(pNtk, pObj)->Signed = 1;
445 printf(
"Warning! The number of LUTs without function is %d (out of %d).\n", nTruths[0], nTruths[0]+nTruths[1] );
450 int nArray = Ndr_ObjReadArray(
p, Obj,
NDR_INPUT, &pArray );
452 int NameId = Ndr_ObjReadBody(
p, Obj,
NDR_OUTPUT );
453 assert( nArray == 1 && NameId == -1 );
454 pObj = Wlc_NtkObj( pNtk, iObj );
455 Vec_IntFill( vFanins, 1, pArray[0] );
459 Vec_IntFree( vFanins );
461 vName2Obj = Vec_IntInvert( &pNtk->
vNameIds, 0 );
464 int * pFanins = Wlc_ObjFanins(pObj);
465 for ( k = 0; k < Wlc_ObjFaninNum(pObj); k++ )
466 pFanins[k] = Vec_IntEntry(vName2Obj, pFanins[k]);
471 Vec_IntWriteEntry( &pNtk->
vFfs, i, Vec_IntEntry(vName2Obj, NameId) );
474 Vec_IntWriteEntry( pNtk->
vInits, i, Vec_IntEntry(vName2Obj, NameId) );
476 assert( (Vec_IntSize(&pNtk->
vFfs) & 1) == 0 );
483 Vec_IntClear( &pNtk->
vFfs );
489 Vec_IntFree(vName2Obj);
491 NameIdMax = Vec_IntFindMax(&pNtk->
vNameIds);
492 nDigits = (
unsigned char)Abc_Base10Log( NameIdMax+1 );
494 for ( i = 1; i <= NameIdMax; i++ )
496 char pName[1000];
sprintf( pName,
"s%0*d", nDigits, i );
498 assert( !fFound && i == NameId );
508 pNtk->
vLutTruths = Vec_WrdStart( Wlc_NtkObjNumMax(pNtk) );
511 int iObj = Wlc_ObjId(pNtk, pObj);
512 int NameId = Wlc_ObjNameId(pNtk, iObj);
516 Truth = Vec_WrdEntry(vTruths, NameId);
517 assert(
sizeof(
void *) == 8 || Wlc_ObjFaninNum(pObj) < 6 );
518 Vec_WrdWriteEntry( pNtk->
vLutTruths, iObj, Truth );
520 Vec_WrdFreeP( &vTruths );