add utility tests

This commit is contained in:
Arnav Sacheti
2025-12-24 20:12:05 +00:00
parent bc8b2c8807
commit ad364ab8d6
3 changed files with 115 additions and 5 deletions

View File

@@ -159,22 +159,21 @@ class TestGetIndexedPath:
addrmap my_addrmap {
reg {
field {} data;
} always_reg;
} always;
};
"""
top = compile_rdl(rdl_source, top="my_addrmap")
reg_node = None
for child in top.children():
if child.inst_name == "always_reg":
if child.inst_name == "always":
reg_node = child
break
assert reg_node is not None
# With keyword filter (default) - SystemRDL identifiers can use keywords but SV can't
path = get_indexed_path(top, reg_node)
# The path should contain always_reg
assert "always_reg" in path
assert path == "always_"
# Without keyword filter
path = get_indexed_path(top, reg_node, skip_kw_filter=True)
assert path == "always_reg"
assert path == "always"