clangformat

Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
gatecat 2023-03-16 11:27:08 +01:00
parent 132a98a91d
commit 39b6584274

View File

@ -2623,13 +2623,11 @@ class Ecp5Packer
auto equals_epsilon = [](delay_t a, delay_t b) { return (std::abs(a - b) / std::max(double(b), 1.0)) < 1e-3; };
auto equals_epsilon_pair = [&](DelayPair &a, DelayPair &b) {
return equals_epsilon(a.min_delay, b.min_delay)
&& equals_epsilon(a.max_delay, b.max_delay);
return equals_epsilon(a.min_delay, b.min_delay) && equals_epsilon(a.max_delay, b.max_delay);
};
auto equals_epsilon_constr = [&](ClockConstraint &a, ClockConstraint &b) {
return equals_epsilon_pair(a.high, b.high)
&& equals_epsilon_pair(a.low, b.low)
&& equals_epsilon_pair(a.period, b.period);
return equals_epsilon_pair(a.high, b.high) && equals_epsilon_pair(a.low, b.low) &&
equals_epsilon_pair(a.period, b.period);
};
pool<IdString> user_constrained, changed_nets;
@ -2787,69 +2785,43 @@ class Ecp5Packer
auto merged_constr = std::unique_ptr<ClockConstraint>(new ClockConstraint());
if (mode == "NEG") {
merged_constr->low = DelayPair(
std::min(c1->low.min_delay, c2->low.min_delay),
std::max(
c1->low.max_delay + c2->period.max_delay,
c2->low.max_delay + c1->period.max_delay
)
);
merged_constr->low = DelayPair(std::min(c1->low.min_delay, c2->low.min_delay),
std::max(c1->low.max_delay + c2->period.max_delay,
c2->low.max_delay + c1->period.max_delay));
} else {
merged_constr->low = DelayPair(
std::min(c1->low.min_delay, c2->low.min_delay),
std::max(c1->low.max_delay, c2->low.max_delay)
);
merged_constr->low = DelayPair(std::min(c1->low.min_delay, c2->low.min_delay),
std::max(c1->low.max_delay, c2->low.max_delay));
}
if (mode == "POS") {
merged_constr->high = DelayPair(
std::min(c1->high.min_delay, c2->high.min_delay),
std::max(
c1->high.max_delay + c2->period.max_delay,
c2->high.max_delay + c1->period.max_delay
)
);
merged_constr->high = DelayPair(std::min(c1->high.min_delay, c2->high.min_delay),
std::max(c1->high.max_delay + c2->period.max_delay,
c2->high.max_delay + c1->period.max_delay));
} else {
merged_constr->high = DelayPair(
std::min(c1->high.min_delay, c2->high.min_delay),
std::max(c1->high.max_delay, c2->high.max_delay)
);
merged_constr->high = DelayPair(std::min(c1->high.min_delay, c2->high.min_delay),
std::max(c1->high.max_delay, c2->high.max_delay));
}
merged_constr->period = DelayPair(
std::min(c1->period.min_delay, c2->period.min_delay),
std::max(c1->period.max_delay, c2->period.max_delay)
);
merged_constr->period = DelayPair(std::min(c1->period.min_delay, c2->period.min_delay),
std::max(c1->period.max_delay, c2->period.max_delay));
if (derived_constr == nullptr) {
derived_constr = std::move(merged_constr);
continue;
}
derived_constr->period.min_delay = std::min(
derived_constr->period.min_delay,
merged_constr->period.min_delay
);
derived_constr->period.max_delay = std::max(
derived_constr->period.max_delay,
merged_constr->period.max_delay
);
derived_constr->low.min_delay = std::min(
derived_constr->low.min_delay,
merged_constr->low.min_delay
);
derived_constr->low.max_delay = std::max(
derived_constr->low.max_delay,
merged_constr->low.max_delay
);
derived_constr->high.min_delay = std::min(
derived_constr->high.min_delay,
merged_constr->high.min_delay
);
derived_constr->high.max_delay = std::max(
derived_constr->high.max_delay,
merged_constr->high.max_delay
);
derived_constr->period.min_delay =
std::min(derived_constr->period.min_delay, merged_constr->period.min_delay);
derived_constr->period.max_delay =
std::max(derived_constr->period.max_delay, merged_constr->period.max_delay);
derived_constr->low.min_delay =
std::min(derived_constr->low.min_delay, merged_constr->low.min_delay);
derived_constr->low.max_delay =
std::max(derived_constr->low.max_delay, merged_constr->low.max_delay);
derived_constr->high.min_delay =
std::min(derived_constr->high.min_delay, merged_constr->high.min_delay);
derived_constr->high.max_delay =
std::max(derived_constr->high.max_delay, merged_constr->high.max_delay);
}
}
@ -2884,10 +2856,14 @@ class Ecp5Packer
log_info(" Derived VCO frequency %.1f MHz of PLL '%s' is out of legal range [400MHz, "
"800MHz]\n",
vco_freq, ci->name.c_str(ctx));
set_constraint(ci, id_CLKOP, simple_clk_contraint(vco_period * int_or_default(ci->params, id_CLKOP_DIV, 1)));
set_constraint(ci, id_CLKOS, simple_clk_contraint(vco_period * int_or_default(ci->params, id_CLKOS_DIV, 1)));
set_constraint(ci, id_CLKOS2, simple_clk_contraint(vco_period * int_or_default(ci->params, id_CLKOS2_DIV, 1)));
set_constraint(ci, id_CLKOS3, simple_clk_contraint(vco_period * int_or_default(ci->params, id_CLKOS3_DIV, 1)));
set_constraint(ci, id_CLKOP,
simple_clk_contraint(vco_period * int_or_default(ci->params, id_CLKOP_DIV, 1)));
set_constraint(ci, id_CLKOS,
simple_clk_contraint(vco_period * int_or_default(ci->params, id_CLKOS_DIV, 1)));
set_constraint(ci, id_CLKOS2,
simple_clk_contraint(vco_period * int_or_default(ci->params, id_CLKOS2_DIV, 1)));
set_constraint(ci, id_CLKOS3,
simple_clk_contraint(vco_period * int_or_default(ci->params, id_CLKOS3_DIV, 1)));
} else if (ci->type == id_OSCG) {
int div = int_or_default(ci->params, id_DIV, 128);
set_constraint(ci, id_OSC, simple_clk_contraint(delay_t((1.0e6 / (2.0 * 155)) * div)));