Compatibility with clang 7.3 and MacOSX 10.11
This commit is contained in:
parent
4ed2308e53
commit
276fabf7ff
|
@ -1,6 +1,7 @@
|
|||
|
||||
#include "coloquinte/circuit_helper.hxx"
|
||||
#include "coloquinte/circuit.hxx"
|
||||
#include <cmath>
|
||||
|
||||
namespace coloquinte{
|
||||
|
||||
|
@ -51,7 +52,7 @@ void add_force(pin_1D const p1, pin_1D const p2, linear_system & L, float_t forc
|
|||
}
|
||||
|
||||
void add_force(pin_1D const p1, pin_1D const p2, linear_system & L, float_t tol, float_t scale){
|
||||
add_force(p1, p2, L, scale/std::max(tol, static_cast<float_t>(std::abs(p2.pos-p1.pos))));
|
||||
add_force(p1, p2, L, scale/std::max(tol, static_cast<float_t>(std::abs((float)(p2.pos-p1.pos)))));
|
||||
}
|
||||
|
||||
point<linear_system> empty_linear_systems(netlist const & circuit, placement_t const & pl){
|
||||
|
@ -344,11 +345,11 @@ point<linear_system> get_linear_pulling_forces (netlist const & circuit, placeme
|
|||
std::vector<float_t> scaling = get_area_scales(circuit);
|
||||
for(index_t i=0; i<LB_pl.cell_cnt(); ++i){
|
||||
L.x.add_anchor(
|
||||
force * scaling[i] / (std::max(static_cast<float_t>(std::abs(UB_pl.positions_[i].x - LB_pl.positions_[i].x)), min_distance)),
|
||||
force * scaling[i] / (std::max(static_cast<float_t>(std::abs((float)(UB_pl.positions_[i].x - LB_pl.positions_[i].x))), min_distance)),
|
||||
i, UB_pl.positions_[i].x
|
||||
);
|
||||
L.y.add_anchor(
|
||||
force * scaling[i] / (std::max(static_cast<float_t>(std::abs(UB_pl.positions_[i].y - LB_pl.positions_[i].y)), min_distance)),
|
||||
force * scaling[i] / (std::max(static_cast<float_t>(std::abs((float)(UB_pl.positions_[i].y - LB_pl.positions_[i].y))), min_distance)),
|
||||
i, UB_pl.positions_[i].y
|
||||
);
|
||||
}
|
||||
|
@ -378,7 +379,7 @@ float_t get_mean_linear_disruption(netlist const & circuit, placement_t const &
|
|||
if( (circuit.get_cell(i).attributes & XMovable) == 0) assert(diff.x == 0);
|
||||
if( (circuit.get_cell(i).attributes & YMovable) == 0) assert(diff.y == 0);
|
||||
|
||||
tot_cost += area * (std::abs(diff.x) + std::abs(diff.y));
|
||||
tot_cost += area * (std::abs((float)diff.x) + std::abs((float)diff.y));
|
||||
tot_area += area;
|
||||
}
|
||||
return tot_cost / tot_area;
|
||||
|
@ -394,7 +395,7 @@ float_t get_mean_quadratic_disruption(netlist const & circuit, placement_t const
|
|||
if( (circuit.get_cell(i).attributes & XMovable) == 0) assert(diff.x == 0);
|
||||
if( (circuit.get_cell(i).attributes & YMovable) == 0) assert(diff.y == 0);
|
||||
|
||||
float_t manhattan = (std::abs(diff.x) + std::abs(diff.y));
|
||||
float_t manhattan = (std::abs((float)diff.x) + std::abs((float)diff.y));
|
||||
tot_cost += area * manhattan * manhattan;
|
||||
tot_area += area;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "common.hxx"
|
||||
#include "netlist.hxx"
|
||||
#include <cmath>
|
||||
|
||||
namespace coloquinte{
|
||||
|
||||
|
@ -30,7 +31,7 @@ struct pin_2D{
|
|||
|
||||
inline int_t dist(pin_2D const a, pin_2D const b){
|
||||
point<int_t> diff = a.pos - b.pos;
|
||||
return std::abs(diff.x) + std::abs(diff.y);
|
||||
return std::abs((float)diff.x) + std::abs((float)diff.y);
|
||||
}
|
||||
|
||||
inline std::vector<pin_2D> get_pins_2D(netlist const & circuit, placement_t const & pl, index_t net_ind){
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include <queue>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#include <numeric>
|
||||
#include <cmath>
|
||||
|
||||
namespace coloquinte{
|
||||
|
||||
|
@ -133,7 +135,7 @@ inline T OSRP_leg<T>::get_displacement(legalizable_task<T> const newly_pushed, b
|
|||
}
|
||||
}
|
||||
|
||||
return cur_cost + width * std::abs(final_abs_pos - target_abs_pos); // Add the cost of the new cell
|
||||
return cur_cost + width * std::abs((float)(final_abs_pos - target_abs_pos)); // Add the cost of the new cell
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
|
@ -119,7 +119,7 @@ std::vector<cell_leg_properties> simple_legalize(
|
|||
|
||||
if(interval_lim >= cur_pos){ // An admissible solution is found (and if cell.x_pos is between cur_pos and interval_lim it is optimal)
|
||||
int_t row_best_x = std::min(interval_lim, std::max(cur_pos, cell.x_pos));
|
||||
int_t row_cost_x = std::abs(row_best_x - cell.x_pos);
|
||||
int_t row_cost_x = std::abs((float)(row_best_x - cell.x_pos));
|
||||
if(not found_location or row_cost_x + additional_cost < best_cost){
|
||||
found_location = true;
|
||||
best_cost = row_cost_x + additional_cost;
|
||||
|
@ -140,11 +140,11 @@ std::vector<cell_leg_properties> simple_legalize(
|
|||
++row_dist
|
||||
){
|
||||
if(central_row + row_dist < nbr_rows - C.nbr_rows){
|
||||
int_t add_cost = C.width * std::abs(static_cast<int_t>(central_row + row_dist) * static_cast<int_t>(row_height) + y_orig - C.y_pos);
|
||||
int_t add_cost = C.width * std::abs((float)static_cast<int_t>(central_row + row_dist) * static_cast<int_t>(row_height) + y_orig - C.y_pos);
|
||||
check_row_cost(central_row + row_dist, C, add_cost);
|
||||
}
|
||||
if(central_row >= row_dist){
|
||||
int_t add_cost = C.width * std::abs(static_cast<int_t>(central_row - row_dist) * static_cast<int_t>(row_height) + y_orig - C.y_pos);
|
||||
int_t add_cost = C.width * std::abs((float)static_cast<int_t>(central_row - row_dist) * static_cast<int_t>(row_height) + y_orig - C.y_pos);
|
||||
check_row_cost(central_row - row_dist, C, add_cost);
|
||||
}
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ std::vector<cell_leg_properties> good_legalize(
|
|||
int_t region_end = it != obstacles[r].rend() ? it->min_x : x_max;
|
||||
if(region_end >= prev_it->max_x + cell.width){
|
||||
int_t loc_x = std::min(region_end - cell.width, std::max(prev_it->max_x, cell.x_pos));
|
||||
int_t loc_cost = cell.width * std::abs(cell.x_pos - loc_x);
|
||||
int_t loc_cost = cell.width * std::abs((float)(cell.x_pos - loc_x));
|
||||
if(not found_here or cur_cost > loc_cost){
|
||||
found_here = true;
|
||||
cur_cost = loc_cost;
|
||||
|
@ -287,11 +287,11 @@ std::vector<cell_leg_properties> good_legalize(
|
|||
++row_dist
|
||||
){
|
||||
if(central_row + row_dist < nbr_rows - C.nbr_rows){
|
||||
int_t add_cost = C.width * std::abs(static_cast<int_t>(central_row + row_dist) * static_cast<int_t>(row_height) + y_orig - C.y_pos);
|
||||
int_t add_cost = C.width * std::abs((float)static_cast<int_t>(central_row + row_dist) * static_cast<int_t>(row_height) + y_orig - C.y_pos);
|
||||
check_row_cost(central_row + row_dist, C, add_cost);
|
||||
}
|
||||
if(central_row >= row_dist){
|
||||
int_t add_cost = C.width * std::abs(static_cast<int_t>(central_row - row_dist) * static_cast<int_t>(row_height) + y_orig - C.y_pos);
|
||||
int_t add_cost = C.width * std::abs((float)static_cast<int_t>(central_row - row_dist) * static_cast<int_t>(row_height) + y_orig - C.y_pos);
|
||||
check_row_cost(central_row - row_dist, C, add_cost);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ std::vector<capacity_t> transport_1D(std::vector<t1D_elt> sources, std::vector<
|
|||
auto get_slope = [&](index_t src, index_t boundary){
|
||||
assert(boundary+1 < sinks.size());
|
||||
assert(src < sources.size());
|
||||
return std::abs(sources[src].first - sinks[boundary+1].first) - std::abs(sources[src].first - sinks[boundary].first);
|
||||
return std::abs((float)(sources[src].first - sinks[boundary+1].first)) - std::abs((float)(sources[src].first - sinks[boundary].first));
|
||||
};
|
||||
|
||||
capacity_t cur_abs_pos = min_abs_pos;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "coloquinte/piecewise_linear.hxx"
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
namespace coloquinte{
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <cassert>
|
||||
#include <stdexcept>
|
||||
#include <cmath>
|
||||
|
||||
namespace coloquinte{
|
||||
namespace gp{
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include <cassert>
|
||||
#include <set>
|
||||
#include <functional>
|
||||
#include <cmath>
|
||||
#include <array>
|
||||
|
||||
namespace coloquinte{
|
||||
using edge_t = std::pair<index_t, index_t>;
|
||||
|
@ -44,7 +46,7 @@ int_t Hconnectivity<pin_cnt>::get_wirelength(std::array<point<int_t>, pin_cnt> c
|
|||
}
|
||||
int_t cost = sorted_points.back().x - sorted_points.front().x + sorted_points[b_con+1].x - sorted_points[e_con+1].x;
|
||||
for(std::uint8_t const E : connexions){
|
||||
cost += std::abs(sorted_points[(E >> 4) +1].x - sorted_points[(E & 15u) +1].x);
|
||||
cost += std::abs((float)(sorted_points[(E >> 4) +1].x - sorted_points[(E & 15u) +1].x));
|
||||
}
|
||||
for(index_t i=0; i<pin_cnt-2; ++i){
|
||||
cost += (minmaxs[i].max - minmaxs[i].min);
|
||||
|
@ -91,7 +93,7 @@ std::int64_t get_wirelength_from_topo(std::vector<point<int_t> > const & points,
|
|||
}
|
||||
std::int64_t cost = 0;
|
||||
for(edge_t const E : Htopo){
|
||||
cost += std::abs(points[E.first].x - points[E.second].x);
|
||||
cost += std::abs((float)(points[E.first].x - points[E.second].x));
|
||||
}
|
||||
for(index_t i=0; i<points.size(); ++i){
|
||||
cost += (minmaxs[i].max - minmaxs[i].min);
|
||||
|
@ -401,7 +403,7 @@ std::vector<std::pair<index_t, index_t> > get_MST_topology(std::vector<point<int
|
|||
edges.push_back(edge_t(0, 1));
|
||||
}
|
||||
if(pins.size() == 3){
|
||||
auto D = [](point<int_t> a, point<int_t> b){ return std::abs(a.x - b.x) + std::abs(a.y - b.y); };
|
||||
auto D = [](point<int_t> a, point<int_t> b){ return (int_t)(std::abs((float)(a.x - b.x)) + std::abs((float)(a.y - b.y))); };
|
||||
auto dists = std::array<int_t, 3>({D(pins[1], pins[2]), D(pins[1], pins[2]), D(pins[0], pins[1])});
|
||||
index_t mx = std::max_element(dists.begin(), dists.end()) - dists.begin();
|
||||
for(index_t i=0; i<3; ++i){
|
||||
|
@ -420,7 +422,7 @@ std::vector<std::pair<index_t, index_t> > get_MST_topology(std::vector<point<int
|
|||
auto edge_length = [&](edge_t E){
|
||||
point<int_t> p1 = pins[E.first],
|
||||
p2 = pins[E.second];
|
||||
return std::abs(p1.x - p2.x) + std::abs(p1.y - p2.y);
|
||||
return std::abs((float)(p1.x - p2.x)) + std::abs((float)(p1.y - p2.y));
|
||||
};
|
||||
// Perform Kruskal to get the tree
|
||||
std::sort(edges.begin(), edges.end(), [&](edge_t a, edge_t b){ return edge_length(a) < edge_length(b); });
|
||||
|
@ -444,8 +446,8 @@ std::int64_t MST_length(std::vector<point<int_t> > const & pins){
|
|||
auto edges = get_MST_topology(pins);
|
||||
std::int64_t sum = 0;
|
||||
for(auto E : edges){
|
||||
sum += std::abs(pins[E.first].x - pins[E.second].x);
|
||||
sum += std::abs(pins[E.first].y - pins[E.second].y);
|
||||
sum += std::abs((float)(pins[E.first].x - pins[E.second].x));
|
||||
sum += std::abs((float)(pins[E.first].y - pins[E.second].y));
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
@ -454,7 +456,7 @@ std::int64_t RSMT_length(std::vector<point<int_t> > const & pins, index_t exacti
|
|||
assert(exactitude_limit <= 10 and exactitude_limit >= 3);
|
||||
if(pins.size() <= 3){
|
||||
if(pins.size() == 2){
|
||||
return std::abs(pins[0].x - pins[1].x) + std::abs(pins[0].y - pins[1].y);
|
||||
return std::abs((float)(pins[0].x - pins[1].x)) + std::abs((float)(pins[0].y - pins[1].y));
|
||||
}
|
||||
else if(pins.size() == 3){
|
||||
auto minmaxX = std::minmax_element(pins.begin(), pins.end(), [](point<int_t> a, point<int_t> b){ return a.x < b.x; }),
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
${CRLCORE_SOURCE_DIR}/src/ccore/bookshelf
|
||||
${CRLCORE_SOURCE_DIR}/src/ccore/alliance/ap
|
||||
${CRLCORE_SOURCE_DIR}/src/ccore/alliance/vst
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${CONFIGURATION_INCLUDE_DIR}
|
||||
${HURRICANE_INCLUDE_DIR}
|
||||
)
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#define HURRICANE_OBSERVER_H
|
||||
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include "hurricane/Error.h"
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
include_directories( ${HURRICANE_SOURCE_DIR}/src/hurricane
|
||||
${HURRICANE_SOURCE_DIR}/src/viewer
|
||||
${HURRICANE_SOURCE_DIR}/src/isobar
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${CONFIGURATION_INCLUDE_DIR}
|
||||
${PYTHON_INCLUDE_PATH}
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue