34 std::vector<std::int64_t>
cap;
37 std::size_t
size()
const {
return cap.size(); }
55inline std::int64_t
bin_overflow(std::int64_t demand, std::int64_t cap) {
return demand > cap ? demand - cap : 0; }
84 if (b.
empty())
return;
89 auto cx = [&](
Coord v) {
return static_cast<int>(std::clamp<Coord>((v - m.
ox) / m.
cell, 0, m.
nx - 1)); };
90 auto cy = [&](
Coord v) {
return static_cast<int>(std::clamp<Coord>((v - m.
oy) / m.
cell, 0, m.
ny - 1)); };
91 const int x0 = cx(r.
x0), x1 = cx(r.
x1 - 1), y0 = cy(r.
y0), y1 = cy(r.
y1 - 1);
92 for (
int y = y0; y <= y1; ++y) {
96 if (by1 <= by0)
continue;
97 for (
int x = x0; x <= x1; ++x) {
100 if (bx1 <= bx0)
continue;
102 const auto d =
static_cast<std::int64_t
>(
static_cast<geom::i128>(hp) * ov / area);
103 if (d == 0)
continue;
104 const auto k =
static_cast<std::size_t
>(y * m.
nx + x);
106 demand[k] += sign * d;
Placement legality (design doc 04 §3 D/E): exact integer tests of courtyards, through-hole obstacles,...
__int128 i128
GCC extension; exact products of nm coordinates.
Box rudy_box(const CongestionMap &m, const Box &b)
RUDY box: the pin box widened to at least one bin per axis, so aligned pins do not give infinite dens...
std::vector< std::int64_t > rudy_demand(const Problem &p, const Placement &pl, const CongestionMap &m)
From-scratch demand of a placement (reference path for the annealer's incremental bookkeeping).
bool rudy_net(const Problem &p, int net)
True if the net contributes RUDY demand (signal nets with at least two pins).
std::int64_t rudy_overflow(const Problem &p, const Placement &pl, const CongestionMap &m)
std::int64_t bin_overflow(std::int64_t demand, std::int64_t cap)
std::int64_t total_overflow(const CongestionMap &m, const std::vector< std::int64_t > &demand)
void scale_bins(CongestionMap &m, const std::vector< Point > &pts, Coord radius, double factor)
Multiplies the capacity of the bins within radius of each point by factor (once per bin per call).
CongestionMap make_congestion_map(const Problem &p, const CongestionOptions &o={})
void add_box_demand(const CongestionMap &m, const Box &b, int sign, std::vector< std::int64_t > &demand, Touch &&touch)
Adds sign × the RUDY demand of a net with pin bounding box b to demand.
Box net_box(const Problem &p, const Placement &pl, int net)
Pin bounding box of one net.
std::int64_t Coord
Engine coordinate: signed 64-bit nanometres.
Coord y1
empty when x1 < x0
constexpr bool empty() const
std::vector< std::int64_t > cap
track-length capacity per bin, nm
int bin(Point q) const
bin containing q (clamped to the grid)
Coord pin_demand
track length consumed by one pin, nm
double pin_tracks
a pin consumes this many tracks across its bin
double pitch_mm
track pitch (width + clearance) used for the capacity
int max_bins
bins along the longer side of the board
double usable
fraction of the ideal track length that is routable (pads, vias, detours)