Compare commits

...

4 Commits

Author SHA1 Message Date
Kelvin Chung e1ad011ede
Merge de38bd34fb into 35629d0a43 2025-10-28 07:45:05 +00:00
tgingold 35629d0a43
gatemate: handle default parameters for IO (#1595)
* gatemate: handle default parameters for IO

This is probably a VHDL specific issue.  In VHDL, there is no
black-box. Primitive instantiations are done using VHDL component
instantiations and the component must have been declared with all its
ports and parameters (generic).  Currently the components are
translated from cells_sim.v and cells_bb.v

If a user doesn't override a parameter, the default value is used
instead.  As a consequence, nextpnr can have 'UNDEFINED' for DRIVER
or SLEW parameters of CC_IOBUF.  I think this is a main difference
with verilog, where unspecified parameters do not appear.

With this change, the UNPLACED value of PIN_NAME and UNDEFINED value
of DRIVE are simply ignored.

* gatemate/pack_io.cc: also handle UNDEFINED for id_SLEW
2025-10-28 08:16:02 +01:00
Kelvin Chung de38bd34fb Change the iter count based timeout 2025-05-23 12:19:40 +01:00
Kelvin Chung 496df84b3b timeout for router1 2025-05-23 10:31:36 +01:00
3 changed files with 26 additions and 7 deletions

View File

@ -397,6 +397,8 @@ po::options_description CommandHandler::getGeneralOptions()
general.add_options()("parallel-refine", "use new experimental parallelised engine for placement refinement");
#endif
general.add_options()("router1-timeout", po::value<int>(), "Timeout for router1 in iteration count (default: 0, no timeout)");
general.add_options()("router2-heatmap", po::value<std::string>(),
"prefix for router2 resource congestion heatmaps");
@ -539,6 +541,10 @@ void CommandHandler::setupContext(Context *ctx)
if (vm.count("parallel-refine"))
ctx->settings[ctx->id("placerHeap/parallelRefine")] = true;
if (vm.count("router1-timeout")) {
ctx->settings[ctx->id("router1/maxIterCnt")] = std::to_string(std::max(0, vm["router1-timeout"].as<int>()));
}
if (vm.count("router2-heatmap"))
ctx->settings[ctx->id("router2/heatmap")] = vm["router2-heatmap"].as<std::string>();
if (vm.count("tmg-ripup") || vm.count("router2-tmg-ripup"))

View File

@ -1146,7 +1146,7 @@ NEXTPNR_NAMESPACE_BEGIN
Router1Cfg::Router1Cfg(Context *ctx)
{
maxIterCnt = ctx->setting<int>("router1/maxIterCnt", 200);
maxIterCnt = ctx->setting<int>("router1/maxIterCnt", 0);
cleanupReroute = ctx->setting<bool>("router1/cleanupReroute", true);
fullCleanupReroute = ctx->setting<bool>("router1/fullCleanupReroute", true);
useEstimate = ctx->setting<bool>("router1/useEstimate", true);
@ -1199,11 +1199,17 @@ bool router1(Context *ctx, const Router1Cfg &cfg)
last_arcs_with_ripup = router.arcs_with_ripup;
last_arcs_without_ripup = router.arcs_without_ripup;
ctx->yield();
#ifndef NDEBUG
router.check();
#endif
}
if (cfg.maxIterCnt){
if (iter_cnt > cfg.maxIterCnt) {
log_error("Max iteration count reached, stopping routing.\n");
}
}
if (ctx->debug)
log("-- %d --\n", iter_cnt);

View File

@ -177,8 +177,9 @@ void GateMatePacker::pack_io()
for (auto &p : ci.params) {
if (p.first.in(id_PIN_NAME, id_PIN_NAME_P, id_PIN_NAME_N)) {
if (ctx->get_package_pin_bel(ctx->id(p.second.as_string())) == BelId())
log_error("Unknown %s '%s' for cell '%s'.\n", p.first.c_str(ctx), p.second.as_string().c_str(),
std::string pname = p.second.as_string();
if (pname != "UNPLACED" && ctx->get_package_pin_bel(ctx->id(pname)) == BelId())
log_error("Unknown %s '%s' for cell '%s'.\n", p.first.c_str(ctx), pname.c_str(),
ci.name.c_str(ctx));
keys.push_back(p.first);
continue;
@ -194,9 +195,15 @@ void GateMatePacker::pack_io()
continue;
if (ci.type.in(id_CC_TOBUF) && p.first.in(id_PULLUP, id_PULLDOWN, id_KEEPER))
continue;
if (ci.type.in(id_CC_OBUF, id_CC_TOBUF, id_CC_IOBUF) &&
p.first.in(id_DRIVE, id_SLEW, id_DELAY_OBF, id_FF_OBF))
continue;
if (ci.type.in(id_CC_OBUF, id_CC_TOBUF, id_CC_IOBUF)) {
if (p.first.in(id_DRIVE, id_SLEW)) {
if (p.second.is_string && p.second.as_string() == "UNDEFINED")
keys.push_back(p.first);
continue;
}
if (p.first.in(id_DELAY_OBF, id_FF_OBF))
continue;
}
if (ci.type.in(id_CC_LVDS_IBUF, id_CC_LVDS_IOBUF) && p.first.in(id_LVDS_RTERM, id_DELAY_IBF, id_FF_IBF))
continue;
if (ci.type.in(id_CC_LVDS_OBUF, id_CC_LVDS_TOBUF, id_CC_LVDS_IOBUF) &&