From 0b04753a1a57769a1d22b31883113b11815095f9 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 24 Sep 2018 02:53:14 +0100 Subject: [PATCH] identify instructions, plan: extract registers --- id_regs.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 id_regs.py diff --git a/id_regs.py b/id_regs.py new file mode 100644 index 0000000..c6c34ff --- /dev/null +++ b/id_regs.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# Copyright (C) 2018 Luke Kenneth Casson Leighton + +""" 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 -- 2.30.2