diff options
author | Keith Rothman <537074+litghost@users.noreply.github.com> | 2021-02-16 14:51:25 -0800 |
---|---|---|
committer | Keith Rothman <537074+litghost@users.noreply.github.com> | 2021-02-17 12:03:16 -0800 |
commit | 7c1544f4d8e5dc75d6d6a8cf973888f5c94bd1b9 (patch) | |
tree | 842b999ee2af18571b97ce22bffa537b8856a25c /fpga_interchange/arch.cc | |
parent | 6f1c835221d18199962273def4386e0385820c67 (diff) | |
download | nextpnr-7c1544f4d8e5dc75d6d6a8cf973888f5c94bd1b9.tar.gz nextpnr-7c1544f4d8e5dc75d6d6a8cf973888f5c94bd1b9.tar.bz2 nextpnr-7c1544f4d8e5dc75d6d6a8cf973888f5c94bd1b9.zip |
Continue fixes.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
Diffstat (limited to 'fpga_interchange/arch.cc')
-rw-r--r-- | fpga_interchange/arch.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fpga_interchange/arch.cc b/fpga_interchange/arch.cc index 58fa3c85..fb4b1b3d 100644 --- a/fpga_interchange/arch.cc +++ b/fpga_interchange/arch.cc @@ -828,6 +828,18 @@ bool Arch::is_net_within_site(const NetInfo &net) const return true; } +size_t Arch::get_cell_type_index(IdString cell_type) const +{ + const CellMapPOD &cell_map = *chip_info->cell_map; + int cell_offset = cell_type.index - cell_map.cell_names[0]; + if((cell_offset < 0 || cell_offset >= cell_map.cell_names.ssize())) { + log_error("Cell %s is not a placable element.\n", cell_type.c_str(this)); + } + NPNR_ASSERT(cell_map.cell_names[cell_offset] == cell_type.index); + + return cell_offset; +} + // Instance constraint templates. template void Arch::ArchConstraints::bindBel(Arch::ArchConstraints::TagState *, const Arch::ConstraintRange); template void Arch::ArchConstraints::unbindBel(Arch::ArchConstraints::TagState *, const Arch::ConstraintRange); |