diff options
author | Keith Rothman <537074+litghost@users.noreply.github.com> | 2021-02-04 14:47:45 -0800 |
---|---|---|
committer | Keith Rothman <537074+litghost@users.noreply.github.com> | 2021-02-04 16:38:07 -0800 |
commit | c99fbde0eb0b1b9b725ba2fead13d3210ce961a7 (patch) | |
tree | 35a86b414b97eab928a84da677628dd8cb1832dc /ice40 | |
parent | 40d026e6fc5ab94c732682c62a6803bd3140953e (diff) | |
download | nextpnr-c99fbde0eb0b1b9b725ba2fead13d3210ce961a7.tar.gz nextpnr-c99fbde0eb0b1b9b725ba2fead13d3210ce961a7.tar.bz2 nextpnr-c99fbde0eb0b1b9b725ba2fead13d3210ce961a7.zip |
Mark IdString and IdStringList single argument constructors explicit.
Single argument constructors will silently convert to that type. This
is typically not the right thing to do. For example, the nexus and
ice40 arch_pybindings.h files were incorrectly parsing bel name strings,
etc.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
Diffstat (limited to 'ice40')
-rw-r--r-- | ice40/arch.cc | 2 | ||||
-rw-r--r-- | ice40/arch.h | 2 | ||||
-rw-r--r-- | ice40/arch_pybindings.h | 8 |
3 files changed, 6 insertions, 6 deletions
diff --git a/ice40/arch.cc b/ice40/arch.cc index 152d70a3..dd58361e 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -564,7 +564,7 @@ IdStringList Arch::getGroupName(GroupId group) const suffix = "lc7_sw"; break; default: - return IdString(); + return IdStringList(); } std::array<IdString, 3> ids{x_ids.at(group.x), y_ids.at(group.y), id(suffix)}; diff --git a/ice40/arch.h b/ice40/arch.h index 1031aefa..74e835ab 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -269,7 +269,7 @@ struct BelPinIterator { BelPin ret; ret.bel.index = ptr->bel_index; - ret.pin = ptr->port; + ret.pin = IdString(ptr->port); return ret; } }; diff --git a/ice40/arch_pybindings.h b/ice40/arch_pybindings.h index dd3161ae..401fae91 100644 --- a/ice40/arch_pybindings.h +++ b/ice40/arch_pybindings.h @@ -30,7 +30,7 @@ namespace PythonConversion { template <> struct string_converter<BelId> { - BelId from_str(Context *ctx, std::string name) { return ctx->getBelByName(ctx->id(name)); } + BelId from_str(Context *ctx, std::string name) { return ctx->getBelByName(IdStringList::parse(ctx, name)); } std::string to_str(Context *ctx, BelId id) { @@ -42,7 +42,7 @@ template <> struct string_converter<BelId> template <> struct string_converter<WireId> { - WireId from_str(Context *ctx, std::string name) { return ctx->getWireByName(ctx->id(name)); } + WireId from_str(Context *ctx, std::string name) { return ctx->getWireByName(IdStringList::parse(ctx, name)); } std::string to_str(Context *ctx, WireId id) { @@ -54,7 +54,7 @@ template <> struct string_converter<WireId> template <> struct string_converter<const WireId> { - WireId from_str(Context *ctx, std::string name) { return ctx->getWireByName(ctx->id(name)); } + WireId from_str(Context *ctx, std::string name) { return ctx->getWireByName(IdStringList::parse(ctx, name)); } std::string to_str(Context *ctx, WireId id) { @@ -66,7 +66,7 @@ template <> struct string_converter<const WireId> template <> struct string_converter<PipId> { - PipId from_str(Context *ctx, std::string name) { return ctx->getPipByName(ctx->id(name)); } + PipId from_str(Context *ctx, std::string name) { return ctx->getPipByName(IdStringList::parse(ctx, name)); } std::string to_str(Context *ctx, PipId id) { |