aboutsummaryrefslogtreecommitdiffstats
path: root/fpga_interchange/arch.cc
diff options
context:
space:
mode:
Diffstat (limited to 'fpga_interchange/arch.cc')
-rw-r--r--fpga_interchange/arch.cc12
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);