Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion include/mockturtle/algorithms/node_resynthesis/xmg_npn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) );
}
Expand Down
4 changes: 2 additions & 2 deletions include/mockturtle/algorithms/sim_resub.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Ntk, validator_t>;

Expand Down
30 changes: 14 additions & 16 deletions include/mockturtle/algorithms/simulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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<uint32_t> empty_slots;
std::vector<int64_t> 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 )
{
Expand All @@ -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] );
Expand All @@ -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 )
{
Expand All @@ -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 )
{
Expand Down