Skip to content

Commit

Permalink
Merge branch 'cda-tum:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Drewniok authored Jul 25, 2023
2 parents d300bc1 + aa68809 commit 2dc75ac
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
22 changes: 11 additions & 11 deletions include/fiction/layouts/obstruction_layout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class obstruction_layout<Lyt, false> : public Lyt
/**
* Standard constructor for empty layouts.
*/
obstruction_layout() : Lyt(), strg{std::make_shared<obstruction_layout_storage>()}
obstruction_layout() : Lyt(), obstr_strg{std::make_shared<obstruction_layout_storage>()}
{
static_assert(is_coordinate_layout_v<Lyt>, "Lyt is not a coordinate layout");
}
Expand All @@ -65,7 +65,7 @@ class obstruction_layout<Lyt, false> : public Lyt
*
* @param lyt Existing layout that is to be extended by an obstruction interface.
*/
explicit obstruction_layout(const Lyt& lyt) : Lyt(lyt), strg{std::make_shared<obstruction_layout_storage>()}
explicit obstruction_layout(const Lyt& lyt) : Lyt(lyt), obstr_strg{std::make_shared<obstruction_layout_storage>()}
{
static_assert(is_coordinate_layout_v<Lyt>, "Lyt is not a coordinate layout");
}
Expand All @@ -76,7 +76,7 @@ class obstruction_layout<Lyt, false> : public Lyt
*/
void obstruct_coordinate(const typename Lyt::coordinate& c) noexcept
{
strg->obstructed_coordinates.insert(c);
obstr_strg->obstructed_coordinates.insert(c);
}
/**
* Marks the connection from coordinate `src` to coordinate `tgt` as obstructed.
Expand All @@ -88,7 +88,7 @@ class obstruction_layout<Lyt, false> : public Lyt
*/
void obstruct_connection(const typename Lyt::coordinate& src, const typename Lyt::coordinate& tgt) noexcept
{
strg->obstructed_connections.insert({src, tgt});
obstr_strg->obstructed_connections.insert({src, tgt});
}
/**
* Clears the obstruction status of the given coordinate `c` if the obstruction was manually marked via
Expand All @@ -98,7 +98,7 @@ class obstruction_layout<Lyt, false> : public Lyt
*/
void clear_obstructed_coordinate(const typename Lyt::coordinate& c) noexcept
{
strg->obstructed_coordinates.erase(c);
obstr_strg->obstructed_coordinates.erase(c);
}
/**
* Clears the obstruction status of the connection from coordinate `src` to coordinate `tgt` if the obstruction was
Expand All @@ -109,21 +109,21 @@ class obstruction_layout<Lyt, false> : public Lyt
*/
void clear_obstructed_connection(const typename Lyt::coordinate& src, const typename Lyt::coordinate& tgt) noexcept
{
strg->obstructed_connections.erase({src, tgt});
obstr_strg->obstructed_connections.erase({src, tgt});
}
/**
* Clears all obstructed coordinates that were manually marked via `obstruct_coordinate`.
*/
void clear_obstructed_coordinates() noexcept
{
strg->obstructed_coordinates.clear();
obstr_strg->obstructed_coordinates.clear();
}
/**
* Clears all obstructed connections that were manually marked via `obstruct_connection`.
*/
void clear_obstructed_connections() noexcept
{
strg->obstructed_connections.clear();
obstr_strg->obstructed_connections.clear();
}
/**
* Checks if the given coordinate is obstructed of some sort.
Expand All @@ -133,7 +133,7 @@ class obstruction_layout<Lyt, false> : public Lyt
*/
[[nodiscard]] bool is_obstructed_coordinate(const typename Lyt::coordinate& c) const noexcept
{
if (strg->obstructed_coordinates.count(c) > 0)
if (obstr_strg->obstructed_coordinates.count(c) > 0)
{
return true;
}
Expand All @@ -160,7 +160,7 @@ class obstruction_layout<Lyt, false> : public Lyt
[[nodiscard]] bool is_obstructed_connection(const typename Lyt::coordinate& src,
const typename Lyt::coordinate& tgt) const noexcept
{
if (strg->obstructed_connections.count({src, tgt}) > 0)
if (obstr_strg->obstructed_connections.count({src, tgt}) > 0)
{
return true;
}
Expand All @@ -176,7 +176,7 @@ class obstruction_layout<Lyt, false> : public Lyt
}

private:
storage strg;
storage obstr_strg;
};

template <class T>
Expand Down
11 changes: 11 additions & 0 deletions test/algorithms/verification/equivalence_checking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "utils/blueprints/network_blueprints.hpp"

#include <fiction/algorithms/verification/equivalence_checking.hpp>
#include <fiction/layouts/obstruction_layout.hpp>
#include <fiction/networks/technology_network.hpp>
#include <fiction/types.hpp>

Expand Down Expand Up @@ -93,6 +94,16 @@ TEST_CASE("Network-layout equivalence", "[equiv]")
check_for_strong_equiv(blueprints::and_or_network<fiction::technology_network>(),
blueprints::and_or_gate_layout<hex_odd_row_gate_clk_lyt>());
}
SECTION("Obstruction layout")
{
const auto lyt = blueprints::and_or_gate_layout<cart_gate_clk_lyt>();
const auto obstr_lyt = obstruction_layout{lyt};

check_for_strong_equiv(blueprints::and_or_network<mockturtle::aig_network>(), obstr_lyt);
check_for_strong_equiv(blueprints::and_or_network<mockturtle::mig_network>(), obstr_lyt);
check_for_strong_equiv(blueprints::and_or_network<mockturtle::xag_network>(), obstr_lyt);
check_for_strong_equiv(blueprints::and_or_network<fiction::technology_network>(), obstr_lyt);
}
}

TEST_CASE("Layout-layout equivalence", "[equiv]")
Expand Down

0 comments on commit 2dc75ac

Please sign in to comment.