Skip to content

Commit 53534b5

Browse files
committed
Add per-object origin tracking (vOrigins) to Gia_Man_t
Add lightweight origin tracking that propagates source-location provenance through ABC's optimization passes. This enables the Yosys abc9 flow to preserve \src attributes on LUT cells after technology mapping, achieving ~100% coverage on tested designs with negligible overhead (~0.6% time, ~3% memory on picorv32). Changes: - Add Vec_Int_t *vOrigins field to Gia_Man_t with inline accessors - Read/write origins via AIGER "y" extension (sentinel -1 for unmapped) - Propagate through all Gia_ManDup* variants via Gia_ManOriginsDup() - Propagate through structural hashing (AND/XOR/MUX) in giaHash.c - Recover origins after GIA→AIG→GIA round-trips (&dc2, &dch) via Gia_ManOriginsAfterRoundTrip() using CO driver + top-down propagation - Propagate through IF mapper using iCopy correspondence - Instrument giaEquiv, giaMuxes, giaTim, giaBalAig, dauGia Co-developed-by: Claude Code v2.1.44 (claude-opus-4-6)
1 parent 3cdb1c4 commit 53534b5

12 files changed

Lines changed: 212 additions & 4 deletions

File tree

src/aig/gia/gia.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ struct Gia_Man_t_
190190
Vec_Int_t * vIdsOrig; // original object IDs
191191
Vec_Int_t * vIdsEquiv; // original object IDs proved equivalent
192192
Vec_Int_t * vEquLitIds; // original object IDs proved equivalent
193+
Vec_Int_t * vOrigins; // per-object origin mapping (from "y" extension)
193194
Vec_Int_t * vCofVars; // cofactoring variables
194195
Vec_Vec_t * vClockDoms; // clock domains
195196
Vec_Flt_t * vTiming; // arrival/required/slack
@@ -462,6 +463,9 @@ static inline int Gia_ManIsConst0Lit( int iLit ) { return (iLit ==
462463
static inline int Gia_ManIsConst1Lit( int iLit ) { return (iLit == 1); }
463464
static inline int Gia_ManIsConstLit( int iLit ) { return (iLit <= 1); }
464465

466+
static inline int Gia_ObjOrigin( Gia_Man_t * p, int iObj ) { return p->vOrigins ? Vec_IntEntry(p->vOrigins, iObj) : -1; }
467+
static inline void Gia_ObjSetOrigin( Gia_Man_t * p, int iObj, int iOrig ) { if (p->vOrigins) Vec_IntWriteEntry(p->vOrigins, iObj, iOrig); }
468+
465469
static inline Gia_Obj_t * Gia_Regular( Gia_Obj_t * p ) { return (Gia_Obj_t *)((ABC_PTRUINT_T)(p) & ~01); }
466470
static inline Gia_Obj_t * Gia_Not( Gia_Obj_t * p ) { return (Gia_Obj_t *)((ABC_PTRUINT_T)(p) ^ 01); }
467471
static inline Gia_Obj_t * Gia_NotCond( Gia_Obj_t * p, int c ) { return (Gia_Obj_t *)((ABC_PTRUINT_T)(p) ^ (c)); }
@@ -1348,6 +1352,8 @@ extern Gia_Man_t * Gia_ManDupOrderDfsReverse( Gia_Man_t * p, int fRevFan
13481352
extern Gia_Man_t * Gia_ManDupOutputGroup( Gia_Man_t * p, int iOutStart, int iOutStop );
13491353
extern Gia_Man_t * Gia_ManDupOutputVec( Gia_Man_t * p, Vec_Int_t * vOutPres );
13501354
extern Gia_Man_t * Gia_ManDupSelectedOutputs( Gia_Man_t * p, Vec_Int_t * vOutsLeft );
1355+
extern void Gia_ManOriginsDup( Gia_Man_t * pNew, Gia_Man_t * pOld );
1356+
extern void Gia_ManOriginsAfterRoundTrip( Gia_Man_t * pNew, Gia_Man_t * pOld );
13511357
extern Gia_Man_t * Gia_ManDupOrderAiger( Gia_Man_t * p );
13521358
extern Gia_Man_t * Gia_ManDupLastPis( Gia_Man_t * p, int nLastPis );
13531359
extern Gia_Man_t * Gia_ManDupFlip( Gia_Man_t * p, int * pInitState );

src/aig/gia/giaAig.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,7 @@ Gia_Man_t * Gia_ManCompress2( Gia_Man_t * p, int fUpdateLevel, int fVerbose )
600600
Aig_ManStop( pTemp );
601601
pGia = Gia_ManFromAig( pNew );
602602
Aig_ManStop( pNew );
603+
Gia_ManOriginsAfterRoundTrip( pGia, p );
603604
Gia_ManTransferTiming( pGia, p );
604605
return pGia;
605606
}
@@ -658,6 +659,8 @@ Gia_Man_t * Gia_ManPerformDch( Gia_Man_t * p, void * pPars )
658659
Gia_ManStop( pGia );
659660
pGia = Gia_ManDup( p );
660661
}
662+
else
663+
Gia_ManOriginsAfterRoundTrip( pGia, p );
661664
Gia_ManTransferTiming( pGia, p );
662665
return pGia;
663666
}

src/aig/gia/giaAiger.c

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,21 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fGiaSi
939939
else if ( fVerbose ) printf( "Finished reading extension \"y\".\n" );
940940
}
941941
else {
942-
if ( fVerbose ) printf( "Cannot read extension \"y\" because AIG is rehashed. Use \"&r -s <file.aig>\".\n" );
942+
if ( fVerbose ) printf( "Skipped extension \"y\" for vEquLitIds (AIG is rehashed).\n" );
943+
}
944+
// populate vOrigins using vNodes to map AIG→GIA object indices
945+
if ( nInts == Vec_IntSize(vNodes) ) {
946+
int k;
947+
int * pData = (int *)pCur;
948+
pNew->vOrigins = Vec_IntStartFull( Gia_ManObjNum(pNew) );
949+
for ( k = 0; k < nInts; k++ )
950+
{
951+
int giaLit = Vec_IntEntry( vNodes, k );
952+
int giaObj = Abc_Lit2Var( giaLit );
953+
int rawLit = pData[k];
954+
if ( rawLit >= 0 && giaObj < Gia_ManObjNum(pNew) )
955+
Vec_IntWriteEntry( pNew->vOrigins, giaObj, Abc_Lit2Var(rawLit) );
956+
}
943957
}
944958
pCur += 4*nInts;
945959
}
@@ -1821,8 +1835,24 @@ void Gia_AigerWriteS( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, in
18211835
assert( Vec_IntSize(p->vObjClasses) == Gia_ManObjNum(p) );
18221836
fwrite( Vec_IntArray(p->vObjClasses), 1, 4*Gia_ManObjNum(p), pFile );
18231837
}
1824-
// write object classes
1825-
if ( p->vEquLitIds )
1838+
// write object origins (vOrigins takes priority over vEquLitIds)
1839+
if ( p->vOrigins )
1840+
{
1841+
int k, nObjs = Gia_ManObjNum(p);
1842+
Vec_Int_t * vLits = Vec_IntStart( nObjs );
1843+
assert( Vec_IntSize(p->vOrigins) == nObjs );
1844+
for ( k = 0; k < nObjs; k++ )
1845+
{
1846+
int orig = Vec_IntEntry(p->vOrigins, k);
1847+
Vec_IntWriteEntry( vLits, k, orig >= 0 ? 2 * orig : -1 );
1848+
}
1849+
fprintf( pFile, "y" );
1850+
Gia_FileWriteBufferSize( pFile, 4*nObjs );
1851+
fwrite( Vec_IntArray(vLits), 1, (size_t)4*nObjs, pFile );
1852+
Vec_IntFree( vLits );
1853+
if ( fVerbose ) printf( "Finished writing extension \"y\" (from origins).\n" );
1854+
}
1855+
else if ( p->vEquLitIds )
18261856
{
18271857
fprintf( pFile, "y" );
18281858
Gia_FileWriteBufferSize( pFile, 4*Gia_ManObjNum(p) );

src/aig/gia/giaBalAig.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ Gia_Man_t * Gia_ManBalanceInt( Gia_Man_t * p, int fStrict )
420420
}
421421
assert( !fStrict || Gia_ManObjNum(pNew) <= Gia_ManObjNum(p) );
422422
Gia_ManHashStop( pNew );
423+
Gia_ManOriginsDup( pNew, p );
423424
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
424425
// perform cleanup
425426
pNew = Gia_ManCleanup( pTemp = pNew );
@@ -819,6 +820,7 @@ Gia_Man_t * Dam_ManMultiAig( Dam_Man_t * pMan )
819820
}
820821
// assert( Gia_ManObjNum(pNew) <= Gia_ManObjNum(p) );
821822
Gia_ManHashStop( pNew );
823+
Gia_ManOriginsDup( pNew, p );
822824
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
823825
// perform cleanup
824826
pNew = Gia_ManCleanup( pTemp = pNew );

src/aig/gia/giaDup.c

Lines changed: 105 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,108 @@ int Gia_ManDupOrderDfs_rec( Gia_Man_t * pNew, Gia_Man_t * p, Gia_Obj_t * pObj )
192192
return pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
193193
}
194194

195+
/**Function*************************************************************
196+
197+
Synopsis [Propagates origin mapping from old to new manager.]
198+
199+
Description [Uses Value field of old objects to find corresponding new objects.]
200+
201+
SideEffects []
202+
203+
SeeAlso []
204+
205+
***********************************************************************/
206+
void Gia_ManOriginsDup( Gia_Man_t * pNew, Gia_Man_t * pOld )
207+
{
208+
Gia_Obj_t * pObj;
209+
int i;
210+
if ( !pOld->vOrigins )
211+
return;
212+
pNew->vOrigins = Vec_IntStartFull( Gia_ManObjNum(pNew) );
213+
Gia_ManForEachObj( pOld, pObj, i )
214+
{
215+
if ( (int)Gia_ObjValue(pObj) != -1 )
216+
{
217+
int iNew = Abc_Lit2Var( Gia_ObjValue(pObj) );
218+
if ( iNew < Gia_ManObjNum(pNew) )
219+
Vec_IntWriteEntry( pNew->vOrigins, iNew,
220+
Vec_IntEntry(pOld->vOrigins, i) );
221+
}
222+
}
223+
}
224+
225+
/**Function*************************************************************
226+
227+
Synopsis [Restores origins after GIA->AIG->GIA round-trip.]
228+
229+
Description [CIs map 1:1 in order. CO drivers map 1:1 (output
230+
correspondence preserved through optimization). Remaining AND nodes
231+
get origins via top-down propagation from CO drivers through fanin
232+
cones. Note: shared nodes between multiple CO cones get the origin
233+
of whichever CO driver is visited first (non-deterministic but
234+
acceptable for best-effort source attribution).]
235+
236+
SideEffects []
237+
238+
SeeAlso []
239+
240+
***********************************************************************/
241+
void Gia_ManOriginsAfterRoundTrip( Gia_Man_t * pNew, Gia_Man_t * pOld )
242+
{
243+
Gia_Obj_t * pObj;
244+
int i;
245+
if ( !pOld->vOrigins )
246+
return;
247+
assert( Gia_ManCiNum(pNew) == Gia_ManCiNum(pOld) );
248+
assert( Gia_ManCoNum(pNew) == Gia_ManCoNum(pOld) );
249+
pNew->vOrigins = Vec_IntStartFull( Gia_ManObjNum(pNew) );
250+
// const0
251+
if ( Vec_IntSize(pOld->vOrigins) > 0 )
252+
Vec_IntWriteEntry( pNew->vOrigins, 0, Vec_IntEntry(pOld->vOrigins, 0) );
253+
// CIs map 1:1 in order
254+
Gia_ManForEachCi( pNew, pObj, i )
255+
{
256+
int iNewObj = Gia_ObjId( pNew, pObj );
257+
int iOldCi = Gia_ObjId( pOld, Gia_ManCi(pOld, i) );
258+
Vec_IntWriteEntry( pNew->vOrigins, iNewObj,
259+
Vec_IntEntry(pOld->vOrigins, iOldCi) );
260+
}
261+
// CO drivers map 1:1 (output correspondence preserved through optimization)
262+
Gia_ManForEachCo( pNew, pObj, i )
263+
{
264+
int iNewDriver = Gia_ObjFaninId0p( pNew, pObj );
265+
Gia_Obj_t * pOldCo = Gia_ManCo( pOld, i );
266+
int iOldDriver = Gia_ObjFaninId0p( pOld, pOldCo );
267+
if ( iNewDriver > 0 && Vec_IntEntry(pNew->vOrigins, iNewDriver) == -1 )
268+
Vec_IntWriteEntry( pNew->vOrigins, iNewDriver,
269+
Vec_IntEntry(pOld->vOrigins, iOldDriver) );
270+
}
271+
// Top-down propagation: spread CO driver origins backward through fanin cones
272+
// Walk AND nodes in reverse topological order (high to low ID)
273+
for ( i = Gia_ManObjNum(pNew) - 1; i > 0; i-- )
274+
{
275+
int f0, f1, orig;
276+
pObj = Gia_ManObj( pNew, i );
277+
if ( !Gia_ObjIsAnd(pObj) )
278+
continue;
279+
orig = Vec_IntEntry( pNew->vOrigins, i );
280+
if ( orig < 0 )
281+
continue;
282+
f0 = Gia_ObjFaninId0(pObj, i);
283+
f1 = Gia_ObjFaninId1(pObj, i);
284+
if ( f0 > 0 && Vec_IntEntry(pNew->vOrigins, f0) == -1 )
285+
Vec_IntWriteEntry( pNew->vOrigins, f0, orig );
286+
if ( f1 > 0 && Vec_IntEntry(pNew->vOrigins, f1) == -1 )
287+
Vec_IntWriteEntry( pNew->vOrigins, f1, orig );
288+
}
289+
}
290+
195291
/**Function*************************************************************
196292
197293
Synopsis [Duplicates AIG while putting objects in the DFS order.]
198294
199295
Description []
200-
296+
201297
SideEffects []
202298
203299
SeeAlso []
@@ -220,6 +316,7 @@ Gia_Man_t * Gia_ManDupOrderDfs( Gia_Man_t * p )
220316
pObj->Value = Gia_ManAppendCi(pNew);
221317
assert( Gia_ManCiNum(pNew) == Gia_ManCiNum(p) );
222318
Gia_ManDupRemapCis( pNew, p );
319+
Gia_ManOriginsDup( pNew, p );
223320
Gia_ManDupRemapEquiv( pNew, p );
224321
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
225322
return pNew;
@@ -544,6 +641,7 @@ Gia_Man_t * Gia_ManDupOrderAiger( Gia_Man_t * p )
544641
pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
545642
Gia_ManForEachCo( p, pObj, i )
546643
pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
644+
Gia_ManOriginsDup( pNew, p );
547645
Gia_ManDupRemapEquiv( pNew, p );
548646
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
549647
assert( Gia_ManIsNormalized(pNew) );
@@ -777,6 +875,7 @@ Gia_Man_t * Gia_ManDup( Gia_Man_t * p )
777875
else if ( Gia_ObjIsCo(pObj) )
778876
pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
779877
}
878+
Gia_ManOriginsDup( pNew, p );
780879
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
781880
if ( p->pCexSeq )
782881
pNew->pCexSeq = Abc_CexDup( p->pCexSeq, Gia_ManRegNum(p) );
@@ -1574,6 +1673,7 @@ Gia_Man_t * Gia_ManDupMarked( Gia_Man_t * p )
15741673
pNew->pSibls[Abc_Lit2Var(pObj->Value)] = Abc_Lit2Var(pSibl->Value);
15751674
}
15761675
}
1676+
Gia_ManOriginsDup( pNew, p );
15771677
return pNew;
15781678
}
15791679

@@ -1805,6 +1905,7 @@ Gia_Man_t * Gia_ManDupDfs( Gia_Man_t * p )
18051905
Gia_ManDupDfs_rec( pNew, p, Gia_ObjFanin0(pObj) );
18061906
Gia_ManForEachCo( p, pObj, i )
18071907
pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1908+
Gia_ManOriginsDup( pNew, p );
18081909
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
18091910
pNew->nConstrs = p->nConstrs;
18101911
if ( p->pCexSeq )
@@ -1873,6 +1974,7 @@ Gia_Man_t * Gia_ManDupDfsRehash( Gia_Man_t * p )
18731974
Gia_ManDupDfsRehash_rec( pNew, p, Gia_ObjFanin0(pObj) );
18741975
Gia_ManForEachCo( p, pObj, i )
18751976
pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1977+
Gia_ManOriginsDup( pNew, p );
18761978
pNew = Gia_ManCleanup( pTemp = pNew );
18771979
Gia_ManStop( pTemp );
18781980
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
@@ -3889,6 +3991,8 @@ Gia_Man_t * Gia_ManChoiceMiter( Vec_Ptr_t * vGias )
38893991
Gia_ManChoiceMiter_rec( pNew, pGia, Gia_ManCo( pGia, k ) );
38903992
}
38913993
Gia_ManHashStop( pNew );
3994+
// propagate origins from the first (primary) AIG
3995+
Gia_ManOriginsDup( pNew, pGia0 );
38923996
// check the presence of dangling nodes
38933997
nNodes = Gia_ManHasDangling( pNew );
38943998
//assert( nNodes == 0 );

src/aig/gia/giaEquiv.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@ Gia_Man_t * Gia_ManEquivReduce( Gia_Man_t * p, int fUseAll, int fDualOut, int fS
744744
Gia_ManForEachCo( p, pObj, i )
745745
pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
746746
Gia_ManHashStop( pNew );
747+
Gia_ManOriginsDup( pNew, p );
747748
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
748749
return pNew;
749750
}

src/aig/gia/giaHash.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,17 @@ int Gia_ManHashXorReal( Gia_Man_t * p, int iLit0, int iLit1 )
503503
assert( *pPlace == 0 );
504504
*pPlace = Abc_Lit2Var( iNode );
505505
}
506+
// propagate origin from parent with lower valid origin ID
507+
if ( p->vOrigins )
508+
{
509+
int iNew = *pPlace;
510+
int o0 = Gia_ObjOrigin(p, Abc_Lit2Var(iLit0));
511+
int o1 = Gia_ObjOrigin(p, Abc_Lit2Var(iLit1));
512+
int orig = (o0 >= 0 && (o1 < 0 || o0 <= o1)) ? o0 : o1;
513+
while ( Vec_IntSize(p->vOrigins) <= iNew )
514+
Vec_IntPush( p->vOrigins, -1 );
515+
Vec_IntWriteEntry( p->vOrigins, iNew, orig );
516+
}
506517
return Abc_Var2Lit( *pPlace, fCompl );
507518
}
508519
}
@@ -558,6 +569,19 @@ int Gia_ManHashMuxReal( Gia_Man_t * p, int iLitC, int iLit1, int iLit0 )
558569
assert( *pPlace == 0 );
559570
*pPlace = Abc_Lit2Var( iNode );
560571
}
572+
// propagate origin from parent with lower valid origin ID
573+
if ( p->vOrigins )
574+
{
575+
int iNew = *pPlace;
576+
int o0 = Gia_ObjOrigin(p, Abc_Lit2Var(iLit0));
577+
int o1 = Gia_ObjOrigin(p, Abc_Lit2Var(iLit1));
578+
int oC = Gia_ObjOrigin(p, Abc_Lit2Var(iLitC));
579+
int orig = (o0 >= 0 && (o1 < 0 || o0 <= o1)) ? o0 : o1;
580+
if ( oC >= 0 && (orig < 0 || oC <= orig) ) orig = oC;
581+
while ( Vec_IntSize(p->vOrigins) <= iNew )
582+
Vec_IntPush( p->vOrigins, -1 );
583+
Vec_IntWriteEntry( p->vOrigins, iNew, orig );
584+
}
561585
return Abc_Var2Lit( *pPlace, fCompl );
562586
}
563587
}
@@ -615,6 +639,18 @@ int Gia_ManHashAnd( Gia_Man_t * p, int iLit0, int iLit1 )
615639
assert( *pPlace == 0 );
616640
*pPlace = Abc_Lit2Var( iNode );
617641
}
642+
// propagate origin from parent with lower valid origin ID
643+
if ( p->vOrigins )
644+
{
645+
int iNew = *pPlace;
646+
int o0 = Gia_ObjOrigin(p, Abc_Lit2Var(iLit0));
647+
int o1 = Gia_ObjOrigin(p, Abc_Lit2Var(iLit1));
648+
int orig = (o0 >= 0 && (o1 < 0 || o0 <= o1)) ? o0 : o1;
649+
// grow vOrigins if needed
650+
while ( Vec_IntSize(p->vOrigins) <= iNew )
651+
Vec_IntPush( p->vOrigins, -1 );
652+
Vec_IntWriteEntry( p->vOrigins, iNew, orig );
653+
}
618654
return Abc_Var2Lit( *pPlace, 0 );
619655
}
620656
}
@@ -761,6 +797,7 @@ Gia_Man_t * Gia_ManRehash( Gia_Man_t * p, int fAddStrash )
761797
}
762798
Gia_ManHashStop( pNew );
763799
pNew->fAddStrash = 0;
800+
Gia_ManOriginsDup( pNew, p );
764801
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
765802
// printf( "Top gate is %s\n", Gia_ObjFaninC0(Gia_ManCo(pNew, 0))? "OR" : "AND" );
766803
pNew = Gia_ManCleanup( pTemp = pNew );

src/aig/gia/giaIf.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3015,6 +3015,24 @@ Gia_Man_t * Gia_ManPerformMappingInt( Gia_Man_t * p, If_Par_t * pPars )
30153015
pNew = Gia_ManFromIfAig( pIfMan );
30163016
else
30173017
pNew = Gia_ManFromIfLogic( pIfMan );
3018+
// propagate origin mapping from input GIA through IF mapper to output GIA
3019+
// IF objects 0..Gia_ManObjNum(p)-1 correspond 1:1 to input GIA objects;
3020+
// iCopy gives the literal in the output GIA (set by Gia_ManFromIfLogic/Aig)
3021+
if ( p->vOrigins )
3022+
{
3023+
If_Obj_t * pIfObj = NULL;
3024+
pNew->vOrigins = Vec_IntStartFull( Gia_ManObjNum(pNew) );
3025+
If_ManForEachObj( pIfMan, pIfObj, i )
3026+
{
3027+
if ( i < Gia_ManObjNum(p) && pIfObj->iCopy >= 0 )
3028+
{
3029+
int iNewObj = Abc_Lit2Var( pIfObj->iCopy );
3030+
if ( iNewObj < Gia_ManObjNum(pNew) )
3031+
Vec_IntWriteEntry( pNew->vOrigins, iNewObj,
3032+
Vec_IntEntry(p->vOrigins, i) );
3033+
}
3034+
}
3035+
}
30183036
if ( p->vCiArrs || p->vCoReqs )
30193037
{
30203038
If_Obj_t * pIfObj = NULL;

src/aig/gia/giaMan.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ void Gia_ManStop( Gia_Man_t * p )
107107
Vec_IntFreeP( &p->vIdsOrig );
108108
Vec_IntFreeP( &p->vIdsEquiv );
109109
Vec_IntFreeP( &p->vEquLitIds );
110+
Vec_IntFreeP( &p->vOrigins );
110111
Vec_IntFreeP( &p->vLutConfigs );
111112
Vec_IntFreeP( &p->vEdgeDelay );
112113
Vec_IntFreeP( &p->vEdgeDelayR );

src/aig/gia/giaMuxes.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ Gia_Man_t * Gia_ManDupMuxes( Gia_Man_t * p, int Limit )
140140
pNew->pSibls[Gia_ObjId(pNew, pObjNew)] = Gia_ObjId(pNew, pSiblNew);
141141
}
142142
Gia_ManHashStop( pNew );
143+
Gia_ManOriginsDup( pNew, p );
143144
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
144145
// perform cleanup
145146
pNew = Gia_ManCleanup( pTemp = pNew );
@@ -253,6 +254,7 @@ Gia_Man_t * Gia_ManDupNoMuxes( Gia_Man_t * p, int fSkipBufs )
253254
pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
254255
}
255256
Gia_ManHashStop( pNew );
257+
Gia_ManOriginsDup( pNew, p );
256258
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
257259
// perform cleanup
258260
pNew = Gia_ManCleanup( pTemp = pNew );

0 commit comments

Comments
 (0)