clangformat

This commit is contained in:
Clifford Wolf 2018-08-05 14:18:34 +02:00
parent 528eddcaf7
commit 287fe7e894
5 changed files with 82 additions and 95 deletions

View File

@ -404,8 +404,7 @@ WireId Arch::getWireByName(IdString name) const
IdString Arch::getWireType(WireId wire) const IdString Arch::getWireType(WireId wire) const
{ {
NPNR_ASSERT(wire != WireId()); NPNR_ASSERT(wire != WireId());
switch (chip_info->wire_data[wire.index].type) switch (chip_info->wire_data[wire.index].type) {
{
case WireInfoPOD::WIRE_TYPE_NONE: case WireInfoPOD::WIRE_TYPE_NONE:
return IdString(); return IdString();
case WireInfoPOD::WIRE_TYPE_GLB2LOCAL: case WireInfoPOD::WIRE_TYPE_GLB2LOCAL:
@ -582,8 +581,7 @@ std::vector<GroupId> Arch::getGroups() const
group.type = GroupId::TYPE_LOCAL_SW; group.type = GroupId::TYPE_LOCAL_SW;
ret.push_back(group); ret.push_back(group);
if (type == TILE_LOGIC) if (type == TILE_LOGIC) {
{
group.type = GroupId::TYPE_LC0_SW; group.type = GroupId::TYPE_LC0_SW;
ret.push_back(group); ret.push_back(group);

View File

@ -230,7 +230,8 @@ static BelPin get_one_bel_pin(const Context *ctx, WireId wire)
} }
// Permute LUT init value given map (LUT input -> ext input) // Permute LUT init value given map (LUT input -> ext input)
unsigned permute_lut(unsigned orig_init, const std::unordered_map<int, int> &input_permute) { unsigned permute_lut(unsigned orig_init, const std::unordered_map<int, int> &input_permute)
{
unsigned new_init = 0; unsigned new_init = 0;
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
@ -381,11 +382,11 @@ void write_asc(const Context *ctx, std::ostream &out)
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
unused.insert(i); unused.insert(i);
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
WireId lut_wire = ctx->getBelPinWire(bel, PortPin(PIN_I0+i)); WireId lut_wire = ctx->getBelPinWire(bel, PortPin(PIN_I0 + i));
for (auto pip : ctx->getPipsUphill(lut_wire)) { for (auto pip : ctx->getPipsUphill(lut_wire)) {
if (ctx->getBoundPipNet(pip) != IdString()) { if (ctx->getBoundPipNet(pip) != IdString()) {
std::string name = ci.wire_data[ctx->getPipSrcWire(pip).index].name.get(); std::string name = ci.wire_data[ctx->getPipSrcWire(pip).index].name.get();
switch(name.back()) { switch (name.back()) {
case '0': case '0':
input_perm[i] = 0; input_perm[i] = 0;
unused.erase(0); unused.erase(0);

View File

@ -29,13 +29,11 @@ void ice40DelayFuzzerMain(Context *ctx)
{ {
std::vector<WireId> srcWires, dstWires; std::vector<WireId> srcWires, dstWires;
for (int i = 0; i < ctx->chip_info->num_wires; i++) for (int i = 0; i < ctx->chip_info->num_wires; i++) {
{
WireId wire; WireId wire;
wire.index = i; wire.index = i;
switch (ctx->chip_info->wire_data[i].type) switch (ctx->chip_info->wire_data[i].type) {
{
case WireInfoPOD::WIRE_TYPE_LUTFF_OUT: case WireInfoPOD::WIRE_TYPE_LUTFF_OUT:
srcWires.push_back(wire); srcWires.push_back(wire);
break; break;
@ -55,8 +53,7 @@ void ice40DelayFuzzerMain(Context *ctx)
int index = 0; int index = 0;
int cnt = 0; int cnt = 0;
while (cnt < NUM_FUZZ_ROUTES) while (cnt < NUM_FUZZ_ROUTES) {
{
if (index >= int(srcWires.size()) || index >= int(dstWires.size())) { if (index >= int(srcWires.size()) || index >= int(dstWires.size())) {
index = 0; index = 0;
ctx->shuffle(srcWires); ctx->shuffle(srcWires);
@ -103,7 +100,8 @@ void ice40DelayFuzzerMain(Context *ctx)
namespace { namespace {
struct model_params_t { struct model_params_t
{
int neighbourhood; int neighbourhood;
int model0_offset; int model0_offset;
@ -125,26 +123,14 @@ struct model_params_t {
static const model_params_t &get(ArchArgs args) static const model_params_t &get(ArchArgs args)
{ {
static const model_params_t model_hx8k = { static const model_params_t model_hx8k = {588, 129253, 8658, 118333, 23915, -73105, 57696,
588, 129253, 8658, -86797, 89, 3706, -316, -575, -158, -296};
118333, 23915, -73105, 57696,
-86797, 89, 3706,
-316, -575, -158, -296
};
static const model_params_t model_lp8k = { static const model_params_t model_lp8k = {867, 206236, 11043, 191910, 31074, -95972, 75739,
867, 206236, 11043, -309793, 30, 11056, -474, -856, -363, -536};
191910, 31074, -95972, 75739,
-309793, 30, 11056,
-474, -856, -363, -536
};
static const model_params_t model_up5k = { static const model_params_t model_up5k = {1761, 305798, 16705, 296830, 24430, -40369, 33038,
1761, 305798, 16705, -162662, 94, 4705, -1099, -1761, -418, -838};
296830, 24430, -40369, 33038,
-162662, 94, 4705,
-1099, -1761, -418, -838
};
if (args.type == ArchArgs::HX1K || args.type == ArchArgs::HX8K) if (args.type == ArchArgs::HX1K || args.type == ArchArgs::HX8K)
return model_hx8k; return model_hx8k;
@ -232,7 +218,7 @@ delay_t Arch::predictDelay(const NetInfo *net_info, const PortRef &sink) const
float dx3 = dx2 * dx; float dx3 = dx2 * dx;
float dy3 = dy2 * dy; float dy3 = dy2 * dy;
float norm3 = powf(dx3 + dy3, 1.0/3.0); float norm3 = powf(dx3 + dy3, 1.0 / 3.0);
// Model #1 // Model #1
float v = p.model1_offset; float v = p.model1_offset;

View File

@ -717,7 +717,8 @@ void gfxTilePip(std::vector<GraphicElement> &g, int x, int y, GfxTileWireId src,
return; return;
} }
if (TILE_WIRE_LUTFF_0_IN_0_LUT <= src && src <= TILE_WIRE_LUTFF_7_IN_3_LUT && TILE_WIRE_LUTFF_0_OUT <= dst && dst <= TILE_WIRE_LUTFF_7_OUT) { if (TILE_WIRE_LUTFF_0_IN_0_LUT <= src && src <= TILE_WIRE_LUTFF_7_IN_3_LUT && TILE_WIRE_LUTFF_0_OUT <= dst &&
dst <= TILE_WIRE_LUTFF_7_OUT) {
int lut_idx = (src - TILE_WIRE_LUTFF_0_IN_0_LUT) / 4; int lut_idx = (src - TILE_WIRE_LUTFF_0_IN_0_LUT) / 4;
int in_idx = (src - TILE_WIRE_LUTFF_0_IN_0_LUT) % 4; int in_idx = (src - TILE_WIRE_LUTFF_0_IN_0_LUT) % 4;
@ -732,7 +733,8 @@ void gfxTilePip(std::vector<GraphicElement> &g, int x, int y, GfxTileWireId src,
return; return;
} }
if (TILE_WIRE_LUTFF_0_IN_0 <= src && src <= TILE_WIRE_LUTFF_7_IN_3 && TILE_WIRE_LUTFF_0_IN_0_LUT <= dst && dst <= TILE_WIRE_LUTFF_7_IN_3_LUT) { if (TILE_WIRE_LUTFF_0_IN_0 <= src && src <= TILE_WIRE_LUTFF_7_IN_3 && TILE_WIRE_LUTFF_0_IN_0_LUT <= dst &&
dst <= TILE_WIRE_LUTFF_7_IN_3_LUT) {
int lut_idx = (src - TILE_WIRE_LUTFF_0_IN_0) / 4; int lut_idx = (src - TILE_WIRE_LUTFF_0_IN_0) / 4;
int in_idx = (src - TILE_WIRE_LUTFF_0_IN_0) % 4; int in_idx = (src - TILE_WIRE_LUTFF_0_IN_0) % 4;
int out_idx = (dst - TILE_WIRE_LUTFF_0_IN_0_LUT) % 4; int out_idx = (dst - TILE_WIRE_LUTFF_0_IN_0_LUT) % 4;