Use double for tns, inspired by pr155
Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
parent
cc9ec25a1a
commit
7b7ea9675e
|
|
@ -63,6 +63,12 @@ Delay::Delay(const Delay &delay) :
|
|||
{
|
||||
}
|
||||
|
||||
Delay::Delay(const DelayDbl &delay) :
|
||||
mean_(delay.mean_),
|
||||
sigma2_(delay.sigma2_)
|
||||
{
|
||||
}
|
||||
|
||||
Delay::Delay(float mean) :
|
||||
mean_(mean),
|
||||
sigma2_(0.0)
|
||||
|
|
@ -173,6 +179,35 @@ Delay::operator==(const Delay &delay) const
|
|||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
DelayDbl::DelayDbl() :
|
||||
mean_(0.0),
|
||||
sigma2_(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
DelayDbl::operator=(float delay)
|
||||
{
|
||||
mean_ = delay;
|
||||
sigma2_ = 0.0;
|
||||
}
|
||||
|
||||
void
|
||||
DelayDbl::operator+=(const Delay &delay)
|
||||
{
|
||||
mean_ += delay.mean_;
|
||||
sigma2_ += delay.sigma2_;
|
||||
}
|
||||
|
||||
void
|
||||
DelayDbl::operator-=(const Delay &delay)
|
||||
{
|
||||
mean_ -= delay.mean_;
|
||||
sigma2_ += delay.sigma2_;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
Delay
|
||||
makeDelay(float delay,
|
||||
float sigma,
|
||||
|
|
|
|||
|
|
@ -64,6 +64,13 @@ Delay::Delay(const Delay &delay) :
|
|||
sigma2_[EarlyLate::lateIndex()] = delay.sigma2_[EarlyLate::lateIndex()];
|
||||
}
|
||||
|
||||
Delay::Delay(const DelayDbl &delay) :
|
||||
mean_(delay.mean_)
|
||||
{
|
||||
sigma2_[EarlyLate::earlyIndex()] = delay.sigma2_[EarlyLate::earlyIndex()];
|
||||
sigma2_[EarlyLate::lateIndex()] = delay.sigma2_[EarlyLate::lateIndex()];
|
||||
}
|
||||
|
||||
Delay::Delay(float mean) :
|
||||
mean_(mean),
|
||||
sigma2_{0.0, 0.0}
|
||||
|
|
@ -196,6 +203,38 @@ Delay::operator==(const Delay &delay) const
|
|||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
DelayDbl::DelayDbl() :
|
||||
mean_(0.0),
|
||||
sigma2_{0.0, 0.0}
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
DelayDbl::operator=(float delay)
|
||||
{
|
||||
mean_ = delay;
|
||||
sigma2_[early_index] = 0.0;
|
||||
sigma2_[late_index] = 0.0;
|
||||
}
|
||||
|
||||
void
|
||||
DelayDbl::operator+=(const Delay &delay)
|
||||
{
|
||||
mean_ += delay.mean_;
|
||||
sigma2_[early_index] += delay.sigma2_[early_index];
|
||||
sigma2_[late_index] += delay.sigma2_[late_index];
|
||||
}
|
||||
|
||||
void
|
||||
DelayDbl::operator-=(const Delay &delay)
|
||||
{
|
||||
mean_ -= delay.mean_;
|
||||
sigma2_[early_index] += delay.sigma2_[early_index];
|
||||
sigma2_[late_index] += delay.sigma2_[late_index];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
Delay
|
||||
makeDelay(float delay,
|
||||
float sigma_early,
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ namespace sta {
|
|||
class StaState;
|
||||
|
||||
typedef float Delay;
|
||||
// Delay double for accumulating Delays.
|
||||
typedef double DelayDbl;
|
||||
|
||||
const Delay delay_zero = 0.0;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
namespace sta {
|
||||
|
||||
class Delay;
|
||||
class DelayDbl;
|
||||
class StaState;
|
||||
|
||||
// Normal distribution with std deviation.
|
||||
|
|
@ -29,6 +30,7 @@ class Delay
|
|||
public:
|
||||
Delay();
|
||||
Delay(const Delay &delay);
|
||||
Delay(const DelayDbl &delay);
|
||||
Delay(float mean);
|
||||
Delay(float mean,
|
||||
float sigma2);
|
||||
|
|
@ -53,6 +55,29 @@ private:
|
|||
float mean_;
|
||||
// Sigma^2
|
||||
float sigma2_;
|
||||
|
||||
friend class DelayDbl;
|
||||
};
|
||||
|
||||
// Dwlay with doubles for accumulating delays.
|
||||
class DelayDbl
|
||||
{
|
||||
public:
|
||||
DelayDbl();
|
||||
float mean() const { return mean_; }
|
||||
float sigma() const;
|
||||
// sigma^2
|
||||
float sigma2() const;
|
||||
void operator=(float delay);
|
||||
void operator+=(const Delay &delay);
|
||||
void operator-=(const Delay &delay);
|
||||
|
||||
private:
|
||||
double mean_;
|
||||
// Sigma^2
|
||||
double sigma2_;
|
||||
|
||||
friend class Delay;
|
||||
};
|
||||
|
||||
const Delay delay_zero(0.0);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
namespace sta {
|
||||
|
||||
class Delay;
|
||||
class DelayDbl;
|
||||
class StaState;
|
||||
|
||||
// Normal distribution with early(left)/late(right) std deviations.
|
||||
|
|
@ -29,6 +30,7 @@ class Delay
|
|||
public:
|
||||
Delay();
|
||||
Delay(const Delay &delay);
|
||||
Delay(const DelayDbl &delay);
|
||||
Delay(float mean);
|
||||
Delay(float mean,
|
||||
float sigma2_early,
|
||||
|
|
@ -60,6 +62,33 @@ private:
|
|||
float mean_;
|
||||
// Sigma^2
|
||||
float sigma2_[EarlyLate::index_count];
|
||||
|
||||
friend class DelayDbl;
|
||||
};
|
||||
|
||||
// Dwlay with doubles for accumulating delays.
|
||||
class DelayDbl
|
||||
{
|
||||
public:
|
||||
DelayDbl();
|
||||
float mean() const { return mean_; }
|
||||
float sigma() const;
|
||||
// sigma^2
|
||||
float sigma2() const;
|
||||
void operator=(float delay);
|
||||
void operator+=(const Delay &delay);
|
||||
void operator-=(const Delay &delay);
|
||||
|
||||
protected:
|
||||
static const int early_index = 0;
|
||||
static const int late_index = 1;
|
||||
|
||||
private:
|
||||
double mean_;
|
||||
// Sigma^2
|
||||
double sigma2_[EarlyLate::index_count];
|
||||
|
||||
friend class Delay;
|
||||
};
|
||||
|
||||
const Delay delay_zero(0.0);
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ typedef UnorderedSet<TagGroup*, TagGroupHash, TagGroupEqual> TagGroupSet;
|
|||
typedef Map<Vertex*, Slack> VertexSlackMap;
|
||||
typedef Vector<VertexSlackMap> VertexSlackMapSeq;
|
||||
typedef Vector<WorstSlacks> WorstSlacksSeq;
|
||||
typedef vector<DelayDbl> DelayDblSeq;
|
||||
|
||||
class Search : public StaState
|
||||
{
|
||||
|
|
@ -570,7 +571,7 @@ protected:
|
|||
// Endpoint vertices with slacks that have changed since tns was found.
|
||||
VertexSet *invalid_tns_;
|
||||
// Indexed by path_ap->index().
|
||||
SlackSeq tns_;
|
||||
DelayDblSeq tns_;
|
||||
// Indexed by path_ap->index().
|
||||
VertexSlackMapSeq tns_slacks_;
|
||||
std::mutex tns_lock_;
|
||||
|
|
|
|||
Loading…
Reference in New Issue