diff --git a/CMakeLists.txt b/CMakeLists.txt index cd3f09e..7f5a0a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ set(CMAKE_CXX_EXTENSIONS OFF) # Set the project name and version project( aigverse - VERSION 0.0.6 + VERSION 0.0.7 DESCRIPTION "A Python library for working with logic networks, synthesis, and optimization." HOMEPAGE_URL "https://github.com/marcelwa/aigverse" diff --git a/bindings/aigverse/include/aigverse/networks/logic_networks.hpp b/bindings/aigverse/include/aigverse/networks/logic_networks.hpp index 988b36d..5fae99e 100644 --- a/bindings/aigverse/include/aigverse/networks/logic_networks.hpp +++ b/bindings/aigverse/include/aigverse/networks/logic_networks.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -82,6 +83,13 @@ void network(pybind11::module& m, const std::string& network_name) .def("num_pos", &Ntk::num_pos) .def("num_cos", &Ntk::num_cos) + .def("num_levels", + [](const Ntk& ntk) -> uint32_t + { + mockturtle::depth_view depth_ntk{ntk}; + return depth_ntk.depth(); + }) + .def("get_node", &Ntk::get_node, "s"_a) .def("make_signal", &Ntk::make_signal, "n"_a) .def("is_complemented", &Ntk::is_complemented, "s"_a) diff --git a/bindings/aigverse/test/networks/test_aig.py b/bindings/aigverse/test/networks/test_aig.py index ce9edbc..5477703 100644 --- a/bindings/aigverse/test/networks/test_aig.py +++ b/bindings/aigverse/test/networks/test_aig.py @@ -290,6 +290,7 @@ def test_aig_structural_properties(self): self.assertTrue(hasattr(aig, 'num_pis')) self.assertTrue(hasattr(aig, 'num_pos')) self.assertTrue(hasattr(aig, 'num_gates')) + self.assertTrue(hasattr(aig, 'num_levels')) self.assertTrue(hasattr(aig, 'fanin_size')) self.assertTrue(hasattr(aig, 'fanout_size')) @@ -297,14 +298,20 @@ def test_aig_structural_properties(self): x1 = aig.create_pi() x2 = aig.create_pi() + self.assertEqual(aig.num_levels(), 0) + # Create AND and OR gates f1 = aig.create_and(x1, x2) f2 = aig.create_or(x1, x2) + self.assertEqual(aig.num_levels(), 0) + # Create primary outputs aig.create_po(f1) aig.create_po(f2) + self.assertEqual(aig.num_levels(), 1) + # Check structural properties self.assertEqual(aig.size(), 5) self.assertEqual(aig.num_pis(), 2) diff --git a/pyproject.toml b/pyproject.toml index 531dc57..ab8564a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta" [project] name = "aigverse" -version = "0.0.6" +version = "0.0.7" description = "A Python library for working with logic networks, synthesis, and optimization." readme = "README.md" authors = [ diff --git a/setup.py b/setup.py index d8ea46f..c6e53b7 100644 --- a/setup.py +++ b/setup.py @@ -83,7 +83,7 @@ def build_extension(self, ext): setup( name='aigverse', - version='0.0.6', + version='0.0.7', author='Marcel Walter', author_email='marcel.walter@tum.de', description='A Python library for working with logic networks, synthesis, and optimization.',