Add hier_path to list of optional keys in validate.py
This adds hier_path as an optional key in validate.py, silencing a
reggen warning. Since we probably don't want to include it in
documentation, this teaches various bits of doc generation to cope
with a "None" index.
Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
diff --git a/util/reggen/gen_selfdoc.py b/util/reggen/gen_selfdoc.py
index 4248902..8d8b6fa 100644
--- a/util/reggen/gen_selfdoc.py
+++ b/util/reggen/gen_selfdoc.py
@@ -208,11 +208,20 @@
def doc_tbl_line(outfile, key, use, desc):
if use is not None:
- genout(
- outfile, key + " | " + validate.key_use[use] + " | " +
- validate.val_types[desc[0]][0] + " | " + desc[1] + "\n")
+ desc_key, desc_txt = desc
+ val_type = (validate.val_types[desc_key][0]
+ if desc_key is not None else None)
else:
- genout(outfile, key + " | " + desc + "\n")
+ assert isinstance(desc, str)
+ val_type = None
+ desc_txt = desc
+
+ if val_type is not None:
+ genout(outfile,
+ '{} | {} | {} | {}\n'
+ .format(key, validate.key_use[use], val_type, desc_txt))
+ else:
+ genout(outfile, key + " | " + desc_txt + "\n")
def document(outfile):