lsils / mockturtle

C++ logic network library
MIT License
210 stars 139 forks source link

Fix a bug when creating `pi` and using `pi_index` #523

Closed boschmitt closed 2 years ago

boschmitt commented 2 years ago

Both mig and xmg uses the same logic as aig to retrieve a primary input index from its node. However, they create primary inputs differently: instead of making their children equal to the pi index, as in a aig, the make them equal to the numerical limit of uint64_t. Effectively this means that the pi_index method on mig and xmg in broken.

This commit solves the issue. Someone must check the other networks to see if the problem also exists, e.g., aqfp seems to suffer from it too.

hriener commented 2 years ago

Hi Bruno,

Could we get failing regression test(s) for the fix(es)?

Best

codecov-commenter commented 2 years ago

Codecov Report

Merging #523 (ef95cf8) into master (4ceb7e0) will decrease coverage by 0.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #523      +/-   ##
==========================================
- Coverage   82.61%   82.60%   -0.01%     
==========================================
  Files         146      146              
  Lines       18080    18099      +19     
==========================================
+ Hits        14936    14950      +14     
- Misses       3144     3149       +5     
Impacted Files Coverage Δ
include/mockturtle/networks/mig.hpp 91.13% <100.00%> (+0.08%) :arrow_up:
include/mockturtle/networks/xmg.hpp 88.22% <100.00%> (+0.10%) :arrow_up:
...nclude/mockturtle/algorithms/dsd_decomposition.hpp 87.32% <0.00%> (-4.23%) :arrow_down:
.../mockturtle/algorithms/node_resynthesis/direct.hpp 54.12% <0.00%> (-1.02%) :arrow_down:
include/mockturtle/networks/aig.hpp 93.91% <0.00%> (+0.05%) :arrow_up:
include/mockturtle/networks/xag.hpp 93.67% <0.00%> (+0.06%) :arrow_up:
include/mockturtle/algorithms/refactoring.hpp 72.61% <0.00%> (+0.32%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4ceb7e0...ef95cf8. Read the comment docs.

hriener commented 2 years ago

Thanks!

The comment in the test cases(s) has a minor typo: /constate/constant/

lee30sonia commented 2 years ago

Someone must check the other networks to see if the problem also exists, e.g., aqfp seems to suffer from it too.

@mdsudara FYI