diff --git a/himbaechel/uarch/gatemate/bitstream.cc b/himbaechel/uarch/gatemate/bitstream.cc index 03abfb93..73574554 100644 --- a/himbaechel/uarch/gatemate/bitstream.cc +++ b/himbaechel/uarch/gatemate/bitstream.cc @@ -19,9 +19,9 @@ #include +#include #include "config.h" #include "gatemate.h" -#include #define HIMBAECHEL_CONSTIDS "uarch/gatemate/constids.inc" #include "himbaechel_constids.h" @@ -122,14 +122,12 @@ struct BitstreamBackend cc.tiles[loc].add_word(stringf("GPIO.%s", p.first.c_str(ctx)), p.second.as_bits()); } break; - case id_CPE.index: - { - int x = getInTileIndex(ctx,cell.second.get()->bel.tile); - for (auto &p : params) { - cc.tiles[loc].add_word(stringf("CPE%d.%s", x, p.first.c_str(ctx)), p.second.as_bits()); - } + case id_CPE.index: { + int x = getInTileIndex(ctx, cell.second.get()->bel.tile); + for (auto &p : params) { + cc.tiles[loc].add_word(stringf("CPE%d.%s", x, p.first.c_str(ctx)), p.second.as_bits()); } - break; + } break; default: break; } @@ -149,9 +147,9 @@ struct BitstreamBackend IdString name = IdString(extra_data.name); CfgLoc loc = getConfigLoc(ctx, pip.tile); std::string word = name.c_str(ctx); - int x = getInTileIndex(ctx,pip.tile); + int x = getInTileIndex(ctx, pip.tile); if (boost::starts_with(word, "IM.")) - boost::replace_all(word, "IM.", stringf("IM%d.",x)); + boost::replace_all(word, "IM.", stringf("IM%d.", x)); if (boost::starts_with(word, "IOES.")) boost::replace_all(word, "IOES.", "IOES1."); cc.tiles[loc].add_word(word, int_to_bitvector(extra_data.value, extra_data.bits)); diff --git a/himbaechel/uarch/gatemate/gatemate.cc b/himbaechel/uarch/gatemate/gatemate.cc index 930d7495..e394d897 100644 --- a/himbaechel/uarch/gatemate/gatemate.cc +++ b/himbaechel/uarch/gatemate/gatemate.cc @@ -64,19 +64,21 @@ void GateMateImpl::postRoute() continue; if (extra_data.type == PipExtra::PIP_EXTRA_CPE) { IdStringList id = ctx->getPipName(w.second.pip); - BelId bel = ctx->getBelByName(IdStringList::concat(id[0], ctx->id("CPE"))); - IdString type = ctx->getBelType(bel); + BelId bel = ctx->getBelByName(IdStringList::concat(id[0], id_CPE)); if (!ctx->getBoundBelCell(bel)) { - CellInfo *cell = ctx->createCell(ctx->id(ctx->nameOfBel(bel)), type); + CellInfo *cell = ctx->createCell(ctx->id(ctx->nameOfBel(bel)), id_CPE); ctx->bindBel(bel, cell, PlaceStrength::STRENGTH_FIXED); - cell->params[id_INIT_L00] = Property(5,4); //"0101"); - cell->params[id_INIT_L01] = Property(15,4); //Property("1111"); - cell->params[id_INIT_L02] = Property(15,4); //Property("1111"); - cell->params[id_INIT_L03] = Property(15,4); //Property("1111"); - cell->params[id_INIT_L10] = Property(8,4); //Property("1000"); - cell->params[id_INIT_L20] = Property(12,4); //Property("1100"); - cell->params[ctx->id("O2")] = Property(3,2); - cell->params[id_RAM_O2] = Property(1,1); + } + CellInfo *cell = ctx->getBoundBelCell(bel); + if (IdString(extra_data.name) == id_RAM_O2) { + cell->params[id_INIT_L00] = Property(5, 4); //"0101"); + cell->params[id_INIT_L01] = Property(15, 4); // Property("1111"); + cell->params[id_INIT_L02] = Property(15, 4); // Property("1111"); + cell->params[id_INIT_L03] = Property(15, 4); // Property("1111"); + cell->params[id_INIT_L10] = Property(8, 4); // Property("1000"); + cell->params[id_INIT_L20] = Property(12, 4); // Property("1100"); + cell->params[ctx->id("O2")] = Property(3, 2); + cell->params[id_RAM_O2] = Property(1, 1); } } }