peepopt: handle empty src-attribute in shiftadd

This commit is contained in:
Philippe Sauter 2024-01-31 13:06:35 +01:00
parent 7f8b6dd982
commit cbdf9b2f9c
1 changed files with 8 additions and 4 deletions

View File

@ -103,15 +103,19 @@ code
new_a.append(old_a); new_a.append(old_a);
} else { } else {
// data >> (...+c) transformed to data[MAX:c] >> (...) // data >> (...+c) transformed to data[MAX:c] >> (...)
if(offset < GetSize(old_a)) // some signal bits left? if(offset < GetSize(old_a)) { // some signal bits left?
new_a.append(old_a.extract_end(offset)); new_a.append(old_a.extract_end(offset));
else { } else {
// warn user in case data is empty (no bits left)
std::string location = shift->get_src_attribute();
if (location.empty())
location = shift->name.str();
if(shift->type.in($shiftx)) if(shift->type.in($shiftx))
log_warning("at %s: result of indexed part-selection is always constant (selecting from '%s' with index '%s + %d')\n", \ log_warning("at %s: result of indexed part-selection is always constant (selecting from '%s' with index '%s + %d')\n", \
shift->get_src_attribute().c_str(), log_signal(old_a), log_signal(var_signal), offset); location.c_str(), log_signal(old_a), log_signal(var_signal), offset);
else else
log_warning("at %s: result of shift operation is always constant (shifting '%s' by '%s + %d'-bits)\n", \ log_warning("at %s: result of shift operation is always constant (shifting '%s' by '%s + %d'-bits)\n", \
shift->get_src_attribute().c_str(), log_signal(old_a), log_signal(var_signal), offset); location.c_str(), log_signal(old_a), log_signal(var_signal), offset);
} }
} }