110 p->vTypes = Vec_StrStart( Vec_StrSize(vLines)+100 );
111 p->vIndexes = Vec_IntStart( Vec_StrSize(vLines)+100 );
112 p->vLut4s = Vec_IntAlloc( 4 * pCounts[
GLS_LUT4] );
113 p->vLut4TTs = Vec_IntAlloc( pCounts[
GLS_LUT4] );
114 p->vLut6s = Vec_IntAlloc( 6 * pCounts[
GLS_LUT6] );
115 p->vLut6TTs = Vec_WrdAlloc( pCounts[
GLS_LUT6] );
116 p->vBoxes = Vec_IntAlloc( 5 * pCounts[
GLS_BOX] );
117 p->vDelays = Vec_IntAlloc( pCounts[
GLS_DEL] );
118 p->vDelayIns = Vec_WecAlloc( pCounts[
GLS_DEL] );
119 p->vDelayOuts = Vec_WecAlloc( pCounts[
GLS_DEL] );
121 p->vOrderPis = Vec_IntAlloc( pCounts[
GLS_PI] );
122 p->vOrderPos = Vec_IntAlloc( pCounts[
GLS_PO] );
123 p->vOrderBoxes = Vec_IntAlloc( pCounts[
GLS_BOX] );
124 p->vOrderDelays = Vec_IntAlloc( pCounts[
GLS_DEL] );
126 p->vOrderSeqs = Vec_IntAlloc( pCounts[
GLS_SEQ] );
239 int i, k, Type, iObj, Entry, iItem;
word Truth;
240 for ( i = 0; fgets( pBuffer,
MAX_LINE, pFile ) != NULL; i++ )
243 Type = Vec_StrEntry(
p->vLines, i );
245 Vec_StrWriteEntry(
p->vTypes, iObj, (
char)Type );
248 Vec_IntPush(
p->vOrderPis, iObj );
249 Vec_IntWriteEntry(
p->vIndexes, iObj, -1 );
253 if ( *pLine++ ==
'(' )
259 Vec_IntPush(
p->vOrderPos, iObj );
261 Vec_IntPush(
p->vOrderLuts, iObj );
263 Vec_IntPush(
p->vOrderSeqs, iObj );
266 if ( (
int)Vec_StrEntry(
p->vTypes, Entry) ==
GLS_DEL )
268 Vec_Int_t * vOuts = Vec_WecEntry(
p->vDelayOuts, Vec_IntEntry(
p->vIndexes, Entry) );
269 Vec_IntPush( vOuts, iObj );
271 else if ( (
int)Vec_StrEntry(
p->vTypes, Entry) ==
GLS_BAR )
272 Vec_IntPush(
p->vOrderLuts, iObj );
275 Vec_IntWriteEntry(
p->vIndexes, iObj, Entry );
280 Vec_IntWriteEntry(
p->vIndexes, iObj, Vec_IntSize(
p->vLut4TTs) );
281 Vec_IntPush(
p->vLut4s, Entry );
284 if ( *pLine !=
',' )
break;
287 Vec_IntPush(
p->vLut4s, Entry );
293 if ( *pLine++ ==
'[' )
295 Abc_TtReadHex( &Truth, pLine );
296 Vec_IntPush(
p->vLut4TTs, (
unsigned)Truth );
297 Vec_IntPush(
p->vOrderLuts, iObj );
301 Vec_IntWriteEntry(
p->vIndexes, iObj, Vec_WrdSize(
p->vLut6TTs) );
302 Vec_IntPush(
p->vLut6s, Entry );
305 if ( *pLine !=
',' )
break;
308 Vec_IntPush(
p->vLut6s, Entry );
314 if ( *pLine++ ==
'[' )
316 Abc_TtReadHex( &Truth, pLine );
317 Vec_WrdPush(
p->vLut6TTs, Truth );
318 Vec_IntPush(
p->vOrderLuts, iObj );
322 Vec_IntWriteEntry(
p->vIndexes, iObj, Vec_IntSize(
p->vBoxes)/5 );
323 Vec_IntPush(
p->vBoxes, Entry );
326 if ( *pLine !=
',' )
break;
329 Vec_IntPush(
p->vBoxes, Entry );
332 assert( k == 4 || k == 5 );
335 Vec_IntPush(
p->vOrderBoxes, iObj );
339 Vec_Int_t * vIns = Vec_WecPushLevel(
p->vDelayIns );
340 Vec_Int_t * vOuts = Vec_WecPushLevel(
p->vDelayOuts );
341 Vec_IntWriteEntry(
p->vIndexes, iObj, Vec_IntSize(
p->vDelays) );
342 Vec_IntPush( vIns, Entry );
347 if ( *pLine !=
',' )
break;
350 Vec_IntPush( vIns, Entry );
356 if ( *pLine++ ==
'[' )
359 Vec_IntPush(
p->vDelays, iItem );
360 Vec_IntPush(
p->vOrderDelays, iObj );
387 int k, iObj, iLit, Index;
char Type;
390 pGia->
pName = Abc_UtilStrsav( pFileName );
391 pGia->
pSpec = Abc_UtilStrsav( pFileName );
393 vMap = Vec_IntStartFull( Vec_StrSize(
p->vTypes) );
394 Vec_IntWriteEntry( vMap, 0, 0 );
395 Vec_IntWriteEntry( vMap, 1, 1 );
398 Vec_IntWriteEntry( vMap, iObj, Gia_ManAppendCi(pGia) );
401 Vec_IntWriteEntry( vMap, iObj, Gia_ManAppendCi(pGia) );
405 assert( Index == Vec_IntEntry(
p->vIndexes, iObj) );
406 vArray = Vec_WecEntry(
p->vDelayOuts, Index);
407 if ( Vec_IntSize(vArray) == 0 )
408 Vec_IntWriteEntry( vMap, iObj, Gia_ManAppendCi(pGia) );
411 Vec_IntWriteEntry( vMap, iObj, Gia_ManAppendCi(pGia) );
416 Type = Vec_StrEntry(
p->vTypes, iObj );
419 int Limit = Type ==
GLS_LUT4 ? 4 : 6;
420 int Index = Vec_IntEntry(
p->vIndexes, iObj);
421 int * pFanins = Type ==
GLS_LUT4 ? Vec_IntEntryP(
p->vLut4s, 4*Index) : Vec_IntEntryP(
p->vLut6s, 6*Index);
422 word Truth = Type ==
GLS_LUT4 ? (
word)Vec_IntEntry(
p->vLut4TTs, Index) : Vec_WrdEntry(
p->vLut6TTs, Index);
423 Vec_IntClear( vLeaves );
424 for ( k = 0; k < Limit; k++ )
425 Vec_IntPush( vLeaves, pFanins[k] ==
GLS_NONE ? 0 : Vec_IntEntry(vMap, pFanins[k]) );
426 iLit =
Kit_TruthToGia( pGia, (
unsigned *)&Truth, Vec_IntSize(vLeaves), vCover, vLeaves, 0 );
427 Vec_IntWriteEntry( vMap, iObj, iLit );
431 iLit = Vec_IntEntry( vMap, Vec_IntEntry(
p->vIndexes, iObj) );
432 Vec_IntWriteEntry( vMap, iObj, iLit );
438 vArray = Vec_WecEntry(
p->vDelayIns, Index);
439 assert( Vec_IntSize(vArray) > 0 );
441 Gia_ManAppendCo( pGia, Vec_IntEntry(vMap, iObj) );
445 Gia_ManAppendCo( pGia, Vec_IntEntry(vMap, Vec_IntEntry(
p->vIndexes, iObj)) );
448 Gia_ManAppendCo( pGia, Vec_IntEntry(vMap, Vec_IntEntry(
p->vIndexes, iObj)) );
450 Vec_IntFree( vCover );
451 Vec_IntFree( vLeaves );
ABC_NAMESPACE_IMPL_START int Kit_TruthToGia(Gia_Man_t *pMan, unsigned *pTruth, int nVars, Vec_Int_t *vMemory, Vec_Int_t *vLeaves, int fHash)
DECLARATIONS ///.