10 definitions in 8 files, 10 with an encoding diagram. src/isa/rv64
| File | Definitions | Other | What |
|---|---|---|---|
| package.lisp | 0 | 0 | the ISA.RV64 package: RISC-V RV64 (a skeleton: docs/isa.md); exports its state contract. |
| state.lisp | 0 | 12 | RV64's architected state and the accessors every semantics body uses. |
| defrv.lisp | 0 | 2 | RISC-V encodings (generated, gen/opcodes.lisp) and DEFRV, an instruction's semantics on its encoding. |
| gen/opcodes.lisp | 0 | 0 | the encodings table, shown with each instruction |
| rv64i.lisp | 10 | 0 | RV64I semantics (a few instructions so far: the skeleton of docs/isa.md). |
| exec.lisp | 0 | 6 | RV64 as a guest: the executor, decoder, step and run loop. |
| enc.lisp | 0 | 2 | RV64 as a host: run-time encoders made from the DEFRV encodings, and the emitter. |
| asm.lisp | 0 | 0 | a compile-time RV64 assembler built from the DEFRV records. |
Package ISA.RV64. This is the worked example of docs/isa.md,
"Adding an ISA". It is small and real. It is not a complete RISC-V.
tools/rvgen
into gen/opcodes.lisp, which is committed.addi add sub and or xor sll ld sd bne.
Every other encoding decodes as illegal.src/isel/rv64.lisp. The identity
pair src/isel/rv64rv64.lisp covers each guest instruction with host
tiles and checks each covering on random inputs.cost/), a recompiler
layer (src/rec) and pairs with the PS3's guests. -DXSPE_HOST=rv64
configures, warns about each of these, and does not build the emulator
binary.| File | What |
|---|---|
package.lisp | ISA.RV64 and its exports |
state.lisp | defisa rv64 (32-bit words, little-endian), the rv64 struct (x, pc, npc, exc), (gpr n), (set-gpr n v) (writes to x0 dropped), rv-load/rv-store (little-endian over the core's big-endian memory, addresses modulo 2^32), i-imm, s-imm, b-imm, branch-to |
defrv.lisp | defrvenc (the generated table), (defrv name ...): definsn with the generated encoding |
gen/opcodes.lisp | the encodings (generated, do not edit) |
rv64i.lisp | the semantics, each quoting the manual |
exec.lisp | rv64-execute, rv64-decode, rv64-fetch, rv64-step, rv64-run |
enc.lisp | (rv64-enc/<name> field...) (fields MSB first), rv64-emit32 |
asm.lisp | rv64-assemble, rv64-load-program (compile time) |
Fields keep riscv-opcodes' names (rd rs1 rs2 imm12 imm12hi imm12lo
bimm12hi bimm12lo ...).
gen/opcodes.lisp. If its extension is
missing, add it to XSPE_RVGEN_ARGS in tools/rvgen/CMakeLists.txt and
regenerate (below).(defrv name (:asm "mnemonic" operand...) (:doc "...") body) in the
extension's file (rv64i.lisp, rv64m.lisp ...), quoting [RVUNPRIV].
Load the file in files.cmake before exec.lisp.tests/isa/rv64/sem.lisp and an LLVM word to
tests/isa/rv64/enc.lisp. If the instruction writes one register, or
memory and nothing else, isel_rv64 covers and verifies it without
further changes.CPM_SOURCE_CACHE=$HOME/.cache/cpm cmake -S . -B build -DXSPE_REGEN=ON
cmake --build build --target rv64-regen && git diff src/isa/rv64/gen
The test rv64_regen (REGEN mode only) requires the committed file to match
a fresh run.
Made from xspe at b2fac33349db by tools/gen-xspe.py. xspe is GPL-3.0-or-later.