clangformat

Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
gatecat 2024-09-30 14:51:33 +02:00
parent fcdaf3f86c
commit 9b51c6e337
66 changed files with 192 additions and 200 deletions

View File

@ -130,14 +130,12 @@ bool boolvec_populate(const dict<KeyType, Property> &ct, const KeyType &key, std
auto found = ct.find(key); auto found = ct.find(key);
if (found == ct.end()) if (found == ct.end())
return false; return false;
if (!found->second.is_string) if (!found->second.is_string) {
{
size_t val = found->second.as_int64(); size_t val = found->second.as_int64();
for (size_t i = 0; i < vec.size(); ++i, val >>= 1) { for (size_t i = 0; i < vec.size(); ++i, val >>= 1) {
vec[i] = (val & 0x1) != 0; vec[i] = (val & 0x1) != 0;
} }
} } else {
else {
const std::string &str = found->second.as_string(); const std::string &str = found->second.as_string();
size_t i = 0; size_t i = 0;
for (auto it = str.crbegin(); it != str.crend() && i < vec.size(); ++i, ++it) { for (auto it = str.crbegin(); it != str.crend() && i < vec.size(); ++i, ++it) {

View File

@ -325,14 +325,14 @@ class HeAPPlacer
if (cell.second->isPseudo()) if (cell.second->isPseudo())
continue; continue;
if (cell.second->bel == BelId()) { if (cell.second->bel == BelId()) {
log_nonfatal_error("Found unbound cell '%s' of type '%s'\n", cell.first.c_str(ctx), cell.second->type.c_str(ctx)); log_nonfatal_error("Found unbound cell '%s' of type '%s'\n", cell.first.c_str(ctx),
cell.second->type.c_str(ctx));
num_errors++; num_errors++;
} } else if (ctx->getBoundBelCell(cell.second->bel) != cell.second.get()) {
else if (ctx->getBoundBelCell(cell.second->bel) != cell.second.get()) { log_nonfatal_error("Found mismatched binding for '%s' or type '%s'\n", cell.first.c_str(ctx),
log_nonfatal_error("Found mismatched binding for '%s' or type '%s'\n", cell.first.c_str(ctx), cell.second->type.c_str(ctx)); cell.second->type.c_str(ctx));
num_errors++; num_errors++;
} } else if (ctx->debug)
else if (ctx->debug)
log_info("AP soln: %s -> %s\n", cell.first.c_str(ctx), ctx->nameOfBel(cell.second->bel)); log_info("AP soln: %s -> %s\n", cell.first.c_str(ctx), ctx->nameOfBel(cell.second->bel));
} }
if (num_errors > 0) { if (num_errors > 0) {
@ -899,7 +899,8 @@ class HeAPPlacer
while (!placed) { while (!placed) {
if (cfg.cell_placement_timeout > 0 && total_iters_for_cell > cfg.cell_placement_timeout) if (cfg.cell_placement_timeout > 0 && total_iters_for_cell > cfg.cell_placement_timeout)
log_error("Unable to find legal placement for cell '%s' of type '%s' after %d attempts, check constraints and " log_error("Unable to find legal placement for cell '%s' of type '%s' after %d attempts, check "
"constraints and "
"utilisation. Use `--placer-heap-cell-placement-timeout` to change the number of " "utilisation. Use `--placer-heap-cell-placement-timeout` to change the number of "
"attempts.\n", "attempts.\n",
ctx->nameOf(ci), ci->type.c_str(ctx), total_iters_for_cell); ctx->nameOf(ci), ci->type.c_str(ctx), total_iters_for_cell);

View File

@ -387,13 +387,12 @@ bool Arch::lookup_cell_delay(int type_idx, IdString from_port, IdString to_port,
{ {
NPNR_ASSERT(type_idx != -1); NPNR_ASSERT(type_idx != -1);
const auto &ct = speed_grade->cell_types[type_idx]; const auto &ct = speed_grade->cell_types[type_idx];
int to_pin_idx = db_binary_search( int to_pin_idx = db_binary_search(ct.pins, [](const CellPinTimingPOD &pd) { return pd.pin; }, to_port.index);
ct.pins, [](const CellPinTimingPOD &pd) { return pd.pin; }, to_port.index);
if (to_pin_idx == -1) if (to_pin_idx == -1)
return false; return false;
const auto &tp = ct.pins[to_pin_idx]; const auto &tp = ct.pins[to_pin_idx];
int arc_idx = db_binary_search( int arc_idx =
tp.comb_arcs, [](const CellPinCombArcPOD &arc) { return arc.input; }, from_port.index); db_binary_search(tp.comb_arcs, [](const CellPinCombArcPOD &arc) { return arc.input; }, from_port.index);
if (arc_idx == -1) if (arc_idx == -1)
return false; return false;
delay = DelayQuad(tp.comb_arcs[arc_idx].delay.fast_min, tp.comb_arcs[arc_idx].delay.slow_max); delay = DelayQuad(tp.comb_arcs[arc_idx].delay.fast_min, tp.comb_arcs[arc_idx].delay.slow_max);
@ -404,8 +403,7 @@ const RelSlice<CellPinRegArcPOD> *Arch::lookup_cell_seq_timings(int type_idx, Id
{ {
NPNR_ASSERT(type_idx != -1); NPNR_ASSERT(type_idx != -1);
const auto &ct = speed_grade->cell_types[type_idx]; const auto &ct = speed_grade->cell_types[type_idx];
int pin_idx = db_binary_search( int pin_idx = db_binary_search(ct.pins, [](const CellPinTimingPOD &pd) { return pd.pin; }, port.index);
ct.pins, [](const CellPinTimingPOD &pd) { return pd.pin; }, port.index);
if (pin_idx == -1) if (pin_idx == -1)
return nullptr; return nullptr;
return &ct.pins[pin_idx].reg_arcs; return &ct.pins[pin_idx].reg_arcs;
@ -416,8 +414,7 @@ TimingPortClass Arch::lookup_port_tmg_type(int type_idx, IdString port, PortType
NPNR_ASSERT(type_idx != -1); NPNR_ASSERT(type_idx != -1);
const auto &ct = speed_grade->cell_types[type_idx]; const auto &ct = speed_grade->cell_types[type_idx];
int pin_idx = db_binary_search( int pin_idx = db_binary_search(ct.pins, [](const CellPinTimingPOD &pd) { return pd.pin; }, port.index);
ct.pins, [](const CellPinTimingPOD &pd) { return pd.pin; }, port.index);
if (pin_idx == -1) if (pin_idx == -1)
return (dir == PORT_OUT) ? TMG_IGNORE : TMG_COMB_INPUT; return (dir == PORT_OUT) ? TMG_IGNORE : TMG_COMB_INPUT;
auto &pin = ct.pins[pin_idx]; auto &pin = ct.pins[pin_idx];

View File

@ -340,8 +340,7 @@ struct GowinGlobalRouter
src = ctx->getBelPinWire(driver.cell->bel, driver.port); src = ctx->getBelPinWire(driver.cell->bel, driver.port);
} }
RouteResult route_result = route_direct_net( RouteResult route_result = route_direct_net(net, [&](PipId pip) { return global_DQCE_pip_filter(pip); }, src);
net, [&](PipId pip) { return global_DQCE_pip_filter(pip); }, src);
if (route_result == NOT_ROUTED) { if (route_result == NOT_ROUTED) {
log_error("Can't route the %s network.\n", ctx->nameOf(net)); log_error("Can't route the %s network.\n", ctx->nameOf(net));
} }
@ -418,8 +417,7 @@ struct GowinGlobalRouter
src = ctx->getBelPinWire(driver.cell->bel, driver.port); src = ctx->getBelPinWire(driver.cell->bel, driver.port);
} }
RouteResult route_result = route_direct_net( RouteResult route_result = route_direct_net(net, [&](PipId pip) { return global_DCS_pip_filter(pip); }, src);
net, [&](PipId pip) { return global_DCS_pip_filter(pip); }, src);
if (route_result == NOT_ROUTED) { if (route_result == NOT_ROUTED) {
log_error("Can't route the %s network.\n", ctx->nameOf(net)); log_error("Can't route the %s network.\n", ctx->nameOf(net));
} }
@ -506,8 +504,7 @@ struct GowinGlobalRouter
WireId src = ctx->getBelPinWire(driver.cell->bel, port); WireId src = ctx->getBelPinWire(driver.cell->bel, port);
std::vector<PipId> path; std::vector<PipId> path;
RouteResult route_result = route_direct_net( RouteResult route_result = route_direct_net(net, [&](PipId pip) { return global_pip_filter(pip); }, src, &path);
net, [&](PipId pip) { return global_pip_filter(pip); }, src, &path);
if (route_result == NOT_ROUTED) { if (route_result == NOT_ROUTED) {
log_error("Can't route the %s network.\n", ctx->nameOf(net)); log_error("Can't route the %s network.\n", ctx->nameOf(net));
} }
@ -571,8 +568,7 @@ struct GowinGlobalRouter
NetInfo *net_before_buf = buf_ci->getPort(id_I); NetInfo *net_before_buf = buf_ci->getPort(id_I);
NPNR_ASSERT(net_before_buf != nullptr); NPNR_ASSERT(net_before_buf != nullptr);
RouteResult route_result = route_direct_net( RouteResult route_result = route_direct_net(net, [&](PipId pip) { return global_pip_filter(pip); }, src);
net, [&](PipId pip) { return global_pip_filter(pip); }, src);
if (route_result == NOT_ROUTED || route_result == ROUTED_PARTIALLY) { if (route_result == NOT_ROUTED || route_result == ROUTED_PARTIALLY) {
log_error("Can't route the %s net. It might be worth removing the BUFG buffer flag.\n", ctx->nameOf(net)); log_error("Can't route the %s net. It might be worth removing the BUFG buffer flag.\n", ctx->nameOf(net));
} }