mirror of https://github.com/YosysHQ/nextpnr.git
fix: handle string DRIVE property in pack_io without crashing (#1668)
* fix: handle string DRIVE property in pack_io without crashing The XDC parser stores all set_property values as string Properties, but pack_io.cc called as_int64() on DRIVE which asserts !is_string. Rather than converting numeric values to integer Properties in the XDC parser (which risks breaking properties like LOC that downstream code reads via to_string()/as_string()), fix the consumption site in pack_io.cc to convert string values to integers when needed. * refactor: use int_or_default for DRIVE property parsing Replace manual is_string/as_int64 branching with int_or_default(), which already handles both Property types with proper error reporting.
This commit is contained in:
parent
54f160d855
commit
77c5c67ade
|
|
@ -470,11 +470,10 @@ void XC7Packer::check_valid_pad(CellInfo *ci, std::string type)
|
|||
if (!boost::starts_with(iostandard, "LVTTL") && !boost::starts_with(iostandard, "LVCMOS"))
|
||||
return;
|
||||
|
||||
auto drive_attr = ci->attrs.find(id_DRIVE);
|
||||
// no drive strength attribute: use default
|
||||
if (drive_attr == ci->attrs.end())
|
||||
if (!ci->attrs.count(id_DRIVE))
|
||||
return;
|
||||
auto drive = drive_attr->second.as_int64();
|
||||
auto drive = int_or_default(ci->attrs, id_DRIVE, 0);
|
||||
|
||||
bool is_iob33 = boost::starts_with(type, "IOB33");
|
||||
if (is_iob33) {
|
||||
|
|
@ -491,7 +490,7 @@ void XC7Packer::check_valid_pad(CellInfo *ci, std::string type)
|
|||
return;
|
||||
}
|
||||
|
||||
log_error("unsupported DRIVE strength property %s for port %s", drive_attr->second.c_str(), ci->name.c_str(ctx));
|
||||
log_error("unsupported DRIVE strength %d for port %s", drive, ci->name.c_str(ctx));
|
||||
}
|
||||
|
||||
SiteIndex XC7Packer::get_ologic_site(BelId io_bel)
|
||||
|
|
|
|||
Loading…
Reference in New Issue