3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-07-24 16:12:33 +00:00
This commit is contained in:
Stan Lee 2026-04-15 11:50:35 -07:00
parent 3fe2cf32dd
commit 321ab5d601
2 changed files with 122 additions and 71 deletions

View file

@ -193,8 +193,34 @@ struct SplitcellsWorker
if (bracket_pos != std::string::npos) {
base_name = base_name.substr(0, bracket_pos);
}
slice_name = module->uniquify(base_name + stringf(
"%c%d%c", format[0], name_lsb, format[1]));
// Extract dimensional indices from Q port wire name
std::string wire_indices;
if (slice_lsb < GetSize(raw_q) && raw_q[slice_lsb].is_wire()) {
// Extract wire name (ex: \Memory[0])
Wire *w = raw_q[slice_lsb].wire;
std::string wire_name = w->name.str();
// Extract bit offset from the wire (ex: 0)
int bit_offset = user_index(slice_lsb);
// Concatenate wire index (ex: \Memory[0] -> [0]) to the bit offset (ex: [0][bit])
size_t bracket_pos = wire_name.find('[');
if (bracket_pos != std::string::npos) {
wire_indices = wire_name.substr(bracket_pos) + stringf(
"%c%d%c", format[0], bit_offset, format[1]);
} else { // no brackets, so no concatenation
wire_indices = stringf(
"%c%d%c", format[0], bit_offset, format[1]);
}
} else {
// Fallback
wire_indices = stringf(
"%c%d%c", format[0], name_lsb, format[1]);
}
// Construct uniquified name by concatenating the base name with the wire indices
slice_name = module->uniquify(base_name + wire_indices);
} else {
slice_name = module->uniquify(base_name + (name_msb == name_lsb ?
stringf("%c%d%c", format[0], name_lsb, format[1]) :