SDC: Fix approximate equality condition
Signed-off-by: Tomasz Michalak <tmichalak@antmicro.com>
diff --git a/sdc-plugin/buffers.cc b/sdc-plugin/buffers.cc
index c997bfa..cb54743 100644
--- a/sdc-plugin/buffers.cc
+++ b/sdc-plugin/buffers.cc
@@ -35,13 +35,13 @@
void Pll::CheckInputClockPeriod(RTLIL::Cell* cell, float input_clock_period) {
float abs_diff = fabs(ClkinPeriod() - input_clock_period);
- bool approx_equal = abs_diff < max(ClkinPeriod(), input_clock_period) * kApproxEqualFactor;
+ bool approx_equal = abs_diff < max(ClkinPeriod(), input_clock_period) * 10 * std::numeric_limits<float>::epsilon();
if (!approx_equal) {
log_cmd_error(
- "CLKIN[1/2]_PERIOD isn't approximately equal (+/-%.2f%%) to the virtual clock constraint "
+ "CLKIN[1/2]_PERIOD doesn't match the virtual clock constraint "
"propagated to the CLKIN[1/2] input of the clock divider cell: "
"%s.\nInput clock period: %f, CLKIN[1/2]_PERIOD: %f\n",
- kApproxEqualFactor * 100, RTLIL::id2cstr(cell->name), input_clock_period, ClkinPeriod());
+ RTLIL::id2cstr(cell->name), input_clock_period, ClkinPeriod());
}
}
diff --git a/sdc-plugin/buffers.h b/sdc-plugin/buffers.h
index 72beb0b..5f51535 100644
--- a/sdc-plugin/buffers.h
+++ b/sdc-plugin/buffers.h
@@ -61,8 +61,7 @@
private:
// Approximate equality check of the input clock period and specified in
- // CLKIN[1/2]_PERIOD parameter kApproxEqualFactor specifies the percentage
- // of the maximum accepted difference
+ // CLKIN[1/2]_PERIOD parameter
void CheckInputClockPeriod(RTLIL::Cell* cell, float input_clock_period);
// Fetch cell's parameters needed for further calculations
@@ -83,8 +82,6 @@
float divclk_divisor;
float clk_mult;
float clk_fbout_phase;
- // Approximate equality factor of 1%
- const float kApproxEqualFactor = 0.01;
};
#endif // _BUFFERS_H_