mirror of https://github.com/YosysHQ/yosys.git
ModuleHdlnameIndex: handle objects with private name and hdlname attribute
This commit is contained in:
parent
eac2294cab
commit
17d45796a6
|
@ -337,12 +337,12 @@ template<typename O>
|
||||||
std::vector<IdString> parse_hdlname(const O* object)
|
std::vector<IdString> parse_hdlname(const O* object)
|
||||||
{
|
{
|
||||||
std::vector<IdString> path;
|
std::vector<IdString> path;
|
||||||
if (!object->name.isPublic())
|
|
||||||
return path;
|
|
||||||
for (auto const &item : object->get_hdlname_attribute())
|
for (auto const &item : object->get_hdlname_attribute())
|
||||||
path.push_back("\\" + item);
|
path.push_back("\\" + item);
|
||||||
if (path.empty())
|
if (path.empty() && object->name.isPublic())
|
||||||
path.push_back(object->name);
|
path.push_back(object->name);
|
||||||
|
if (!path.empty() && !(object->name.isPublic() || object->name.begins_with("$paramod") || object->name.begins_with("$abstract")))
|
||||||
|
path.pop_back();
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,17 +351,22 @@ std::pair<std::vector<IdString>, IdString> parse_scopename(const O* object)
|
||||||
{
|
{
|
||||||
std::vector<IdString> path;
|
std::vector<IdString> path;
|
||||||
IdString trailing = object->name;
|
IdString trailing = object->name;
|
||||||
if (object->name.isPublic()) {
|
if (object->name.isPublic() || object->name.begins_with("$paramod") || object->name.begins_with("$abstract")) {
|
||||||
for (auto const &item : object->get_hdlname_attribute())
|
for (auto const &item : object->get_hdlname_attribute())
|
||||||
path.push_back("\\" + item);
|
path.push_back("\\" + item);
|
||||||
if (!path.empty()) {
|
if (!path.empty()) {
|
||||||
trailing = path.back();
|
trailing = path.back();
|
||||||
path.pop_back();
|
path.pop_back();
|
||||||
}
|
}
|
||||||
|
} else if (object->has_attribute(ID::hdlname)) {
|
||||||
|
for (auto const &item : object->get_hdlname_attribute())
|
||||||
|
path.push_back("\\" + item);
|
||||||
|
if (!path.empty()) {
|
||||||
|
path.pop_back();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
for (auto const &item : split_tokens(object->get_string_attribute(ID(scopename)), " "))
|
for (auto const &item : split_tokens(object->get_string_attribute(ID(scopename)), " "))
|
||||||
path.push_back("\\" + item);
|
path.push_back("\\" + item);
|
||||||
|
|
||||||
}
|
}
|
||||||
return {path, trailing};
|
return {path, trailing};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue