diff options
| author | Maciej Kurc <mkurc@antmicro.com> | 2022-05-12 11:55:16 +0200 | 
|---|---|---|
| committer | Maciej Kurc <mkurc@antmicro.com> | 2022-05-12 11:55:16 +0200 | 
| commit | d75c45c63f444af0349463346101c9d7d7ae6283 (patch) | |
| tree | 4dc7868ffbb4d86e45fb5874e17b88d747e72bfc /fpga_interchange | |
| parent | 7c7a4f095921f4f6dbec27a73862e5d26ffb230e (diff) | |
| download | nextpnr-d75c45c63f444af0349463346101c9d7d7ae6283.tar.gz nextpnr-d75c45c63f444af0349463346101c9d7d7ae6283.tar.bz2 nextpnr-d75c45c63f444af0349463346101c9d7d7ae6283.zip | |
Added fallback to VCC as the preferred constant if the architecture does not specify one.
Signed-off-by: Maciej Kurc <mkurc@antmicro.com>
Diffstat (limited to 'fpga_interchange')
| -rw-r--r-- | fpga_interchange/arch.cc | 13 | ||||
| -rw-r--r-- | fpga_interchange/luts.cc | 6 | ||||
| -rw-r--r-- | fpga_interchange/site_arch.cc | 7 | 
3 files changed, 20 insertions, 6 deletions
| diff --git a/fpga_interchange/arch.cc b/fpga_interchange/arch.cc index 05b50ae2..6a7c4fe1 100644 --- a/fpga_interchange/arch.cc +++ b/fpga_interchange/arch.cc @@ -301,6 +301,12 @@ void Arch::init()      for (size_t tile_type = 0; tile_type < chip_info->tile_types.size(); ++tile_type) {          pseudo_pip_data.init_tile_type(getCtx(), tile_type);      } + +    // Warn if there is no preferred constant net defined in the architecture +    IdString const_net_name(getCtx()->chip_info->constants->best_constant_net); +    if (const_net_name == IdString()) { +        log_warning("The architecture does not specify preferred constant net. Using VCC as default.\n"); +    }  }  // ----------------------------------------------------------------------- @@ -877,7 +883,12 @@ static void prepare_sites_for_routing(Context *ctx)      IdString gnd_net_name(ctx->chip_info->constants->gnd_net_name);      IdString const_net_name(ctx->chip_info->constants->best_constant_net); -    NPNR_ASSERT(const_net_name == vcc_net_name || const_net_name == gnd_net_name); +    NPNR_ASSERT(const_net_name == IdString() || const_net_name == vcc_net_name || const_net_name == gnd_net_name); + +    // FIXME: Use VCC if the architecture does not device the best constant +    if (const_net_name == IdString()) { +        const_net_name = vcc_net_name; +    }      for (BelId bel : ctx->getBels()) {          CellInfo *cell = ctx->getBoundBelCell(bel); diff --git a/fpga_interchange/luts.cc b/fpga_interchange/luts.cc index 03c01803..2a847253 100644 --- a/fpga_interchange/luts.cc +++ b/fpga_interchange/luts.cc @@ -429,8 +429,7 @@ bool LutMapper::remap_luts(const Context *ctx, SiteLutMappingResult *lut_mapping                  if ((used_pins & (1 << bel_pin_idx)) == 0) {                      NPNR_ASSERT(bel_to_cell_pin_remaps[cell_idx][bel_pin_idx] == -1);                      cell.lutCell.pin_connections.emplace(lutBel.pins.at(bel_pin_idx), LutCell::PinConnection::Const); -                } -                else { +                } else {                      cell.lutCell.pin_connections.emplace(lutBel.pins.at(bel_pin_idx), LutCell::PinConnection::Signal);                  }              } @@ -442,8 +441,7 @@ bool LutMapper::remap_luts(const Context *ctx, SiteLutMappingResult *lut_mapping                      NPNR_ASSERT(bel_to_cell_pin_remaps[cell_idx][bel_pin_idx] == -1);                      auto pin = lutBel.pins.at(bel_pin_idx);                      cell.lutCell.pin_connections.emplace(pin, LutCell::PinConnection::Const); -                } -                else { +                } else {                      cell.lutCell.pin_connections.emplace(lutBel.pins.at(bel_pin_idx), LutCell::PinConnection::Signal);                  }              } diff --git a/fpga_interchange/site_arch.cc b/fpga_interchange/site_arch.cc index bb9c9a11..d0a5c48c 100644 --- a/fpga_interchange/site_arch.cc +++ b/fpga_interchange/site_arch.cc @@ -140,7 +140,12 @@ SiteArch::SiteArch(const SiteInformation *site_info)      IdString gnd_net_name(ctx->chip_info->constants->gnd_net_name);      IdString const_net_name(ctx->chip_info->constants->best_constant_net); -    NPNR_ASSERT(const_net_name == vcc_net_name || const_net_name == gnd_net_name); +    NPNR_ASSERT(const_net_name == IdString() || const_net_name == vcc_net_name || const_net_name == gnd_net_name); + +    // FIXME: Use VCC if the architecture does not device the best constant +    if (const_net_name == IdString()) { +        const_net_name = vcc_net_name; +    }      for (CellInfo *cell : site_info->cells_in_site) {          for (const auto &pin_pair : cell->cell_bel_pins) { | 
