Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
simon1hofmann committed Jul 27, 2023
1 parent 30b1d45 commit 200340a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
11 changes: 2 additions & 9 deletions experiments/optimization/optimization.cpp
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
#include "fiction/layouts/coordinates.hpp"
#include "fiction_experiments.hpp"

#include <fiction/algorithms/path_finding/a_star.hpp>
#include <fiction/algorithms/path_finding/cost.hpp>
#include <fiction/algorithms/path_finding/distance.hpp> // pre-defined types suitable for the FCN domain
#include <fiction/algorithms/physical_design/orthogonal.hpp> // scalable heuristic for physical design of FCN layouts
#include <fiction/algorithms/physical_design/layout_optimization.hpp> // scalable heuristic for physical design of FCN layouts
#include <fiction/algorithms/physical_design/optimization.hpp> // scalable heuristic for physical design of FCN layouts
#include <fiction/algorithms/properties/critical_path_length_and_throughput.hpp> // critical path and throughput calculations
#include <fiction/algorithms/verification/equivalence_checking.hpp> // SAT-based equivalence checking
#include <fiction/io/print_layout.hpp>
#include <fiction/layouts/obstruction_layout.hpp>
#include <fiction/traits.hpp> // traits for type-checking
#include <fiction/types.hpp>

#include <fmt/format.h> // output formatting
#include <lorina/genlib.hpp> // Genlib file parsing
#include <lorina/lorina.hpp> // Verilog/BLIF/AIGER/... file parsing
#include <mockturtle/io/verilog_reader.hpp> // call-backs to read Verilog files into networks

#include <algorithm>
#include <cassert>
#include <chrono>
#include <cstdlib>
#include <sstream>
#include <string>
#include <vector>

using coordinate = fiction::offset::ucoord_t;
using gate_lyt = fiction::gate_level_layout<
Expand Down Expand Up @@ -87,7 +80,7 @@ int main() // NOLINT

const std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
// Optimization
obs_gate_lyt layout = fiction::optimize_layout<gate_lyt>(gate_level_layout);
obs_gate_lyt layout = fiction::optimize<gate_lyt>(gate_level_layout);

print_gate_level_layout(print_stream1, layout, true, false);
std::cout << print_stream1.str();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Created by simon on 14.04.23.
//

#ifndef FICTION_HEXAGONALIZATION_HPP
#define FICTION_HEXAGONALIZATION_HPP
#ifndef FICTION_OPTIMIZATION_HPP
#define FICTION_OPTIMIZATION_HPP

#include "fiction/traits.hpp"
#include "fiction/types.hpp"
Expand All @@ -15,10 +15,9 @@
#include <fiction/algorithms/properties/critical_path_length_and_throughput.hpp> // critical path and throughput calculations
#include <fiction/algorithms/verification/equivalence_checking.hpp> // SAT-based equivalence checking
#include <fiction/layouts/obstruction_layout.hpp>
#include <fiction/layouts/bounding_box.hpp>

#include <mockturtle/traits.hpp>
#include <mockturtle/utils/node_map.hpp>
#include <mockturtle/views/topo_view.hpp>

#include <cmath>
#include <cstdint>
Expand Down Expand Up @@ -684,7 +683,7 @@ void fix_dead_nodes(obs_gate_lyt& lyt, std::vector<coordinate>& gt) noexcept


template <typename Lyt>
[[nodiscard]] detail::obs_gate_lyt optimize_layout(const Lyt& lyt) noexcept
[[nodiscard]] detail::obs_gate_lyt optimize(const Lyt& lyt) noexcept
{
static_assert(is_gate_level_layout_v<Lyt>, "Lyt is not a gate level layout");
static_assert(is_cartesian_layout_v<Lyt>, "Lyt is not a Cartesian layout");
Expand All @@ -696,12 +695,9 @@ template <typename Lyt>
const auto height = bounding_box_before.get_y_size();

// Optimization
using obs_gate_lyt = fiction::obstruction_layout<Lyt>;
obs_gate_lyt layout = fiction::obstruction_layout<Lyt>(lyt);
detail::obs_gate_lyt layout = fiction::obstruction_layout<Lyt>(lyt);

using coordinate = fiction::offset::ucoord_t;

std::vector<coordinate> gates;
std::vector<detail::coordinate> gates;
for (int x = 0; x <= width; x++)
{
for (int y = 0; y <= height; y++)
Expand All @@ -717,7 +713,7 @@ template <typename Lyt>
}

// sort gates based on diagonal line
std::sort(gates.begin(), gates.end(), [](coordinate a, coordinate b) { return a.x + a.y < b.x + b.y; });
std::sort(gates.begin(), gates.end(), [](detail::coordinate a, detail::coordinate b) { return a.x + a.y < b.x + b.y; });

int moved = 1;

Expand All @@ -734,15 +730,15 @@ template <typename Lyt>

for (int gate_id = 0; gate_id < gates.size(); gate_id++)
{
std::pair<bool, coordinate> moved_gate = detail::move_gate(gates[gate_id], layout, width, height);
std::pair<bool, detail::coordinate> moved_gate = detail::move_gate(gates[gate_id], layout, width, height);

if (moved_gate.first)
{
moved += 1;
gates[gate_id] = moved_gate.second; // update gate location
}
}
std::sort(gates.begin(), gates.end(), [](coordinate a, coordinate b) { return a.x + a.y < b.x + b.y; });
std::sort(gates.begin(), gates.end(), [](detail::coordinate a, detail::coordinate b) { return a.x + a.y < b.x + b.y; });
}

detail::delete_wires(layout, width, height);
Expand All @@ -759,4 +755,4 @@ template <typename Lyt>

} // namespace fiction

#endif // FICTION_HEXAGONALIZATION_HPP
#endif // FICTION_OPTIMIZATION_HPP

0 comments on commit 200340a

Please sign in to comment.