From 82873289f6ef4eb4a7860a229acb9e50987c52a2 Mon Sep 17 00:00:00 2001 From: Gabriel Gouvine Date: Wed, 6 May 2015 16:09:50 +0200 Subject: [PATCH] Improvements for Steiner trees * Fixed a bug when calling vertical topology computation * Now export a horizontal topology function for routers --- coloquinte/src/coloquinte/circuit_helper.hxx | 1 + coloquinte/src/topologies.cxx | 78 ++++++++++++-------- 2 files changed, 50 insertions(+), 29 deletions(-) diff --git a/coloquinte/src/coloquinte/circuit_helper.hxx b/coloquinte/src/coloquinte/circuit_helper.hxx index e19994c6..53187393 100644 --- a/coloquinte/src/coloquinte/circuit_helper.hxx +++ b/coloquinte/src/coloquinte/circuit_helper.hxx @@ -82,6 +82,7 @@ std::int64_t get_HPWL_length(netlist const & circuit, placement_t const & pl, in std::int64_t get_RSMT_length(netlist const & circuit, placement_t const & pl, index_t net_ind); std::vector > get_MST_topology(std::vector > const & pins); +std::vector > get_RSMT_horizontal_topology(std::vector > const & pins, index_t exactitude_limits); point > > get_RSMT_topology(std::vector > const & pins, index_t exactitude_limit); } // namespace coloquinte diff --git a/coloquinte/src/topologies.cxx b/coloquinte/src/topologies.cxx index 3a2d67b8..7bb4790a 100644 --- a/coloquinte/src/topologies.cxx +++ b/coloquinte/src/topologies.cxx @@ -343,9 +343,55 @@ std::vector get_big_horizontal_topology_from_sorted(std::vector get_RSMT_horizontal_topology(std::vector > const & pins, index_t exactitude_limit){ + if(pins.size() <= 1) + return std::vector(); + else if(pins.size() == 2) + return std::vector(1, edge_t(0, 1)); + else if(pins.size() == 3){ + std::vector ipoints(pins.size()); + for(index_t i=0; i{{xpoints[0].index, xpoints[1].index}, {xpoints[1].index, xpoints[2].index}}; + } + else{ + std::vector horizontal_topology; + + // Sort the pins by x coordinate + std::vector ipoints(pins.size()); + for(index_t i=0; i > sorted_pins(pins.size()); + for(index_t i=0; i > get_MST_topology(std::vector > const & pins){ std::vector edges; @@ -478,34 +524,8 @@ point > > get_RSMT_topology(std::vector< return point >{{{xpoints[0].index, xpoints[1].index}, {xpoints[1].index, xpoints[2].index}}, {{ypoints[0].index, ypoints[1].index}, {ypoints[1].index, ypoints[2].index}}}; } else{ - std::vector horizontal_topology; - - // Sort the pins by x coordinate - std::vector ipoints(pins.size()); - for(index_t i=0; i > sorted_pins(pins.size()); - for(index_t i=0; i >(horizontal_topology, get_vertical_topology(sorted_pins, horizontal_topology)); + std::vector horizontal_topology = get_RSMT_horizontal_topology(pins, exactitude_limit); + return point >(horizontal_topology, get_vertical_topology(pins, horizontal_topology)); } }