Skip to content

Commit

Permalink
🏷️ Type interface for exact and orthogonal
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelwa committed Dec 4, 2024
1 parent 3bf6811 commit 5528c98
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <fiction/algorithms/physical_design/exact.hpp>

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

#include <sstream>

Expand All @@ -38,6 +37,8 @@ inline void exact(pybind11::module& m)
.def(py::init<>())
.def_readwrite("scheme", &fiction::exact_physical_design_params::scheme,
DOC(fiction_exact_physical_design_params_scheme))
.def_readwrite("upper_bound_area", &fiction::exact_physical_design_params::upper_bound_area,
DOC(fiction_exact_physical_design_params_upper_bound_area))
.def_readwrite("upper_bound_x", &fiction::exact_physical_design_params::upper_bound_x,
DOC(fiction_exact_physical_design_params_upper_bound_x))
.def_readwrite("upper_bound_y", &fiction::exact_physical_design_params::upper_bound_y,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <fiction/algorithms/physical_design/orthogonal.hpp>

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

#include <sstream>

Expand Down
90 changes: 89 additions & 1 deletion bindings/mnt/pyfiction/pyfiction.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,7 @@ class technology_mapping_stats:

def __init__(self) -> None: ...

def report(self) -> str: ...
def report(self) -> None: ...

def __repr__(self) -> str: ...

Expand Down Expand Up @@ -1665,6 +1665,94 @@ def color_routing(
) -> bool: ...


class technology_constraints(Enum):
NONE: ...
TOPOLINANO: ...


class exact_params:

def __init__(self) -> None: ...

scheme: str
upper_bound_area: int
upper_bound_x: int
upper_bound_y: int
fixed_size: bool
num_threads: int
crossings: bool
border_io: bool
straight_inverters: bool
desynchronize: bool
minimize_wires: bool
minimize_crossings: bool
timeout: int
technology_specifics: technology_constraints


class exact_stats:
time_total: float
x_size: int
y_size: int
num_gates: int
num_wires: int
num_crossings: int
num_aspect_ratios: int

def __init__(self) -> None: ...

def report(self) -> str: ...

def __repr__(self) -> str: ...


def exact_cartesian(
network: technology_network,
parameters: Optional[exact_params] = None,
statistics: Optional[exact_stats] = None
) -> cartesian_gate_layout: ...


def exact_shifted_cartesian(
network: technology_network,
parameters: Optional[exact_params] = None,
statistics: Optional[exact_stats] = None
) -> shifted_cartesian_gate_layout: ...


def exact_hexagonal(
network: technology_network,
parameters: Optional[exact_params] = None,
statistics: Optional[exact_stats] = None
) -> hexagonal_gate_layout: ...


class orthogonal_params:
def __init__(self) -> None: ...


class orthogonal_stats:
time_total: float
x_size: int
y_size: int
num_gates: int
num_wires: int
num_crossings: int

def __init__(self) -> None: ...

def report(self) -> None: ...

def __repr__(self) -> str: ...


def orthogonal(
network: technology_network,
parameters: Optional[orthogonal_params] = orthogonal_params(),
statistics: Optional[orthogonal_stats] = None
) -> cartesian_gate_layout: ...


# properties

def critical_path_length_and_throughput(
Expand Down
10 changes: 4 additions & 6 deletions include/fiction/algorithms/physical_design/exact.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <mockturtle/traits.hpp>
#include <mockturtle/utils/node_map.hpp>
#include <mockturtle/utils/stopwatch.hpp>
#include <mockturtle/views/color_view.hpp>
#include <mockturtle/views/depth_view.hpp>
#include <mockturtle/views/fanout_view.hpp>
#include <mockturtle/views/topo_view.hpp>
Expand All @@ -36,19 +35,18 @@
#include <z3++.h>

#include <algorithm>
#include <atomic>
#include <cassert>
#include <chrono>
#include <cstdint>
#include <cstdlib>
#include <functional>
#include <future>
#include <iostream>
#include <limits>
#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <thread>
#include <unordered_map>
#include <unordered_set>
#include <vector>
Expand Down Expand Up @@ -940,7 +938,7 @@ class exact_impl
/**
* Constructs a series of expressions to evaluate how many tiles were occupied by a given edge. Therefore, all
* te variables are translated to expressions of the form ite(te, 1, 0) which allows for applying z3::sum to
* them. This is a work around because no such api function for pseudo boolean exists.
* them. This is a workaround because no such api function for pseudo boolean exists.
*
* @param e Edge to consider.
* @param ve Vector of expressions to extend.
Expand All @@ -958,7 +956,7 @@ class exact_impl
// an artificial latch variable counts as an extra 1 clock cycle (n clock phases)
if (has_synchronization_elements_v<Lyt> && params.synchronization_elements && !params.desynchronize)
{
ve.push_back(z3::ite(get_te(t, e), get_tse(t) * num_phases + one, zero));
ve.push_back(z3::ite(get_te(t, e), (get_tse(t) * num_phases) + one, zero));
}
else
{
Expand Down Expand Up @@ -2366,7 +2364,7 @@ class exact_impl
*/
void black_list_gates() // TODO take advantage of incremental solving
{
const auto gather_black_list_expr = [this](const auto& port, const auto& t) noexcept
const auto gather_black_list_expr = [this](const auto& port, const auto& t)
{
z3::expr_vector iop{*ctx};

Expand Down

0 comments on commit 5528c98

Please sign in to comment.