From 35629d0a43221c3f33777867405619ecb3d5c9ff Mon Sep 17 00:00:00 2001 From: tgingold Date: Tue, 28 Oct 2025 08:16:02 +0100 Subject: [PATCH] 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 --- himbaechel/uarch/gatemate/pack_io.cc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/himbaechel/uarch/gatemate/pack_io.cc b/himbaechel/uarch/gatemate/pack_io.cc index 575acce5..438e9a63 100644 --- a/himbaechel/uarch/gatemate/pack_io.cc +++ b/himbaechel/uarch/gatemate/pack_io.cc @@ -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) &&