diff options
author | David Shah <dave@ds0.me> | 2020-11-09 14:53:11 +0000 |
---|---|---|
committer | David Shah <dave@ds0.me> | 2020-11-30 08:45:28 +0000 |
commit | 963fd175ad69c5468bfc486e789cf6c7ff85f57e (patch) | |
tree | 937d54d46b2096b2ca6510ff391aa58ec214f3c3 /nexus | |
parent | 4e5ad7feac5b41876e3b09162cea8815fe0821bf (diff) | |
download | nextpnr-963fd175ad69c5468bfc486e789cf6c7ff85f57e.tar.gz nextpnr-963fd175ad69c5468bfc486e789cf6c7ff85f57e.tar.bz2 nextpnr-963fd175ad69c5468bfc486e789cf6c7ff85f57e.zip |
nexus: Lookup speed grade and pip delays
Signed-off-by: David Shah <dave@ds0.me>
Diffstat (limited to 'nexus')
-rw-r--r-- | nexus/arch.cc | 21 | ||||
-rw-r--r-- | nexus/arch.h | 11 |
2 files changed, 31 insertions, 1 deletions
diff --git a/nexus/arch.cc b/nexus/arch.cc index 7b4e2041..aff00d5d 100644 --- a/nexus/arch.cc +++ b/nexus/arch.cc @@ -137,6 +137,27 @@ Arch::Arch(ArchArgs args) : args(args) } log_error("Unknown package '%s'. Available package options:%s\n", package.c_str(), all_packages.c_str()); } + + // Validate and set up speed grade + + // Convert speed to speed grade (TODO: low power back bias mode too) + if (speed == "7") + speed = "10"; + else if (speed == "8") + speed = "11"; + else if (speed == "9") + speed = "12"; + + speed_grade = nullptr; + for (size_t i = 0; i < db->num_speed_grades; i++) { + auto &sg = db->speed_grades[i]; + if (sg.name.get() == speed) { + speed_grade = &sg; + break; + } + } + if (!speed_grade) + log_error("Unknown speed grade '%s'.\n", speed.c_str()); } // ----------------------------------------------------------------------- diff --git a/nexus/arch.h b/nexus/arch.h index 88660ca1..93272af8 100644 --- a/nexus/arch.h +++ b/nexus/arch.h @@ -307,6 +307,7 @@ NPNR_PACKED_STRUCT(struct CellTimingPOD { NPNR_PACKED_STRUCT(struct PipTimingPOD { int32_t min_delay; int32_t max_delay; + // fanout adder seemingly unused by nexus, reserved for future ECP5 etc support int32_t min_fanout_adder; int32_t max_fanout_adder; }); @@ -910,6 +911,7 @@ struct Arch : BaseCtx boost::iostreams::mapped_file_source blob_file; const DatabasePOD *db; const ChipInfoPOD *chip_info; + const SpeedGradePOD *speed_grade; int package_idx; @@ -1275,7 +1277,14 @@ struct Arch : BaseCtx WireId getPipDstWire(PipId pip) const { return canonical_wire(pip.tile, pip_data(pip).to_wire); } - DelayInfo getPipDelay(PipId pip) const { return getDelayFromNS(0.1 + (pip.index % 30) / 1000.0); } + DelayInfo getPipDelay(PipId pip) const + { + DelayInfo delay; + auto &cls = speed_grade->pip_classes[pip_data(pip).timing_class]; + delay.min_delay = std::max(0, cls.min_delay); + delay.max_delay = std::max(0, cls.max_delay); + return delay; + } UpDownhillPipRange getPipsDownhill(WireId wire) const { |