diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 33ec07cbd..32d8713ba 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -63,6 +63,24 @@ jobs: run: | cd build ./test/run_tests "~[quality]" + build-gcc10: + runs-on: ubuntu-latest + name: GNU GCC 10 + + steps: + - uses: actions/checkout@v1 + with: + submodules: true + - name: Build mockturtle + run: | + mkdir build + cd build + cmake -DCMAKE_CXX_COMPILER=g++-10 -DMOCKTURTLE_TEST=ON .. + make run_tests + - name: Run tests + run: | + cd build + ./test/run_tests "~[quality]" build-clang8: runs-on: ubuntu-latest name: Clang 8 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 9cfad2bf0..d4fcfbf70 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -45,8 +45,26 @@ jobs: run: | cd build ./test/run_tests "~[quality]" - build-clang9: - name: Clang 9 + build-gcc10: + name: GNU GCC 10 + runs-on: macOS-latest + + steps: + - uses: actions/checkout@v1 + with: + submodules: true + - name: Build mockturtle + run: | + mkdir build + cd build + cmake -DCMAKE_CXX_COMPILER=/usr/local/opt/gcc@10/bin/g++-10 -DMOCKTURTLE_TEST=ON .. + make run_tests + - name: Run tests + run: | + cd build + ./test/run_tests "~[quality]" + build-clang: + name: Clang 12 runs-on: macOS-latest steps: diff --git a/include/mockturtle/algorithms/node_resynthesis/xmg_npn.hpp b/include/mockturtle/algorithms/node_resynthesis/xmg_npn.hpp index e90bcf37a..e5b417a74 100644 --- a/include/mockturtle/algorithms/node_resynthesis/xmg_npn.hpp +++ b/include/mockturtle/algorithms/node_resynthesis/xmg_npn.hpp @@ -272,7 +272,7 @@ class xmg_npn_resynthesis load_optimal_xmgs( 1 ); //size optimization - for ( const auto e : opt_xmgs ) + for ( const auto& e : opt_xmgs ) { class2signal.insert( std::make_pair( e.first, create_xmg_from_str( e.second, signals ) ) ); } diff --git a/include/mockturtle/algorithms/sim_resub.hpp b/include/mockturtle/algorithms/sim_resub.hpp index 952d4485a..680b1a22b 100644 --- a/include/mockturtle/algorithms/sim_resub.hpp +++ b/include/mockturtle/algorithms/sim_resub.hpp @@ -121,7 +121,7 @@ class sim_aig_resub_functor { public: using stats = sim_aig_resub_functor_stats; - using TT = typename kitty::partial_truth_table; + using TT = kitty::partial_truth_table; using node = typename Ntk::node; using signal = typename Ntk::signal; using vgate = typename validator_t::gate; @@ -734,7 +734,7 @@ class simulation_based_resub_engine using node = typename Ntk::node; using signal = typename Ntk::signal; - using TT = typename kitty::partial_truth_table; + using TT = kitty::partial_truth_table; using gtype = typename validator_t::gate_type; using circuit = imaginary_circuit; diff --git a/include/mockturtle/algorithms/simulation.hpp b/include/mockturtle/algorithms/simulation.hpp index 287f9bb94..653ef08c9 100644 --- a/include/mockturtle/algorithms/simulation.hpp +++ b/include/mockturtle/algorithms/simulation.hpp @@ -192,10 +192,9 @@ class partial_simulator } } - /* copy constructor */ - partial_simulator( partial_simulator const& sim ) - : patterns( sim.patterns ), num_patterns( sim.num_patterns ) - { } + /* copy constructors */ + partial_simulator( partial_simulator const& sim ) = default; + partial_simulator& operator=( partial_simulator const& sim ) = default; /*! \brief Create a `partial_simulator` with given simulation patterns. * @@ -309,10 +308,9 @@ class bit_packed_simulator : public partial_simulator fill_cares( num_pis ); } - /* copy constructor */ - bit_packed_simulator( bit_packed_simulator const& sim ) - : partial_simulator( sim ), care( sim.care ), packed_patterns( sim.packed_patterns ) - { } + /* copy constructors */ + bit_packed_simulator( bit_packed_simulator const& sim ) = default; + bit_packed_simulator& operator=( bit_packed_simulator const& sim ) = default; /* copy constructor from `partial_simulator` */ bit_packed_simulator( partial_simulator const& sim ) @@ -361,9 +359,9 @@ class bit_packed_simulator : public partial_simulator if ( num_patterns == packed_patterns ) { return false; } assert( num_patterns > packed_patterns ); - std::vector empty_slots; + std::vector empty_slots; /* for each unpacked pattern (at `p`), try to pack it into one of the patterns before it (at `pos` in block `block`). */ - for ( int p = num_patterns - 1; p >= (int)packed_patterns; --p ) + for ( int64_t p = num_patterns - 1; p >= (int64_t)packed_patterns; --p ) { for ( auto block = p < 1024 ? 0 : std::rand() % ( p >> 6 ); block <= ( p >> 6 ); ++block ) { @@ -388,14 +386,14 @@ class bit_packed_simulator : public partial_simulator { /* fill the empty slots (from smaller values; `empty_slots` should be reversely sorted) */ /* `empty_slots[j]` is the smallest position where larger positions are all empty */ - int j = 0; - for ( int i = empty_slots.size() - 1; i >= 0; --i ) + int64_t j = 0; + for ( int64_t i = empty_slots.size() - 1; i >= 0; --i ) { while ( empty_slots[j] >= num_patterns - 1 && j <= i ) { if ( empty_slots[j] == num_patterns - 1 ) { --num_patterns; } ++j; - if ( j == (int)empty_slots.size() ) { break; } + if ( j == (int64_t)empty_slots.size() ) { break; } } if ( j > i ) { break; } move_pattern( num_patterns - 1, empty_slots[i] ); @@ -419,14 +417,14 @@ class bit_packed_simulator : public partial_simulator for ( auto i = 0u; i < patterns.size(); ++i ) { kitty::partial_truth_table tt( num_patterns ); - kitty::create_random( tt, seed + patterns.size() + i ); + kitty::create_random( tt, std::default_random_engine::result_type( seed + patterns.size() + i ) ); patterns.at( i ) = ( patterns.at( i ) & care.at( i ) ) | ( tt & ~care.at( i ) ); } } private: /* all bits in patterns generated before construction are care bits */ - void fill_cares( uint32_t const num_pis ) + void fill_cares( uint64_t const num_pis ) { for ( auto i = 0u; i < num_pis; ++i ) { @@ -436,7 +434,7 @@ class bit_packed_simulator : public partial_simulator } /* move the pattern at position `from` to position `to`. */ - void move_pattern( uint32_t const from, uint32_t const to ) + void move_pattern( uint64_t const from, uint64_t const to ) { for ( auto i = 0u; i < patterns.size(); ++i ) {