From 5c6e23141289377dbc6ce9d799b0b92ed6234a19 Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Fri, 19 Feb 2021 09:44:14 -0800 Subject: [PATCH] Remove some signedness warnings. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- common/exclusive_state_groups.h | 4 ++-- common/exclusive_state_groups.impl.h | 15 +++++++-------- fpga_interchange/arch.cc | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/common/exclusive_state_groups.h b/common/exclusive_state_groups.h index c9b0df66..f2dcb858 100644 --- a/common/exclusive_state_groups.h +++ b/common/exclusive_state_groups.h @@ -69,7 +69,7 @@ template = 0 && (size_t)next_state < StateCount); // Increment and mark the state as selected. count[next_state] += 1; @@ -92,7 +92,7 @@ template = 0 && (size_t)next_state < StateCount); NPNR_ASSERT(selected_states[next_state]); count[next_state] -= 1; diff --git a/common/exclusive_state_groups.impl.h b/common/exclusive_state_groups.impl.h index 864e16c6..9946e9a6 100644 --- a/common/exclusive_state_groups.impl.h +++ b/common/exclusive_state_groups.impl.h @@ -40,14 +40,14 @@ void ExclusiveStateGroup::print_debug(const Co log_info("%s.%s is currently unselected\n", object.c_str(ctx), definition.prefix.c_str(ctx)); } else if (state >= 0) { log_info("%s.%s = %s, count = %d\n", object.c_str(ctx), definition.prefix.c_str(ctx), - definition.states[state].c_str(ctx), count[state]); + definition.states.at(state).c_str(ctx), count[state]); } else { NPNR_ASSERT(state == kOverConstrained); log_info("%s.%s is currently overconstrained, states selected:\n", object.c_str(ctx), definition.prefix.c_str(ctx)); for (size_t i = 0; i < definition.states.size(); ++i) { if (selected_states[i]) { - log_info(" - %s, count = %d\n", definition.states[i].c_str(ctx), count[i]); + log_info(" - %s, count = %d\n", definition.states.at(i).c_str(ctx), count[i]); } } } @@ -62,9 +62,9 @@ void ExclusiveStateGroup::explain_implies(cons log_info("Placing cell %s at bel %s does not violate %s.%s\n", cell.c_str(ctx), ctx->nameOfBel(bel), object.c_str(ctx), definition.prefix.c_str(ctx)); } else { - NPNR_ASSERT(next_state < definition.states.size()); - log_info("Placing cell %s at bel %s does violates %s.%s.\n", cell.c_str(ctx), ctx->nameOfBel(bel), - object.c_str(ctx), definition.prefix.c_str(ctx)); + log_info("Placing cell %s at bel %s does violates %s.%s, desired state = %s.\n", cell.c_str(ctx), + ctx->nameOfBel(bel), object.c_str(ctx), definition.prefix.c_str(ctx), + definition.states.at(next_state).c_str(ctx)); print_debug(ctx, object, definition); } } @@ -83,11 +83,10 @@ void ExclusiveStateGroup::explain_requires(con log_info("Placing cell %s at bel %s does violates %s.%s, because current state is %s, constraint requires one " "of:\n", cell.c_str(ctx), ctx->nameOfBel(bel), object.c_str(ctx), definition.prefix.c_str(ctx), - definition.states[state].c_str(ctx)); + definition.states.at(state).c_str(ctx)); for (const auto required_state : state_range) { - NPNR_ASSERT(required_state < definition.states.size()); - log_info(" - %s\n", definition.states[required_state].c_str(ctx)); + log_info(" - %s\n", definition.states.at(required_state).c_str(ctx)); } print_debug(ctx, object, definition); } diff --git a/fpga_interchange/arch.cc b/fpga_interchange/arch.cc index b1d5090a..4cffd6ca 100644 --- a/fpga_interchange/arch.cc +++ b/fpga_interchange/arch.cc @@ -217,7 +217,7 @@ void Arch::setup_byname() const for (int i = 0; i < chip_info->tiles.ssize(); i++) { auto &tile = chip_info->tiles[i]; auto &tile_type = chip_info->tile_types[tile.type]; - for (int j = 0; j < tile_type.site_types.size(); j++) { + for (size_t j = 0; j < tile_type.site_types.size(); j++) { auto &site = chip_info->sites[tile.sites[j]]; site_by_name[id(site.name.get())] = std::make_pair(i, j); }