--- /dev/null
+#!/usr/bin/env python
+# Copyright (C) 2018 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
+
+""" identify registers used in riscv/insns/*.h and create code
+ that can be used in spike at runtime
+
+ the design of spike assumes that once an opcode is identified,
+ the role of decoding the instruction is implicitly rolled into
+ and included inside the function that emulates that opcode.
+
+ however there may be circumstances where the behaviour of an
+ instruction has to change depending on "tags" associated with
+ the registers (security extensions, simple-v extension).
+"""
+
+import os
+
+def list_insns():
+ insns_dir = "./riscv/insns"
+ res = []
+ for fname in os.listdir(insns_dir):
+ if not fname.endswith(".h"):
+ continue
+ res.append(os.path.join(insns_dir, fname))
+ return res
+
+if __name__ == '__main__':
+ files = list_insns()
+ for f in files:
+ print f