timing: Add safe zero check function for delay_t
This commit is contained in:
parent
ac2ab40d3c
commit
35bb3f3a8d
@ -78,6 +78,16 @@ struct PortRef
|
|||||||
IdString port;
|
IdString port;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Zero checking which works regardless if delay_t is floating or integer
|
||||||
|
inline bool is_zero_delay(delay_t delay)
|
||||||
|
{
|
||||||
|
if constexpr (std::is_floating_point<delay_t>::value) {
|
||||||
|
return std::fpclassify(delay) == FP_ZERO;
|
||||||
|
} else {
|
||||||
|
return delay == 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// minimum and maximum delay
|
// minimum and maximum delay
|
||||||
struct DelayPair
|
struct DelayPair
|
||||||
{
|
{
|
||||||
|
@ -985,7 +985,7 @@ CriticalPath TimingAnalyser::build_critical_path_report(domain_id_t domain_pair,
|
|||||||
|
|
||||||
if (related_clock) {
|
if (related_clock) {
|
||||||
delay_t clock_delay = clock_delays.at(clock_pair);
|
delay_t clock_delay = clock_delays.at(clock_pair);
|
||||||
if (clock_delay != 0) {
|
if (!is_zero_delay(clock_delay)) {
|
||||||
CriticalPath::Segment seg_c2c;
|
CriticalPath::Segment seg_c2c;
|
||||||
seg_c2c.type = CriticalPath::Segment::Type::CLK_TO_CLK;
|
seg_c2c.type = CriticalPath::Segment::Type::CLK_TO_CLK;
|
||||||
seg_c2c.delay = DelayPair(clock_delay);
|
seg_c2c.delay = DelayPair(clock_delay);
|
||||||
@ -1005,7 +1005,7 @@ CriticalPath TimingAnalyser::build_critical_path_report(domain_id_t domain_pair,
|
|||||||
|
|
||||||
delay_t clock_skew = clock_delay_launch - clock_delay_capture;
|
delay_t clock_skew = clock_delay_launch - clock_delay_capture;
|
||||||
|
|
||||||
if (clock_skew != 0) {
|
if (!is_zero_delay(clock_skew)) {
|
||||||
CriticalPath::Segment seg_skew;
|
CriticalPath::Segment seg_skew;
|
||||||
seg_skew.type = CriticalPath::Segment::Type::CLK_SKEW;
|
seg_skew.type = CriticalPath::Segment::Type::CLK_SKEW;
|
||||||
seg_skew.delay = DelayPair(clock_skew);
|
seg_skew.delay = DelayPair(clock_skew);
|
||||||
|
Loading…
Reference in New Issue
Block a user