Changed Coloquinte's datastructures naming
Used a big sed command Needs some testing
This commit is contained in:
parent
f724be79d5
commit
d71ba37aa7
|
@ -50,17 +50,17 @@ void optimize_on_topology_HPWL(netlist const & circuit, detailed_placement & pl)
|
|||
if((circuit.get_cell(i).attributes & XMovable) != 0 and (circuit.get_cell(oi).attributes & XMovable) != 0){
|
||||
// Two movable cells: OK
|
||||
auto A = g.addArc(cell_nodes[oi], cell_nodes[i]);
|
||||
constraint_arcs.push_back(arc_pair(A, -circuit.get_cell(i).size.x_));
|
||||
constraint_arcs.push_back(arc_pair(A, -circuit.get_cell(i).size.x));
|
||||
}
|
||||
else if((circuit.get_cell( i).attributes & XMovable) != 0){
|
||||
// The cell c is movable and constrained on the right
|
||||
auto A = g.addArc(fixed, cell_nodes[i]);
|
||||
constraint_arcs.push_back(arc_pair(A, pl.plt_.positions_[oi].x_ - circuit.get_cell(i).size.x_));
|
||||
constraint_arcs.push_back(arc_pair(A, pl.plt_.positions_[oi].x - circuit.get_cell(i).size.x));
|
||||
}
|
||||
else if((circuit.get_cell(oi).attributes & XMovable) != 0){
|
||||
// The cell oc is movable and constrained on the left
|
||||
auto A = g.addArc(cell_nodes[oi], fixed);
|
||||
constraint_arcs.push_back(arc_pair(A, -pl.plt_.positions_[i].x_ - circuit.get_cell(i).size.x_));
|
||||
constraint_arcs.push_back(arc_pair(A, -pl.plt_.positions_[i].x - circuit.get_cell(i).size.x));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ void optimize_on_topology_HPWL(netlist const & circuit, detailed_placement & pl)
|
|||
index_t rc = pl.row_last_cells_[r];
|
||||
if(rc != null_ind and (circuit.get_cell(rc).attributes & XMovable) != 0){
|
||||
auto Ar = g.addArc(fixed, cell_nodes[rc]);
|
||||
constraint_arcs.push_back(arc_pair(Ar, pl.max_x_ - circuit.get_cell(rc).size.x_));
|
||||
constraint_arcs.push_back(arc_pair(Ar, pl.max_x_ - circuit.get_cell(rc).size.x));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ void optimize_on_topology_HPWL(netlist const & circuit, detailed_placement & pl)
|
|||
for(index_t n=0; n<circuit.net_cnt(); ++n){
|
||||
for(auto p : circuit.get_net(n)){
|
||||
index_t c = p.cell_ind;
|
||||
int_t pin_offs = (pl.plt_.orientations_[c].x_ ? p.offset.x_ : circuit.get_cell(c).size.x_ - p.offset.x_); // Offset to the beginning of the cell
|
||||
int_t pin_offs = (pl.plt_.orientations_[c].x ? p.offset.x : circuit.get_cell(c).size.x - p.offset.x); // Offset to the beginning of the cell
|
||||
if((circuit.get_cell(c).attributes & XMovable) != 0){
|
||||
Arc Al = g.addArc(cell_nodes[c], Lnet_nodes[n]);
|
||||
constraint_arcs.push_back(arc_pair(Al, pin_offs));
|
||||
|
@ -95,9 +95,9 @@ void optimize_on_topology_HPWL(netlist const & circuit, detailed_placement & pl)
|
|||
}
|
||||
else{ // Fixed offset
|
||||
auto Al = g.addArc(fixed, Lnet_nodes[n]);
|
||||
constraint_arcs.push_back(arc_pair(Al, pl.plt_.positions_[c].x_ + pin_offs));
|
||||
constraint_arcs.push_back(arc_pair(Al, pl.plt_.positions_[c].x + pin_offs));
|
||||
auto Ar = g.addArc(Unet_nodes[n], fixed);
|
||||
constraint_arcs.push_back(arc_pair(Ar, - pl.plt_.positions_[c].x_ - pin_offs));
|
||||
constraint_arcs.push_back(arc_pair(Ar, - pl.plt_.positions_[c].x - pin_offs));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ void optimize_on_topology_HPWL(netlist const & circuit, detailed_placement & pl)
|
|||
// And we get the new positions as the dual values of the current solution (compared to the fixed pin)
|
||||
for(index_t c=0; c<circuit.cell_cnt(); ++c){ // The cells
|
||||
if((circuit.get_cell(c).attributes & XMovable) != 0){
|
||||
pl.plt_.positions_[c].x_ = ns.potential(cell_nodes[c]) - ns.potential(fixed);
|
||||
pl.plt_.positions_[c].x = ns.potential(cell_nodes[c]) - ns.potential(fixed);
|
||||
}
|
||||
}
|
||||
pl.selfcheck();
|
||||
|
|
|
@ -22,8 +22,8 @@ std::function<std::int64_t(netlist const &, detailed_placement const &, std::vec
|
|||
// Get the possible positions for a swap
|
||||
int_t swp_min_c1 = c2_bnds.first,
|
||||
swp_min_c2 = c1_bnds.first,
|
||||
swp_max_c1 = c2_bnds.second - circuit.get_cell(c1).size.x_,
|
||||
swp_max_c2 = c1_bnds.second - circuit.get_cell(c2).size.x_;
|
||||
swp_max_c1 = c2_bnds.second - circuit.get_cell(c1).size.x,
|
||||
swp_max_c2 = c1_bnds.second - circuit.get_cell(c2).size.x;
|
||||
|
||||
if(swp_max_c1 >= swp_min_c1 and swp_max_c2 >= swp_min_c2){
|
||||
// Check both orientations of the cell
|
||||
|
@ -49,20 +49,20 @@ std::function<std::int64_t(netlist const &, detailed_placement const &, std::vec
|
|||
point<bool> o2 = pl.plt_.orientations_[c2];
|
||||
|
||||
// Warning: won't work if the two cells don't have the same height
|
||||
pl.plt_.positions_[c1].x_ = (swp_min_c1 + swp_max_c1) / 2;
|
||||
pl.plt_.positions_[c2].x_ = (swp_min_c2 + swp_max_c2) / 2;
|
||||
pl.plt_.positions_[c1].y_ = p2.y_;
|
||||
pl.plt_.positions_[c2].y_ = p1.y_;
|
||||
pl.plt_.positions_[c1].x = (swp_min_c1 + swp_max_c1) / 2;
|
||||
pl.plt_.positions_[c2].x = (swp_min_c2 + swp_max_c2) / 2;
|
||||
pl.plt_.positions_[c1].y = p2.y;
|
||||
pl.plt_.positions_[c2].y = p1.y;
|
||||
|
||||
// For standard cell placement, we want all the rows to be aligned in the same way
|
||||
if( (circuit.get_cell(c1).attributes & YFlippable) != 0 and (circuit.get_cell(c2).attributes & YFlippable) != 0)
|
||||
std::swap(pl.plt_.orientations_[c1].y_, pl.plt_.orientations_[c2].y_);
|
||||
std::swap(pl.plt_.orientations_[c1].y, pl.plt_.orientations_[c2].y);
|
||||
|
||||
if(try_flip and (circuit.get_cell(c1).attributes & XFlippable) != 0 and (circuit.get_cell(c2).attributes & XFlippable) != 0){
|
||||
index_t bst_ind = 4;
|
||||
for(index_t i=0; i<4; ++i){
|
||||
pl.plt_.orientations_[c1].x_ = i % 2;
|
||||
pl.plt_.orientations_[c2].x_ = i / 2;
|
||||
pl.plt_.orientations_[c1].x = i % 2;
|
||||
pl.plt_.orientations_[c2].x = i / 2;
|
||||
std::int64_t new_cost = get_nets_cost(circuit, pl, involved_nets);
|
||||
if(new_cost < old_cost){
|
||||
old_cost = new_cost;
|
||||
|
@ -73,8 +73,8 @@ std::function<std::int64_t(netlist const &, detailed_placement const &, std::vec
|
|||
// One of the orientations with the new positions was better
|
||||
if(bst_ind < 4){
|
||||
pl.swap_standard_cell_topologies(c1, c2);
|
||||
pl.plt_.orientations_[c1].x_ = bst_ind % 2;
|
||||
pl.plt_.orientations_[c2].x_ = bst_ind / 2;
|
||||
pl.plt_.orientations_[c1].x = bst_ind % 2;
|
||||
pl.plt_.orientations_[c2].x = bst_ind / 2;
|
||||
// We kept the swap
|
||||
return true;
|
||||
}
|
||||
|
@ -126,15 +126,15 @@ std::function<std::int64_t(netlist const &, detailed_placement const &, std::vec
|
|||
// Number of cells after/before the end of the cell
|
||||
index_t nb_after = 0;
|
||||
index_t nb_before = 0;
|
||||
int_t pos_low = pl.plt_.positions_[c].x_ - circuit.get_cell(c).size.x_,
|
||||
pos_hgh = pl.plt_.positions_[c].x_ + 2*circuit.get_cell(c).size.x_;
|
||||
int_t pos_low = pl.plt_.positions_[c].x - circuit.get_cell(c).size.x,
|
||||
pos_hgh = pl.plt_.positions_[c].x + 2*circuit.get_cell(c).size.x;
|
||||
for(index_t oc=first_oc; oc != null_ind and nb_after <= row_extent; oc = pl.get_next_standard_cell_on_row(oc, other_row)){
|
||||
assert(pl.cell_rows_[oc] == other_row);
|
||||
if( (circuit.get_cell(oc).attributes & XMovable) == 0) continue; // Don't touche fixed cells
|
||||
|
||||
// Count the cells which should trigger stop or shouldn't be used at the next iteration
|
||||
if(pl.plt_.positions_[oc].x_ >= pos_hgh) ++nb_after;
|
||||
if(pl.plt_.positions_[oc].x_ + circuit.get_cell(oc).size.x_ <= pos_low) ++ nb_before;
|
||||
if(pl.plt_.positions_[oc].x >= pos_hgh) ++nb_after;
|
||||
if(pl.plt_.positions_[oc].x + circuit.get_cell(oc).size.x <= pos_low) ++ nb_before;
|
||||
|
||||
if(try_swap(circuit, pl, c, oc, try_flip, get_nets_cost)){
|
||||
std::swap(c, oc);
|
||||
|
|
|
@ -22,7 +22,7 @@ void netlist::selfcheck() const{
|
|||
assert(pin_cnt == net_indexes_.size());
|
||||
|
||||
for(auto const p : pin_offsets_){
|
||||
assert(std::isfinite(p.x_) and std::isfinite(p.y_));
|
||||
assert(std::isfinite(p.x) and std::isfinite(p.y));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,10 +57,10 @@ void verify_placement_legality(netlist const & circuit, placement_t const & pl,
|
|||
for(index_t i=0; i<circuit.cell_cnt(); ++i){
|
||||
event b, e;
|
||||
b.cell = i; e.cell = i;
|
||||
b.x_min = cells[i].x_min_; e.x_min = cells[i].x_min_;
|
||||
b.x_max = cells[i].x_max_; e.x_max = cells[i].x_max_;
|
||||
b.y = cells[i].y_min_; b.removal = false;
|
||||
e.y = cells[i].y_max_; e.removal = true;
|
||||
b.x_min = cells[i].x_min; e.x_min = cells[i].x_min;
|
||||
b.x_max = cells[i].x_max; e.x_max = cells[i].x_max;
|
||||
b.y = cells[i].y_min; b.removal = false;
|
||||
e.y = cells[i].y_max; e.removal = true;
|
||||
if(b.x_max > b.x_min and e.y != b.y){
|
||||
all_events.push_back(b);
|
||||
all_events.push_back(e);
|
||||
|
|
|
@ -8,7 +8,7 @@ std::int64_t get_HPWL_length(netlist const & circuit, placement_t const & pl, in
|
|||
if(circuit.get_net(net_ind).pin_cnt <= 1) return 0;
|
||||
|
||||
auto pins = get_pins_1D(circuit, pl, net_ind);
|
||||
auto minmaxX = std::minmax_element(pins.x_.begin(), pins.x_.end()), minmaxY = std::minmax_element(pins.y_.begin(), pins.y_.end());
|
||||
auto minmaxX = std::minmax_element(pins.x.begin(), pins.x.end()), minmaxY = std::minmax_element(pins.y.begin(), pins.y.end());
|
||||
return ((minmaxX.second->pos - minmaxX.first->pos) + (minmaxY.second->pos - minmaxY.first->pos));
|
||||
}
|
||||
|
||||
|
@ -67,12 +67,12 @@ point<linear_system> empty_linear_systems(netlist const & circuit, placement_t c
|
|||
}
|
||||
|
||||
if( (XMovable & circuit.get_cell(i).attributes) == 0 or not found_true_net){
|
||||
ret.x_.add_triplet(i, i, 1.0f);
|
||||
ret.x_.add_doublet(i, pl.positions_[i].x_);
|
||||
ret.x.add_triplet(i, i, 1.0f);
|
||||
ret.x.add_doublet(i, pl.positions_[i].x);
|
||||
}
|
||||
if( (YMovable & circuit.get_cell(i).attributes) == 0 or not found_true_net){
|
||||
ret.y_.add_triplet(i, i, 1.0f);
|
||||
ret.y_.add_doublet(i, pl.positions_[i].y_);
|
||||
ret.y.add_triplet(i, i, 1.0f);
|
||||
ret.y.add_doublet(i, pl.positions_[i].y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,8 +143,8 @@ point<linear_system> get_HPWLF_linear_system (netlist const & circuit, placement
|
|||
if(pin_cnt < min_s or pin_cnt >= max_s) continue;
|
||||
|
||||
auto pins = get_pins_1D(circuit, pl, i);
|
||||
get_HPWLF(pins.x_, L.x_, tol);
|
||||
get_HPWLF(pins.y_, L.y_, tol);
|
||||
get_HPWLF(pins.x, L.x, tol);
|
||||
get_HPWLF(pins.y, L.y, tol);
|
||||
}
|
||||
return L;
|
||||
}
|
||||
|
@ -157,30 +157,30 @@ point<linear_system> get_HPWLR_linear_system (netlist const & circuit, placement
|
|||
if(pin_cnt < min_s or pin_cnt >= max_s) continue;
|
||||
|
||||
auto pins = get_pins_1D(circuit, pl, i);
|
||||
get_HPWLR(pins.x_, L.x_, tol);
|
||||
get_HPWLR(pins.y_, L.y_, tol);
|
||||
get_HPWLR(pins.x, L.x, tol);
|
||||
get_HPWLR(pins.y, L.y, tol);
|
||||
}
|
||||
return L;
|
||||
}
|
||||
|
||||
point<linear_system> get_star_linear_system (netlist const & circuit, placement_t const & pl, float_t tol, index_t min_s, index_t max_s){
|
||||
point<linear_system> L = empty_linear_systems(circuit, pl);
|
||||
L.x_.add_variables(circuit.net_cnt());
|
||||
L.y_.add_variables(circuit.net_cnt());
|
||||
L.x.add_variables(circuit.net_cnt());
|
||||
L.y.add_variables(circuit.net_cnt());
|
||||
for(index_t i=0; i<circuit.net_cnt(); ++i){
|
||||
// Has the net the right pin count?
|
||||
index_t pin_cnt = circuit.get_net(i).pin_cnt;
|
||||
if(pin_cnt < min_s or pin_cnt >= max_s){
|
||||
// Put a one in the intermediate variable in order to avoid non-invertible matrices
|
||||
L.x_.add_triplet(i+circuit.cell_cnt(), i+circuit.cell_cnt(), 1.0f);
|
||||
L.y_.add_triplet(i+circuit.cell_cnt(), i+circuit.cell_cnt(), 1.0f);
|
||||
L.x.add_triplet(i+circuit.cell_cnt(), i+circuit.cell_cnt(), 1.0f);
|
||||
L.y.add_triplet(i+circuit.cell_cnt(), i+circuit.cell_cnt(), 1.0f);
|
||||
continue;
|
||||
}
|
||||
|
||||
auto pins = get_pins_1D(circuit, pl, i);
|
||||
// Provide the index of the star's central pin in the linear system
|
||||
get_star(pins.x_, L.x_, tol, i+circuit.cell_cnt());
|
||||
get_star(pins.y_, L.y_, tol, i+circuit.cell_cnt());
|
||||
get_star(pins.x, L.x, tol, i+circuit.cell_cnt());
|
||||
get_star(pins.y, L.y, tol, i+circuit.cell_cnt());
|
||||
}
|
||||
return L;
|
||||
}
|
||||
|
@ -193,8 +193,8 @@ point<linear_system> get_clique_linear_system (netlist const & circuit, placemen
|
|||
if(pin_cnt < min_s or pin_cnt >= max_s) continue;
|
||||
|
||||
auto pins = get_pins_1D(circuit, pl, i);
|
||||
get_clique(pins.x_, L.x_, tol);
|
||||
get_clique(pins.y_, L.y_, tol);
|
||||
get_clique(pins.x, L.x, tol);
|
||||
get_clique(pins.y, L.y, tol);
|
||||
}
|
||||
return L;
|
||||
}
|
||||
|
@ -213,8 +213,8 @@ point<linear_system> get_MST_linear_system(netlist const & circuit, placement_t
|
|||
}
|
||||
auto const edges = get_MST_topology(points);
|
||||
for(auto E : edges){
|
||||
add_force(pins[E.first].x(), pins[E.second].x(), L.x_, tol, 1.0f);
|
||||
add_force(pins[E.first].y(), pins[E.second].y(), L.y_, tol, 1.0f);
|
||||
add_force(pins[E.first].x(), pins[E.second].x(), L.x, tol, 1.0f);
|
||||
add_force(pins[E.first].y(), pins[E.second].y(), L.y, tol, 1.0f);
|
||||
}
|
||||
}
|
||||
return L;
|
||||
|
@ -233,11 +233,11 @@ point<linear_system> get_RSMT_linear_system(netlist const & circuit, placement_t
|
|||
points.push_back(p.pos);
|
||||
}
|
||||
auto const edges = get_RSMT_topology(points, 8);
|
||||
for(auto E : edges.x_){
|
||||
add_force(pins[E.first].x(), pins[E.second].x(), L.x_, tol, 1.0f);
|
||||
for(auto E : edges.x){
|
||||
add_force(pins[E.first].x(), pins[E.second].x(), L.x, tol, 1.0f);
|
||||
}
|
||||
for(auto E : edges.y_){
|
||||
add_force(pins[E.first].y(), pins[E.second].y(), L.y_, tol, 1.0f);
|
||||
for(auto E : edges.y){
|
||||
add_force(pins[E.first].y(), pins[E.second].y(), L.y, tol, 1.0f);
|
||||
}
|
||||
}
|
||||
return L;
|
||||
|
@ -278,28 +278,28 @@ void solve_linear_system(netlist const & circuit, placement_t & pl, point<linear
|
|||
std::vector<float_t> x_sol, y_sol;
|
||||
std::vector<float_t> x_guess(pl.cell_cnt()), y_guess(pl.cell_cnt());
|
||||
|
||||
assert(L.x_.internal_size() == x_guess.size());
|
||||
assert(L.y_.internal_size() == y_guess.size());
|
||||
assert(L.x.internal_size() == x_guess.size());
|
||||
assert(L.y.internal_size() == y_guess.size());
|
||||
|
||||
for(index_t i=0; i<pl.cell_cnt(); ++i){
|
||||
x_guess[i] = static_cast<float_t>(pl.positions_[i].x_);
|
||||
y_guess[i] = static_cast<float_t>(pl.positions_[i].y_);
|
||||
x_guess[i] = static_cast<float_t>(pl.positions_[i].x);
|
||||
y_guess[i] = static_cast<float_t>(pl.positions_[i].y);
|
||||
}
|
||||
#pragma omp parallel sections num_threads(2)
|
||||
{
|
||||
#pragma omp section
|
||||
x_sol = L.x_.solve_CG(x_guess, nbr_iter);
|
||||
x_sol = L.x.solve_CG(x_guess, nbr_iter);
|
||||
#pragma omp section
|
||||
y_sol = L.y_.solve_CG(y_guess, nbr_iter);
|
||||
y_sol = L.y.solve_CG(y_guess, nbr_iter);
|
||||
}
|
||||
for(index_t i=0; i<pl.cell_cnt(); ++i){
|
||||
if( (circuit.get_cell(i).attributes & XMovable) != 0){
|
||||
assert(std::isfinite(x_sol[i]));
|
||||
pl.positions_[i].x_ = static_cast<int_t>(x_sol[i]);
|
||||
pl.positions_[i].x = static_cast<int_t>(x_sol[i]);
|
||||
}
|
||||
if( (circuit.get_cell(i).attributes & YMovable) != 0){
|
||||
assert(std::isfinite(y_sol[i]));
|
||||
pl.positions_[i].y_ = static_cast<int_t>(y_sol[i]);
|
||||
pl.positions_[i].y = static_cast<int_t>(y_sol[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -325,13 +325,13 @@ point<linear_system> get_pulling_forces (netlist const & circuit, placement_t co
|
|||
float_t typical_force = 1.0f / typical_distance;
|
||||
std::vector<float_t> scaling = get_area_scales(circuit);
|
||||
for(index_t i=0; i<pl.cell_cnt(); ++i){
|
||||
L.x_.add_anchor(
|
||||
L.x.add_anchor(
|
||||
typical_force * scaling[i],
|
||||
i, pl.positions_[i].x_
|
||||
i, pl.positions_[i].x
|
||||
);
|
||||
L.y_.add_anchor(
|
||||
L.y.add_anchor(
|
||||
typical_force * scaling[i],
|
||||
i, pl.positions_[i].y_
|
||||
i, pl.positions_[i].y
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -343,13 +343,13 @@ point<linear_system> get_linear_pulling_forces (netlist const & circuit, placeme
|
|||
assert(LB_pl.cell_cnt() == UB_pl.cell_cnt());
|
||||
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)),
|
||||
i, UB_pl.positions_[i].x_
|
||||
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)),
|
||||
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)),
|
||||
i, UB_pl.positions_[i].y_
|
||||
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)),
|
||||
i, UB_pl.positions_[i].y
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -375,10 +375,10 @@ float_t get_mean_linear_disruption(netlist const & circuit, placement_t const &
|
|||
float_t area = static_cast<float_t>(circuit.get_cell(i).area);
|
||||
point<int_t> diff = LB_pl.positions_[i] - UB_pl.positions_[i];
|
||||
|
||||
if( (circuit.get_cell(i).attributes & XMovable) == 0) assert(diff.x_ == 0);
|
||||
if( (circuit.get_cell(i).attributes & YMovable) == 0) assert(diff.y_ == 0);
|
||||
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(diff.x) + std::abs(diff.y));
|
||||
tot_area += area;
|
||||
}
|
||||
return tot_cost / tot_area;
|
||||
|
@ -391,10 +391,10 @@ float_t get_mean_quadratic_disruption(netlist const & circuit, placement_t const
|
|||
float_t area = static_cast<float_t>(circuit.get_cell(i).area);
|
||||
point<int_t> diff = LB_pl.positions_[i] - UB_pl.positions_[i];
|
||||
|
||||
if( (circuit.get_cell(i).attributes & XMovable) == 0) assert(diff.x_ == 0);
|
||||
if( (circuit.get_cell(i).attributes & YMovable) == 0) assert(diff.y_ == 0);
|
||||
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(diff.x) + std::abs(diff.y));
|
||||
tot_cost += area * manhattan * manhattan;
|
||||
tot_area += area;
|
||||
}
|
||||
|
|
|
@ -24,28 +24,28 @@ struct pin_2D{
|
|||
bool movable;
|
||||
|
||||
pin_2D(index_t c, point<int_t> p, point<int_t> o, bool m) : cell_ind(c), pos(p), offs(o), movable(m){}
|
||||
pin_1D x() const{ return pin_1D(cell_ind, pos.x_, offs.x_, movable); }
|
||||
pin_1D y() const{ return pin_1D(cell_ind, pos.y_, offs.y_, movable); }
|
||||
pin_1D x() const{ return pin_1D(cell_ind, pos.x, offs.x, movable); }
|
||||
pin_1D y() const{ return pin_1D(cell_ind, pos.y, offs.y, movable); }
|
||||
};
|
||||
|
||||
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(diff.x) + std::abs(diff.y);
|
||||
}
|
||||
|
||||
inline std::vector<pin_2D> get_pins_2D(netlist const & circuit, placement_t const & pl, index_t net_ind){
|
||||
std::vector<pin_2D> ret;
|
||||
for(auto p : circuit.get_net(net_ind)){
|
||||
assert(std::isfinite(pl.positions_[p.cell_ind].x_) and std::isfinite(pl.positions_[p.cell_ind].y_));
|
||||
assert(std::isfinite(pl.orientations_[p.cell_ind].x_) and std::isfinite(pl.orientations_[p.cell_ind].y_));
|
||||
assert(std::isfinite(pl.positions_[p.cell_ind].x) and std::isfinite(pl.positions_[p.cell_ind].y));
|
||||
assert(std::isfinite(pl.orientations_[p.cell_ind].x) and std::isfinite(pl.orientations_[p.cell_ind].y));
|
||||
|
||||
point<int_t> offs;
|
||||
offs.x_ = pl.orientations_[p.cell_ind].x_ ? p.offset.x_ : circuit.get_cell(p.cell_ind).size.x_ - p.offset.x_;
|
||||
offs.y_ = pl.orientations_[p.cell_ind].y_ ? p.offset.y_ : circuit.get_cell(p.cell_ind).size.y_ - p.offset.y_;
|
||||
offs.x = pl.orientations_[p.cell_ind].x ? p.offset.x : circuit.get_cell(p.cell_ind).size.x - p.offset.x;
|
||||
offs.y = pl.orientations_[p.cell_ind].y ? p.offset.y : circuit.get_cell(p.cell_ind).size.y - p.offset.y;
|
||||
point<int_t> pos = offs + pl.positions_[p.cell_ind];
|
||||
|
||||
assert(std::isfinite(offs.x_) and std::isfinite(offs.y_));
|
||||
assert(std::isfinite(pos.x_) and std::isfinite(pos.y_));
|
||||
assert(std::isfinite(offs.x) and std::isfinite(offs.y));
|
||||
assert(std::isfinite(pos.x) and std::isfinite(pos.y));
|
||||
|
||||
bool movable = (circuit.get_cell(p.cell_ind).attributes & XMovable) != 0 and (circuit.get_cell(p.cell_ind).attributes & YMovable) != 0;
|
||||
ret.push_back(pin_2D(p.cell_ind, pos, offs, movable));
|
||||
|
@ -56,22 +56,22 @@ inline std::vector<pin_2D> get_pins_2D(netlist const & circuit, placemen
|
|||
inline point<std::vector<pin_1D> > get_pins_1D(netlist const & circuit, placement_t const & pl, index_t net_ind){
|
||||
point<std::vector<pin_1D> > ret;
|
||||
for(auto p : circuit.get_net(net_ind)){
|
||||
assert(std::isfinite(pl.positions_[p.cell_ind].x_) and std::isfinite(pl.positions_[p.cell_ind].y_));
|
||||
assert(std::isfinite(pl.orientations_[p.cell_ind].x_) and std::isfinite(pl.orientations_[p.cell_ind].y_));
|
||||
assert(std::isfinite(pl.positions_[p.cell_ind].x) and std::isfinite(pl.positions_[p.cell_ind].y));
|
||||
assert(std::isfinite(pl.orientations_[p.cell_ind].x) and std::isfinite(pl.orientations_[p.cell_ind].y));
|
||||
|
||||
point<int_t> offs;
|
||||
offs.x_ = pl.orientations_[p.cell_ind].x_ ? p.offset.x_ : circuit.get_cell(p.cell_ind).size.x_ - p.offset.x_;
|
||||
offs.y_ = pl.orientations_[p.cell_ind].y_ ? p.offset.y_ : circuit.get_cell(p.cell_ind).size.y_ - p.offset.y_;
|
||||
offs.x = pl.orientations_[p.cell_ind].x ? p.offset.x : circuit.get_cell(p.cell_ind).size.x - p.offset.x;
|
||||
offs.y = pl.orientations_[p.cell_ind].y ? p.offset.y : circuit.get_cell(p.cell_ind).size.y - p.offset.y;
|
||||
point<int_t> pos = offs + pl.positions_[p.cell_ind];
|
||||
|
||||
assert(std::isfinite(offs.x_) and std::isfinite(offs.y_));
|
||||
assert(std::isfinite(pos.x_) and std::isfinite(pos.y_));
|
||||
assert(std::isfinite(offs.x) and std::isfinite(offs.y));
|
||||
assert(std::isfinite(pos.x) and std::isfinite(pos.y));
|
||||
|
||||
bool x_movable = (circuit.get_cell(p.cell_ind).attributes & XMovable) != 0;
|
||||
bool y_movable = (circuit.get_cell(p.cell_ind).attributes & YMovable) != 0;
|
||||
|
||||
ret.x_.push_back(pin_1D(p.cell_ind, pos.x_, offs.x_, x_movable));
|
||||
ret.y_.push_back(pin_1D(p.cell_ind, pos.y_, offs.y_, y_movable));
|
||||
ret.x.push_back(pin_1D(p.cell_ind, pos.x, offs.x, x_movable));
|
||||
ret.y.push_back(pin_1D(p.cell_ind, pos.y, offs.y, y_movable));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -30,83 +30,83 @@ enum Movability{
|
|||
|
||||
template<typename T>
|
||||
struct point{
|
||||
T x_, y_;
|
||||
T x, y;
|
||||
point(){}
|
||||
point(T x, T y): x_(x), y_(y){}
|
||||
point(T x, T y): x(x), y(y){}
|
||||
|
||||
template<typename S>
|
||||
operator point<S>() const{
|
||||
return point<S>(static_cast<S>(x_), static_cast<S>(y_));
|
||||
return point<S>(static_cast<S>(x), static_cast<S>(y));
|
||||
}
|
||||
|
||||
void operator+=(point<T> const o){
|
||||
x_ += o.x_;
|
||||
y_ += o.y_;
|
||||
x += o.x;
|
||||
y += o.y;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
point<T> operator+(point<T> const a, point<T> const b){
|
||||
return point<T>(a.x_+b.x_, a.y_+b.y_);
|
||||
return point<T>(a.x+b.x, a.y+b.y);
|
||||
}
|
||||
template<typename T>
|
||||
point<T> operator-(point<T> const a, point<T> const b){
|
||||
return point<T>(a.x_-b.x_, a.y_-b.y_);
|
||||
return point<T>(a.x-b.x, a.y-b.y);
|
||||
}
|
||||
template<typename T>
|
||||
point<T> operator*(T lambda, point<T> const p){
|
||||
return point<T>(lambda * p.x_, lambda * p.y_);
|
||||
return point<T>(lambda * p.x, lambda * p.y);
|
||||
}
|
||||
template<typename T>
|
||||
point<T> operator*(point<T> const a, point<T> const b){
|
||||
return point<T>(a.x_*b.x_, a.y_*b.y_);
|
||||
return point<T>(a.x*b.x, a.y*b.y);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct box{
|
||||
T x_min_, x_max_, y_min_, y_max_;
|
||||
T x_min, x_max, y_min, y_max;
|
||||
box(){}
|
||||
box(T x_mn, T x_mx, T y_mn, T y_mx) : x_min_(x_mn), x_max_(x_mx), y_min_(y_mn), y_max_(y_mx){}
|
||||
box(point<T> mn, point<T> mx) : x_min_(mn.x_), x_max_(mx.x_), y_min_(mn.y_), y_max_(mx.y_){}
|
||||
box(T x_mn, T x_mx, T y_mn, T y_mx) : x_min(x_mn), x_max(x_mx), y_min(y_mn), y_max(y_mx){}
|
||||
box(point<T> mn, point<T> mx) : x_min(mn.x), x_max(mx.x), y_min(mn.y), y_max(mx.y){}
|
||||
|
||||
bool in(box<T> const o) const{
|
||||
return x_max_ <= o.x_max_
|
||||
&& y_max_ <= o.y_max_
|
||||
&& x_min_ >= o.x_min_
|
||||
&& y_min_ >= o.y_min_;
|
||||
return x_max <= o.x_max
|
||||
&& y_max <= o.y_max
|
||||
&& x_min >= o.x_min
|
||||
&& y_min >= o.y_min;
|
||||
}
|
||||
bool intersects(box<T> const o) const{
|
||||
return x_min_ < o.x_max_
|
||||
&& y_min_ < o.y_max_
|
||||
&& o.x_min_ < x_max_
|
||||
&& o.y_min_ < y_max_;
|
||||
return x_min < o.x_max
|
||||
&& y_min < o.y_max
|
||||
&& o.x_min < x_max
|
||||
&& o.y_min < y_max;
|
||||
}
|
||||
box<T> intersection(box<T> const o) const{
|
||||
return box<T>(
|
||||
std::max(x_min_, o.x_min_),
|
||||
std::min(x_max_, o.x_max_),
|
||||
std::max(y_min_, o.y_min_),
|
||||
std::min(y_max_, o.y_max_)
|
||||
std::max(x_min, o.x_min),
|
||||
std::min(x_max, o.x_max),
|
||||
std::max(y_min, o.y_min),
|
||||
std::min(y_max, o.y_max)
|
||||
);
|
||||
}
|
||||
box<T> bounding_box(box<T> const o) const{
|
||||
return box<T>(
|
||||
std::min(x_min_, o.x_min_),
|
||||
std::max(x_max_, o.x_max_),
|
||||
std::min(y_min_, o.y_min_),
|
||||
std::max(y_max_, o.y_max_)
|
||||
std::min(x_min, o.x_min),
|
||||
std::max(x_max, o.x_max),
|
||||
std::min(y_min, o.y_min),
|
||||
std::max(y_max, o.y_max)
|
||||
);
|
||||
}
|
||||
point<T> dimensions() const{
|
||||
return point<T>(x_max_-x_min_, y_max_-y_min_);
|
||||
return point<T>(x_max-x_min, y_max-y_min);
|
||||
}
|
||||
bool empty() const{
|
||||
return dimensions().x_ <= 0 or dimensions().y_ <= 0;
|
||||
return dimensions().x <= 0 or dimensions().y <= 0;
|
||||
}
|
||||
|
||||
template<typename S>
|
||||
operator box<S>() const{
|
||||
return box<S>(static_cast<S>(x_min_), static_cast<S>(x_max_), static_cast<S>(y_min_), static_cast<S>(y_max_));
|
||||
return box<S>(static_cast<S>(x_min), static_cast<S>(x_max), static_cast<S>(y_min), static_cast<S>(y_max));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ struct temporary_cell{
|
|||
index_t list_index;
|
||||
|
||||
temporary_cell(){}
|
||||
temporary_cell(point<int_t> s, mask_t attr, index_t ind) : size(s), attributes(attr), list_index(ind){ area = static_cast<capacity_t>(s.x_) * static_cast<capacity_t>(s.y_);}
|
||||
temporary_cell(point<int_t> s, mask_t attr, index_t ind) : size(s), attributes(attr), list_index(ind){ area = static_cast<capacity_t>(s.x) * static_cast<capacity_t>(s.y);}
|
||||
};
|
||||
|
||||
struct temporary_net{
|
||||
|
|
|
@ -212,7 +212,7 @@ inline region_distribution::movable_cell::movable_cell(capacity_t demand, point<
|
|||
inline box<int_t> region_distribution::placement_area() const { return placement_area_; }
|
||||
inline point<float_t> region_distribution::region_dimensions() const {
|
||||
point<int_t> s = static_cast<point<float_t> >(placement_area().dimensions());
|
||||
return point<float_t>(s.x_/x_regions_cnt(), s.y_/y_regions_cnt());
|
||||
return point<float_t>(s.x/x_regions_cnt(), s.y/y_regions_cnt());
|
||||
}
|
||||
|
||||
inline index_t region_distribution::x_regions_cnt() const { return x_regions_cnt_; }
|
||||
|
@ -247,10 +247,10 @@ inline capacity_t region_distribution::region::allocated_capacity() const{
|
|||
inline index_t region_distribution::region::cell_cnt() const{ return cell_references_.size(); }
|
||||
|
||||
inline float_t region_distribution::region::distance(region_distribution::cell_ref const & C) const{
|
||||
return std::abs(pos_.x_ - C.pos_.x_) + std::abs(pos_.y_ - C.pos_.y_);
|
||||
return std::abs(pos_.x - C.pos_.x) + std::abs(pos_.y - C.pos_.y);
|
||||
/*
|
||||
float_t manhattan = std::max(static_cast<float_t>(0.0), std::max(C.pos_.x_ - surface_.x_max_, surface_.x_min_ - C.pos_.x_))
|
||||
+ std::max(static_cast<float_t>(0.0), std::max(C.pos_.y_ - surface_.y_max_, surface_.y_min_ - C.pos_.y_));
|
||||
float_t manhattan = std::max(static_cast<float_t>(0.0), std::max(C.pos_.x - surface_.x_max, surface_.x_min - C.pos_.x))
|
||||
+ std::max(static_cast<float_t>(0.0), std::max(C.pos_.y - surface_.y_max, surface_.y_min - C.pos_.y));
|
||||
return manhattan * (1.0 + manhattan * 0.0001);
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ void detailed_placement::selfcheck() const{
|
|||
for(index_t i=0; i<cell_cnt(); ++i){
|
||||
for(index_t l=0; l<cell_height(i); ++l){
|
||||
// not verified now since we don't modify the position for the obstacles
|
||||
// : assert(c.position.x_ >= min_x_ and c.position.x_ + c.width <= max_x_);
|
||||
// : assert(c.position.x >= min_x_ and c.position.x + c.width <= max_x_);
|
||||
|
||||
index_t n_ind = l + neighbours_limits_[i];
|
||||
assert(cell_rows_[i] + cell_height(i) <= row_cnt());
|
||||
|
@ -143,10 +143,10 @@ std::pair<int_t, int_t> detailed_placement::get_limit_positions(netlist const &
|
|||
a_i = neighbours_[l].second;
|
||||
|
||||
if(b_i != null_ind){
|
||||
ret.first = std::max(ret.first, plt_.positions_[b_i].x_ + circuit.get_cell(b_i).size.x_);
|
||||
ret.first = std::max(ret.first, plt_.positions_[b_i].x + circuit.get_cell(b_i).size.x);
|
||||
}
|
||||
if(a_i != null_ind){
|
||||
ret.second = std::min(ret.second, plt_.positions_[a_i].x_);
|
||||
ret.second = std::min(ret.second, plt_.positions_[a_i].x);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
@ -250,7 +250,7 @@ void detailed_placement::reorder_standard_cells(std::vector<index_t> const old_o
|
|||
void row_compatible_orientation(netlist const & circuit, detailed_placement & pl, bool first_row_orient){
|
||||
for(index_t c=0; c<circuit.cell_cnt(); ++c){
|
||||
if( (circuit.get_cell(c).attributes & YFlippable) != 0 and pl.cell_height(c) == 1){
|
||||
pl.plt_.orientations_[c].y_ = (pl.cell_rows_[c] % 2 != 0) ^ first_row_orient;
|
||||
pl.plt_.orientations_[c].y = (pl.cell_rows_[c] % 2 != 0) ^ first_row_orient;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,14 +12,14 @@ namespace dp{
|
|||
void get_result(netlist const & circuit, detailed_placement const & dpl, placement_t & gpl){
|
||||
for(index_t c=0; c<circuit.cell_cnt(); ++c){
|
||||
if( (circuit.get_cell(c).attributes & XMovable) != 0)
|
||||
gpl.positions_[c].x_ = dpl.plt_.positions_[c].x_;
|
||||
gpl.positions_[c].x = dpl.plt_.positions_[c].x;
|
||||
if( (circuit.get_cell(c).attributes & YMovable) != 0)
|
||||
gpl.positions_[c].y_ = dpl.plt_.positions_[c].y_;
|
||||
gpl.positions_[c].y = dpl.plt_.positions_[c].y;
|
||||
|
||||
if( (circuit.get_cell(c).attributes & XFlippable) != 0)
|
||||
gpl.orientations_[c].x_ = dpl.plt_.orientations_[c].x_;
|
||||
gpl.orientations_[c].x = dpl.plt_.orientations_[c].x;
|
||||
if( (circuit.get_cell(c).attributes & YFlippable) != 0)
|
||||
gpl.orientations_[c].y_ = dpl.plt_.orientations_[c].y_;
|
||||
gpl.orientations_[c].y = dpl.plt_.orientations_[c].y;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -356,8 +356,8 @@ std::vector<cell_leg_properties> good_legalize(
|
|||
detailed_placement legalize(netlist const & circuit, placement_t const & pl, box<int_t> surface, int_t row_height){
|
||||
if(row_height <= 0) throw std::runtime_error("The rows' height should be positive\n");
|
||||
|
||||
index_t nbr_rows = (surface.y_max_ - surface.y_min_) / row_height;
|
||||
// The position of the ith row is surface.y_min_ + i * row_height
|
||||
index_t nbr_rows = (surface.y_max - surface.y_min) / row_height;
|
||||
// The position of the ith row is surface.y_min + i * row_height
|
||||
|
||||
std::vector<std::vector<fixed_cell_interval> > row_occupation(nbr_rows);
|
||||
std::vector<cell_to_leg> cells;
|
||||
|
@ -372,32 +372,32 @@ detailed_placement legalize(netlist const & circuit, placement_t const & pl, box
|
|||
if( (cur.attributes & XMovable) != 0 && (cur.attributes & YMovable) != 0){
|
||||
// Just truncate the position we target
|
||||
point<int_t> target_pos = pl.positions_[i];
|
||||
index_t cur_cell_rows = (cur.size.y_ + row_height -1) / row_height;
|
||||
cells.push_back(cell_to_leg(target_pos.x_, target_pos.y_, i, cur.size.x_, cur_cell_rows));
|
||||
index_t cur_cell_rows = (cur.size.y + row_height -1) / row_height;
|
||||
cells.push_back(cell_to_leg(target_pos.x, target_pos.y, i, cur.size.x, cur_cell_rows));
|
||||
cell_heights[i] = cur_cell_rows;
|
||||
}
|
||||
else{
|
||||
// In each row, we put the index of the fixed cell and the range that is already occupied
|
||||
int_t low_x_pos = pl.positions_[i].x_,
|
||||
hgh_x_pos = pl.positions_[i].x_ + cur.size.x_,
|
||||
low_y_pos = pl.positions_[i].y_,
|
||||
hgh_y_pos = pl.positions_[i].y_ + cur.size.y_;
|
||||
int_t low_x_pos = pl.positions_[i].x,
|
||||
hgh_x_pos = pl.positions_[i].x + cur.size.x,
|
||||
low_y_pos = pl.positions_[i].y,
|
||||
hgh_y_pos = pl.positions_[i].y + cur.size.y;
|
||||
|
||||
new_placement.positions_[i] = point<int_t>(low_x_pos, low_y_pos);
|
||||
if(hgh_y_pos <= surface.y_min_ or low_y_pos >= surface.y_max_ or hgh_x_pos <= surface.x_min_ or low_x_pos >= surface.x_max_){
|
||||
if(hgh_y_pos <= surface.y_min or low_y_pos >= surface.y_max or hgh_x_pos <= surface.x_min or low_x_pos >= surface.x_max){
|
||||
placement_rows[i] = null_ind;
|
||||
cell_heights[i] = 0;
|
||||
}
|
||||
else{
|
||||
assert(low_x_pos < hgh_x_pos and low_y_pos < hgh_y_pos);
|
||||
|
||||
int_t rnd_hgh_x_pos = std::min(surface.x_max_, hgh_x_pos);
|
||||
int_t rnd_hgh_y_pos = std::min(surface.y_max_, hgh_y_pos);
|
||||
int_t rnd_low_x_pos = std::max(surface.x_min_, low_x_pos);
|
||||
int_t rnd_low_y_pos = std::max(surface.y_min_, low_y_pos);
|
||||
int_t rnd_hgh_x_pos = std::min(surface.x_max, hgh_x_pos);
|
||||
int_t rnd_hgh_y_pos = std::min(surface.y_max, hgh_y_pos);
|
||||
int_t rnd_low_x_pos = std::max(surface.x_min, low_x_pos);
|
||||
int_t rnd_low_y_pos = std::max(surface.y_min, low_y_pos);
|
||||
|
||||
index_t first_row = (rnd_low_y_pos - surface.y_min_) / row_height;
|
||||
index_t last_row = (index_t) (rnd_hgh_y_pos - surface.y_min_ + row_height - 1) / row_height; // Exclusive: if the cell spans the next row, i.e. pos % row_height >= 0, include it too
|
||||
index_t first_row = (rnd_low_y_pos - surface.y_min) / row_height;
|
||||
index_t last_row = (index_t) (rnd_hgh_y_pos - surface.y_min + row_height - 1) / row_height; // Exclusive: if the cell spans the next row, i.e. pos % row_height >= 0, include it too
|
||||
assert(last_row <= nbr_rows);
|
||||
|
||||
placement_rows[i] = first_row;
|
||||
|
@ -421,12 +421,12 @@ detailed_placement legalize(netlist const & circuit, placement_t const & pl, box
|
|||
std::vector<std::vector<index_t> > cells_by_rows;
|
||||
|
||||
auto final_cells = good_legalize(row_occupation, cells, cells_by_rows,
|
||||
surface.x_min_, surface.x_max_, surface.y_min_,
|
||||
surface.x_min, surface.x_max, surface.y_min,
|
||||
row_height, nbr_rows
|
||||
);
|
||||
|
||||
for(cell_leg_properties C : final_cells){
|
||||
new_placement.positions_[C.ind] = point<int_t>(C.x_pos, static_cast<int_t>(C.row_pos) * row_height + surface.y_min_);
|
||||
new_placement.positions_[C.ind] = point<int_t>(C.x_pos, static_cast<int_t>(C.row_pos) * row_height + surface.y_min);
|
||||
placement_rows[C.ind] = C.row_pos;
|
||||
}
|
||||
|
||||
|
@ -435,8 +435,8 @@ detailed_placement legalize(netlist const & circuit, placement_t const & pl, box
|
|||
placement_rows,
|
||||
cell_heights,
|
||||
cells_by_rows,
|
||||
surface.x_min_, surface.x_max_,
|
||||
surface.y_min_,
|
||||
surface.x_min, surface.x_max,
|
||||
surface.y_min,
|
||||
nbr_rows, row_height
|
||||
);
|
||||
}
|
||||
|
|
|
@ -141,10 +141,10 @@ inline void spread_orient(netlist const & circuit, placement_t & pl, std::functi
|
|||
} // End anonymous namespace
|
||||
|
||||
void optimize_x_orientations(netlist const & circuit, placement_t & pl){
|
||||
opt_orient(circuit, pl, [](point<int_t> p) -> int_t { return p.x_; }, [](point<bool> & p) -> bool & { return p.x_; }, XFlippable);
|
||||
opt_orient(circuit, pl, [](point<int_t> p) -> int_t { return p.x; }, [](point<bool> & p) -> bool & { return p.x; }, XFlippable);
|
||||
}
|
||||
void optimize_y_orientations(netlist const & circuit, placement_t & pl){
|
||||
opt_orient(circuit, pl, [](point<int_t> p) -> int_t { return p.y_; }, [](point<bool> & p) -> bool & { return p.y_; }, YFlippable);
|
||||
opt_orient(circuit, pl, [](point<int_t> p) -> int_t { return p.y; }, [](point<bool> & p) -> bool & { return p.y; }, YFlippable);
|
||||
}
|
||||
|
||||
// Iteratively optimize feasible orientations; performs only one pass
|
||||
|
@ -155,8 +155,8 @@ void optimize_exact_orientations(netlist const & circuit, placement_t & pl){
|
|||
|
||||
/*
|
||||
void spread_orientations(netlist const & circuit, placement_t & pl){
|
||||
spread_orient(circuit, pl, [](point<float_t> & p) -> float_t & { return p.x_; }, XFlippable);
|
||||
spread_orient(circuit, pl, [](point<float_t> & p) -> float_t & { return p.y_; }, YFlippable);
|
||||
spread_orient(circuit, pl, [](point<float_t> & p) -> float_t & { return p.x; }, XFlippable);
|
||||
spread_orient(circuit, pl, [](point<float_t> & p) -> float_t & { return p.y; }, YFlippable);
|
||||
}
|
||||
*/
|
||||
|
||||
|
|
|
@ -79,28 +79,28 @@ region_distribution::region::region(capacity_t cap, point<float_t> pos, std::vec
|
|||
|
||||
box<int_t> region_distribution::get_box(index_t x, index_t y, index_t x_cnt, index_t y_cnt) const{
|
||||
auto ret = box<int_t>(
|
||||
placement_area_.x_min_ + ( ((std::int64_t) (placement_area_.x_max_ - placement_area_.x_min_)) * x ) / x_cnt,
|
||||
placement_area_.x_min_ + ( ((std::int64_t) (placement_area_.x_max_ - placement_area_.x_min_)) * (x+1) ) / x_cnt,
|
||||
placement_area_.y_min_ + ( ((std::int64_t) (placement_area_.y_max_ - placement_area_.y_min_)) * y ) / y_cnt,
|
||||
placement_area_.y_min_ + ( ((std::int64_t) (placement_area_.y_max_ - placement_area_.y_min_)) * (y+1) ) / y_cnt
|
||||
placement_area_.x_min + ( ((std::int64_t) (placement_area_.x_max - placement_area_.x_min)) * x ) / x_cnt,
|
||||
placement_area_.x_min + ( ((std::int64_t) (placement_area_.x_max - placement_area_.x_min)) * (x+1) ) / x_cnt,
|
||||
placement_area_.y_min + ( ((std::int64_t) (placement_area_.y_max - placement_area_.y_min)) * y ) / y_cnt,
|
||||
placement_area_.y_min + ( ((std::int64_t) (placement_area_.y_max - placement_area_.y_min)) * (y+1) ) / y_cnt
|
||||
);
|
||||
assert(not ret.empty());
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<region_distribution::region> region_distribution::prepare_regions(index_t x_cnt, index_t y_cnt) const{
|
||||
assert(placement_area_.x_max_ > placement_area_.x_min_);
|
||||
assert(placement_area_.y_max_ > placement_area_.y_min_);
|
||||
assert(placement_area_.x_max > placement_area_.x_min);
|
||||
assert(placement_area_.y_max > placement_area_.y_min);
|
||||
|
||||
// Uses a sweepline algorithm to initialize all regions' capacities at a time, taking macros and density maps into account
|
||||
|
||||
// The events in the priority queue: basically a density_limit object, but the y_min_ may be different from the original one
|
||||
// The events in the priority queue: basically a density_limit object, but the y_min may be different from the original one
|
||||
struct event{
|
||||
box<int_t> box_;
|
||||
capacity_t multiplicator_;
|
||||
bool operator<(event const o) const{
|
||||
return box_.y_min_ > o.box_.y_min_ // Priority queue = highest first
|
||||
or (box_.y_min_ == o.box_.y_min_ and multiplicator_ > o.multiplicator_); // Smallest density first, just because
|
||||
return box_.y_min > o.box_.y_min // Priority queue = highest first
|
||||
or (box_.y_min == o.box_.y_min and multiplicator_ > o.multiplicator_); // Smallest density first, just because
|
||||
}
|
||||
event(box<int_t> surface, capacity_t den) : box_(surface), multiplicator_(den) {}
|
||||
event(density_limit D, capacity_t density_mul) : box_(D.box_) {
|
||||
|
@ -109,9 +109,9 @@ std::vector<region_distribution::region> region_distribution::prepare_regions(in
|
|||
};
|
||||
|
||||
struct line_y{
|
||||
int_t y_min_, y_max_;
|
||||
int_t y_min, y_max;
|
||||
capacity_t multiplicator_;
|
||||
line_y(int_t mn, int_t mx, capacity_t cap) : y_min_(mn), y_max_(mx), multiplicator_(cap) {}
|
||||
line_y(int_t mn, int_t mx, capacity_t cap) : y_min(mn), y_max(mx), multiplicator_(cap) {}
|
||||
};
|
||||
|
||||
// The regions' capacities
|
||||
|
@ -120,10 +120,10 @@ std::vector<region_distribution::region> region_distribution::prepare_regions(in
|
|||
// Find the limits of the regions
|
||||
std::vector<int_t> x_reg_lims(x_cnt+1), y_reg_lims(y_cnt+1);
|
||||
for(index_t i=0; i<=x_cnt; ++i){
|
||||
x_reg_lims[i] = placement_area_.x_min_ + ( ((std::int64_t) (placement_area_.x_max_ - placement_area_.x_min_)) * i ) / x_cnt;
|
||||
x_reg_lims[i] = placement_area_.x_min + ( ((std::int64_t) (placement_area_.x_max - placement_area_.x_min)) * i ) / x_cnt;
|
||||
}
|
||||
for(index_t i=0; i<=y_cnt; ++i){
|
||||
y_reg_lims[i] = placement_area_.y_min_ + ( ((std::int64_t) (placement_area_.y_max_ - placement_area_.y_min_)) * i ) / y_cnt;
|
||||
y_reg_lims[i] = placement_area_.y_min + ( ((std::int64_t) (placement_area_.y_max - placement_area_.y_min)) * i ) / y_cnt;
|
||||
}
|
||||
|
||||
//std::vector<box<int_t> > added;
|
||||
|
@ -132,12 +132,12 @@ std::vector<region_distribution::region> region_distribution::prepare_regions(in
|
|||
/*
|
||||
// Failed attempt at calculating the coordinates directly
|
||||
point<int_t> dims = placement_area_.dimensions();
|
||||
auto mins = point<int_t>(placement_area_.x_min_, placement_area_.y_min_);
|
||||
auto mins = point<int_t>(placement_area_.x_min, placement_area_.y_min);
|
||||
|
||||
index_t x_mn = (static_cast<std::int64_t>(bx.x_min_ - mins.x_ + 1) * x_cnt) / dims.x_,
|
||||
x_mx = (static_cast<std::int64_t>(bx.x_max_ - mins.x_ - 1) * x_cnt) / dims.x_ + 1,
|
||||
y_mn = (static_cast<std::int64_t>(bx.y_min_ - mins.y_ + 1) * y_cnt) / dims.y_,
|
||||
y_mx = (static_cast<std::int64_t>(bx.y_max_ - mins.y_ - 1) * y_cnt) / dims.y_ + 1;
|
||||
index_t x_mn = (static_cast<std::int64_t>(bx.x_min - mins.x + 1) * x_cnt) / dims.x,
|
||||
x_mx = (static_cast<std::int64_t>(bx.x_max - mins.x - 1) * x_cnt) / dims.x + 1,
|
||||
y_mn = (static_cast<std::int64_t>(bx.y_min - mins.y + 1) * y_cnt) / dims.y,
|
||||
y_mx = (static_cast<std::int64_t>(bx.y_max - mins.y - 1) * y_cnt) / dims.y + 1;
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -148,15 +148,15 @@ std::vector<region_distribution::region> region_distribution::prepare_regions(in
|
|||
added.push_back(bx);
|
||||
*/
|
||||
|
||||
assert(bx.x_min_ >= placement_area_.x_min_);
|
||||
assert(bx.y_min_ >= placement_area_.y_min_);
|
||||
assert(bx.x_max_ <= placement_area_.x_max_);
|
||||
assert(bx.y_max_ <= placement_area_.y_max_);
|
||||
assert(bx.x_min >= placement_area_.x_min);
|
||||
assert(bx.y_min >= placement_area_.y_min);
|
||||
assert(bx.x_max <= placement_area_.x_max);
|
||||
assert(bx.y_max <= placement_area_.y_max);
|
||||
|
||||
index_t x_mn = std::upper_bound(x_reg_lims.begin(), x_reg_lims.end(), bx.x_min_) - x_reg_lims.begin() -1,
|
||||
y_mn = std::upper_bound(y_reg_lims.begin(), y_reg_lims.end(), bx.y_min_) - y_reg_lims.begin() -1,
|
||||
x_mx = std::lower_bound(x_reg_lims.begin(), x_reg_lims.end(), bx.x_max_) - x_reg_lims.begin(),
|
||||
y_mx = std::lower_bound(y_reg_lims.begin(), y_reg_lims.end(), bx.y_max_) - y_reg_lims.begin();
|
||||
index_t x_mn = std::upper_bound(x_reg_lims.begin(), x_reg_lims.end(), bx.x_min) - x_reg_lims.begin() -1,
|
||||
y_mn = std::upper_bound(y_reg_lims.begin(), y_reg_lims.end(), bx.y_min) - y_reg_lims.begin() -1,
|
||||
x_mx = std::lower_bound(x_reg_lims.begin(), x_reg_lims.end(), bx.x_max) - x_reg_lims.begin(),
|
||||
y_mx = std::lower_bound(y_reg_lims.begin(), y_reg_lims.end(), bx.y_max) - y_reg_lims.begin();
|
||||
|
||||
for(index_t x=x_mn; x<x_mx; ++x){
|
||||
for(index_t y=y_mn; y<y_mx; ++y){
|
||||
|
@ -164,7 +164,7 @@ std::vector<region_distribution::region> region_distribution::prepare_regions(in
|
|||
assert(bx.intersects(cur_box));
|
||||
box<int_t> inter = bx.intersection(cur_box);
|
||||
point<int_t> dims = inter.dimensions();
|
||||
region_caps[y*x_cnt + x] += d * static_cast<capacity_t>(dims.x_) * static_cast<capacity_t>(dims.y_);
|
||||
region_caps[y*x_cnt + x] += d * static_cast<capacity_t>(dims.x) * static_cast<capacity_t>(dims.y);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -186,24 +186,24 @@ std::vector<region_distribution::region> region_distribution::prepare_regions(in
|
|||
// The initial sweepline, with begin and end of the line
|
||||
std::map<int_t, line_y> active_obstacles;
|
||||
|
||||
line_y placement_begin (placement_area_.y_min_, placement_area_.y_max_, full_density_mul),
|
||||
placement_end (placement_area_.y_min_, placement_area_.y_max_, 0);
|
||||
line_y placement_begin (placement_area_.y_min, placement_area_.y_max, full_density_mul),
|
||||
placement_end (placement_area_.y_min, placement_area_.y_max, 0);
|
||||
|
||||
active_obstacles.insert(std::pair<int_t, line_y>(placement_area_.x_min_, placement_begin)); // Full density placement area as initial object
|
||||
active_obstacles.insert(std::pair<int_t, line_y>(placement_area_.x_max_, placement_end));
|
||||
active_obstacles.insert(std::pair<int_t, line_y>(placement_area_.x_min, placement_begin)); // Full density placement area as initial object
|
||||
active_obstacles.insert(std::pair<int_t, line_y>(placement_area_.x_max, placement_end));
|
||||
|
||||
|
||||
// Main loop: sweep the line on y (the line is horizontal, and moves toward bigger y)
|
||||
while(not events.empty()){
|
||||
event D = events.top();
|
||||
int_t x_b=D.box_.x_min_, x_e=D.box_.x_max_;
|
||||
int_t y_b=D.box_.y_min_, y_e=D.box_.y_max_;
|
||||
int_t x_b=D.box_.x_min, x_e=D.box_.x_max;
|
||||
int_t y_b=D.box_.y_min, y_e=D.box_.y_max;
|
||||
events.pop();
|
||||
|
||||
assert(x_b >= placement_area_.x_min_);
|
||||
assert(y_b >= placement_area_.y_min_);
|
||||
assert(x_e <= placement_area_.x_max_);
|
||||
assert(y_e <= placement_area_.y_max_);
|
||||
assert(x_b >= placement_area_.x_min);
|
||||
assert(y_b >= placement_area_.y_min);
|
||||
assert(x_e <= placement_area_.x_max);
|
||||
assert(y_e <= placement_area_.y_max);
|
||||
|
||||
// For each delimitation between the bounds of the new rectangle
|
||||
// If the new delimitation has higher density or this delimitation ends on y there
|
||||
|
@ -215,7 +215,7 @@ std::vector<region_distribution::region> region_distribution::prepare_regions(in
|
|||
line_y const new_elt(y_b, y_e, D.multiplicator_);
|
||||
std::vector<line_y> new_delimitations;
|
||||
|
||||
// First element on the line whose x_ is after our x_min (i.e. may have an intersection), and while there is an intersection
|
||||
// First element on the line whose x is after our x_min (i.e. may have an intersection), and while there is an intersection
|
||||
auto first_it = active_obstacles.upper_bound(x_b);
|
||||
assert(first_it != active_obstacles.begin());
|
||||
assert(std::prev(first_it)->first <= x_b);
|
||||
|
@ -224,8 +224,8 @@ std::vector<region_distribution::region> region_distribution::prepare_regions(in
|
|||
for(auto it = std::prev(first_it); it != active_obstacles.end() and it->first < x_e;){
|
||||
auto next_it = std::next(it);
|
||||
assert(next_it != active_obstacles.end());
|
||||
assert(it->second.y_min_ <= y_b);
|
||||
assert(it->second.y_max_ >= y_b);
|
||||
assert(it->second.y_min <= y_b);
|
||||
assert(it->second.y_max >= y_b);
|
||||
assert(it->first < x_e);
|
||||
assert(next_it->first > x_b);
|
||||
assert(next_it-> first > it->first);
|
||||
|
@ -233,18 +233,18 @@ std::vector<region_distribution::region> region_distribution::prepare_regions(in
|
|||
int_t x_c_min = std::max(x_b, it->first),
|
||||
x_c_max = std::min(x_e, next_it->first);
|
||||
assert(x_c_min < x_c_max);
|
||||
// Add the area from it->second.y_min_ to D.box_.y_min_
|
||||
if(y_b > it->second.y_min_)
|
||||
add_region(box<int_t>(it->first, next_it->first, it->second.y_min_, y_b), it->second.multiplicator_);
|
||||
it->second.y_min_ = y_b; // Now the part before has been used
|
||||
// Add the area from it->second.y_min to D.box_.y_min
|
||||
if(y_b > it->second.y_min)
|
||||
add_region(box<int_t>(it->first, next_it->first, it->second.y_min, y_b), it->second.multiplicator_);
|
||||
it->second.y_min = y_b; // Now the part before has been used
|
||||
|
||||
auto part_b = *it, part_e = *next_it;
|
||||
|
||||
if(part_b.second.multiplicator_ > D.multiplicator_ or part_b.second.y_max_ == y_b){ // The new event is visible now
|
||||
if(part_b.second.multiplicator_ > D.multiplicator_ or part_b.second.y_max == y_b){ // The new event is visible now
|
||||
|
||||
// In case parts of the line become visible again later
|
||||
if(part_b.second.y_max_ > y_e){ // Push back a new event to account for the comeback
|
||||
events.push(event(box<int_t>(x_c_min, x_c_max, y_e, part_b.second.y_max_), part_b.second.multiplicator_));
|
||||
if(part_b.second.y_max > y_e){ // Push back a new event to account for the comeback
|
||||
events.push(event(box<int_t>(x_c_min, x_c_max, y_e, part_b.second.y_max), part_b.second.multiplicator_));
|
||||
}
|
||||
|
||||
// Depending whether this part of the line is or is not fully covered
|
||||
|
@ -265,8 +265,8 @@ std::vector<region_distribution::region> region_distribution::prepare_regions(in
|
|||
}
|
||||
else{ // The new event is not visible yet
|
||||
currently_in = false;
|
||||
if(part_b.second.y_max_ < y_e){ // Push back a new event
|
||||
events.push(event(box<int_t>(x_c_min, x_c_max, part_b.second.y_max_, y_e), D.multiplicator_));
|
||||
if(part_b.second.y_max < y_e){ // Push back a new event
|
||||
events.push(event(box<int_t>(x_c_min, x_c_max, part_b.second.y_max, y_e), D.multiplicator_));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,8 +274,8 @@ std::vector<region_distribution::region> region_distribution::prepare_regions(in
|
|||
}
|
||||
}
|
||||
for(auto it=active_obstacles.begin(); std::next(it) != active_obstacles.end(); ++it){
|
||||
assert(it->second.y_max_ == placement_area_.y_max_);
|
||||
add_region(box<int_t>(it->first, std::next(it)->first, it->second.y_min_, it->second.y_max_), it->second.multiplicator_);
|
||||
assert(it->second.y_max == placement_area_.y_max);
|
||||
add_region(box<int_t>(it->first, std::next(it)->first, it->second.y_min, it->second.y_max), it->second.multiplicator_);
|
||||
}
|
||||
|
||||
std::vector<region> ret(x_cnt*y_cnt);
|
||||
|
@ -284,7 +284,7 @@ std::vector<region_distribution::region> region_distribution::prepare_regions(in
|
|||
box<int_t> bx = get_box(x, y, x_cnt, y_cnt);
|
||||
ret[y*x_cnt + x] = region(
|
||||
region_caps[y*x_cnt + x],
|
||||
point<float_t>(0.5f * bx.x_min_ + 0.5f * bx.x_max_, 0.5f * bx.y_min_ + 0.5f * bx.y_max_),
|
||||
point<float_t>(0.5f * bx.x_min + 0.5f * bx.x_max, 0.5f * bx.y_min + 0.5f * bx.y_max),
|
||||
std::vector<cell_ref>()
|
||||
);
|
||||
}
|
||||
|
@ -437,7 +437,7 @@ void region_distribution::region::distribute_new_cells(std::vector<std::referenc
|
|||
}
|
||||
|
||||
sort_uniquify(all_cells);
|
||||
std::sort(all_cells.begin(), all_cells.end(), [](cell_ref const a, cell_ref const b){ return a.allocated_capacity_ > b.allocated_capacity_ or (a.allocated_capacity_ == b.allocated_capacity_ and a.pos_.x_+a.pos_.y_ < b.pos_.x_+b.pos_.y_); });
|
||||
std::sort(all_cells.begin(), all_cells.end(), [](cell_ref const a, cell_ref const b){ return a.allocated_capacity_ > b.allocated_capacity_ or (a.allocated_capacity_ == b.allocated_capacity_ and a.pos_.x+a.pos_.y < b.pos_.x+b.pos_.y); });
|
||||
|
||||
std::vector<std::vector<float_t> > costs(regions.size());
|
||||
std::vector<capacity_t> demands;
|
||||
|
@ -704,7 +704,7 @@ void region_distribution::redo_line_partitions(){
|
|||
for(index_t x=0; x<x_regions_cnt(); ++x){
|
||||
regs.push_back(std::reference_wrapper<region>(get_region(x, y)));
|
||||
}
|
||||
region::redistribute_cells(regs, [](point<float_t> p){ return p.x_; });
|
||||
region::redistribute_cells(regs, [](point<float_t> p){ return p.x; });
|
||||
}
|
||||
#pragma omp parallel for
|
||||
for(index_t x=0; x<x_regions_cnt(); ++x){
|
||||
|
@ -712,7 +712,7 @@ void region_distribution::redo_line_partitions(){
|
|||
for(index_t y=0; y<y_regions_cnt(); ++y){
|
||||
regs.push_back(std::reference_wrapper<region>(get_region(x, y)));
|
||||
}
|
||||
region::redistribute_cells(regs, [](point<float_t> p){ return p.y_; });
|
||||
region::redistribute_cells(regs, [](point<float_t> p){ return p.y; });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -737,7 +737,7 @@ void region_distribution::x_resize(index_t sz){
|
|||
for(index_t x=0; x<x_regions_cnt(); ++x){
|
||||
regs.push_back(std::reference_wrapper<region>(get_region(x, y)));
|
||||
}
|
||||
region::distribute_new_cells(regs, cells, [](point<float_t> p){ return p.x_; });
|
||||
region::distribute_new_cells(regs, cells, [](point<float_t> p){ return p.x; });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -762,7 +762,7 @@ void region_distribution::y_resize(index_t sz){
|
|||
for(index_t y=0; y<y_regions_cnt(); ++y){
|
||||
regs.push_back(std::reference_wrapper<region>(get_region(x, y)));
|
||||
}
|
||||
region::distribute_new_cells(regs, cells, [](point<float_t> p){ return p.y_; });
|
||||
region::distribute_new_cells(regs, cells, [](point<float_t> p){ return p.y; });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -823,7 +823,7 @@ region_distribution::region_distribution(
|
|||
auto pos = pl.positions_[i];
|
||||
auto end = pos + c.size;
|
||||
density_limit macro;
|
||||
macro.box_ = box<int_t>(pos.x_, end.x_, pos.y_, end.y_);
|
||||
macro.box_ = box<int_t>(pos.x, end.x, pos.y, end.y);
|
||||
macro.density_ = 0.0f;
|
||||
density_map_.push_back(macro);
|
||||
}
|
||||
|
@ -969,11 +969,11 @@ std::vector<region_distribution::movable_cell> region_distribution::export_sprea
|
|||
for(index_t i=0; i<n; ++i){
|
||||
point<float_t> pt = R.cell_references_[i].pos_;
|
||||
float_t cap = static_cast<float_t>(R.cell_references_[i].allocated_capacity_);
|
||||
x_cells[i] = OSRP_task(pt.x_, cap/total_capacity * (surface.x_max_ - surface.x_min_), 1.0, i);
|
||||
y_cells[i] = OSRP_task(pt.y_, cap/total_capacity * (surface.y_max_ - surface.y_min_), 1.0, i);
|
||||
x_cells[i] = OSRP_task(pt.x, cap/total_capacity * (surface.x_max - surface.x_min), 1.0, i);
|
||||
y_cells[i] = OSRP_task(pt.y, cap/total_capacity * (surface.y_max - surface.y_min), 1.0, i);
|
||||
}
|
||||
std::vector<float_t> x_ret = get_optimal_quadratic_pos(x_cells, surface.x_min_, surface.x_max_);
|
||||
std::vector<float_t> y_ret = get_optimal_quadratic_pos(y_cells, surface.y_min_, surface.y_max_);
|
||||
std::vector<float_t> x_ret = get_optimal_quadratic_pos(x_cells, surface.x_min, surface.x_max);
|
||||
std::vector<float_t> y_ret = get_optimal_quadratic_pos(y_cells, surface.y_min, surface.y_max);
|
||||
|
||||
for(index_t i=0; i<n; ++i){
|
||||
weighted_pos[R.cell_references_[i].index_in_list_] +=
|
||||
|
@ -988,7 +988,7 @@ std::vector<region_distribution::movable_cell> region_distribution::export_sprea
|
|||
movable_cell C = cell_list_[i];
|
||||
assert(C.demand_ > 0);
|
||||
C.pos_ = ( static_cast<float_t>(1.0) / static_cast<float_t>(C.demand_) ) * weighted_pos[i];
|
||||
assert(std::isfinite(C.pos_.x_) and std::isfinite(C.pos_.y_));
|
||||
assert(std::isfinite(C.pos_.x) and std::isfinite(C.pos_.y));
|
||||
ret.push_back(C);
|
||||
}
|
||||
return ret;
|
||||
|
@ -1003,19 +1003,19 @@ std::vector<region_distribution::movable_cell> region_distribution::export_sprea
|
|||
index_t n = R.cell_references_.size();
|
||||
float_t total_capacity = static_cast<float_t>(R.capacity());
|
||||
box<float_t> surface = static_cast<box<float_t> >(get_box(x, y, x_regions_cnt(), y_regions_cnt()));
|
||||
assert(surface.x_max_ > surface.x_min_ and surface.y_max_ > surface.y_min_);
|
||||
assert(surface.x_max > surface.x_min and surface.y_max > surface.y_min);
|
||||
|
||||
std::vector<legalizable_task<float_t> > x_cells, y_cells;
|
||||
|
||||
for(auto const C : R.cell_references_){
|
||||
float_t cap = static_cast<float_t>(C.allocated_capacity_);
|
||||
float_t x_cap_prop = cap/total_capacity * (surface.x_max_ - surface.x_min_),
|
||||
y_cap_prop = cap/total_capacity * (surface.y_max_ - surface.y_min_);
|
||||
x_cells.push_back(legalizable_task<float_t>(x_cap_prop, C.pos_.x_, C.index_in_list_));
|
||||
y_cells.push_back(legalizable_task<float_t>(y_cap_prop, C.pos_.y_, C.index_in_list_));
|
||||
float_t x_cap_prop = cap/total_capacity * (surface.x_max - surface.x_min),
|
||||
y_cap_prop = cap/total_capacity * (surface.y_max - surface.y_min);
|
||||
x_cells.push_back(legalizable_task<float_t>(x_cap_prop, C.pos_.x, C.index_in_list_));
|
||||
y_cells.push_back(legalizable_task<float_t>(y_cap_prop, C.pos_.y, C.index_in_list_));
|
||||
}
|
||||
|
||||
OSRP_leg<float_t> x_leg(surface.x_min_, surface.x_max_), y_leg(surface.y_min_, surface.y_max_);
|
||||
OSRP_leg<float_t> x_leg(surface.x_min, surface.x_max), y_leg(surface.y_min, surface.y_max);
|
||||
|
||||
std::sort(x_cells.begin(), x_cells.end());
|
||||
for(legalizable_task<float_t> & C : x_cells)
|
||||
|
@ -1025,7 +1025,7 @@ std::vector<region_distribution::movable_cell> region_distribution::export_sprea
|
|||
auto x_pl = x_leg.get_placement();
|
||||
for(index_t i=0; i<n; ++i){
|
||||
assert(std::isfinite(x_pl[i].second));
|
||||
weighted_pos[x_pl[i].first].x_ += (x_pl[i].second + 0.5f * x_cells[i].width) * static_cast<float_t>(x_cells[i].width * total_capacity / (surface.x_max_ - surface.x_min_));
|
||||
weighted_pos[x_pl[i].first].x += (x_pl[i].second + 0.5f * x_cells[i].width) * static_cast<float_t>(x_cells[i].width * total_capacity / (surface.x_max - surface.x_min));
|
||||
}
|
||||
|
||||
std::sort(y_cells.begin(), y_cells.end());
|
||||
|
@ -1036,7 +1036,7 @@ std::vector<region_distribution::movable_cell> region_distribution::export_sprea
|
|||
auto y_pl = y_leg.get_placement();
|
||||
for(index_t i=0; i<n; ++i){
|
||||
assert(std::isfinite(y_pl[i].second));
|
||||
weighted_pos[y_pl[i].first].y_ += (y_pl[i].second + 0.5f * y_cells[i].width) * static_cast<float_t>(y_cells[i].width * total_capacity / (surface.y_max_ - surface.y_min_));
|
||||
weighted_pos[y_pl[i].first].y += (y_pl[i].second + 0.5f * y_cells[i].width) * static_cast<float_t>(y_cells[i].width * total_capacity / (surface.y_max - surface.y_min));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1046,7 +1046,7 @@ std::vector<region_distribution::movable_cell> region_distribution::export_sprea
|
|||
movable_cell C = cell_list_[i];
|
||||
assert(C.demand_ > 0);
|
||||
C.pos_ = ( 1.0f / static_cast<float_t>(C.demand_ * cell_density_mul) ) * weighted_pos[i];
|
||||
assert(std::isfinite(C.pos_.x_) and std::isfinite(C.pos_.y_));
|
||||
assert(std::isfinite(C.pos_.x) and std::isfinite(C.pos_.y));
|
||||
ret.push_back(C);
|
||||
}
|
||||
return ret;
|
||||
|
@ -1055,7 +1055,7 @@ std::vector<region_distribution::movable_cell> region_distribution::export_sprea
|
|||
float_t region_distribution::region::cost() const{
|
||||
float_t res = 0.0;
|
||||
for(cell_ref const C : cell_references_){
|
||||
res += (std::abs(C.pos_.x_-pos_.x_) + std::abs(C.pos_.y_-pos_.y_)) * static_cast<float_t>(C.allocated_capacity_);
|
||||
res += (std::abs(C.pos_.x-pos_.x) + std::abs(C.pos_.y-pos_.y)) * static_cast<float_t>(C.allocated_capacity_);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -180,10 +180,10 @@ Hnet_group get_B2B_netgroup(netlist const & circuit, detailed_placement const &
|
|||
|
||||
Hnet_group ret;
|
||||
for(index_t c : cells)
|
||||
ret.cell_widths.push_back(circuit.get_cell(c).size.x_);
|
||||
ret.cell_widths.push_back(circuit.get_cell(c).size.x);
|
||||
|
||||
for(index_t n : involved_nets){
|
||||
std::vector<pin_1D> cur_pins = get_pins_1D(circuit, pl.plt_, n).x_;
|
||||
std::vector<pin_1D> cur_pins = get_pins_1D(circuit, pl.plt_, n).x;
|
||||
for(pin_1D & p : cur_pins){
|
||||
auto it = std::lower_bound(cells_in_row.begin(), cells_in_row.end(), p.cell_ind);
|
||||
if(it != cells_in_row.end() and it->cell_ind == p.cell_ind){
|
||||
|
@ -206,7 +206,7 @@ Hnet_group get_RSMT_netgroup(netlist const & circuit, detailed_placement const &
|
|||
|
||||
Hnet_group ret;
|
||||
for(index_t c : cells)
|
||||
ret.cell_widths.push_back(circuit.get_cell(c).size.x_);
|
||||
ret.cell_widths.push_back(circuit.get_cell(c).size.x);
|
||||
|
||||
for(index_t n : involved_nets){
|
||||
auto vpins = get_pins_2D(circuit, pl.plt_, n);
|
||||
|
@ -223,7 +223,7 @@ Hnet_group get_RSMT_netgroup(netlist const & circuit, detailed_placement const &
|
|||
std::vector<point<int_t> > pin_locations;
|
||||
for(auto p : vpins)
|
||||
pin_locations.push_back(p.pos);
|
||||
auto const Htopo = get_RSMT_topology(pin_locations, 8).x_;
|
||||
auto const Htopo = get_RSMT_topology(pin_locations, 8).x;
|
||||
|
||||
// In the horizontal topology, we transform the parts of the tree that are on the row into HPWL subnets
|
||||
// Two pins sharing an edge are in the same subnet if one of them is on the row: use union-find
|
||||
|
@ -432,7 +432,7 @@ std::vector<std::pair<int_t, int_t> > get_cell_ranges(netlist const & circuit, d
|
|||
std::vector<std::pair<int_t, int_t> > lims;
|
||||
|
||||
for(index_t i=0; i+1<cells.size(); ++i){
|
||||
assert(pl.plt_.positions_[cells[i]].x_ + circuit.get_cell(cells[i]).size.x_ <= pl.plt_.positions_[cells[i+1]].x_);
|
||||
assert(pl.plt_.positions_[cells[i]].x + circuit.get_cell(cells[i]).size.x <= pl.plt_.positions_[cells[i+1]].x);
|
||||
}
|
||||
|
||||
// Extreme limits, except macros are allowed to be beyond the limit of the placement area
|
||||
|
@ -442,13 +442,13 @@ std::vector<std::pair<int_t, int_t> > get_cell_ranges(netlist const & circuit, d
|
|||
for(index_t OSRP_cell : cells){
|
||||
auto attr = circuit.get_cell(OSRP_cell).attributes;
|
||||
auto cur_lim = std::pair<int_t, int_t>(lower_lim, upper_lim);
|
||||
int_t pos = pl.plt_.positions_[OSRP_cell].x_;
|
||||
int_t pos = pl.plt_.positions_[OSRP_cell].x;
|
||||
if( (attr & XMovable) == 0 or pl.cell_height(OSRP_cell) != 1){
|
||||
cur_lim = std::pair<int_t, int_t>(pos, pos + circuit.get_cell(OSRP_cell).size.x_);
|
||||
cur_lim = std::pair<int_t, int_t>(pos, pos + circuit.get_cell(OSRP_cell).size.x);
|
||||
}
|
||||
else{
|
||||
assert(pos >= lower_lim);
|
||||
assert(pos + circuit.get_cell(OSRP_cell).size.x_ <= upper_lim);
|
||||
assert(pos + circuit.get_cell(OSRP_cell).size.x <= upper_lim);
|
||||
}
|
||||
lims.push_back(cur_lim);
|
||||
}
|
||||
|
@ -486,8 +486,8 @@ void OSRP_generic(netlist const & circuit, detailed_placement & pl){
|
|||
std::vector<int> flipped;
|
||||
optimize_noncvx_sequence(nets, no_permutation, final_positions, flipped, flippability, lims);
|
||||
for(index_t i=0; i<cells.size(); ++i){
|
||||
bool old_orient = pl.plt_.orientations_[cells[i]].x_;
|
||||
pl.plt_.orientations_[cells[i]].x_ = flipped[i] ? not old_orient : old_orient;
|
||||
bool old_orient = pl.plt_.orientations_[cells[i]].x;
|
||||
pl.plt_.orientations_[cells[i]].x = flipped[i] ? not old_orient : old_orient;
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
@ -496,7 +496,7 @@ void OSRP_generic(netlist const & circuit, detailed_placement & pl){
|
|||
|
||||
// Update the positions and orientations
|
||||
for(index_t i=0; i<cells.size(); ++i){
|
||||
pl.plt_.positions_[cells[i]].x_ = final_positions[i];
|
||||
pl.plt_.positions_[cells[i]].x = final_positions[i];
|
||||
}
|
||||
}
|
||||
} // Iteration on the rows
|
||||
|
@ -560,10 +560,10 @@ void swaps_row_generic(netlist const & circuit, detailed_placement & pl, index_t
|
|||
for(index_t i=0; i<cells.size(); ++i){
|
||||
index_t r_ind = best_permutation[i]; // In the row from in the Hnet_group
|
||||
new_cell_order[r_ind] = cells[i];
|
||||
pl.plt_.positions_[cells[i]].x_ = best_positions[r_ind];
|
||||
pl.plt_.positions_[cells[i]].x = best_positions[r_ind];
|
||||
if(NON_CONVEX){
|
||||
bool old_orient = pl.plt_.orientations_[cells[i]].x_;
|
||||
pl.plt_.orientations_[cells[i]].x_ = best_flippings[r_ind] ? not old_orient : old_orient;
|
||||
bool old_orient = pl.plt_.orientations_[cells[i]].x;
|
||||
pl.plt_.orientations_[cells[i]].x = best_flippings[r_ind] ? not old_orient : old_orient;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,17 +34,17 @@ template<int pin_cnt>
|
|||
int_t Hconnectivity<pin_cnt>::get_wirelength(std::array<point<int_t>, pin_cnt> const sorted_points) const{
|
||||
std::array<minmax_t, pin_cnt-2> minmaxs;
|
||||
for(index_t i=0; i<pin_cnt-2; ++i){
|
||||
minmaxs[i] = minmax_t(sorted_points[i+1].y_, sorted_points[i+1].y_);
|
||||
minmaxs[i] = minmax_t(sorted_points[i+1].y, sorted_points[i+1].y);
|
||||
}
|
||||
std::uint8_t b_con = extremes & 15u, e_con = extremes >> 4;
|
||||
minmaxs[b_con].merge(sorted_points.front() .y_);
|
||||
minmaxs[e_con].merge(sorted_points.back() .y_);
|
||||
minmaxs[b_con].merge(sorted_points.front() .y);
|
||||
minmaxs[e_con].merge(sorted_points.back() .y);
|
||||
for(std::uint8_t const E : connexions){
|
||||
minmaxs[(E >> 4)].merge(minmaxs[(E & 15u)]);
|
||||
}
|
||||
int_t cost = sorted_points.back().x_ - sorted_points.front().x_ + sorted_points[b_con+1].x_ - sorted_points[e_con+1].x_;
|
||||
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(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);
|
||||
|
@ -84,14 +84,14 @@ int_t get_wirelength_from_sorted(std::vector<point<int_t> > const & pins, std::a
|
|||
std::int64_t get_wirelength_from_topo(std::vector<point<int_t> > const & points, std::vector<std::pair<index_t, index_t> > Htopo){
|
||||
std::vector<minmax_t> minmaxs(points.size());
|
||||
for(index_t i=0; i<points.size(); ++i){
|
||||
minmaxs[i] = minmax_t(points[i].y_, points[i].y_);
|
||||
minmaxs[i] = minmax_t(points[i].y, points[i].y);
|
||||
}
|
||||
for(auto const E : Htopo){
|
||||
minmaxs[E.second].merge(minmaxs[E.first]);
|
||||
}
|
||||
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(points[E.first].x - points[E.second].x);
|
||||
}
|
||||
for(index_t i=0; i<points.size(); ++i){
|
||||
cost += (minmaxs[i].max - minmaxs[i].min);
|
||||
|
@ -133,7 +133,7 @@ std::vector<edge_t> get_vertical_topology(std::vector<point<int_t> > pins, std::
|
|||
ipoints[i] = indexed_pt(pins[i], i);
|
||||
}
|
||||
|
||||
std::sort(ipoints.begin(), ipoints.end(), [](indexed_pt a , indexed_pt b){return a.y_ < b.y_; });
|
||||
std::sort(ipoints.begin(), ipoints.end(), [](indexed_pt a , indexed_pt b){return a.y < b.y; });
|
||||
|
||||
// First pin with y ordering
|
||||
std::vector<index_t> min_y_pin(pins.size());
|
||||
|
@ -222,19 +222,19 @@ inline void northeast_octant_neighbours(std::vector<point<int_t> > pins, std::ve
|
|||
}
|
||||
|
||||
std::sort(point_list.begin(), point_list.end(),
|
||||
[](indexed_pt const a, indexed_pt const b){ return a.x_ + a.y_ < b.x_ + b.y_; }
|
||||
[](indexed_pt const a, indexed_pt const b){ return a.x + a.y < b.x + b.y; }
|
||||
);
|
||||
|
||||
// Decreasing order of x and y; multiset not necessary because no two elements have same coordinate
|
||||
std::set<indexed_pt, std::function<bool (indexed_pt const, indexed_pt const)> >
|
||||
active_upper_octant([](indexed_pt const a, indexed_pt const b)->bool{return a.x_ > b.x_;}),
|
||||
active_lower_octant([](indexed_pt const a, indexed_pt const b)->bool{return a.y_ > b.y_;});
|
||||
active_upper_octant([](indexed_pt const a, indexed_pt const b)->bool{return a.x > b.x;}),
|
||||
active_lower_octant([](indexed_pt const a, indexed_pt const b)->bool{return a.y > b.y;});
|
||||
|
||||
for(indexed_pt const current : point_list){
|
||||
{ // North to north-east region
|
||||
auto first_it = active_upper_octant.lower_bound(current); // Largest x with x <= current.x
|
||||
auto it = first_it;
|
||||
for(; it != active_upper_octant.end() && it->x_ - it->y_ >= current.x_ - current.y_; ++it){
|
||||
for(; it != active_upper_octant.end() && it->x - it->y >= current.x - current.y; ++it){
|
||||
edges.push_back(std::pair<index_t, index_t>(current.index, it->index));
|
||||
}
|
||||
if(first_it != active_upper_octant.end()){ active_upper_octant.erase(first_it, it); }
|
||||
|
@ -243,7 +243,7 @@ inline void northeast_octant_neighbours(std::vector<point<int_t> > pins, std::ve
|
|||
{ // North-east to east region
|
||||
auto first_it = active_lower_octant.lower_bound(current); // Largest y with y <= current.y
|
||||
auto it = first_it;
|
||||
for(; it != active_lower_octant.end() && it->y_ - it->x_ >= current.y_ - current.x_; ++it){
|
||||
for(; it != active_lower_octant.end() && it->y - it->x >= current.y - current.x; ++it){
|
||||
edges.push_back(std::pair<index_t, index_t>(current.index, it->index));
|
||||
}
|
||||
if(first_it != active_lower_octant.end()){ active_lower_octant.erase(first_it, it); }
|
||||
|
@ -255,7 +255,7 @@ inline void northeast_octant_neighbours(std::vector<point<int_t> > pins, std::ve
|
|||
// Gets the nearest octant neighbour for each point in the south-east quadrant
|
||||
inline void southeast_octant_neighbours(std::vector<point<int_t> > pins, std::vector<std::pair<index_t, index_t> > & edges){
|
||||
for(auto & pin : pins){
|
||||
pin.y_ = - pin.y_;
|
||||
pin.y = - pin.y;
|
||||
}
|
||||
northeast_octant_neighbours(pins, edges);
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ std::vector<edge_t> get_big_horizontal_topology_from_sorted(std::vector<point<in
|
|||
|
||||
std::vector<point<int_t> > inverted_coords = pins;
|
||||
for(point<int_t> & pt : inverted_coords){
|
||||
std::swap(pt.x_, pt.y_);
|
||||
std::swap(pt.x, pt.y);
|
||||
}
|
||||
auto Htopo = get_vertical_topology(inverted_coords, Vtopo);
|
||||
|
||||
|
@ -356,7 +356,7 @@ std::vector<edge_t> get_RSMT_horizontal_topology(std::vector<point<int_t> > cons
|
|||
ipoints[i] = indexed_pt(pins[i], i);
|
||||
}
|
||||
auto xpoints=ipoints;
|
||||
std::sort(xpoints.begin(), xpoints.end(), [](indexed_pt a , indexed_pt b){return a.x_ < b.x_; });
|
||||
std::sort(xpoints.begin(), xpoints.end(), [](indexed_pt a , indexed_pt b){return a.x < b.x; });
|
||||
|
||||
return std::vector<edge_t>{{xpoints[0].index, xpoints[1].index}, {xpoints[1].index, xpoints[2].index}};
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ std::vector<edge_t> get_RSMT_horizontal_topology(std::vector<point<int_t> > cons
|
|||
for(index_t i=0; i<pins.size(); ++i){
|
||||
ipoints[i] = indexed_pt(pins[i], i);
|
||||
}
|
||||
std::sort(ipoints.begin(), ipoints.end(), [](indexed_pt a , indexed_pt b){return a.x_ < b.x_; });
|
||||
std::sort(ipoints.begin(), ipoints.end(), [](indexed_pt a , indexed_pt b){return a.x < b.x; });
|
||||
std::vector<point<int_t> > sorted_pins(pins.size());
|
||||
for(index_t i=0; i<pins.size(); ++i){
|
||||
sorted_pins[i] = ipoints[i];
|
||||
|
@ -401,7 +401,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 std::abs(a.x - b.x) + std::abs(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 +420,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(p1.x - p2.x) + std::abs(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 +444,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(pins[E.first].x - pins[E.second].x);
|
||||
sum += std::abs(pins[E.first].y - pins[E.second].y);
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
@ -454,12 +454,12 @@ 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(pins[0].x - pins[1].x) + std::abs(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_; }),
|
||||
minmaxY = std::minmax_element(pins.begin(), pins.end(), [](point<int_t> a, point<int_t> b){ return a.y_ < b.y_; });
|
||||
return (minmaxX.second->x_ - minmaxX.first->x_) + (minmaxY.second->y_ - minmaxY.first->y_);
|
||||
auto minmaxX = std::minmax_element(pins.begin(), pins.end(), [](point<int_t> a, point<int_t> b){ return a.x < b.x; }),
|
||||
minmaxY = std::minmax_element(pins.begin(), pins.end(), [](point<int_t> a, point<int_t> b){ return a.y < b.y; });
|
||||
return (minmaxX.second->x - minmaxX.first->x) + (minmaxY.second->y - minmaxY.first->y);
|
||||
}
|
||||
else{
|
||||
return 0;
|
||||
|
@ -467,7 +467,7 @@ std::int64_t RSMT_length(std::vector<point<int_t> > const & pins, index_t exacti
|
|||
}
|
||||
else{
|
||||
std::vector<point<int_t> > points = pins;
|
||||
std::sort(points.begin(), points.end(), [](point<int_t> a , point<int_t> b){return a.x_ < b.x_; });
|
||||
std::sort(points.begin(), points.end(), [](point<int_t> a , point<int_t> b){return a.x < b.x; });
|
||||
|
||||
if(points.size() <= exactitude_limit){
|
||||
switch(points.size()){
|
||||
|
@ -517,9 +517,9 @@ point<std::vector<std::pair<index_t, index_t> > > get_RSMT_topology(std::vector<
|
|||
ipoints[i] = indexed_pt(pins[i], i);
|
||||
}
|
||||
auto xpoints=ipoints;
|
||||
std::sort(xpoints.begin(), xpoints.end(), [](indexed_pt a , indexed_pt b){return a.x_ < b.x_; });
|
||||
std::sort(xpoints.begin(), xpoints.end(), [](indexed_pt a , indexed_pt b){return a.x < b.x; });
|
||||
auto ypoints=ipoints;
|
||||
std::sort(ypoints.begin(), ypoints.end(), [](indexed_pt a , indexed_pt b){return a.y_ < b.y_; });
|
||||
std::sort(ypoints.begin(), ypoints.end(), [](indexed_pt a , indexed_pt b){return a.y < b.y; });
|
||||
|
||||
return point<std::vector<edge_t> >{{{xpoints[0].index, xpoints[1].index}, {xpoints[1].index, xpoints[2].index}}, {{ypoints[0].index, ypoints[1].index}, {ypoints[1].index, ypoints[2].index}}};
|
||||
}
|
||||
|
|
|
@ -148,19 +148,19 @@ namespace {
|
|||
, DbU::Unit pitch
|
||||
)
|
||||
{
|
||||
DbU::Unit tx = position.x_ * pitch;
|
||||
DbU::Unit ty = position.y_ * pitch;
|
||||
DbU::Unit tx = position.x * pitch;
|
||||
DbU::Unit ty = position.y * pitch;
|
||||
|
||||
Box cellBox = model->getAbutmentBox();
|
||||
Transformation::Orientation orient = Transformation::Orientation::ID;
|
||||
|
||||
if ( not orientation.x_ and orientation.y_) {
|
||||
if ( not orientation.x and orientation.y) {
|
||||
tx += cellBox.getWidth();
|
||||
orient = Transformation::Orientation::MX;
|
||||
} else if ( orientation.x_ and not orientation.y_) {
|
||||
} else if ( orientation.x and not orientation.y) {
|
||||
ty += cellBox.getHeight();
|
||||
orient = Transformation::Orientation::MY;
|
||||
} else if ( not orientation.x_ and not orientation.y_) {
|
||||
} else if ( not orientation.x and not orientation.y) {
|
||||
tx += cellBox.getWidth();
|
||||
ty += cellBox.getHeight();
|
||||
orient = Transformation::Orientation::R2;
|
||||
|
@ -586,7 +586,7 @@ namespace Etesian {
|
|||
_placementLB.positions_ = positions;
|
||||
_placementLB.orientations_ = orientations;
|
||||
_placementUB = _placementLB;
|
||||
//cerr << "Coloquinte cell height: " << _circuit.get_cell(0).size.y_ << endl;
|
||||
//cerr << "Coloquinte cell height: " << _circuit.get_cell(0).size.y << endl;
|
||||
|
||||
}
|
||||
|
||||
|
@ -616,11 +616,11 @@ namespace Etesian {
|
|||
auto legalizer = (options & ForceUniformDensity) != 0 ?
|
||||
region_distribution::uniform_density_distribution (_surface, _circuit, _placementLB, _densityLimits)
|
||||
: region_distribution::full_density_distribution (_surface, _circuit, _placementLB, _densityLimits);
|
||||
while(legalizer.region_dimensions().x_ > 2*legalizer.region_dimensions().y_)
|
||||
while(legalizer.region_dimensions().x > 2*legalizer.region_dimensions().y)
|
||||
legalizer.x_bipartition();
|
||||
while(2*legalizer.region_dimensions().x_ < legalizer.region_dimensions().y_)
|
||||
while(2*legalizer.region_dimensions().x < legalizer.region_dimensions().y)
|
||||
legalizer.y_bipartition();
|
||||
while( std::max(legalizer.region_dimensions().x_, legalizer.region_dimensions().y_)*4 > minDisruption ) {
|
||||
while( std::max(legalizer.region_dimensions().x, legalizer.region_dimensions().y)*4 > minDisruption ) {
|
||||
legalizer.x_bipartition();
|
||||
legalizer.y_bipartition();
|
||||
legalizer.redo_line_partitions();
|
||||
|
|
Loading…
Reference in New Issue