Skip to content

Commit

Permalink
Improving filters in emap + fixes (#644)
Browse files Browse the repository at this point in the history
* Fix in extract adders

* Tests on emap

* Improve cut filtering in emap for cut merging operations
  • Loading branch information
aletempiac authored Jun 14, 2024
1 parent b7fe3a7 commit bfcee23
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion experiments/emap.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down
23 changes: 22 additions & 1 deletion include/mockturtle/algorithms/emap.hpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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<CutType*, MaxCuts>::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 )
{
Expand Down
2 changes: 1 addition & 1 deletion include/mockturtle/algorithms/extract_adders.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ class extract_adders_impl
std::vector<node<Ntk>> tmp_visited;

const std::array<uint64_t, 8> and2func = { 0x88, 0x44, 0x22, 0x11, 0x77, 0xbb, 0xdd, 0xee };
const std::array<uint64_t, 8> maj3func = { 0xe8, 0xd4, 0xb2, 0x71, 0x8e, 0xd4, 0x2b, 0x17 };
const std::array<uint64_t, 8> maj3func = { 0xe8, 0xd4, 0xb2, 0x71, 0x8e, 0x4d, 0x2b, 0x17 };
const std::array<uint64_t, 2> xor2func = { 0x66, 0x99 };
const std::array<uint64_t, 2> xor3func = { 0x96, 0x69 };
};
Expand Down

0 comments on commit bfcee23

Please sign in to comment.