3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-21 21:33:40 +00:00

Index struct/union members within corresponding wire chunks

This guards against access to bits outside of struct/union
members via dynamic indexing.
This commit is contained in:
Dag Lem 2023-02-28 18:45:55 +01:00
parent 79043cb849
commit 0d3423ddea
5 changed files with 68 additions and 32 deletions

View file

@ -524,7 +524,13 @@ void AstNode::dumpVlog(FILE *f, std::string indent) const
break;
case AST_IDENTIFIER:
fprintf(f, "%s", id2vl(str).c_str());
{
AST::AstNode *member_node = AST::get_struct_member(this);
if (member_node)
fprintf(f, "%s[%d:%d]", id2vl(str).c_str(), member_node->range_left, member_node->range_right);
else
fprintf(f, "%s", id2vl(str).c_str());
}
for (auto child : children)
child->dumpVlog(f, "");
break;