Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(&dch): choices bugs in &put #356

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

wjrforcyber
Copy link
Contributor

@wjrforcyber wjrforcyber commented Jan 9, 2025

This pull request fixes a bug when use &dch with &put.

Minimum reproducible Bug:

./abc -c "&r i10.aig; &dch; &put"
ABC command line: "&r i10.aig; &dch; &put".

Warning: Transforming AIG with 0 choice nodes.
Assertion failed: (!fChoices || (p->pNexts && p->pReprs)), function Gia_ManToAig, file giaAig.c, line 320.
[1]    83729 abort      ./abc -c "&r i10.aig; &dch; &put"

Analysis

This is caused by missing the deriving process between pSibls and pReprs, pNexts.
We could see that due to the use of pSibls, Gia_ManFromAigChoices is put into use instead of Gia_ManFromAig:

abc/src/aig/gia/giaAig.c

Lines 649 to 650 in d5e1a5d

// pGia = Gia_ManFromAig( pNew );
pGia = Gia_ManFromAigChoices( pNew );

which misses the deriving process like Gia_ManFromAig has:

abc/src/aig/gia/giaAig.c

Lines 98 to 99 in d5e1a5d

if ( pNew->pNexts )
Gia_ManDeriveReprs( pNew );

So I add a function void Gia_ManDeriveReprsFromSibls( Gia_Man_t *p ) at the end of Gia_ManFromAigChoices, which helps assertion pass.

After fix

  • No error.
  • cec checked.
    For the MRE above:
./abc -c "&r i10.aig; &dch; &put; ps; cec i10.aig"
ABC command line: "&r i10.aig; &dch; &put; ps; cec i10.aig".

Warning: Transforming AIG with 631 choice nodes.
i10                           : i/o =  257/  224  lat =    0  and =   4251 (choice = 631)  lev = 33
Warning: The choice nodes in the original AIG are removed by strashing.
Networks are equivalent.  Time =     0.19 sec

For a detailed &dch and &ps:

./abc -c "&r i10.aig; &dch; &ps; &put; ps; cec i10.aig"
ABC command line: "&r i10.aig; &dch; &ps; &put; ps; cec i10.aig".

i10      : i/o =    257/    224  and =    4251  lev =   38 (11.44)  mem = 0.06 MB  ch =  754
cst =       0  cls =    631  lit =     754  unused =    3123  proof =     0
Warning: Transforming AIG with 631 choice nodes.
i10                           : i/o =  257/  224  lat =    0  and =   4251 (choice = 631)  lev = 33
Warning: The choice nodes in the original AIG are removed by strashing.
Networks are equivalent.  Time =     0.18 sec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant