Open kdockser opened 4 years ago
If it helps - I extended the parse_opcodes.py
script from riscv-opcodes to generate lots of SAIL boilerplate. This is what I've used for the WIP crypto SAIL models. See riscv-crypto/bin/parse_opcodes.py for the script. I'm not proud of it, but it saved me a lot of time.
Example usage:
cat <bitmanip opcodes text file> | python3 ./bin/parse_opcodes.py -sail-boilerplate
Some disclaimers - it doesn't necessarily generate SAIL in the same way that the sail-riscv
repository structures it. It generates a single AST entry per instruction from an opcodes-*
file, rather than one AST for multiple instructions like the handwritten code does. It's easy enough to bash the generated output into this shape though. The most useful part of it is to very quickly generate the encode/decode/disassembly clauses.
The Sail model needs to be updated to include the proposed bitmanip instructions. This needs to be done in such a way so as to enable the generation of emulators (OCaml and C) as well as theorem prover definitions.