clangformat

Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
David Shah 2020-12-30 16:49:55 +00:00
parent 3611f54902
commit 818faa78aa
7 changed files with 37 additions and 43 deletions

View File

@ -870,7 +870,8 @@ void write_bitstream(Context *ctx, std::string base_config_file, std::string tex
if (dir != "OUTPUT") if (dir != "OUTPUT")
log_error("Pseudo-differential IO '%s' must be output\n", ctx->nameOf(ci)); log_error("Pseudo-differential IO '%s' must be output\n", ctx->nameOf(ci));
if (pio != "PIOA") if (pio != "PIOA")
log_error("Pseudo-differential IO '%s' must be constrained to 'A' side of pair\n", ctx->nameOf(ci)); log_error("Pseudo-differential IO '%s' must be constrained to 'A' side of pair\n",
ctx->nameOf(ci));
std::string cpio_tile = get_comp_pio_tile(ctx, bel); std::string cpio_tile = get_comp_pio_tile(ctx, bel);
std::string cpic_tile = get_comp_pic_tile(ctx, bel); std::string cpic_tile = get_comp_pic_tile(ctx, bel);
cc.tiles[cpio_tile].add_enum(pio + ".BASE_TYPE", dir + "_" + iotype); cc.tiles[cpio_tile].add_enum(pio + ".BASE_TYPE", dir + "_" + iotype);

View File

@ -479,7 +479,8 @@ DelayInfo Arch::getWireTypeDelay(IdString wire)
} }
} }
void Arch::read_cst(std::istream &in) { void Arch::read_cst(std::istream &in)
{
std::regex iobre = std::regex("IO_LOC +\"([^\"]+)\" +([^ ;]+);"); std::regex iobre = std::regex("IO_LOC +\"([^\"]+)\" +([^ ;]+);");
std::smatch match; std::smatch match;
std::string line; std::string line;
@ -776,10 +777,7 @@ const std::vector<BelId> &Arch::getBelsByTile(int x, int y) const { return bels_
bool Arch::getBelGlobalBuf(BelId bel) const { return bels.at(bel).gb; } bool Arch::getBelGlobalBuf(BelId bel) const { return bels.at(bel).gb; }
uint32_t Arch::getBelChecksum(BelId bel) const uint32_t Arch::getBelChecksum(BelId bel) const { return bel.index; }
{
return bel.index;
}
void Arch::bindBel(BelId bel, CellInfo *cell, PlaceStrength strength) void Arch::bindBel(BelId bel, CellInfo *cell, PlaceStrength strength)
{ {
@ -896,10 +894,7 @@ IdString Arch::getPipType(PipId pip) const { return pips.at(pip).type; }
const std::map<IdString, std::string> &Arch::getPipAttrs(PipId pip) const { return pips.at(pip).attrs; } const std::map<IdString, std::string> &Arch::getPipAttrs(PipId pip) const { return pips.at(pip).attrs; }
uint32_t Arch::getPipChecksum(PipId wire) const uint32_t Arch::getPipChecksum(PipId wire) const { return wire.index; }
{
return wire.index;
}
void Arch::bindPip(PipId pip, NetInfo *net, PlaceStrength strength) void Arch::bindPip(PipId pip, NetInfo *net, PlaceStrength strength)
{ {

View File

@ -35,7 +35,10 @@ template <typename T> struct RelPtr
const T *get() const { return reinterpret_cast<const T *>(reinterpret_cast<const char *>(this) + offset); } const T *get() const { return reinterpret_cast<const T *>(reinterpret_cast<const char *>(this) + offset); }
T *get_mut() const { return const_cast<T *>(reinterpret_cast<const T *>(reinterpret_cast<const char *>(this) + offset)); } T *get_mut() const
{
return const_cast<T *>(reinterpret_cast<const T *>(reinterpret_cast<const char *>(this) + offset));
}
const T &operator[](size_t index) const { return get()[index]; } const T &operator[](size_t index) const { return get()[index]; }

View File

@ -151,7 +151,6 @@ void arch_wrap_python(py::module &m)
fn_wrapper_2a_v<Context, decltype(&Context::addClock), &Context::addClock, conv_from_str<IdString>, fn_wrapper_2a_v<Context, decltype(&Context::addClock), &Context::addClock, conv_from_str<IdString>,
pass_through<float>>::def_wrap(ctx_cls, "addClock"); pass_through<float>>::def_wrap(ctx_cls, "addClock");
WRAP_MAP_UPTR(m, CellMap, "IdCellMap"); WRAP_MAP_UPTR(m, CellMap, "IdCellMap");
WRAP_MAP_UPTR(m, NetMap, "IdNetMap"); WRAP_MAP_UPTR(m, NetMap, "IdNetMap");
WRAP_MAP(m, HierarchyMap, wrap_context<HierarchicalCell &>, "HierarchyMap"); WRAP_MAP(m, HierarchyMap, wrap_context<HierarchicalCell &>, "HierarchyMap");

View File

@ -19,10 +19,10 @@
*/ */
#include "cells.h" #include "cells.h"
#include <iostream>
#include "design_utils.h" #include "design_utils.h"
#include "log.h" #include "log.h"
#include "util.h" #include "util.h"
#include <iostream>
NEXTPNR_NAMESPACE_BEGIN NEXTPNR_NAMESPACE_BEGIN

View File

@ -19,13 +19,13 @@
*/ */
#include <algorithm> #include <algorithm>
#include <iostream>
#include <iterator> #include <iterator>
#include <unordered_set> #include <unordered_set>
#include "cells.h" #include "cells.h"
#include "design_utils.h" #include "design_utils.h"
#include "log.h" #include "log.h"
#include "util.h" #include "util.h"
#include <iostream>
NEXTPNR_NAMESPACE_BEGIN NEXTPNR_NAMESPACE_BEGIN
@ -41,8 +41,7 @@ static void pack_lut_lutffs(Context *ctx)
if (ctx->verbose) if (ctx->verbose)
log_info("cell '%s' is of type '%s'\n", ctx->nameOf(ci), ci->type.c_str(ctx)); log_info("cell '%s' is of type '%s'\n", ctx->nameOf(ci), ci->type.c_str(ctx));
if (is_lut(ctx, ci)) { if (is_lut(ctx, ci)) {
std::unique_ptr<CellInfo> packed = std::unique_ptr<CellInfo> packed = create_generic_cell(ctx, ctx->id("SLICE"), ci->name.str(ctx) + "_LC");
create_generic_cell(ctx, ctx->id("SLICE"), ci->name.str(ctx) + "_LC");
std::copy(ci->attrs.begin(), ci->attrs.end(), std::inserter(packed->attrs, packed->attrs.begin())); std::copy(ci->attrs.begin(), ci->attrs.end(), std::inserter(packed->attrs, packed->attrs.begin()));
packed_cells.insert(ci->name); packed_cells.insert(ci->name);
if (ctx->verbose) if (ctx->verbose)
@ -96,8 +95,7 @@ static void pack_nonlut_ffs(Context *ctx)
for (auto cell : sorted(ctx->cells)) { for (auto cell : sorted(ctx->cells)) {
CellInfo *ci = cell.second; CellInfo *ci = cell.second;
if (is_ff(ctx, ci)) { if (is_ff(ctx, ci)) {
std::unique_ptr<CellInfo> packed = std::unique_ptr<CellInfo> packed = create_generic_cell(ctx, ctx->id("SLICE"), ci->name.str(ctx) + "_DFFLC");
create_generic_cell(ctx, ctx->id("SLICE"), ci->name.str(ctx) + "_DFFLC");
std::copy(ci->attrs.begin(), ci->attrs.end(), std::inserter(packed->attrs, packed->attrs.begin())); std::copy(ci->attrs.begin(), ci->attrs.end(), std::inserter(packed->attrs, packed->attrs.begin()));
if (ctx->verbose) if (ctx->verbose)
log_info("packed cell %s into %s\n", ctx->nameOf(ci), ctx->nameOf(packed.get())); log_info("packed cell %s into %s\n", ctx->nameOf(ci), ctx->nameOf(packed.get()));
@ -196,9 +194,9 @@ static bool is_nextpnr_iob(const Context *ctx, CellInfo *cell)
cell->type == ctx->id("$nextpnr_iobuf"); cell->type == ctx->id("$nextpnr_iobuf");
} }
static bool is_gowin_iob(const Context *ctx, const CellInfo *cell) { static bool is_gowin_iob(const Context *ctx, const CellInfo *cell)
switch (cell->type.index)
{ {
switch (cell->type.index) {
case ID_IBUF: case ID_IBUF:
case ID_OBUF: case ID_OBUF:
case ID_IOBUF: case ID_IOBUF:
@ -222,8 +220,7 @@ static void pack_io(Context *ctx)
CellInfo *ci = cell.second; CellInfo *ci = cell.second;
if (is_gowin_iob(ctx, ci)) { if (is_gowin_iob(ctx, ci)) {
CellInfo *iob = nullptr; CellInfo *iob = nullptr;
switch (ci->type.index) switch (ci->type.index) {
{
case ID_IBUF: case ID_IBUF:
iob = net_driven_by(ctx, ci->ports.at(id_I).net, is_nextpnr_iob, id_O); iob = net_driven_by(ctx, ci->ports.at(id_I).net, is_nextpnr_iob, id_O);
break; break;
@ -247,8 +244,7 @@ static void pack_io(Context *ctx)
packed_cells.insert(iob->name); packed_cells.insert(iob->name);
} }
// Create a IOB buffer // Create a IOB buffer
std::unique_ptr<CellInfo> ice_cell = std::unique_ptr<CellInfo> ice_cell = create_generic_cell(ctx, id_IOB, ci->name.str(ctx) + "$iob");
create_generic_cell(ctx, id_IOB, ci->name.str(ctx) + "$iob");
gwio_to_iob(ctx, ci, ice_cell.get(), packed_cells); gwio_to_iob(ctx, ci, ice_cell.get(), packed_cells);
new_cells.push_back(std::move(ice_cell)); new_cells.push_back(std::move(ice_cell));
auto gwiob = new_cells.back().get(); auto gwiob = new_cells.back().get();