nexus: Lookup speed grade and pip delays

Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
David Shah 2020-11-09 14:53:11 +00:00
parent 4e5ad7feac
commit 963fd175ad
2 changed files with 31 additions and 1 deletions

View File

@ -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()); 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());
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

View File

@ -307,6 +307,7 @@ NPNR_PACKED_STRUCT(struct CellTimingPOD {
NPNR_PACKED_STRUCT(struct PipTimingPOD { NPNR_PACKED_STRUCT(struct PipTimingPOD {
int32_t min_delay; int32_t min_delay;
int32_t max_delay; int32_t max_delay;
// fanout adder seemingly unused by nexus, reserved for future ECP5 etc support
int32_t min_fanout_adder; int32_t min_fanout_adder;
int32_t max_fanout_adder; int32_t max_fanout_adder;
}); });
@ -910,6 +911,7 @@ struct Arch : BaseCtx
boost::iostreams::mapped_file_source blob_file; boost::iostreams::mapped_file_source blob_file;
const DatabasePOD *db; const DatabasePOD *db;
const ChipInfoPOD *chip_info; const ChipInfoPOD *chip_info;
const SpeedGradePOD *speed_grade;
int package_idx; 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); } 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 UpDownhillPipRange getPipsDownhill(WireId wire) const
{ {