ecp5: clangformat
Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
parent
36178a5713
commit
bc022173f0
@ -1087,14 +1087,18 @@ void write_bitstream(Context *ctx, std::string base_config_file, std::string tex
|
|||||||
} else if (ci->type == id_EXTREFB) {
|
} else if (ci->type == id_EXTREFB) {
|
||||||
TileGroup tg;
|
TileGroup tg;
|
||||||
tg.tiles = get_dcu_tiles(ctx, ci->bel);
|
tg.tiles = get_dcu_tiles(ctx, ci->bel);
|
||||||
tg.config.add_word("EXTREF.REFCK_DCBIAS_EN", parse_config_str(str_or_default(ci->params, ctx->id("REFCK_DCBIAS_EN"), "0"), 1));
|
tg.config.add_word("EXTREF.REFCK_DCBIAS_EN",
|
||||||
tg.config.add_word("EXTREF.REFCK_RTERM", parse_config_str(str_or_default(ci->params, ctx->id("REFCK_RTERM"), "0"), 1));
|
parse_config_str(str_or_default(ci->params, ctx->id("REFCK_DCBIAS_EN"), "0"), 1));
|
||||||
tg.config.add_word("EXTREF.REFCK_PWDNB", parse_config_str(str_or_default(ci->params, ctx->id("REFCK_PWDNB"), "0"), 1));
|
tg.config.add_word("EXTREF.REFCK_RTERM",
|
||||||
|
parse_config_str(str_or_default(ci->params, ctx->id("REFCK_RTERM"), "0"), 1));
|
||||||
|
tg.config.add_word("EXTREF.REFCK_PWDNB",
|
||||||
|
parse_config_str(str_or_default(ci->params, ctx->id("REFCK_PWDNB"), "0"), 1));
|
||||||
cc.tilegroups.push_back(tg);
|
cc.tilegroups.push_back(tg);
|
||||||
} else if (ci->type == id_PCSCLKDIV) {
|
} else if (ci->type == id_PCSCLKDIV) {
|
||||||
Loc loc = ctx->getBelLocation(ci->bel);
|
Loc loc = ctx->getBelLocation(ci->bel);
|
||||||
std::string tname = ctx->getTileByTypeAndLocation(loc.y+1, loc.x, "BMID_0H");
|
std::string tname = ctx->getTileByTypeAndLocation(loc.y + 1, loc.x, "BMID_0H");
|
||||||
cc.tiles[tname].add_enum("PCSCLKDIV" + std::to_string(loc.z), str_or_default(ci->params, ctx->id("GSR"), "ENABLED"));
|
cc.tiles[tname].add_enum("PCSCLKDIV" + std::to_string(loc.z),
|
||||||
|
str_or_default(ci->params, ctx->id("GSR"), "ENABLED"));
|
||||||
} else {
|
} else {
|
||||||
NPNR_ASSERT_FALSE("unsupported cell type");
|
NPNR_ASSERT_FALSE("unsupported cell type");
|
||||||
}
|
}
|
||||||
|
27
ecp5/pack.cc
27
ecp5/pack.cc
@ -236,14 +236,14 @@ class Ecp5Packer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return true if an port is a top level port that provides its own IOBUF
|
// Return true if an port is a top level port that provides its own IOBUF
|
||||||
bool is_top_port(PortRef &port) {
|
bool is_top_port(PortRef &port)
|
||||||
|
{
|
||||||
if (port.cell == nullptr)
|
if (port.cell == nullptr)
|
||||||
return false;
|
return false;
|
||||||
if (port.cell->type == id_DCUA) {
|
if (port.cell->type == id_DCUA) {
|
||||||
return port.port == id_CH0_HDINP || port.port == id_CH0_HDINN || port.port == id_CH0_HDOUTP ||
|
return port.port == id_CH0_HDINP || port.port == id_CH0_HDINN || port.port == id_CH0_HDOUTP ||
|
||||||
port.port == id_CH0_HDOUTN ||
|
port.port == id_CH0_HDOUTN || port.port == id_CH1_HDINP || port.port == id_CH1_HDINN ||
|
||||||
port.port == id_CH1_HDINP || port.port == id_CH1_HDINN || port.port == id_CH1_HDOUTP ||
|
port.port == id_CH1_HDOUTP || port.port == id_CH1_HDOUTN;
|
||||||
port.port == id_CH1_HDOUTN;
|
|
||||||
} else if (port.cell->type == id_EXTREFB) {
|
} else if (port.cell->type == id_EXTREFB) {
|
||||||
return port.port == id_REFCLKP || port.port == id_REFCLKN;
|
return port.port == id_REFCLKP || port.port == id_REFCLKN;
|
||||||
} else {
|
} else {
|
||||||
@ -252,20 +252,23 @@ class Ecp5Packer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return true if a net only drives a top port
|
// Return true if a net only drives a top port
|
||||||
bool drives_top_port(NetInfo *net, PortRef &tp) {
|
bool drives_top_port(NetInfo *net, PortRef &tp)
|
||||||
|
{
|
||||||
if (net == nullptr)
|
if (net == nullptr)
|
||||||
return false;
|
return false;
|
||||||
for (auto user : net->users) {
|
for (auto user : net->users) {
|
||||||
if (is_top_port(user)) {
|
if (is_top_port(user)) {
|
||||||
if (net->users.size() > 1)
|
if (net->users.size() > 1)
|
||||||
log_error(" port %s.%s must be connected to (and only to) a top level pin\n", user.cell->name.c_str(ctx), user.port.c_str(ctx));
|
log_error(" port %s.%s must be connected to (and only to) a top level pin\n",
|
||||||
|
user.cell->name.c_str(ctx), user.port.c_str(ctx));
|
||||||
tp = user;
|
tp = user;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (net->driver.cell != nullptr && is_top_port(net->driver)) {
|
if (net->driver.cell != nullptr && is_top_port(net->driver)) {
|
||||||
if (net->users.size() > 1)
|
if (net->users.size() > 1)
|
||||||
log_error(" port %s.%s must be connected to (and only to) a top level pin\n", net->driver.cell->name.c_str(ctx), net->driver.port.c_str(ctx));
|
log_error(" port %s.%s must be connected to (and only to) a top level pin\n",
|
||||||
|
net->driver.cell->name.c_str(ctx), net->driver.port.c_str(ctx));
|
||||||
tp = net->driver;
|
tp = net->driver;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -308,9 +311,8 @@ class Ecp5Packer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (drives_top_port(ionet, tp)) {
|
} else if (drives_top_port(ionet, tp)) {
|
||||||
log_info("%s feeds %s %s.%s, removing %s %s.\n", ci->name.c_str(ctx), tp.cell->type.c_str(ctx), tp.cell->name.c_str(ctx),
|
log_info("%s feeds %s %s.%s, removing %s %s.\n", ci->name.c_str(ctx), tp.cell->type.c_str(ctx),
|
||||||
tp.port.c_str(ctx),
|
tp.cell->name.c_str(ctx), tp.port.c_str(ctx), ci->type.c_str(ctx), ci->name.c_str(ctx));
|
||||||
ci->type.c_str(ctx), ci->name.c_str(ctx));
|
|
||||||
if (ionet != nullptr) {
|
if (ionet != nullptr) {
|
||||||
ctx->nets.erase(ionet->name);
|
ctx->nets.erase(ionet->name);
|
||||||
tp.cell->ports.at(tp.port).net = nullptr;
|
tp.cell->ports.at(tp.port).net = nullptr;
|
||||||
@ -349,7 +351,6 @@ class Ecp5Packer
|
|||||||
trio->attrs[ctx->id("BEL")] = ctx->getBelName(pinBel).str(ctx);
|
trio->attrs[ctx->id("BEL")] = ctx->getBelName(pinBel).str(ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
flush_cells();
|
flush_cells();
|
||||||
@ -1123,7 +1124,7 @@ class Ecp5Packer
|
|||||||
}
|
}
|
||||||
if (!dcu->attrs.count(ctx->id("BEL")))
|
if (!dcu->attrs.count(ctx->id("BEL")))
|
||||||
log_error("DCU must be constrained to a Bel!\n");
|
log_error("DCU must be constrained to a Bel!\n");
|
||||||
std::string bel = dcu->attrs.at(ctx->id("BEL"));
|
std::string bel = dcu->attrs.at(ctx->id("BEL"));
|
||||||
NPNR_ASSERT(bel.substr(bel.length() - 3) == "DCU");
|
NPNR_ASSERT(bel.substr(bel.length() - 3) == "DCU");
|
||||||
bel.replace(bel.length() - 3, 3, "EXTREF");
|
bel.replace(bel.length() - 3, 3, "EXTREF");
|
||||||
ci->attrs[ctx->id("BEL")] = bel;
|
ci->attrs[ctx->id("BEL")] = bel;
|
||||||
@ -1139,7 +1140,7 @@ class Ecp5Packer
|
|||||||
Loc loc = ctx->getBelLocation(bel);
|
Loc loc = ctx->getBelLocation(bel);
|
||||||
// DCU0 -> CLKDIV z=0; DCU1 -> CLKDIV z=1
|
// DCU0 -> CLKDIV z=0; DCU1 -> CLKDIV z=1
|
||||||
ci->constr_abs_z = true;
|
ci->constr_abs_z = true;
|
||||||
ci->constr_z = (loc.x >= 69) ? 1 : 0;
|
ci->constr_z = (loc.x >= 69) ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user