mirror of https://github.com/YosysHQ/nextpnr.git
static: Fix exponent overflow on big designs
Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
parent
fcc80c5332
commit
ca6a25e41e
|
|
@ -129,11 +129,11 @@ struct PlacerBin
|
|||
struct PlacerPort
|
||||
{
|
||||
// for wirelength data
|
||||
static constexpr float invalid = std::numeric_limits<float>::lowest();
|
||||
static constexpr double invalid = std::numeric_limits<double>::lowest();
|
||||
|
||||
PortRef ref;
|
||||
RealPair max_exp{invalid, invalid};
|
||||
RealPair min_exp{invalid, invalid};
|
||||
DoublePair max_exp{invalid, invalid};
|
||||
DoublePair min_exp{invalid, invalid};
|
||||
bool has_max_exp(Axis axis) const { return max_exp.at(axis) != invalid; }
|
||||
bool has_min_exp(Axis axis) const { return min_exp.at(axis) != invalid; }
|
||||
};
|
||||
|
|
@ -143,8 +143,8 @@ struct PlacerNet
|
|||
NetInfo *ni;
|
||||
bool skip = false;
|
||||
RealPair b1, b0; // real bounding box
|
||||
RealPair min_exp, x_min_exp;
|
||||
RealPair max_exp, x_max_exp;
|
||||
DoublePair min_exp, x_min_exp;
|
||||
DoublePair max_exp, x_max_exp;
|
||||
RealPair wa_wl;
|
||||
// lines up with user indexes; plus one for driver
|
||||
std::vector<PlacerPort> ports;
|
||||
|
|
|
|||
|
|
@ -35,34 +35,38 @@ enum class Axis
|
|||
Y
|
||||
};
|
||||
|
||||
struct RealPair
|
||||
template <typename T>
|
||||
struct RealPairTempl
|
||||
{
|
||||
RealPair() : x(0), y(0) {};
|
||||
RealPair(float x, float y) : x(x), y(y) {};
|
||||
explicit RealPair(Loc l, float bias = 0.0f) : x(l.x + bias), y(l.y + bias) {};
|
||||
float x, y;
|
||||
RealPair &operator+=(const RealPair &other)
|
||||
RealPairTempl() : x(0), y(0) {};
|
||||
RealPairTempl(T x, T y) : x(x), y(y) {};
|
||||
explicit RealPairTempl(Loc l, T bias = 0.0f) : x(l.x + bias), y(l.y + bias) {};
|
||||
T x, y;
|
||||
RealPairTempl &operator+=(const RealPairTempl &other)
|
||||
{
|
||||
x += other.x;
|
||||
y += other.y;
|
||||
return *this;
|
||||
}
|
||||
RealPair &operator/=(float factor)
|
||||
RealPairTempl &operator/=(T factor)
|
||||
{
|
||||
x /= factor;
|
||||
y /= factor;
|
||||
return *this;
|
||||
}
|
||||
friend RealPair operator+(RealPair a, RealPair b);
|
||||
friend RealPair operator-(RealPair a, RealPair b);
|
||||
RealPair operator*(float factor) const { return RealPair(x * factor, y * factor); }
|
||||
RealPair operator/(float factor) const { return RealPair(x / factor, y / factor); }
|
||||
template <typename Tf> friend RealPairTempl<Tf> operator+(RealPairTempl<Tf> a, RealPairTempl<Tf> b);
|
||||
template <typename Tf> friend RealPairTempl<Tf> operator-(RealPairTempl<Tf> a, RealPairTempl<Tf> b);
|
||||
RealPairTempl operator*(T factor) const { return RealPairTempl(x * factor, y * factor); }
|
||||
RealPairTempl operator/(T factor) const { return RealPairTempl(x / factor, y / factor); }
|
||||
// to simplify axis-generic code
|
||||
inline float &at(Axis axis) { return (axis == Axis::Y) ? y : x; }
|
||||
inline const float &at(Axis axis) const { return (axis == Axis::Y) ? y : x; }
|
||||
inline T &at(Axis axis) { return (axis == Axis::Y) ? y : x; }
|
||||
inline const T &at(Axis axis) const { return (axis == Axis::Y) ? y : x; }
|
||||
};
|
||||
inline RealPair operator+(RealPair a, RealPair b) { return RealPair(a.x + b.x, a.y + b.y); }
|
||||
inline RealPair operator-(RealPair a, RealPair b) { return RealPair(a.x - b.x, a.y - b.y); }
|
||||
template <typename T> inline RealPairTempl<T> operator+(RealPairTempl<T> a, RealPairTempl<T> b) { return RealPairTempl(a.x + b.x, a.y + b.y); }
|
||||
template <typename T> inline RealPairTempl<T> operator-(RealPairTempl<T> a, RealPairTempl<T> b) { return RealPairTempl(a.x - b.x, a.y - b.y); }
|
||||
|
||||
using RealPair = RealPairTempl<float>;
|
||||
using DoublePair = RealPairTempl<double>;
|
||||
|
||||
// array2d; but as ourafft wants it
|
||||
struct FFTArray
|
||||
|
|
|
|||
Loading…
Reference in New Issue