diff --git a/experiments/emap.cpp b/experiments/emap.cpp index 55ced8457..75e6a2d07 100644 --- a/experiments/emap.cpp +++ b/experiments/emap.cpp @@ -1,5 +1,5 @@ /* mockturtle: C++ logic network library - * Copyright (C) 2018-2023 EPFL + * Copyright (C) 2018-2024 EPFL * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation diff --git a/include/mockturtle/algorithms/emap.hpp b/include/mockturtle/algorithms/emap.hpp index 2ca21c5b6..7c552195e 100644 --- a/include/mockturtle/algorithms/emap.hpp +++ b/include/mockturtle/algorithms/emap.hpp @@ -1,5 +1,5 @@ /* mockturtle: C++ logic network library - * Copyright (C) 2018-2023 EPFL + * Copyright (C) 2018-2024 EPFL * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -478,6 +478,27 @@ class emap_cut_set ipos = std::upper_bound( _pcuts.begin(), _pend, &cut, []( auto a, auto b ) { return sort_area( *a, *b ); } ); } + /* check for redundant cut */ + typename std::array::iterator jpos = ipos; + if ( cut->ignore ) + { + while ( jpos != _pcuts.begin() ) + { + --jpos; + if ( ( *jpos )->size() < cut.size() ) + break; + if ( ( *jpos )->signature() == cut.signature() && std::equal( cut.begin(), cut.end(), ( *jpos )->begin() ) ) + return; + } + } + else if ( ipos != _pcuts.begin() ) + { + if ( ( *( ipos - 1 ) )->signature() == cut.signature() && std::equal( cut.begin(), cut.end(), ( *( ipos - 1 ) )->begin() ) ) + { + return; + } + } + /* too many cuts, we need to remove one */ if ( _pend == _pcuts.end() || limit_reached ) { diff --git a/include/mockturtle/algorithms/extract_adders.hpp b/include/mockturtle/algorithms/extract_adders.hpp index efb36fe84..072aaf35a 100644 --- a/include/mockturtle/algorithms/extract_adders.hpp +++ b/include/mockturtle/algorithms/extract_adders.hpp @@ -911,7 +911,7 @@ class extract_adders_impl std::vector> tmp_visited; const std::array and2func = { 0x88, 0x44, 0x22, 0x11, 0x77, 0xbb, 0xdd, 0xee }; - const std::array maj3func = { 0xe8, 0xd4, 0xb2, 0x71, 0x8e, 0xd4, 0x2b, 0x17 }; + const std::array maj3func = { 0xe8, 0xd4, 0xb2, 0x71, 0x8e, 0x4d, 0x2b, 0x17 }; const std::array xor2func = { 0x66, 0x99 }; const std::array xor3func = { 0x96, 0x69 }; };