aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/exclusive_state_groups.h4
-rw-r--r--common/exclusive_state_groups.impl.h15
2 files changed, 9 insertions, 10 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 <size_t StateCount, typename StateType = int8_t, typename CountType = u
bool add_implies(int32_t next_state)
{
- NPNR_ASSERT(next_state < StateCount);
+ NPNR_ASSERT(next_state >= 0 && (size_t)next_state < StateCount);
// Increment and mark the state as selected.
count[next_state] += 1;
@@ -92,7 +92,7 @@ template <size_t StateCount, typename StateType = int8_t, typename CountType = u
void remove_implies(int32_t next_state)
{
- NPNR_ASSERT(next_state < StateCount);
+ NPNR_ASSERT(next_state >= 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<StateCount, StateType, CountType>::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<StateCount, StateType, CountType>::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<StateCount, StateType, CountType>::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);
}