mirror of https://github.com/YosysHQ/yosys.git
splitcells was the issue?
This commit is contained in:
parent
550d48c417
commit
21a2a1b4f8
|
|
@ -188,8 +188,8 @@ struct SplitcellsWorker
|
||||||
std::string base_name = cell->name.str();
|
std::string base_name = cell->name.str();
|
||||||
IdString slice_name;
|
IdString slice_name;
|
||||||
if (blast) {
|
if (blast) {
|
||||||
// Strip existing brackets from cell name
|
// Strip existing '[' or '.' from cell name
|
||||||
size_t bracket_pos = base_name.find('[');
|
size_t bracket_pos = base_name.find_first_of('[.');
|
||||||
if (bracket_pos != std::string::npos) {
|
if (bracket_pos != std::string::npos) {
|
||||||
base_name = base_name.substr(0, bracket_pos);
|
base_name = base_name.substr(0, bracket_pos);
|
||||||
}
|
}
|
||||||
|
|
@ -205,12 +205,12 @@ struct SplitcellsWorker
|
||||||
// Extract bit offset from the wire (ex: 0)
|
// Extract bit offset from the wire (ex: 0)
|
||||||
int bit_offset = user_index(slice_lsb);
|
int bit_offset = user_index(slice_lsb);
|
||||||
|
|
||||||
// Concatenate wire index (ex: \Memory[0] -> [0]) to the bit offset (ex: [0][bit])
|
// Concatenate struct attribute or wire index (ex: \Memory[0] -> [0]) to the bit offset
|
||||||
size_t bracket_pos = wire_name.find('[');
|
size_t bracket_pos = wire_name.find_first_of('[.');
|
||||||
if (bracket_pos != std::string::npos) {
|
if (bracket_pos != std::string::npos) {
|
||||||
wire_indices = wire_name.substr(bracket_pos) + stringf(
|
wire_indices = wire_name.substr(bracket_pos) + stringf(
|
||||||
"%c%d%c", format[0], bit_offset, format[1]);
|
"%c%d%c", format[0], bit_offset, format[1]);
|
||||||
} else { // no brackets, so no concatenation using wire, use slice_lsb + name_lsb offset instead
|
} else { // no '[' or '.', so no concatenation using wire, use slice_lsb + name_lsb offset instead
|
||||||
wire_indices = stringf(
|
wire_indices = stringf(
|
||||||
"%c%d%c", format[0], slice_lsb + wire_offset, format[1]);
|
"%c%d%c", format[0], slice_lsb + wire_offset, format[1]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,16 +108,10 @@ struct RegRenameInstance {
|
||||||
size_t last_open = cellName.rfind('[');
|
size_t last_open = cellName.rfind('[');
|
||||||
size_t last_close = cellName.rfind(']');
|
size_t last_close = cellName.rfind(']');
|
||||||
if (last_open != std::string::npos && last_close != std::string::npos && last_close > last_open) {
|
if (last_open != std::string::npos && last_close != std::string::npos && last_close > last_open) {
|
||||||
|
// Check that bracket content is just a single bit index
|
||||||
// Check that bracket content is just a single bit index
|
std::string inner = cellName.substr(last_open + 1, last_close - last_open - 1);
|
||||||
std::string inner = cellName.substr(last_open + 1, last_close - last_open - 1);
|
wireName = cellName.substr(0, last_open);
|
||||||
if (!inner.empty() && inner.find_first_not_of("0123456789") == std::string::npos) {
|
bitIndex = std::stoi(inner);
|
||||||
wireName = cellName.substr(0, last_open);
|
|
||||||
bitIndex = std::stoi(inner);
|
|
||||||
} else {
|
|
||||||
wireName = cellName;
|
|
||||||
bitIndex = 0;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
wireName = cellName;
|
wireName = cellName;
|
||||||
bitIndex = 0;
|
bitIndex = 0;
|
||||||
|
|
@ -312,13 +306,9 @@ struct RegRenamePass : public Pass {
|
||||||
if (!signal_name.empty() && signal_name.back() == ']') {
|
if (!signal_name.empty() && signal_name.back() == ']') {
|
||||||
size_t open = signal_name.rfind('[');
|
size_t open = signal_name.rfind('[');
|
||||||
if (open != std::string::npos) {
|
if (open != std::string::npos) {
|
||||||
std::string inner = signal_name.substr(open + 1,
|
std::string inner = signal_name.substr(open + 1, signal_name.size() - open - 2);
|
||||||
signal_name.size() - open - 2);
|
signal_bits = signal_name.substr(open);
|
||||||
// Check for alphabetical characters since they can be contained in brackets in a wire name.
|
signal_name.erase(open);
|
||||||
if (!inner.empty() && inner.find_first_not_of("0123456789:") == std::string::npos) {
|
|
||||||
signal_bits = signal_name.substr(open);
|
|
||||||
signal_name.erase(open);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue