Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Draft] An implementation is proposed for representing pseudoinstructions in Sail. The realization is similar to instructions, with a few differences: 1. `union clause ast`: Same. 1. `mapping clause assembly`: Same. 1. `function clause execute`: This calls the execute clauses for the respective base instructions as defined for each pseudoinstruction. Note: There are two pseudoinstruction examples in this PR: LA and VNEG. LA maps to two base instructions, and VNEG maps to one. The implementation for LA compiles, but the implementation for VNEG fails: ``` Error: model/riscv_insts_end.sail:24.16-23: 24 |function clause execute C_ILLEGAL(s) = { handle_illegal(); RETIRE_FAIL } | ^-----^ | Function execute calls function marked non-executable ``` ... a message which leaves more questions than answers for me. 1. `mapping clause encdec`: This is undefined for pseudoinstructions because, for one thing, some pseudoinstructions map to more than one instruction. This is replaced by a new scattered mapping: `function clause pseudo_of`: This maps the pseudoinstruction AST to a list of strings of the mapped instructions, for example: ``` function clause pseudo_of(LA(rd, imm)) = [| "auipc" ^ spc() ^ reg_name(rd) ^ sep() ^ hex_bits_signed_20(imm[31..12]), "addi" ^ spc() ^ reg_name(rd) ^ sep() ^"x0" ^ sep() ^ hex_bits_signed_12(imm[11..0]) |] ``` This is roughly analogous to `function clause assembly`, but instead of representing the instruction syntax, it represents the syntax of the mapped instructions.
- Loading branch information