lsils / mockturtle

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

[WIP - don't merge] Allow mockturtle to run on big-endian platforms. #481

Closed boschmitt closed 2 years ago

boschmitt commented 3 years ago

Most of the code is not influenced by the endianness. However the combination of bit-filed struct and union is.

For example. Take this code:

union {
    struct
    {
        uint64_t complement : 1;
        uint64_t index : 63;
    };
    uint64_t data;
};

If we try to change the value of 'complement' using (data ^ 1), then things will break. This commit adds compile-time macros to identify the endianness of the platform, and change the order of 'complement' and 'index' accordingly. (Everything else is taken care by the compiler.)

It might be a good idea to also wait for kitty to merge https://github.com/msoeken/kitty/pull/122 and update kitty

codecov-commenter commented 3 years ago

Codecov Report

Merging #481 (9015d19) into master (1309dab) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #481   +/-   ##
=======================================
  Coverage   83.47%   83.47%           
=======================================
  Files         136      136           
  Lines       15926    15926           
=======================================
  Hits        13295    13295           
  Misses       2631     2631           
Impacted Files Coverage Δ
include/mockturtle/networks/aig.hpp 93.56% <ø> (ø)
include/mockturtle/networks/aqfp.hpp 90.00% <ø> (ø)
include/mockturtle/networks/mig.hpp 91.57% <ø> (ø)
include/mockturtle/networks/storage.hpp 96.96% <ø> (ø)
include/mockturtle/networks/xag.hpp 93.29% <ø> (ø)
include/mockturtle/networks/xmg.hpp 86.55% <ø> (ø)

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 1309dab...9015d19. Read the comment docs.

boschmitt commented 3 years ago

This don't solve the whole problem.

Upon further investigation I noticed that bsat2 does not work on other platforms. Ideally we should change code that rely on SAT solvers to no use it.