From 2024346f4dc202da9863c1a76d06fe74e9e03055 Mon Sep 17 00:00:00 2001 From: David Shah Date: Thu, 15 Nov 2018 19:10:31 +0000 Subject: [PATCH] ecp5: Consider fanout when calculating pip delays Signed-off-by: David Shah --- ecp5/arch.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ecp5/arch.h b/ecp5/arch.h index 938ca354..52cca416 100644 --- a/ecp5/arch.h +++ b/ecp5/arch.h @@ -461,6 +461,7 @@ struct Arch : BaseCtx std::vector bel_to_cell; std::unordered_map wire_to_net; std::unordered_map pip_to_net; + std::unordered_map wire_fanout; ArchArgs args; Arch(ArchArgs args); @@ -643,6 +644,7 @@ struct Arch : BaseCtx auto pip = it->second.pip; if (pip != PipId()) { + wire_fanout[getPipSrcWire(pip)]--; pip_to_net[pip] = nullptr; } @@ -733,6 +735,7 @@ struct Arch : BaseCtx NPNR_ASSERT(pip_to_net[pip] == nullptr); pip_to_net[pip] = net; + wire_fanout[getPipSrcWire(pip)]++; WireId dst; dst.index = locInfo(pip)->pip_data[pip.index].dst_idx; @@ -747,6 +750,7 @@ struct Arch : BaseCtx { NPNR_ASSERT(pip != PipId()); NPNR_ASSERT(pip_to_net[pip] != nullptr); + wire_fanout[getPipSrcWire(pip)]--; WireId dst; dst.index = locInfo(pip)->pip_data[pip.index].dst_idx; @@ -819,8 +823,14 @@ struct Arch : BaseCtx { DelayInfo delay; NPNR_ASSERT(pip != PipId()); - delay.min_delay = speed_grade->pip_classes[locInfo(pip)->pip_data[pip.index].timing_class].min_base_delay; - delay.max_delay = speed_grade->pip_classes[locInfo(pip)->pip_data[pip.index].timing_class].max_base_delay; + int fanout = 0; + auto fnd_fanout = wire_fanout.find(getPipSrcWire(pip)); + if (fnd_fanout != wire_fanout.end()) + fanout = fnd_fanout->second; + delay.min_delay = speed_grade->pip_classes[locInfo(pip)->pip_data[pip.index].timing_class].min_base_delay + + fanout * speed_grade->pip_classes[locInfo(pip)->pip_data[pip.index].timing_class].min_fanout_adder; + delay.max_delay = speed_grade->pip_classes[locInfo(pip)->pip_data[pip.index].timing_class].max_base_delay + + fanout * speed_grade->pip_classes[locInfo(pip)->pip_data[pip.index].timing_class].max_fanout_adder; return delay; }