-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Add hexagonalization algorithm to pyfiction (#295)
- Loading branch information
1 parent
14fdb3b
commit 00dd5e7
Showing
6 changed files
with
75 additions
and
15 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
bindings/pyfiction/include/pyfiction/algorithms/physical_design/hexagonalization.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// Created by simon on 22.09.23. | ||
// | ||
|
||
#ifndef PYFICTION_HEXAGONALIZATION_HPP | ||
#define PYFICTION_HEXAGONALIZATION_HPP | ||
|
||
#include "pyfiction/documentation.hpp" | ||
|
||
#include <fiction/algorithms/physical_design/hexagonalization.hpp> | ||
#include <fiction/types.hpp> | ||
|
||
#include <pybind11/pybind11.h> | ||
|
||
namespace pyfiction | ||
{ | ||
|
||
namespace detail | ||
{ | ||
|
||
template <typename Lyt> | ||
void hexagonalization(pybind11::module& m) | ||
{ | ||
using namespace pybind11::literals; | ||
|
||
m.def( | ||
"hexagonalization", | ||
[](const Lyt& lyt) -> py_hexagonal_gate_layout { return fiction::hexagonalization<Lyt>(lyt); }, "layout"_a, | ||
DOC(fiction_hexagonalization)); | ||
} | ||
|
||
} // namespace detail | ||
|
||
inline void hexagonalization(pybind11::module& m) | ||
{ | ||
detail::hexagonalization<py_cartesian_gate_layout>(m); | ||
} | ||
|
||
} // namespace pyfiction | ||
|
||
#endif // PYFICTION_HEXAGONALIZATION_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
bindings/pyfiction/test/algorithms/physical_design/test_hexagonalization.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from fiction.pyfiction import * | ||
import unittest | ||
import os | ||
|
||
dir_path = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
|
||
class TestHexagonalization(unittest.TestCase): | ||
|
||
def test_hexagonalization(self): | ||
network = read_logic_network(dir_path + "/../../resources/mux21.v") | ||
layout = orthogonal(network) | ||
hex_layout = hexagonalization(layout) | ||
self.assertEqual(equivalence_checking(layout, hex_layout), eq_type.STRONG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters