Skip to content

Commit

Permalink
clangformat
Browse files Browse the repository at this point in the history
Signed-off-by: gatecat <gatecat@ds0.me>
  • Loading branch information
gatecat committed Jun 18, 2024
1 parent c89037d commit a29a17f
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
2 changes: 0 additions & 2 deletions common/kernel/command.cc
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ po::options_description CommandHandler::getGeneralOptions()

general.add_options()("static-dump-density", "write density csv files during placer-static flow");


#if !defined(NPNR_DISABLE_THREADS)
general.add_options()("parallel-refine", "use new experimental parallelised engine for placement refinement");
#endif
Expand Down Expand Up @@ -549,7 +548,6 @@ void CommandHandler::setupContext(Context *ctx)
if (vm.count("static-dump-density"))
ctx->settings[ctx->id("static/dump_density")] = true;


// Setting default values
if (ctx->settings.find(ctx->id("target_freq")) == ctx->settings.end())
ctx->settings[ctx->id("target_freq")] = std::to_string(12e6);
Expand Down
18 changes: 9 additions & 9 deletions common/place/parallel_refine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ struct ThreadState : DetailPlacerThreadState
BelId old_bel = cell->bel;
CellInfo *bound = nullptr;
{
#if !defined(NPNR_DISABLE_THREADS)
std::shared_lock<std::shared_timed_mutex> l(g.archapi_mutex);
#endif
#if !defined(NPNR_DISABLE_THREADS)
std::shared_lock<std::shared_timed_mutex> l(g.archapi_mutex);
#endif
bound = ctx->getBoundBelCell(new_bel);
}
if (bound && (bound->belStrength > STRENGTH_STRONG || bound->cluster != ClusterId()))
Expand Down Expand Up @@ -127,9 +127,9 @@ struct ThreadState : DetailPlacerThreadState
used_bels.insert(db.second);
CellInfo *bound = nullptr;
{
#if !defined(NPNR_DISABLE_THREADS)
std::shared_lock<std::shared_timed_mutex> l(g.archapi_mutex);
#endif
#if !defined(NPNR_DISABLE_THREADS)
std::shared_lock<std::shared_timed_mutex> l(g.archapi_mutex);
#endif
bound = ctx->getBoundBelCell(db.second);
}
if (bound) {
Expand Down Expand Up @@ -160,9 +160,9 @@ struct ThreadState : DetailPlacerThreadState
} else {
bool avail = false;
{
#if !defined(NPNR_DISABLE_THREADS)
std::shared_lock<std::shared_timed_mutex> l(g.archapi_mutex);
#endif
#if !defined(NPNR_DISABLE_THREADS)
std::shared_lock<std::shared_timed_mutex> l(g.archapi_mutex);
#endif
avail = ctx->checkBelAvail(db.second);
}
if (!avail)
Expand Down
18 changes: 10 additions & 8 deletions common/place/placer_static.cc
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,8 @@ class StaticPlacer
if (!ctx->isBelLocationValid(bel)) {
ctx->unbindBel(bel);
} else {
log_info(" placed potpourri cell '%s' at bel '%s'\n", ctx->nameOf(ci), ctx->nameOfBel(bel));
log_info(" placed potpourri cell '%s' at bel '%s'\n", ctx->nameOf(ci),
ctx->nameOfBel(bel));
break;
}
}
Expand Down Expand Up @@ -910,7 +911,7 @@ class StaticPlacer
force_sum += std::abs(mc.ref_dens_grad.x) + std::abs(mc.ref_dens_grad.y);
}
const float eta = 1e-1;
float init_dens_penalty = eta * (wirelen_sum / force_sum);
float init_dens_penalty = eta * (wirelen_sum / force_sum);
log_info("initial density penalty: %f\n", init_dens_penalty);
dens_penalty.resize(groups.size(), init_dens_penalty);
update_potentials(true); // set initial potential
Expand Down Expand Up @@ -1003,14 +1004,15 @@ class StaticPlacer
float penalty_beta = 2.0e3f;
float alpha_l = 1.05f, alpha_h = 1.06f;
double penalty_incr = alpha_h - 1;
void update_penalties() {
void update_penalties()
{
float pot_norm = 0;
// compute L2-norm of relative system potential
std::vector<float> rel_pot;
for (int g = 0; g < int(groups.size()); g++) {
auto &group = groups.at(g);
if (!group.enabled)
continue;
continue;
float phi_hat = group.curr_potential / group.init_potential;
rel_pot.push_back(phi_hat);
pot_norm += phi_hat * phi_hat;
Expand All @@ -1019,17 +1021,16 @@ class StaticPlacer
log_info("pot_norm: %f\n", pot_norm);
// update penalty multiplier (ELFPlace equation 22)
double log_term = std::log(penalty_beta * pot_norm + 1);
penalty_incr = penalty_incr * ((log_term / (log_term + 1)) * (alpha_h - alpha_l) + alpha_l);
penalty_incr = penalty_incr * ((log_term / (log_term + 1)) * (alpha_h - alpha_l) + alpha_l);
// update density penalties (ELFPlace equation 21)
for (int g = 0; g < int(groups.size()); g++) {
if (!groups.at(g).enabled)
continue;
continue;
float next_penalty = dens_penalty.at(g) + (penalty_incr * (rel_pot.at(g) / pot_norm));
dens_penalty.at(g) = next_penalty;
}
}


void initialise()
{
float initial_steplength = 0.01f;
Expand Down Expand Up @@ -1152,7 +1153,8 @@ class StaticPlacer
RealPair drv_loc = cell_loc(ni->driver.cell, false);
for (auto usr : ni->users.enumerate()) {
RealPair usr_loc = cell_loc(usr.value.cell, false);
delay_t est_delay = cfg.timing_c + cfg.timing_mx * std::abs(drv_loc.x - usr_loc.x) + cfg.timing_my * std::abs(drv_loc.y - usr_loc.y);
delay_t est_delay = cfg.timing_c + cfg.timing_mx * std::abs(drv_loc.x - usr_loc.x) +
cfg.timing_my * std::abs(drv_loc.y - usr_loc.y);
tmg.set_route_delay(CellPortKey(usr.value), DelayPair(est_delay));
}
}
Expand Down
2 changes: 1 addition & 1 deletion ecp5/bitstream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1548,7 +1548,7 @@ struct ECP5Bitgen
cc.tiles[tile].add_enum(eclkb + ".MODE", "ECLKBRIDGECS");
} else if (ci->type == id_DDRDLL) {
Loc loc = ctx->getBelLocation(ci->bel);
bool u = loc.y<15, r = loc.x> 15;
bool u = loc.y < 15, r = loc.x > 15;
std::string tiletype = fmt_str("DDRDLL_" << (u ? 'U' : 'L') << (r ? 'R' : 'L'));
if ((ctx->args.type == ArchArgs::LFE5U_12F || ctx->args.type == ArchArgs::LFE5U_25F ||
ctx->args.type == ArchArgs::LFE5UM_25F || ctx->args.type == ArchArgs::LFE5UM5G_25F) &&
Expand Down
4 changes: 2 additions & 2 deletions ecp5/gfx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ void gfxTileBel(std::vector<GraphicElement> &g, int x, int y, int z, int w, int
}
g.push_back(el);
} else if (bel_type == id_DCCA) {
el.x1 = x + switchbox_x1 + (z)*0.025;
el.x1 = x + switchbox_x1 + (z) * 0.025;
el.y1 = y + 0.14;
el.x2 = x + switchbox_x1 + (z)*0.025 + 0.020;
el.x2 = x + switchbox_x1 + (z) * 0.025 + 0.020;
el.y2 = y + 0.18;
g.push_back(el);
} else if (bel_type.in(id_DP16KD, id_MULT18X18D, id_ALU54B)) {
Expand Down
2 changes: 1 addition & 1 deletion generic/viaduct/fabulous/fasm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ struct FabFasmWriter
continue;
unsigned pip_data = pip_tags.at(pip.index).data;
unsigned from_pin = (pip_data >> 4) & 0xF;
unsigned to_pin = (pip_data)&0xF;
unsigned to_pin = (pip_data) & 0xF;
NPNR_ASSERT(to_pin == i);
phys_to_log[from_pin].push_back(i);
}
Expand Down
2 changes: 1 addition & 1 deletion gui/lineshader.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class LineShader

public:
LineShader(QObject *parent) : parent_(parent), program_(nullptr) {}
~LineShader() { ((QOpenGLWidget*) parent_)->makeCurrent(); }
~LineShader() { ((QOpenGLWidget *)parent_)->makeCurrent(); }

static constexpr const char *vertexShaderSource_ =
"#version 150\n"
Expand Down
2 changes: 1 addition & 1 deletion himbaechel/arch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
*/

#include "arch.h"
#include <boost/filesystem/path.hpp>
#include "archdefs.h"
#include "chipdb.h"
#include "log.h"
#include "nextpnr.h"
#include <boost/filesystem/path.hpp>

#include "command.h"
#include "placer1.h"
Expand Down

0 comments on commit a29a17f

Please sign in to comment.