Skip to content

Commit a5ba1d2

Browse files
committed
fix bugs in handling last id in hdlname to scopename conversion
1 parent d640157 commit a5ba1d2

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

kernel/scopeinfo.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,10 @@ std::vector<IdString> parse_hdlname(const O* object)
341341
path.push_back("\\" + item);
342342
if (path.empty() && object->name.isPublic())
343343
path.push_back(object->name);
344-
if (!path.empty() && !(object->name.isPublic() || object->name.begins_with("$paramod") || object->name.begins_with("$abstract")))
344+
if (!path.empty() && !(object->name.isPublic() || object->name.begins_with("$paramod") || object->name.begins_with("$abstract"))) {
345345
path.pop_back();
346+
path.push_back(object->name);
347+
}
346348
return path;
347349
}
348350

passes/fsm/fsm_extract.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,10 @@ static void extract_fsm(RTLIL::Wire *wire)
378378
fsm_cell->parameters[ID::NAME] = RTLIL::Const(wire->name.str());
379379
fsm_cell->attributes = wire->attributes;
380380
if(fsm_cell->attributes.count(ID::hdlname)) {
381-
fsm_cell->attributes[ID(scopename)] = fsm_cell->attributes[ID::hdlname];
381+
auto hdlname = fsm_cell->get_hdlname_attribute();
382+
hdlname.pop_back();
383+
fsm_cell->set_hdlname_attribute(hdlname);
384+
fsm_cell->set_string_attribute(ID(scopename), fsm_cell->get_string_attribute(ID::hdlname));
382385
fsm_cell->attributes.erase(ID::hdlname);
383386
}
384387
fsm_data.copy_to_cell(fsm_cell);
@@ -390,7 +393,10 @@ static void extract_fsm(RTLIL::Wire *wire)
390393
wire->name = stringf("$fsm$oldstate%s", wire->name.c_str());
391394
module->wires_[wire->name] = wire;
392395
if(wire->attributes.count(ID::hdlname)) {
393-
wire->attributes[ID(scopename)] = wire->attributes[ID::hdlname];
396+
auto hdlname = wire->get_hdlname_attribute();
397+
hdlname.pop_back();
398+
wire->set_hdlname_attribute(hdlname);
399+
wire->set_string_attribute(ID(scopename), wire->get_string_attribute(ID::hdlname));
394400
wire->attributes.erase(ID::hdlname);
395401
}
396402

0 commit comments

Comments
 (0)