aboutsummaryrefslogtreecommitdiffstats
path: root/ecp5/arch.cc
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-07-18 16:01:53 +0200
committerDavid Shah <davey1576@gmail.com>2018-07-18 16:01:53 +0200
commitc80934f953a9aa185aec0f3e9b9a23296c6e682b (patch)
tree5a7db31881695904f512caeec6b8fbf861f32e55 /ecp5/arch.cc
parent5393841c669775eab5a5e5fde9be2bab3ec67879 (diff)
downloadnextpnr-c80934f953a9aa185aec0f3e9b9a23296c6e682b.tar.gz
nextpnr-c80934f953a9aa185aec0f3e9b9a23296c6e682b.tar.bz2
nextpnr-c80934f953a9aa185aec0f3e9b9a23296c6e682b.zip
ecp5: Add support for pin name constraints using 'LOC' attributes
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ecp5/arch.cc')
-rw-r--r--ecp5/arch.cc33
1 files changed, 31 insertions, 2 deletions
diff --git a/ecp5/arch.cc b/ecp5/arch.cc
index 0ffede3b..1510a27f 100644
--- a/ecp5/arch.cc
+++ b/ecp5/arch.cc
@@ -118,6 +118,16 @@ Arch::Arch(ArchArgs args) : args(args)
log_error("Unsupported ECP5 chip type.\n");
}
#endif
+ package_info = nullptr;
+ for (int i = 0; i < chip_info->num_packages; i++) {
+ if (args.package == chip_info->package_info[i].name.get()) {
+ package_info = &(chip_info->package_info[i]);
+ break;
+ }
+ }
+
+ if (!package_info)
+ log_error("Unsupported package '%s' for '%s'.\n", args.package.c_str(), getChipName().c_str());
id_trellis_slice = id("TRELLIS_SLICE");
id_clk = id("CLK");
@@ -282,9 +292,28 @@ IdString Arch::getPipName(PipId pip) const
// -----------------------------------------------------------------------
-BelId Arch::getPackagePinBel(const std::string &pin) const { return BelId(); }
+BelId Arch::getPackagePinBel(const std::string &pin) const
+{
+ for (int i = 0; i < package_info->num_pins; i++) {
+ if (package_info->pin_data[i].name.get() == pin) {
+ BelId bel;
+ bel.location = package_info->pin_data[i].abs_loc;
+ bel.index = package_info->pin_data[i].bel_index;
+ return bel;
+ }
+ }
+ return BelId();
+}
-std::string Arch::getBelPackagePin(BelId bel) const { return ""; }
+std::string Arch::getBelPackagePin(BelId bel) const
+{
+ for (int i = 0; i < package_info->num_pins; i++) {
+ if (package_info->pin_data[i].abs_loc == bel.location && package_info->pin_data[i].bel_index == bel.index) {
+ return package_info->pin_data[i].name.get();
+ }
+ }
+ return "";
+}
// -----------------------------------------------------------------------
void Arch::estimatePosition(BelId bel, int &x, int &y, bool &gb) const