Updates from clangformat
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
parent
5f37da9704
commit
fd40d6f58d
@ -291,10 +291,7 @@ struct Context : Arch
|
||||
return rngstate * 0x2545F4914F6CDD1D;
|
||||
}
|
||||
|
||||
int rng()
|
||||
{
|
||||
return rng64() & 0x3fffffff;
|
||||
}
|
||||
int rng() { return rng64() & 0x3fffffff; }
|
||||
|
||||
int rng(int n)
|
||||
{
|
||||
@ -311,21 +308,24 @@ struct Context : Arch
|
||||
|
||||
while (1) {
|
||||
int x = rng64() & (m - 1);
|
||||
if (x < n) return x;
|
||||
if (x < n)
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
void rngseed(uint64_t seed)
|
||||
{
|
||||
rngstate = seed ? seed : 0x3141592653589793;
|
||||
for (int i = 0; i < 5; i++) rng64();
|
||||
for (int i = 0; i < 5; i++)
|
||||
rng64();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void shuffle(std::vector<T> &a) {
|
||||
template <typename T> void shuffle(std::vector<T> &a)
|
||||
{
|
||||
for (size_t i = 0; i != a.size(); i++) {
|
||||
size_t j = i + rng(a.size() - i);
|
||||
if (j > i) std::swap(a[i], a[j]);
|
||||
if (j > i)
|
||||
std::swap(a[i], a[j]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -67,7 +67,8 @@ struct Router
|
||||
delay_t maxDelay = 0.0;
|
||||
WireId failedDest;
|
||||
|
||||
Router(Context *ctx, IdString net_name, bool ripup = false, delay_t ripup_penalty = 0)
|
||||
Router(Context *ctx, IdString net_name, bool ripup = false,
|
||||
delay_t ripup_penalty = 0)
|
||||
{
|
||||
auto net_info = ctx->nets.at(net_name);
|
||||
|
||||
@ -438,7 +439,8 @@ bool route_design(Context *ctx)
|
||||
netCnt = 0;
|
||||
int ripCnt = 0;
|
||||
|
||||
std::vector<IdString> ripupArray(ripupQueue.begin(), ripupQueue.end());
|
||||
std::vector<IdString> ripupArray(ripupQueue.begin(),
|
||||
ripupQueue.end());
|
||||
ctx->shuffle(ripupArray);
|
||||
|
||||
for (auto net_name : ripupArray) {
|
||||
@ -447,7 +449,8 @@ bool route_design(Context *ctx)
|
||||
net_name.c_str(ctx),
|
||||
int(ctx->nets.at(net_name)->users.size()));
|
||||
|
||||
Router router(ctx, net_name, true, ripup_penalty * (iterCnt - 1));
|
||||
Router router(ctx, net_name, true,
|
||||
ripup_penalty * (iterCnt - 1));
|
||||
|
||||
netCnt++;
|
||||
visitCnt += router.visitCnt;
|
||||
|
@ -748,10 +748,9 @@ void json_import(Context *ctx, string modname, JsonNode *node)
|
||||
int netid = bits->data_array.at(i)->data_number;
|
||||
if (netid >= netnames.size())
|
||||
netnames.resize(netid + 1);
|
||||
netnames.at(netid) =
|
||||
ctx->id(basename +
|
||||
(num_bits == 1 ? ""
|
||||
: std::string("[") +
|
||||
netnames.at(netid) = ctx->id(
|
||||
basename +
|
||||
(num_bits == 1 ? "" : std::string("[") +
|
||||
std::to_string(i) +
|
||||
std::string("]")));
|
||||
}
|
||||
|
@ -279,8 +279,13 @@ template <> struct hash<NEXTPNR_NAMESPACE_PREFIX PipId>
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct hash<NEXTPNR_NAMESPACE_PREFIX BelType> : hash<int> {};
|
||||
template <> struct hash<NEXTPNR_NAMESPACE_PREFIX PortPin> : hash<int> {};
|
||||
template <> struct hash<NEXTPNR_NAMESPACE_PREFIX BelType> : hash<int>
|
||||
{
|
||||
};
|
||||
|
||||
template <> struct hash<NEXTPNR_NAMESPACE_PREFIX PortPin> : hash<int>
|
||||
{
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
NEXTPNR_NAMESPACE_BEGIN
|
||||
|
@ -200,8 +200,8 @@ void nxio_to_sb(Context *ctx, CellInfo *nxio, CellInfo *sbio)
|
||||
}
|
||||
NetInfo *donet = sbio->ports.at(ctx->id("D_OUT_0")).net;
|
||||
CellInfo *tbuf =
|
||||
net_driven_by(ctx, donet, []
|
||||
(const Context *ctx, const CellInfo *cell) {
|
||||
net_driven_by(ctx, donet,
|
||||
[](const Context *ctx, const CellInfo *cell) {
|
||||
return cell->type == ctx->id("$_TBUF_");
|
||||
},
|
||||
"Y");
|
||||
@ -251,7 +251,8 @@ bool is_enable_port(const Context *ctx, const PortRef &port)
|
||||
|
||||
bool is_global_net(const Context *ctx, const NetInfo *net)
|
||||
{
|
||||
return bool(net_driven_by(ctx, net, is_gbuf, ctx->id("GLOBAL_BUFFER_OUTPUT")));
|
||||
return bool(
|
||||
net_driven_by(ctx, net, is_gbuf, ctx->id("GLOBAL_BUFFER_OUTPUT")));
|
||||
}
|
||||
|
||||
NEXTPNR_NAMESPACE_END
|
||||
|
@ -27,8 +27,7 @@ NEXTPNR_NAMESPACE_BEGIN
|
||||
|
||||
// Create a standard iCE40 cell and return it
|
||||
// Name will be automatically assigned if not specified
|
||||
CellInfo *create_ice_cell(Context *ctx, IdString type,
|
||||
std::string name = "");
|
||||
CellInfo *create_ice_cell(Context *ctx, IdString type, std::string name = "");
|
||||
|
||||
// Return true if a cell is a LUT
|
||||
inline bool is_lut(const Context *ctx, const CellInfo *cell)
|
||||
|
@ -39,8 +39,8 @@ static void pack_lut_lutffs(Context *ctx)
|
||||
log_info("cell '%s' is of type '%s'\n", ci->name.c_str(ctx),
|
||||
ci->type.c_str(ctx));
|
||||
if (is_lut(ctx, ci)) {
|
||||
CellInfo *packed =
|
||||
create_ice_cell(ctx, "ICESTORM_LC", ci->name.str(ctx) + "_LC");
|
||||
CellInfo *packed = create_ice_cell(ctx, "ICESTORM_LC",
|
||||
ci->name.str(ctx) + "_LC");
|
||||
std::copy(ci->attrs.begin(), ci->attrs.end(),
|
||||
std::inserter(packed->attrs, packed->attrs.begin()));
|
||||
packed_cells.insert(ci->name);
|
||||
@ -168,7 +168,8 @@ static void set_net_constant(const Context *ctx, NetInfo *orig,
|
||||
for (auto user : orig->users) {
|
||||
if (user.cell != nullptr) {
|
||||
CellInfo *uc = user.cell;
|
||||
log_info("%s user %s\n", orig->name.c_str(ctx), uc->name.c_str(ctx));
|
||||
log_info("%s user %s\n", orig->name.c_str(ctx),
|
||||
uc->name.c_str(ctx));
|
||||
if (is_lut(ctx, uc) && (user.port.str(ctx).at(0) == 'I') &&
|
||||
!constval) {
|
||||
uc->ports[user.port].net = nullptr;
|
||||
@ -204,7 +205,8 @@ static void pack_constants(Context *ctx)
|
||||
|
||||
for (auto net : ctx->nets) {
|
||||
NetInfo *ni = net.second;
|
||||
if (ni->driver.cell != nullptr && ni->driver.cell->type == ctx->id("GND")) {
|
||||
if (ni->driver.cell != nullptr &&
|
||||
ni->driver.cell->type == ctx->id("GND")) {
|
||||
set_net_constant(ctx, ni, gnd_net, false);
|
||||
ctx->cells[gnd_cell->name] = gnd_cell;
|
||||
ctx->nets[gnd_net->name] = gnd_net;
|
||||
@ -224,7 +226,8 @@ static void pack_constants(Context *ctx)
|
||||
|
||||
static bool is_nextpnr_iob(Context *ctx, CellInfo *cell)
|
||||
{
|
||||
return cell->type == ctx->id("$nextpnr_ibuf") || cell->type == ctx->id("$nextpnr_obuf") ||
|
||||
return cell->type == ctx->id("$nextpnr_ibuf") ||
|
||||
cell->type == ctx->id("$nextpnr_obuf") ||
|
||||
cell->type == ctx->id("$nextpnr_iobuf");
|
||||
}
|
||||
|
||||
@ -240,7 +243,8 @@ static void pack_io(Context *ctx)
|
||||
CellInfo *ci = cell.second;
|
||||
if (is_nextpnr_iob(ctx, ci)) {
|
||||
CellInfo *sb = nullptr;
|
||||
if (ci->type == ctx->id("$nextpnr_ibuf") || ci->type == ctx->id("$nextpnr_iobuf")) {
|
||||
if (ci->type == ctx->id("$nextpnr_ibuf") ||
|
||||
ci->type == ctx->id("$nextpnr_iobuf")) {
|
||||
sb = net_only_drives(ctx, ci->ports.at("O").net, is_sb_io,
|
||||
"PACKAGE_PIN", true, ci);
|
||||
|
||||
@ -252,8 +256,8 @@ static void pack_io(Context *ctx)
|
||||
// Trivial case, SB_IO used. Just destroy the net and the
|
||||
// iobuf
|
||||
log_info("%s feeds SB_IO %s, removing %s %s.\n",
|
||||
ci->name.c_str(ctx), sb->name.c_str(ctx), ci->type.c_str(ctx),
|
||||
ci->name.c_str(ctx));
|
||||
ci->name.c_str(ctx), sb->name.c_str(ctx),
|
||||
ci->type.c_str(ctx), ci->name.c_str(ctx));
|
||||
NetInfo *net = sb->ports.at("PACKAGE_PIN").net;
|
||||
if (net != nullptr) {
|
||||
ctx->nets.erase(net->name);
|
||||
|
Loading…
Reference in New Issue
Block a user