[FPGA interchange] Small fix to get_net_type.

If get_net_type was called before the driver was placed, it could return
the wrong value.

Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
This commit is contained in:
Keith Rothman 2021-03-23 10:57:37 -07:00
parent 22fb2c1548
commit 5e96740451
2 changed files with 14 additions and 9 deletions

View File

@ -217,10 +217,15 @@ struct Arch : ArchAPI<ArchRanges>
PhysicalNetlist::PhysNetlist::NetType get_net_type(NetInfo *net) const
{
NPNR_ASSERT(net->driver.cell != nullptr);
if (net->driver.cell->bel == get_gnd_bel()) {
NPNR_ASSERT(net != nullptr);
IdString gnd_cell_name(chip_info->constants->gnd_cell_name);
IdString gnd_cell_port(chip_info->constants->gnd_cell_port);
IdString vcc_cell_name(chip_info->constants->vcc_cell_name);
IdString vcc_cell_port(chip_info->constants->vcc_cell_port);
if (net->driver.cell->type == gnd_cell_name && net->driver.port == gnd_cell_port) {
return PhysicalNetlist::PhysNetlist::NetType::GND;
} else if (net->driver.cell->bel == get_vcc_bel()) {
} else if (net->driver.cell->type == vcc_cell_name && net->driver.port == vcc_cell_port) {
return PhysicalNetlist::PhysNetlist::NetType::VCC;
} else {
return PhysicalNetlist::PhysNetlist::NetType::SIGNAL;

View File

@ -98,15 +98,15 @@ bool check_initial_wires(const Context *ctx, SiteInformation *site_info)
static bool is_invalid_site_port(const SiteArch *ctx, const SiteNetInfo *net, const SitePip &pip)
{
SyntheticType type = ctx->pip_synthetic_type(pip);
PhysicalNetlist::PhysNetlist::NetType net_type = ctx->ctx->get_net_type(net->net);
bool is_invalid = false;
if (type == SYNTH_GND) {
IdString gnd_net_name(ctx->ctx->chip_info->constants->gnd_net_name);
return net->net->name != gnd_net_name;
is_invalid = net_type != PhysicalNetlist::PhysNetlist::NetType::GND;
} else if (type == SYNTH_VCC) {
IdString vcc_net_name(ctx->ctx->chip_info->constants->vcc_net_name);
return net->net->name != vcc_net_name;
} else {
return false;
is_invalid = net_type != PhysicalNetlist::PhysNetlist::NetType::VCC;
}
return is_invalid;
}
struct SiteExpansionLoop