int Wlc_ObjAlloc( Wlc_Ntk_t * p, int Type, int Signed, int End, int Beg ) { Wlc_Obj_t * pObj; assert( Type != WLC_OBJ_PO && Type != WLC_OBJ_FI ); if ( p->iObj == p->nObjsAlloc ) { p->pObjs = ABC_REALLOC( Wlc_Obj_t, p->pObjs, 2 * p->nObjsAlloc ); memset( p->pObjs + p->nObjsAlloc, 0, sizeof(Wlc_Obj_t) * p->nObjsAlloc ); p->nObjsAlloc *= 2; } pObj = Wlc_NtkObj( p, p->iObj ); pObj->Type = Type; pObj->Signed = Signed; pObj->End = End; pObj->Beg = Beg; if ( Wlc_ObjIsCi(pObj) ) Wlc_ObjSetCi( p, pObj ); p->nObjs[Type]++; return p->iObj++; }
void Wlc_WriteTables( FILE * pFile, Wlc_Ntk_t * p ) { Vec_Int_t * vNodes; Wlc_Obj_t * pObj, * pFanin; word * pTable; int i; if ( p->vTables == NULL || Vec_PtrSize(p->vTables) == 0 ) return; // map tables into their nodes vNodes = Vec_IntStart( Vec_PtrSize(p->vTables) ); Wlc_NtkForEachObj( p, pObj, i ) if ( pObj->Type == WLC_OBJ_TABLE ) Vec_IntWriteEntry( vNodes, Wlc_ObjTableId(pObj), i ); // write tables Vec_PtrForEachEntry( word *, p->vTables, pTable, i ) { pObj = Wlc_NtkObj( p, Vec_IntEntry(vNodes, i) ); assert( pObj->Type == WLC_OBJ_TABLE ); pFanin = Wlc_ObjFanin0( p, pObj ); Wlc_WriteTableOne( pFile, Wlc_ObjRange(pFanin), Wlc_ObjRange(pObj), pTable, i ); } Vec_IntFree( vNodes ); }
int Wlc_ObjCreate( Wlc_Ntk_t * p, int Type, int Signed, int End, int Beg, Vec_Int_t * vFanins ) { int iFaninNew = Wlc_ObjAlloc( p, Type, Signed, End, Beg ); Wlc_ObjAddFanins( p, Wlc_NtkObj(p, iFaninNew), vFanins ); return iFaninNew; }