Start of public OpenTitan development history
Code contributors:
Alex Bradbury <asb@lowrisc.org>
Cindy Chen <chencindy@google.com>
Eunchan Kim <eunchan@google.com>
Gaurang Chitroda <gaurangg@google.com>
Mark Hayter <mark.hayter@gmail.com>
Michael Schaffner <msf@google.com>
Miguel Osorio <miguelosorio@google.com>
Nils Graf <nilsg@google.com>
Philipp Wagner <phw@lowrisc.org>
Pirmin Vogel <vogelpi@lowrisc.org>
Ram Babu Penugonda <rampenugonda@google.com>
Scott Johnson <scottdj@google.com>
Shail Kushwah <kushwahs@google.com>
Srikrishna Iyer <sriyer@google.com>
Steve Nelson <Steve.Nelson@wdc.com>
Tao Liu <taliu@google.com>
Timothy Chen <timothytim@google.com>
Tobias Wölfel <tobias.woelfel@mailbox.org>
Weicai Yang <weicai@google.com>
diff --git a/hw/ip/rv_timer/doc/reg_timer.py b/hw/ip/rv_timer/doc/reg_timer.py
new file mode 100755
index 0000000..c9ab05c
--- /dev/null
+++ b/hw/ip/rv_timer/doc/reg_timer.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python3
+# Copyright lowRISC contributors.
+# Licensed under the Apache License, Version 2.0, see LICENSE for details.
+# SPDX-License-Identifier: Apache-2.0
+r"""Mako template to hjson register description
+"""
+import sys
+import argparse
+from io import StringIO
+
+from mako.template import Template
+
+
+def main():
+ parser = argparse.ArgumentParser(prog="reg_timer")
+ parser.add_argument(
+ 'input',
+ nargs='?',
+ metavar='file',
+ type=argparse.FileType('r'),
+ default=sys.stdin,
+ help='input template file')
+ parser.add_argument('--harts', '-s', type=int, help='Number of Harts')
+ parser.add_argument(
+ '--timers',
+ '-t',
+ type=int,
+ default=1,
+ help='Number of Timers in a Hart. Maximum up to 32')
+
+ args = parser.parse_args()
+
+ if args.timers > 32:
+ raise Exception("OOB TIMERS")
+ # Determine output: if stdin then stdout if not then ??
+ out = StringIO()
+
+ reg_tpl = Template(args.input.read())
+ out.write(reg_tpl.render(harts=args.harts, timers=args.timers))
+
+ print(out.getvalue())
+
+ out.close()
+
+
+if __name__ == "__main__":
+ main()