diff --git a/.claude/skills/encoding-viz/SKILL.md b/.claude/skills/encoding-viz/SKILL.md new file mode 100644 index 000000000..9d7c6f6be --- /dev/null +++ b/.claude/skills/encoding-viz/SKILL.md @@ -0,0 +1,103 @@ +--- +name: encoding-viz +description: Generate or port the RISC-V encoding-space visualizer — an HTML map showing spec coverage (decoded vs not), hardware-backed custom instructions, toolchain-only dead definitions, and spec deviations. Use when asked to visualize/audit instruction encodings, check ISA-spec alignment, find reclaimable encoding space, or set up the tool in another hardware repo. +--- + +# Encoding-space visualizer + +`util/enc_viz/gen_encoding_viz.py` (stdlib-only Python 3, read-only) renders a +self-contained `encoding_map.html` answering four questions: + +1. Which **spec** instructions does the hardware decode (blue) vs not (gray)? +2. Which **custom** instructions are hardware-backed (one hue per extension)? +3. What is **in the toolchain but not decoded** (black + dedicated section) + — i.e. reclaimable encoding space? +4. Where does the implementation **deviate from the spec** (same-name + encoding mismatches; custom instructions on spec-claimed encodings)? + +## Using it in this repo + +```sh +cd util/enc_viz && python3 gen_encoding_viz.py # -> encoding_map.html +python3 gen_encoding_viz.py --crypto # + rv_zv* on the canvas +python3 gen_encoding_viz.py --decoder new_decoder.sv # extend decoder scan +``` + +- First run clones upstream `riscv/riscv-opcodes` into `.cache/` (needs network + once); later runs are offline. Pinned via `UPSTREAM_COMMIT`. +- The enabled custom extensions are parsed **live from the top-level Makefile + `OPCODES` variable** — after enabling/disabling an extension or running + `make update_opcodes`, just re-run the script. +- If the console warns that an RTL file references instructions no scanned + decoder handles, a new decoder file exists: re-run with `--decoder FILE.sv`. +- If it warns `riscv_instr.sv is stale`, run `make update_opcodes` first. + +Read `util/enc_viz/README.md` for the full option table and map legend. + +## Core semantics (preserve these when porting) + +- **Ground truth** = a machine-readable spec opcode file (upstream + `riscv-opcodes/extensions/rv_v` here), never a hand-copied list. +- **"Implemented" = decode check only**: the instruction name (as generated in + the instruction package, e.g. `VADD_VV`) appears as a whole-word token in an + explicit allowlist of decoder RTL files (`DECODER_FILES`). Do not scan all + RTL — functional units referencing an op would create false positives. + Whole-word matching against the candidate set + requiring the file to + reference the instruction package makes unqualified matches safe. +- **"In toolchain"** = has a localparam in the generated instruction package + (`riscv_instr.sv`), which is also cross-checked against the opcode files so + stale generation is flagged instead of silently trusted. +- **Local-spec drift**: the project's local copy of the spec opcode file is + diffed against upstream. Name-absent-upstream entries become a + "not in spec" pseudo-extension (they are usually custom instructions or + legacy leftovers hiding in the spec file); same-name-different-bits entries + go to the mismatch panel. +- **Grid placement**: an instruction occupies exactly the funct7 rows its + fixed bits allow (`(f7 & mask7) == match7`) — an op using funct7 bits as + immediate/operand fills its whole column, a funct6-only op fills 2 rows. + Never model partial-funct7 ops as "column claimed"; compute row + compatibility. +- **Conflicts**: pairwise fixed-bit overlap across different origins, split + into *active* (both decoded) vs *latent* (≥1 dead). Red is reserved for + genuine bit overlaps only. + +## Porting checklist (new hardware project) + +Copy `util/enc_viz/` (script + README), then adapt the constants at the top of +the script — everything project-specific is configuration, not logic: + +1. **Spec canvas**: `UPSTREAM_URL` / `UPSTREAM_COMMIT` / `SPEC_FILES` — which + upstream extension files are the ground truth for this project (e.g. + `rv_v`, or `rv_i` + `rv_m`, …). +2. **Local opcode files**: path in `main()` (`sw/toolchain/riscv-opcodes` + here) and `RVV_LOCAL_FILE` (the local spec copy to diff). How is the + enabled set declared? Adapt `parse_makefile_opcodes` (`_OPCODES_RE`) to the + project's build variable, keep `EXT_FILES_FALLBACK` as the manual fallback. +3. **Generated instruction package**: `sv_path` (this repo: + `hw/ip/snitch/src/riscv_instr.sv`) and, if the format differs, the + `_SV_RE` regex in `parse_riscv_instr_sv`. +4. **Decoders**: `DECODER_FILES` — find them empirically: scan all RTL for + whole-word instruction-name references and list the files that decode + (case/casez on the instruction), not the FUs that consume decoded ops. The + built-in "referenced outside decoders" warning will catch any you miss. +5. **Repo detection**: `find_repo()` walks up looking for a landmark path — + change the marker directory. +6. **Grids**: `CUSTOM_MAJORS`, `FUNCT3_CAT`/`CATEGORY_ORDER` (OP-V-specific), + and `MAJOR_NAMES` if the project overloads different major opcodes. Drop + the OP-V grid entirely for non-vector projects; the funct7×funct3 custom + grids and list sections are generic. +7. **Colors**: curate `EXT_COLORS` for the known extensions; unknown ones get + `EXTRA_HUES` automatically. + +## Verifying a port (or any substantial change) + +- Cross-check the printed counts against ground truth: spec instr count must + equal the upstream file's instruction count; `toolchain localparams` must + match the generated package; `0 missing / 0 drift` on the consistency check. +- Simulate an end-to-end change in a throwaway fake repo (temp dir with a + minimal Makefile, opcode files, instruction package, and a fake decoder + referencing one of two new instructions): the map must show one live, one + dead, and — without `--decoder` — warn about the unscanned decoder file. +- Sanity-check one known instruction per category in the HTML: a decoded spec + op (blue), a decoded custom op (its hue), a known-dead definition (black), + and any known deviation (mismatch panel). diff --git a/Makefile b/Makefile index b87b946f1..c4e2363fe 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,8 @@ include util/Makefrag BENDER_VERSION = 0.29.1 # Do not include minifloat opcodes, since they conflict with the RVV opcodes! -OPCODES := "opcodes-rvv opcodes-rv32b_CUSTOM opcodes-ipu_CUSTOM opcodes-frep_CUSTOM opcodes-dma_CUSTOM opcodes-ssr_CUSTOM opcodes-smallfloat opcodes-vfx_CUSTOM" +# enable hardware-implemented custom extensions +OPCODES := "opcodes-rvv opcodes-frep_CUSTOM opcodes-dma_CUSTOM opcodes-smallfloat opcodes-vfx_CUSTOM" # Default target diff --git a/hw/ip/snitch/src/riscv_instr.sv b/hw/ip/snitch/src/riscv_instr.sv index e0c6bd867..54e61a672 100644 --- a/hw/ip/snitch/src/riscv_instr.sv +++ b/hw/ip/snitch/src/riscv_instr.sv @@ -34,88 +34,6 @@ package riscv_instr; localparam logic [31:0] DMREP = 32'b000011100000?????000000000101011; localparam logic [31:0] FREP_O = 32'b?????????????????000????10001011; localparam logic [31:0] FREP_I = 32'b?????????????????000????00001011; - localparam logic [31:0] IMV_X_W = 32'b111000000000?????000?????1011011; - localparam logic [31:0] IMV_W_X = 32'b111100000000?????000?????1011011; - localparam logic [31:0] IADDI = 32'b?????????????????000?????1111011; - localparam logic [31:0] ISLLI = 32'b000000???????????001?????1111011; - localparam logic [31:0] ISLTI = 32'b?????????????????010?????1111011; - localparam logic [31:0] ISLTIU = 32'b?????????????????011?????1111011; - localparam logic [31:0] IXORI = 32'b?????????????????100?????1111011; - localparam logic [31:0] ISRLI = 32'b000000???????????101?????1111011; - localparam logic [31:0] ISRAI = 32'b010000???????????101?????1111011; - localparam logic [31:0] IORI = 32'b?????????????????110?????1111011; - localparam logic [31:0] IANDI = 32'b?????????????????111?????1111011; - localparam logic [31:0] IADD = 32'b0000000??????????000?????1011011; - localparam logic [31:0] ISUB = 32'b0100000??????????000?????1011011; - localparam logic [31:0] ISLL = 32'b0000000??????????001?????1011011; - localparam logic [31:0] ISLT = 32'b0000000??????????010?????1011011; - localparam logic [31:0] ISLTU = 32'b0000000??????????011?????1011011; - localparam logic [31:0] IXOR = 32'b0000000??????????100?????1011011; - localparam logic [31:0] ISRL = 32'b0000000??????????101?????1011011; - localparam logic [31:0] ISRA = 32'b0100000??????????101?????1011011; - localparam logic [31:0] IOR = 32'b0000000??????????110?????1011011; - localparam logic [31:0] IAND = 32'b0000000??????????111?????1011011; - localparam logic [31:0] IMADD = 32'b?????01??????????000?????1011011; - localparam logic [31:0] IMSUB = 32'b?????01??????????001?????1011011; - localparam logic [31:0] INMSUB = 32'b?????01??????????010?????1011011; - localparam logic [31:0] INMADD = 32'b?????01??????????011?????1011011; - localparam logic [31:0] IMUL = 32'b0000010??????????000?????1011011; - localparam logic [31:0] IMULH = 32'b0000010??????????001?????1011011; - localparam logic [31:0] IMULHSU = 32'b0000010??????????010?????1011011; - localparam logic [31:0] IMULHU = 32'b0000010??????????011?????1011011; - localparam logic [31:0] IANDN = 32'b0100000??????????111?????1011011; - localparam logic [31:0] IORN = 32'b0100000??????????110?????1011011; - localparam logic [31:0] IXNOR = 32'b0100000??????????100?????1011011; - localparam logic [31:0] ISLO = 32'b0010000??????????001?????1011011; - localparam logic [31:0] ISRO = 32'b0010000??????????101?????1011011; - localparam logic [31:0] IROL = 32'b0110000??????????001?????1011011; - localparam logic [31:0] IROR = 32'b0110000??????????101?????1011011; - localparam logic [31:0] ISBCLR = 32'b0100100??????????001?????1011011; - localparam logic [31:0] ISBSET = 32'b0010100??????????001?????1011011; - localparam logic [31:0] ISBINV = 32'b0110100??????????001?????1011011; - localparam logic [31:0] ISBEXT = 32'b0100100??????????101?????1011011; - localparam logic [31:0] IGORC = 32'b0010100??????????101?????1011011; - localparam logic [31:0] IGREV = 32'b0110100??????????101?????1011011; - localparam logic [31:0] ISLOI = 32'b001000???????????001?????1111011; - localparam logic [31:0] ISROI = 32'b001000???????????101?????1111011; - localparam logic [31:0] IRORI = 32'b011000???????????101?????1111011; - localparam logic [31:0] ISBCLRI = 32'b010010???????????001?????1111011; - localparam logic [31:0] ISBSETI = 32'b001010???????????001?????1111011; - localparam logic [31:0] ISBINVI = 32'b011010???????????001?????1111011; - localparam logic [31:0] ISBEXTI = 32'b010010???????????101?????1111011; - localparam logic [31:0] IGORCI = 32'b001010???????????101?????1111011; - localparam logic [31:0] IGREVI = 32'b011010???????????101?????1111011; - localparam logic [31:0] ICLZ = 32'b011000000000?????010?????1011011; - localparam logic [31:0] ICTZ = 32'b011000000001?????010?????1011011; - localparam logic [31:0] IPCNT = 32'b011000000010?????010?????1011011; - localparam logic [31:0] ISEXT_B = 32'b011000000100?????010?????1011011; - localparam logic [31:0] ISEXT_H = 32'b011000000101?????010?????1011011; - localparam logic [31:0] ICRC32_B = 32'b011000010000?????001?????1011011; - localparam logic [31:0] ICRC32_H = 32'b011000010001?????001?????1011011; - localparam logic [31:0] ICRC32_W = 32'b011000010010?????001?????1011011; - localparam logic [31:0] ICRC32C_B = 32'b011000011000?????001?????1011011; - localparam logic [31:0] ICRC32C_H = 32'b011000011001?????001?????1011011; - localparam logic [31:0] ICRC32C_W = 32'b011000011010?????001?????1011011; - localparam logic [31:0] ISH1ADD = 32'b0010000??????????010?????1011011; - localparam logic [31:0] ISH2ADD = 32'b0010000??????????100?????1011011; - localparam logic [31:0] ISH3ADD = 32'b0010000??????????110?????1011011; - localparam logic [31:0] ICLMUL = 32'b0000101??????????001?????1011011; - localparam logic [31:0] ICLMULR = 32'b0000101??????????010?????1011011; - localparam logic [31:0] ICLMULH = 32'b0000101??????????011?????1011011; - localparam logic [31:0] IMIN = 32'b0000101??????????100?????1011011; - localparam logic [31:0] IMAX = 32'b0000101??????????101?????1011011; - localparam logic [31:0] IMINU = 32'b0000101??????????110?????1011011; - localparam logic [31:0] IMAXU = 32'b0000101??????????111?????1011011; - localparam logic [31:0] ISHFL = 32'b0000100??????????001?????1011011; - localparam logic [31:0] IUNSHFL = 32'b0000100??????????101?????1011011; - localparam logic [31:0] IBEXT = 32'b0000100??????????110?????1011011; - localparam logic [31:0] IBDEP = 32'b0100100??????????110?????1011011; - localparam logic [31:0] IPACK = 32'b0000100??????????100?????1011011; - localparam logic [31:0] IPACKU = 32'b0100100??????????100?????1011011; - localparam logic [31:0] IPACKH = 32'b0000100??????????111?????1011011; - localparam logic [31:0] IBFP = 32'b0100100??????????111?????1011011; - localparam logic [31:0] ISHFLI = 32'b0000100??????????001?????1111011; - localparam logic [31:0] IUNSHFLI = 32'b0000100??????????101?????1111011; localparam logic [31:0] SLLI_RV32 = 32'b0000000??????????001?????0010011; localparam logic [31:0] SRLI_RV32 = 32'b0000000??????????101?????0010011; localparam logic [31:0] SRAI_RV32 = 32'b0100000??????????101?????0010011; @@ -150,64 +68,6 @@ package riscv_instr; localparam logic [31:0] AMOSWAP_W = 32'b00001????????????010?????0101111; localparam logic [31:0] LR_W = 32'b00010??00000?????010?????0101111; localparam logic [31:0] SC_W = 32'b00011????????????010?????0101111; - localparam logic [31:0] ANDN = 32'b0100000??????????111?????0110011; - localparam logic [31:0] ORN = 32'b0100000??????????110?????0110011; - localparam logic [31:0] XNOR = 32'b0100000??????????100?????0110011; - localparam logic [31:0] SLO = 32'b0010000??????????001?????0110011; - localparam logic [31:0] SRO = 32'b0010000??????????101?????0110011; - localparam logic [31:0] ROL = 32'b0110000??????????001?????0110011; - localparam logic [31:0] ROR = 32'b0110000??????????101?????0110011; - localparam logic [31:0] SBCLR = 32'b0100100??????????001?????0110011; - localparam logic [31:0] SBSET = 32'b0010100??????????001?????0110011; - localparam logic [31:0] SBINV = 32'b0110100??????????001?????0110011; - localparam logic [31:0] SBEXT = 32'b0100100??????????101?????0110011; - localparam logic [31:0] GORC = 32'b0010100??????????101?????0110011; - localparam logic [31:0] GREV = 32'b0110100??????????101?????0110011; - localparam logic [31:0] SLOI = 32'b001000???????????001?????0010011; - localparam logic [31:0] SROI = 32'b001000???????????101?????0010011; - localparam logic [31:0] RORI = 32'b011000???????????101?????0010011; - localparam logic [31:0] SBCLRI = 32'b010010???????????001?????0010011; - localparam logic [31:0] SBSETI = 32'b001010???????????001?????0010011; - localparam logic [31:0] SBINVI = 32'b011010???????????001?????0010011; - localparam logic [31:0] SBEXTI = 32'b010010???????????101?????0010011; - localparam logic [31:0] GORCI = 32'b001010???????????101?????0010011; - localparam logic [31:0] GREVI = 32'b011010???????????101?????0010011; - localparam logic [31:0] CMIX = 32'b?????11??????????001?????0110011; - localparam logic [31:0] CMOV = 32'b?????11??????????101?????0110011; - localparam logic [31:0] FSL = 32'b?????10??????????001?????0110011; - localparam logic [31:0] FSR = 32'b?????10??????????101?????0110011; - localparam logic [31:0] FSRI = 32'b?????1???????????101?????0010011; - localparam logic [31:0] CLZ = 32'b011000000000?????001?????0010011; - localparam logic [31:0] CTZ = 32'b011000000001?????001?????0010011; - localparam logic [31:0] PCNT = 32'b011000000010?????001?????0010011; - localparam logic [31:0] SEXT_B = 32'b011000000100?????001?????0010011; - localparam logic [31:0] SEXT_H = 32'b011000000101?????001?????0010011; - localparam logic [31:0] CRC32_B = 32'b011000010000?????001?????0010011; - localparam logic [31:0] CRC32_H = 32'b011000010001?????001?????0010011; - localparam logic [31:0] CRC32_W = 32'b011000010010?????001?????0010011; - localparam logic [31:0] CRC32C_B = 32'b011000011000?????001?????0010011; - localparam logic [31:0] CRC32C_H = 32'b011000011001?????001?????0010011; - localparam logic [31:0] CRC32C_W = 32'b011000011010?????001?????0010011; - localparam logic [31:0] SH1ADD = 32'b0010000??????????010?????0110011; - localparam logic [31:0] SH2ADD = 32'b0010000??????????100?????0110011; - localparam logic [31:0] SH3ADD = 32'b0010000??????????110?????0110011; - localparam logic [31:0] CLMUL = 32'b0000101??????????001?????0110011; - localparam logic [31:0] CLMULR = 32'b0000101??????????010?????0110011; - localparam logic [31:0] CLMULH = 32'b0000101??????????011?????0110011; - localparam logic [31:0] MIN = 32'b0000101??????????100?????0110011; - localparam logic [31:0] MAX = 32'b0000101??????????101?????0110011; - localparam logic [31:0] MINU = 32'b0000101??????????110?????0110011; - localparam logic [31:0] MAXU = 32'b0000101??????????111?????0110011; - localparam logic [31:0] SHFL = 32'b0000100??????????001?????0110011; - localparam logic [31:0] UNSHFL = 32'b0000100??????????101?????0110011; - localparam logic [31:0] BEXT = 32'b0000100??????????110?????0110011; - localparam logic [31:0] BDEP = 32'b0100100??????????110?????0110011; - localparam logic [31:0] PACK = 32'b0000100??????????100?????0110011; - localparam logic [31:0] PACKU = 32'b0100100??????????100?????0110011; - localparam logic [31:0] PACKH = 32'b0000100??????????111?????0110011; - localparam logic [31:0] BFP = 32'b0100100??????????111?????0110011; - localparam logic [31:0] SHFLI = 32'b0000100??????????001?????0010011; - localparam logic [31:0] UNSHFLI = 32'b0000100??????????101?????0010011; localparam logic [31:0] C_SRLI_RV32 = 32'b????????????????100000????????01; localparam logic [31:0] C_SRAI_RV32 = 32'b????????????????100001????????01; localparam logic [31:0] C_SLLI_RV32 = 32'b????????????????0000??????????10; @@ -1043,10 +903,6 @@ package riscv_instr; localparam logic [31:0] FCVT_AB_B = 32'b010001100011?????000?????1010011; localparam logic [31:0] FCVT_B_AB = 32'b010001100011?????000?????1010011; localparam logic [31:0] FCVT_AB_AB = 32'b010001100011?????000?????1010011; - localparam logic [31:0] SCFGRI = 32'b????????????00000001?????0101011; - localparam logic [31:0] SCFGWI = 32'b?????????????????010000000101011; - localparam logic [31:0] SCFGR = 32'b0000000?????00001001?????0101011; - localparam logic [31:0] SCFGW = 32'b0000000??????????010000010101011; localparam logic [31:0] ECALL = 32'b00000000000000000000000001110011; localparam logic [31:0] EBREAK = 32'b00000000000100000000000001110011; localparam logic [31:0] URET = 32'b00000000001000000000000001110011; diff --git a/util/enc_viz/.gitignore b/util/enc_viz/.gitignore new file mode 100644 index 000000000..ceddaa37f --- /dev/null +++ b/util/enc_viz/.gitignore @@ -0,0 +1 @@ +.cache/ diff --git a/util/enc_viz/README.md b/util/enc_viz/README.md new file mode 100644 index 000000000..250d7a8c8 --- /dev/null +++ b/util/enc_viz/README.md @@ -0,0 +1,167 @@ +# Encoding-space visualizer + +`gen_encoding_viz.py` builds a single, self-contained HTML map of how the +RISC-V Vector (RVV) encoding space — and the adjacent custom major opcodes — is +used by this hardware. It is **read-only**: it never modifies the repo. + +It answers four questions at a glance, checked against the RVV v1.0 ground +truth ([upstream `riscv-opcodes` `extensions/rv_v`](https://github.com/riscv/riscv-opcodes/blob/master/extensions/rv_v)): + +1. **Which RVV v1.0 spec instructions does the hardware implement?** + 🟦 blue = decoded, ⬜ gray = not. *Implemented = the instruction is decoded + by one of the decoders (snitch, spatz decoder, FPU sequencer, DMA + front-end) — a decode check only; the logic behind the decoder is not + verified.* +2. **Which custom instructions are hardware-backed?** One hue per custom + extension group (same decode check). +3. **What is in the toolchain but not in hardware?** Instructions with a + `riscv_instr.sv` localparam that no decoder references — shown ⬛ black in + the grids *and* listed exhaustively in a dedicated section (reclaimable + encoding space). +4. **Where does the implementation deviate from the spec?** A dedicated + panel lists (a) encoding mismatches — same instruction name, different + fixed bits vs the spec — and (b) custom instructions occupying + spec-claimed encodings. + +--- + +## Quick start + +```sh +cd util/enc_viz +python3 gen_encoding_viz.py +# opens: util/enc_viz/encoding_map.html (open it in any browser) +``` + +First run clones the upstream spec (~seconds, needs network); later runs are offline. + +Re-run it any time the RTL, the opcode files, or `riscv_instr.sv` change — the +map always reflects the current sources. + +--- + +## Requirements + +- **Python 3** (standard library only — no pip installs). +- **git** and **network access on the first run** only, to fetch the upstream + spec. It is cached under `util/enc_viz/.cache/` (git-ignored); subsequent runs + are fully offline. + +--- + +## What it reads + +| Input | Role | +|-------|------| +| upstream `riscv/riscv-opcodes` `extensions/rv_v` (auto-cloned, pinned commit) | the RVV v1.0 ground truth = the canvas (`--crypto` adds the `rv_zv*` exts) | +| `sw/toolchain/riscv-opcodes/opcodes-*` (the 7 custom entries in the Makefile `OPCODES` var) | our custom extensions | +| `sw/toolchain/riscv-opcodes/opcodes-rvv` (the 8th `OPCODES` entry) | diffed against the upstream canvas: entries absent upstream (e.g. `vlx*`, `vfwdotp`, legacy v0.9 leftovers) become the **`rvv (not in spec v1.0)`** pseudo-extension; same-name entries with different fixed bits are listed in the **spec-deviation panel** | +| `hw/ip/snitch/src/riscv_instr.sv` | the toolchain truth: "in toolchain" = has a localparam here (also cross-checked against the opcode files; a stale file triggers a warning) | +| the decoders under `hw/`: `snitch.sv`, `spatz_decoder.sv`, `spatz_fpu_sequencer.sv`, `axi_dma_tc_snitch_fe.sv` | what the hardware actually decodes | + +"Implemented" = the instruction name is referenced in one of the decoder +files, either qualified (`riscv_instr::VADD_VV`) or unqualified (`FREP_O`, +when the file does `import riscv_instr::*`). This is a decode check only. + +--- + +## Command-line options + +``` +python3 gen_encoding_viz.py [--repo DIR] [--out FILE] [--spec-commit SHA] [--crypto] +``` + +| Option | Default | Meaning | +|--------|---------|---------| +| `--repo DIR` | auto-detected | Spatz repo root (found by walking up from the script). | +| `--out FILE` | `encoding_map.html` next to the script | Where to write the HTML. | +| `--spec-commit SHA` | pinned commit | Which upstream `riscv-opcodes` commit to diff against. | +| `--crypto` | off | Also draw the ratified vector-crypto exts (`rv_zv*`) on the canvas (they claim OP-V slots too — e.g. Zvfbfwma's `vfwmaccbf16` sits on funct6 0x3b, which `vfwdotp` reuses). | +| `--decoder FILE.sv` | — | Treat an additional RTL file as a decoder (repeatable; extends the built-in list). | + +Examples: +```sh +# write somewhere else +python3 gen_encoding_viz.py --out /tmp/enc.html + +# run from anywhere, point at a specific checkout +python3 util/enc_viz/gen_encoding_viz.py --repo /path/to/spatz +``` + +--- + +## Reading the map + +**Colors** +| Color | Meaning | +|-------|---------| +| 🟦 blue | spec instruction the hardware decodes | +| ⬜ gray | spec instruction we do **not** implement | +| extension hue | custom instruction that **is** decoded | +| ⬛ black | in the toolchain (`riscv_instr.sv`) but decoded by no hardware (reclaimable) | +| blue/gray two-tone | one slot holding both implemented and unimplemented sub-encodings | +| 🟥 red hatch | a **genuine** encoding conflict (two instructions' fixed bits overlap) | +| empty | free encoding space | + +**Sections** +- **OP-V grid** — funct6 (rows) × category (columns) for major 0x57. A cell + labeled `name +N` holds several legal sub-encodings that differ by + `vm`/`vs1`/`vs2`/`rs1`; hover to see each one and its status. +- **Custom major grids** — CUSTOM-0/1/2/3 (0x0b/2b/5b/7b) as funct7 × funct3 + grids (collapsible; the summary line shows used/free slot counts). I-type + immediate ops claim a whole funct3 column and are shown in a banner; free + cells inside a claimed column are red-hatched. +- **Standard opcodes overloaded by custom ext** — rv32b (OP / OP-IMM), + smallfloat (OP-FP / FMA), vector-crypto (0x77), listed so nothing is dropped. +- **In toolchain but not decoded by hardware** — the exhaustive list of ⬛ + dead definitions, grouped per extension (collapsible), so reclaimable + encoding space is visible at a glance rather than scattered across grids. +- **Active vs latent conflicts** — *active* = both sides decoded in hardware + (real collision); *latent* = at least one side is a dead definition + (paper collision only). +- **Deviations from the RVV v1.0 spec** — (a) *encoding mismatches*: same + instruction name, different fixed bits between our `opcodes-rvv` and the + spec (these deviations end up in the generated decoder masks); (b) *custom + instructions on spec-claimed encodings*: a custom instruction's fixed bits + overlap an RVV spec instruction. +- **Extension status table** — per extension: defined / implemented / dead. + +Hover any cell or chip for the full 32-bit pattern, origin file, and the RTL +file(s) that decode it. + +--- + +## Sharing the result + +`encoding_map.html` is fully self-contained (all CSS/JS inlined, no external +requests), so you can open it locally, email it, or host it on any internal web +server / GitLab Pages — no dependencies required. + +--- + +## Adding a new custom extension + +The tool follows the build configuration automatically: + +1. Add your `opcodes-xxx_CUSTOM` file and list it in the top-level Makefile + `OPCODES` variable — the tool parses that variable each run and assigns the + new extension a distinct hue automatically. +2. Run `make update_opcodes` — if you forget, the tool warns that + `riscv_instr.sv` is stale. +3. If the new instructions are decoded by one of the known decoders + (`snitch.sv`, `spatz_decoder.sv`, `spatz_fpu_sequencer.sv`, + `axi_dma_tc_snitch_fe.sv`), nothing else to do. If your hardware adds a + **new decoder file**, the tool detects instructions referenced outside the + known decoders and prints/renders a warning — re-run with + `--decoder your_decoder.sv` (repeatable) to include it in the scan. + +## Notes & limitations + +- "Implemented" is a decode check by design: the name is referenced in one of + the decoder files. An instruction that is decoded but whose execution logic + is broken/absent still reads as implemented — verifying the logic is out of + scope for this tool. +- The standard-overloaded majors (OP / OP-IMM / OP-FP) are shown as lists, not + grids — gridding them would require drawing base-ISA occupancy too. +- The upstream spec commit is pinned for reproducibility; bump `--spec-commit` + (or edit `UPSTREAM_COMMIT` in the script) to track a newer spec. diff --git a/util/enc_viz/encoding_map.html b/util/enc_viz/encoding_map.html new file mode 100644 index 000000000..7fe4242c6 --- /dev/null +++ b/util/enc_viz/encoding_map.html @@ -0,0 +1,230 @@ + + +
c6edca7d8c| spec — implemented: RVV v1.0 instruction decoded by the hardware | |
| spec — not implemented: RVV v1.0 instruction with no decoder reference | |
| spec — partially implemented: slot holds several sub-encodings, only some decoded (hover for the list) | |
| custom — implemented, one hue per extension: frep_CUSTOMdma_CUSTOMsmallfloatvfx_CUSTOMrvv (not in spec v1.0) | |
| custom — in toolchain, not decoded: has a riscv_instr.sv localparam but no decoder reference (reclaimable) | |
| conflict: two instructions' fixed bits genuinely overlap | |
| free: unallocated encoding space |
| extension | defined | implemented | dead (reclaimable) |
|---|---|---|---|
| frep_CUSTOM | 2 | 2 | 0 |
| dma_CUSTOM | 8 | 8 | 0 |
| smallfloat | 38 | 33 | 5 |
| vfx_CUSTOM | 17 | 17 | 0 |
| rvv (not in spec v1.0) | 74 | 6 | 68 |
name +N” label means 15 slot(s) hold several legal sub-encodings distinguished by vm/vs1/vs2/rs1 (e.g. vfmerge.vfm & vfmv.v.f) — hover to see each and its status. Red is reserved for genuine bit-overlaps.| funct6 | OPIVV | OPIVX | OPIVI | OPMVV | OPMVX | OPFVV | OPFVF |
|---|---|---|---|---|---|---|---|
| 000000 0x00 | VADD_VV | VADD_VX | VADD_VI | VREDSUM_VS | VFADD_VV | VFADD_VF | |
| 000001 0x01 | VREDAND_VS | VFREDUSUM_VS | |||||
| 000010 0x02 | VSUB_VV | VSUB_VX | VREDOR_VS | VFSUB_VV | VFSUB_VF | ||
| 000011 0x03 | VRSUB_VX | VRSUB_VI | VREDXOR_VS | VFREDOSUM_VS | |||
| 000100 0x04 | VMINU_VV | VMINU_VX | VREDMINU_VS | VFMIN_VV | VFMIN_VF | ||
| 000101 0x05 | VMIN_VV | VMIN_VX | VREDMIN_VS | VFREDMIN_VS | |||
| 000110 0x06 | VMAXU_VV | VMAXU_VX | VREDMAXU_VS | VFMAX_VV | VFMAX_VF | ||
| 000111 0x07 | VMAX_VV | VMAX_VX | VREDMAX_VS | VFREDMAX_VS | |||
| 001000 0x08 | VAADDU_VV | VAADDU_VX | VFSGNJ_VV | VFSGNJ_VF | |||
| 001001 0x09 | VAND_VV | VAND_VX | VAND_VI | VAADD_VV | VAADD_VX | VFSGNJN_VV | VFSGNJN_VF |
| 001010 0x0a | VOR_VV | VOR_VX | VOR_VI | VASUBU_VV | VASUBU_VX | VFSGNJX_VV | VFSGNJX_VF |
| 001011 0x0b | VXOR_VV | VXOR_VX | VXOR_VI | VASUB_VV | VASUB_VX | ||
| 001100 0x0c | VRGATHER_VV | VRGATHER_VX | VRGATHER_VI | ||||
| 001101 0x0d | |||||||
| 001110 0x0e | VRGATHEREI16_VV | VSLIDEUP_VX | VSLIDEUP_VI | VSLIDE1UP_VX | VFSLIDE1UP_VF | ||
| 001111 0x0f | VSLIDEDOWN_VX | VSLIDEDOWN_VI | VSLIDE1DOWN_VX | VFSLIDE1DOWN_VF | |||
| 010000 0x10 | VADC_VVM | VADC_VXM | VADC_VIM | VMV_X_S +2 | VMV_S_X | VFMV_F_S | VFMV_S_F |
| 010001 0x11 | VMADC_VVM +1 | VMADC_VXM +1 | VMADC_VIM +1 | ||||
| 010010 0x12 | VSBC_VVM | VSBC_VXM | VZEXT_VF8 +5 | VFCVT_XU_F_V +20 | |||
| 010011 0x13 | VMSBC_VVM +1 | VMSBC_VXM +1 | VFSQRT_V +3 | ||||
| 010100 0x14 | VMSBF_M +4 | ||||||
| 010101 0x15 | |||||||
| 010110 0x16 | |||||||
| 010111 0x17 | VMERGE_VVM +1 | VMERGE_VXM +1 | VMERGE_VIM +1 | VCOMPRESS_VM | VFMERGE_VFM +1 | ||
| 011000 0x18 | VMSEQ_VV | VMSEQ_VX | VMSEQ_VI | VMANDN_MM | VMFEQ_VV | VMFEQ_VF | |
| 011001 0x19 | VMSNE_VV | VMSNE_VX | VMSNE_VI | VMAND_MM | VMFLE_VV | VMFLE_VF | |
| 011010 0x1a | VMSLTU_VV | VMSLTU_VX | VMOR_MM | ||||
| 011011 0x1b | VMSLT_VV | VMSLT_VX | VMXOR_MM | VMFLT_VV | VMFLT_VF | ||
| 011100 0x1c | VMSLEU_VV | VMSLEU_VX | VMSLEU_VI | VMORN_MM | VMFNE_VV | VMFNE_VF | |
| 011101 0x1d | VMSLE_VV | VMSLE_VX | VMSLE_VI | VMNAND_MM | VMFGT_VF | ||
| 011110 0x1e | VMSGTU_VX | VMSGTU_VI | VMNOR_MM | ||||
| 011111 0x1f | VMSGT_VX | VMSGT_VI | VMXNOR_MM | VMFGE_VF | |||
| 100000 0x20 | VSADDU_VV | VSADDU_VX | VSADDU_VI | VDIVU_VV | VDIVU_VX | VFDIV_VV | VFDIV_VF |
| 100001 0x21 | VSADD_VV | VSADD_VX | VSADD_VI | VDIV_VV | VDIV_VX | VFRDIV_VF | |
| 100010 0x22 | VSSUBU_VV | VSSUBU_VX | VREMU_VV | VREMU_VX | |||
| 100011 0x23 | VSSUB_VV | VSSUB_VX | VREM_VV | VREM_VX | |||
| 100100 0x24 | VMULHU_VV | VMULHU_VX | VFMUL_VV | VFMUL_VF | |||
| 100101 0x25 | VSLL_VV | VSLL_VX | VSLL_VI | VMUL_VV | VMUL_VX | VFXMACC_VF | |
| 100110 0x26 | VMULHSU_VV | VMULHSU_VX | VFXMUL_VF | ||||
| 100111 0x27 | VSMUL_VV | VSMUL_VX | VMV1R_V +3 | VMULH_VV | VMULH_VX | VFRSUB_VF | |
| 101000 0x28 | VSRL_VV | VSRL_VX | VSRL_VI | VFMADD_VV | VFMADD_VF | ||
| 101001 0x29 | VSRA_VV | VSRA_VX | VSRA_VI | VMADD_VV | VMADD_VX | VFNMADD_VV | VFNMADD_VF |
| 101010 0x2a | VSSRL_VV | VSSRL_VX | VSSRL_VI | VFMSUB_VV | VFMSUB_VF | ||
| 101011 0x2b | VSSRA_VV | VSSRA_VX | VSSRA_VI | VNMSUB_VV | VNMSUB_VX | VFNMSUB_VV | VFNMSUB_VF |
| 101100 0x2c | VNSRL_WV | VNSRL_WX | VNSRL_WI | VFMACC_VV | VFMACC_VF | ||
| 101101 0x2d | VNSRA_WV | VNSRA_WX | VNSRA_WI | VMACC_VV | VMACC_VX | VFNMACC_VV | VFNMACC_VF |
| 101110 0x2e | VNCLIPU_WV | VNCLIPU_WX | VNCLIPU_WI | VFMSAC_VV | VFMSAC_VF | ||
| 101111 0x2f | VNCLIP_WV | VNCLIP_WX | VNCLIP_WI | VNMSAC_VV | VNMSAC_VX | VFNMSAC_VV | VFNMSAC_VF |
| 110000 0x30 | VWREDSUMU_VS | VWADDU_VV | VWADDU_VX | VFWADD_VV | VFWADD_VF | ||
| 110001 0x31 | VWREDSUM_VS | VWADD_VV | VWADD_VX | VFWREDUSUM_VS | |||
| 110010 0x32 | VWSUBU_VV | VWSUBU_VX | VFWSUB_VV | VFWSUB_VF | |||
| 110011 0x33 | VWSUB_VV | VWSUB_VX | VFWREDOSUM_VS | ||||
| 110100 0x34 | VWADDU_WV | VWADDU_WX | VFWADD_WV | VFWADD_WF | |||
| 110101 0x35 | VWADD_WV | VWADD_WX | |||||
| 110110 0x36 | VWSUBU_WV | VWSUBU_WX | VFWSUB_WV | VFWSUB_WF | |||
| 110111 0x37 | VWSUB_WV | VWSUB_WX | |||||
| 111000 0x38 | VWMULU_VV | VWMULU_VX | VFWMUL_VV | VFWMUL_VF | |||
| 111001 0x39 | |||||||
| 111010 0x3a | VWMULSU_VV | VWMULSU_VX | |||||
| 111011 0x3b | VWMUL_VV | VWMUL_VX | VFWDOTP_VV | VFWDOTP_VF | |||
| 111100 0x3c | VWMACCU_VV | VWMACCU_VX | VFWMACC_VV | VFWMACC_VF | |||
| 111101 0x3d | VWMACC_VV | VWMACC_VX | VFWNMACC_VV | VFWNMACC_VF | |||
| 111110 0x3e | VWMACCUS_VX | VFWMSAC_VV | VFWMSAC_VF | ||||
| 111111 0x3f | VWMACCSU_VV | VWMACCSU_VX | VFWNMSAC_VV | VFWNMSAC_VF |
| funct7 | f3=0 | f3=1 | f3=2 | f3=3 | f3=4 | f3=5 | f3=6 | f3=7 |
|---|---|---|---|---|---|---|---|---|
| 0000000 0x00 | FREP_O +1 | VFXMACC_VRF | ||||||
| 0000001 0x01 | FREP_O +1 | VFXMUL_VRF | ||||||
| 0000010 0x02 | FREP_O +1 | |||||||
| 0000011 0x03 | FREP_O +1 | VVENTCLR | ||||||
| 0000100 0x04 | FREP_O +1 | VFXMACC_VRF | ||||||
| 0000101 0x05 | FREP_O +1 | VFXMUL_VRF | ||||||
| 0000110 0x06 | FREP_O +1 | |||||||
| 0000111 0x07 | FREP_O +1 | |||||||
| 0001000 0x08 | FREP_O +1 | VFXMACC_VRF | ||||||
| 0001001 0x09 | FREP_O +1 | VFXMUL_VRF | ||||||
| 0001010 0x0a | FREP_O +1 | |||||||
| 0001011 0x0b | FREP_O +1 | |||||||
| 0001100 0x0c | FREP_O +1 | VFXMACC_VRF | ||||||
| 0001101 0x0d | FREP_O +1 | VFXMUL_VRF | ||||||
| 0001110 0x0e | FREP_O +1 | |||||||
| 0001111 0x0f | FREP_O +1 | |||||||
| 0010000 0x10 | FREP_O +1 | VFXMACC_VRF | ||||||
| 0010001 0x11 | FREP_O +1 | VFXMUL_VRF | ||||||
| 0010010 0x12 | FREP_O +1 | |||||||
| 0010011 0x13 | FREP_O +1 | |||||||
| 0010100 0x14 | FREP_O +1 | VFXMACC_VRF | ||||||
| 0010101 0x15 | FREP_O +1 | VFXMUL_VRF | ||||||
| 0010110 0x16 | FREP_O +1 | |||||||
| 0010111 0x17 | FREP_O +1 | |||||||
| 0011000 0x18 | FREP_O +1 | VFXMACC_VRF | ||||||
| 0011001 0x19 | FREP_O +1 | VFXMUL_VRF | ||||||
| 0011010 0x1a | FREP_O +1 | |||||||
| 0011011 0x1b | FREP_O +1 | |||||||
| 0011100 0x1c | FREP_O +1 | VFXMACC_VRF | ||||||
| 0011101 0x1d | FREP_O +1 | VFXMUL_VRF | ||||||
| 0011110 0x1e | FREP_O +1 | |||||||
| 0011111 0x1f | FREP_O +1 | |||||||
| 0100000 0x20 | FREP_O +1 | VFXMACC_VRF | ||||||
| 0100001 0x21 | FREP_O +1 | VFXMUL_VRF | ||||||
| 0100010 0x22 | FREP_O +1 | |||||||
| 0100011 0x23 | FREP_O +1 | |||||||
| 0100100 0x24 | FREP_O +1 | VFXMACC_VRF | ||||||
| 0100101 0x25 | FREP_O +1 | VFXMUL_VRF | ||||||
| 0100110 0x26 | FREP_O +1 | |||||||
| 0100111 0x27 | FREP_O +1 | |||||||
| 0101000 0x28 | FREP_O +1 | VFXMACC_VRF | ||||||
| 0101001 0x29 | FREP_O +1 | VFXMUL_VRF | ||||||
| 0101010 0x2a | FREP_O +1 | |||||||
| 0101011 0x2b | FREP_O +1 | |||||||
| 0101100 0x2c | FREP_O +1 | VFXMACC_VRF | ||||||
| 0101101 0x2d | FREP_O +1 | VFXMUL_VRF | ||||||
| 0101110 0x2e | FREP_O +1 | |||||||
| 0101111 0x2f | FREP_O +1 | |||||||
| 0110000 0x30 | FREP_O +1 | VFXMACC_VRF | ||||||
| 0110001 0x31 | FREP_O +1 | VFXMUL_VRF | ||||||
| 0110010 0x32 | FREP_O +1 | |||||||
| 0110011 0x33 | FREP_O +1 | |||||||
| 0110100 0x34 | FREP_O +1 | VFXMACC_VRF | ||||||
| 0110101 0x35 | FREP_O +1 | VFXMUL_VRF | ||||||
| 0110110 0x36 | FREP_O +1 | |||||||
| 0110111 0x37 | FREP_O +1 | |||||||
| 0111000 0x38 | FREP_O +1 | VFXMACC_VRF | ||||||
| 0111001 0x39 | FREP_O +1 | VFXMUL_VRF | ||||||
| 0111010 0x3a | FREP_O +1 | |||||||
| 0111011 0x3b | FREP_O +1 | |||||||
| 0111100 0x3c | FREP_O +1 | VFXMACC_VRF | ||||||
| 0111101 0x3d | FREP_O +1 | VFXMUL_VRF | ||||||
| 0111110 0x3e | FREP_O +1 | |||||||
| 0111111 0x3f | FREP_O +1 | |||||||
| 1000000 0x40 | FREP_O +1 | VFXMACC_VRF | ||||||
| 1000001 0x41 | FREP_O +1 | VFXMUL_VRF | ||||||
| 1000010 0x42 | FREP_O +1 | |||||||
| 1000011 0x43 | FREP_O +1 | |||||||
| 1000100 0x44 | FREP_O +1 | VFXMACC_VRF | ||||||
| 1000101 0x45 | FREP_O +1 | VFXMUL_VRF | ||||||
| 1000110 0x46 | FREP_O +1 | |||||||
| 1000111 0x47 | FREP_O +1 | |||||||
| 1001000 0x48 | FREP_O +1 | VFXMACC_VRF | ||||||
| 1001001 0x49 | FREP_O +1 | VFXMUL_VRF | ||||||
| 1001010 0x4a | FREP_O +1 | |||||||
| 1001011 0x4b | FREP_O +1 | |||||||
| 1001100 0x4c | FREP_O +1 | VFXMACC_VRF | ||||||
| 1001101 0x4d | FREP_O +1 | VFXMUL_VRF | ||||||
| 1001110 0x4e | FREP_O +1 | |||||||
| 1001111 0x4f | FREP_O +1 | |||||||
| 1010000 0x50 | FREP_O +1 | VFXMACC_VRF | ||||||
| 1010001 0x51 | FREP_O +1 | VFXMUL_VRF | ||||||
| 1010010 0x52 | FREP_O +1 | |||||||
| 1010011 0x53 | FREP_O +1 | |||||||
| 1010100 0x54 | FREP_O +1 | VFXMACC_VRF | ||||||
| 1010101 0x55 | FREP_O +1 | VFXMUL_VRF | ||||||
| 1010110 0x56 | FREP_O +1 | |||||||
| 1010111 0x57 | FREP_O +1 | |||||||
| 1011000 0x58 | FREP_O +1 | VFXMACC_VRF | ||||||
| 1011001 0x59 | FREP_O +1 | VFXMUL_VRF | ||||||
| 1011010 0x5a | FREP_O +1 | |||||||
| 1011011 0x5b | FREP_O +1 | |||||||
| 1011100 0x5c | FREP_O +1 | VFXMACC_VRF | ||||||
| 1011101 0x5d | FREP_O +1 | VFXMUL_VRF | ||||||
| 1011110 0x5e | FREP_O +1 | |||||||
| 1011111 0x5f | FREP_O +1 | |||||||
| 1100000 0x60 | FREP_O +1 | VFXMACC_VRF | ||||||
| 1100001 0x61 | FREP_O +1 | VFXMUL_VRF | ||||||
| 1100010 0x62 | FREP_O +1 | |||||||
| 1100011 0x63 | FREP_O +1 | |||||||
| 1100100 0x64 | FREP_O +1 | VFXMACC_VRF | ||||||
| 1100101 0x65 | FREP_O +1 | VFXMUL_VRF | ||||||
| 1100110 0x66 | FREP_O +1 | |||||||
| 1100111 0x67 | FREP_O +1 | |||||||
| 1101000 0x68 | FREP_O +1 | VFXMACC_VRF | ||||||
| 1101001 0x69 | FREP_O +1 | VFXMUL_VRF | ||||||
| 1101010 0x6a | FREP_O +1 | |||||||
| 1101011 0x6b | FREP_O +1 | |||||||
| 1101100 0x6c | FREP_O +1 | VFXMACC_VRF | ||||||
| 1101101 0x6d | FREP_O +1 | VFXMUL_VRF | ||||||
| 1101110 0x6e | FREP_O +1 | |||||||
| 1101111 0x6f | FREP_O +1 | |||||||
| 1110000 0x70 | FREP_O +1 | VFXMACC_VRF | ||||||
| 1110001 0x71 | FREP_O +1 | VFXMUL_VRF | ||||||
| 1110010 0x72 | FREP_O +1 | |||||||
| 1110011 0x73 | FREP_O +1 | |||||||
| 1110100 0x74 | FREP_O +1 | VFXMACC_VRF | ||||||
| 1110101 0x75 | FREP_O +1 | VFXMUL_VRF | ||||||
| 1110110 0x76 | FREP_O +1 | |||||||
| 1110111 0x77 | FREP_O +1 | |||||||
| 1111000 0x78 | FREP_O +1 | VFXMACC_VRF | ||||||
| 1111001 0x79 | FREP_O +1 | VFXMUL_VRF | ||||||
| 1111010 0x7a | FREP_O +1 | |||||||
| 1111011 0x7b | FREP_O +1 | |||||||
| 1111100 0x7c | FREP_O +1 | VFXMACC_VRF | ||||||
| 1111101 0x7d | FREP_O +1 | VFXMUL_VRF | ||||||
| 1111110 0x7e | FREP_O +1 | |||||||
| 1111111 0x7f | FREP_O +1 |
| funct7 | f3=0 | f3=1 | f3=2 | f3=3 | f3=4 | f3=5 | f3=6 | f3=7 |
|---|---|---|---|---|---|---|---|---|
| 0000000 0x00 | DMSRC | |||||||
| 0000001 0x01 | DMDST | |||||||
| 0000010 0x02 | DMCPYI | |||||||
| 0000011 0x03 | DMCPY | |||||||
| 0000100 0x04 | DMSTATI | |||||||
| 0000101 0x05 | DMSTAT | |||||||
| 0000110 0x06 | DMSTR | |||||||
| 0000111 0x07 | DMREP | |||||||
| 0001000 0x08 | ||||||||
| 0001001 0x09 | ||||||||
| 0001010 0x0a | ||||||||
| 0001011 0x0b | ||||||||
| 0001100 0x0c | ||||||||
| 0001101 0x0d | ||||||||
| 0001110 0x0e | ||||||||
| 0001111 0x0f | ||||||||
| 0010000 0x10 | ||||||||
| 0010001 0x11 | ||||||||
| 0010010 0x12 | ||||||||
| 0010011 0x13 | ||||||||
| 0010100 0x14 | ||||||||
| 0010101 0x15 | ||||||||
| 0010110 0x16 | ||||||||
| 0010111 0x17 | ||||||||
| 0011000 0x18 | ||||||||
| 0011001 0x19 | ||||||||
| 0011010 0x1a | ||||||||
| 0011011 0x1b | ||||||||
| 0011100 0x1c | ||||||||
| 0011101 0x1d | ||||||||
| 0011110 0x1e | ||||||||
| 0011111 0x1f | ||||||||
| 0100000 0x20 | ||||||||
| 0100001 0x21 | ||||||||
| 0100010 0x22 | ||||||||
| 0100011 0x23 | ||||||||
| 0100100 0x24 | ||||||||
| 0100101 0x25 | ||||||||
| 0100110 0x26 | ||||||||
| 0100111 0x27 | ||||||||
| 0101000 0x28 | ||||||||
| 0101001 0x29 | ||||||||
| 0101010 0x2a | ||||||||
| 0101011 0x2b | ||||||||
| 0101100 0x2c | ||||||||
| 0101101 0x2d | ||||||||
| 0101110 0x2e | ||||||||
| 0101111 0x2f | ||||||||
| 0110000 0x30 | ||||||||
| 0110001 0x31 | ||||||||
| 0110010 0x32 | ||||||||
| 0110011 0x33 | ||||||||
| 0110100 0x34 | ||||||||
| 0110101 0x35 | ||||||||
| 0110110 0x36 | ||||||||
| 0110111 0x37 | ||||||||
| 0111000 0x38 | ||||||||
| 0111001 0x39 | ||||||||
| 0111010 0x3a | ||||||||
| 0111011 0x3b | ||||||||
| 0111100 0x3c | ||||||||
| 0111101 0x3d | ||||||||
| 0111110 0x3e | ||||||||
| 0111111 0x3f | ||||||||
| 1000000 0x40 | ||||||||
| 1000001 0x41 | ||||||||
| 1000010 0x42 | ||||||||
| 1000011 0x43 | ||||||||
| 1000100 0x44 | ||||||||
| 1000101 0x45 | ||||||||
| 1000110 0x46 | ||||||||
| 1000111 0x47 | ||||||||
| 1001000 0x48 | ||||||||
| 1001001 0x49 | ||||||||
| 1001010 0x4a | ||||||||
| 1001011 0x4b | ||||||||
| 1001100 0x4c | ||||||||
| 1001101 0x4d | ||||||||
| 1001110 0x4e | ||||||||
| 1001111 0x4f | ||||||||
| 1010000 0x50 | ||||||||
| 1010001 0x51 | ||||||||
| 1010010 0x52 | ||||||||
| 1010011 0x53 | ||||||||
| 1010100 0x54 | ||||||||
| 1010101 0x55 | ||||||||
| 1010110 0x56 | ||||||||
| 1010111 0x57 | ||||||||
| 1011000 0x58 | ||||||||
| 1011001 0x59 | ||||||||
| 1011010 0x5a | ||||||||
| 1011011 0x5b | ||||||||
| 1011100 0x5c | ||||||||
| 1011101 0x5d | ||||||||
| 1011110 0x5e | ||||||||
| 1011111 0x5f | ||||||||
| 1100000 0x60 | ||||||||
| 1100001 0x61 | ||||||||
| 1100010 0x62 | ||||||||
| 1100011 0x63 | ||||||||
| 1100100 0x64 | ||||||||
| 1100101 0x65 | ||||||||
| 1100110 0x66 | ||||||||
| 1100111 0x67 | ||||||||
| 1101000 0x68 | ||||||||
| 1101001 0x69 | ||||||||
| 1101010 0x6a | ||||||||
| 1101011 0x6b | ||||||||
| 1101100 0x6c | ||||||||
| 1101101 0x6d | ||||||||
| 1101110 0x6e | ||||||||
| 1101111 0x6f | ||||||||
| 1110000 0x70 | ||||||||
| 1110001 0x71 | ||||||||
| 1110010 0x72 | ||||||||
| 1110011 0x73 | ||||||||
| 1110100 0x74 | ||||||||
| 1110101 0x75 | ||||||||
| 1110110 0x76 | ||||||||
| 1110111 0x77 | ||||||||
| 1111000 0x78 | ||||||||
| 1111001 0x79 | ||||||||
| 1111010 0x7a | ||||||||
| 1111011 0x7b | ||||||||
| 1111100 0x7c | ||||||||
| 1111101 0x7d | ||||||||
| 1111110 0x7e | ||||||||
| 1111111 0x7f |
| funct7 | f3=0 | f3=1 | f3=2 | f3=3 | f3=4 | f3=5 | f3=6 | f3=7 |
|---|---|---|---|---|---|---|---|---|
| 0000000 0x00 | ||||||||
| 0000001 0x01 | ||||||||
| 0000010 0x02 | ||||||||
| 0000011 0x03 | ||||||||
| 0000100 0x04 | ||||||||
| 0000101 0x05 | ||||||||
| 0000110 0x06 | ||||||||
| 0000111 0x07 | ||||||||
| 0001000 0x08 | ||||||||
| 0001001 0x09 | ||||||||
| 0001010 0x0a | ||||||||
| 0001011 0x0b | ||||||||
| 0001100 0x0c | ||||||||
| 0001101 0x0d | ||||||||
| 0001110 0x0e | ||||||||
| 0001111 0x0f | ||||||||
| 0010000 0x10 | ||||||||
| 0010001 0x11 | ||||||||
| 0010010 0x12 | ||||||||
| 0010011 0x13 | ||||||||
| 0010100 0x14 | ||||||||
| 0010101 0x15 | ||||||||
| 0010110 0x16 | ||||||||
| 0010111 0x17 | ||||||||
| 0011000 0x18 | ||||||||
| 0011001 0x19 | ||||||||
| 0011010 0x1a | ||||||||
| 0011011 0x1b | ||||||||
| 0011100 0x1c | ||||||||
| 0011101 0x1d | ||||||||
| 0011110 0x1e | ||||||||
| 0011111 0x1f | ||||||||
| 0100000 0x20 | ||||||||
| 0100001 0x21 | ||||||||
| 0100010 0x22 | ||||||||
| 0100011 0x23 | ||||||||
| 0100100 0x24 | ||||||||
| 0100101 0x25 | ||||||||
| 0100110 0x26 | ||||||||
| 0100111 0x27 | ||||||||
| 0101000 0x28 | ||||||||
| 0101001 0x29 | ||||||||
| 0101010 0x2a | ||||||||
| 0101011 0x2b | ||||||||
| 0101100 0x2c | ||||||||
| 0101101 0x2d | ||||||||
| 0101110 0x2e | ||||||||
| 0101111 0x2f | ||||||||
| 0110000 0x30 | ||||||||
| 0110001 0x31 | ||||||||
| 0110010 0x32 | ||||||||
| 0110011 0x33 | ||||||||
| 0110100 0x34 | ||||||||
| 0110101 0x35 | ||||||||
| 0110110 0x36 | ||||||||
| 0110111 0x37 | ||||||||
| 0111000 0x38 | ||||||||
| 0111001 0x39 | ||||||||
| 0111010 0x3a | ||||||||
| 0111011 0x3b | ||||||||
| 0111100 0x3c | ||||||||
| 0111101 0x3d | ||||||||
| 0111110 0x3e | ||||||||
| 0111111 0x3f | ||||||||
| 1000000 0x40 | ||||||||
| 1000001 0x41 | ||||||||
| 1000010 0x42 | ||||||||
| 1000011 0x43 | ||||||||
| 1000100 0x44 | ||||||||
| 1000101 0x45 | ||||||||
| 1000110 0x46 | ||||||||
| 1000111 0x47 | ||||||||
| 1001000 0x48 | ||||||||
| 1001001 0x49 | ||||||||
| 1001010 0x4a | ||||||||
| 1001011 0x4b | ||||||||
| 1001100 0x4c | ||||||||
| 1001101 0x4d | ||||||||
| 1001110 0x4e | ||||||||
| 1001111 0x4f | ||||||||
| 1010000 0x50 | P_FLB_RRPOST | P_FLH_RRPOST | P_FLW_RRPOST | P_FLD_RRPOST | ||||
| 1010001 0x51 | ||||||||
| 1010010 0x52 | ||||||||
| 1010011 0x53 | ||||||||
| 1010100 0x54 | ||||||||
| 1010101 0x55 | ||||||||
| 1010110 0x56 | ||||||||
| 1010111 0x57 | ||||||||
| 1011000 0x58 | ||||||||
| 1011001 0x59 | ||||||||
| 1011010 0x5a | ||||||||
| 1011011 0x5b | ||||||||
| 1011100 0x5c | ||||||||
| 1011101 0x5d | ||||||||
| 1011110 0x5e | ||||||||
| 1011111 0x5f | ||||||||
| 1100000 0x60 | P_VLE8_V_RRPOST | P_VLE16_V_RRPOST | P_VLE32_V_RRPOST | P_VLE64_V_RRPOST | ||||
| 1100001 0x61 | P_VLE8_V_RRPOST | P_VLE16_V_RRPOST | P_VLE32_V_RRPOST | P_VLE64_V_RRPOST | ||||
| 1100010 0x62 | P_VLX8_V_RRPOST | P_VLX16_V_RRPOST | P_VLX32_V_RRPOST | P_VLX64_V_RRPOST | ||||
| 1100011 0x63 | P_VLX8_V_RRPOST | P_VLX16_V_RRPOST | P_VLX32_V_RRPOST | P_VLX64_V_RRPOST | ||||
| 1100100 0x64 | ||||||||
| 1100101 0x65 | ||||||||
| 1100110 0x66 | ||||||||
| 1100111 0x67 | ||||||||
| 1101000 0x68 | ||||||||
| 1101001 0x69 | ||||||||
| 1101010 0x6a | ||||||||
| 1101011 0x6b | ||||||||
| 1101100 0x6c | ||||||||
| 1101101 0x6d | ||||||||
| 1101110 0x6e | ||||||||
| 1101111 0x6f | ||||||||
| 1110000 0x70 | ||||||||
| 1110001 0x71 | ||||||||
| 1110010 0x72 | ||||||||
| 1110011 0x73 | ||||||||
| 1110100 0x74 | ||||||||
| 1110101 0x75 | ||||||||
| 1110110 0x76 | ||||||||
| 1110111 0x77 | ||||||||
| 1111000 0x78 | ||||||||
| 1111001 0x79 | ||||||||
| 1111010 0x7a | ||||||||
| 1111011 0x7b | ||||||||
| 1111100 0x7c | ||||||||
| 1111101 0x7d | ||||||||
| 1111110 0x7e | ||||||||
| 1111111 0x7f |
{ctx['spec_commit'][:10]}--decoder <file>:{esc(fn)}: {esc(', '.join(only[:8]))}"
+ f"{' …' if len(only) > 8 else ''}| " + " | spec — implemented: RVV v1.0 instruction decoded by the hardware |
| " + " | spec — not implemented: RVV v1.0 instruction with no decoder reference |
| " + " | spec — partially implemented: slot holds several sub-encodings, " + "only some decoded (hover for the list) |
| " + f" | custom — implemented, one hue per extension: {ext_sws} |
| " + " | custom — in toolchain, not decoded: has a riscv_instr.sv localparam " + "but no decoder reference (reclaimable) |
| " + " | conflict: two instructions' fixed bits genuinely overlap |
| " + " | free: unallocated encoding space |
| extension | defined | implemented | dead (reclaimable) |
|---|---|---|---|
| {esc(b['name'])} | " + f"{b['total']} | {b['live']} | {dead_txt} |
make update_opcodes. Missing: "
+ f"{esc(', '.join(ctx['tc_missing']) or '—')} · encoding drift: "
+ f"{esc(', '.join(ctx['tc_enc_diff']) or '—')}name +N” label means {s['opv_multi']} slot(s) "
+ "hold several legal sub-encodings distinguished by vm/vs1/vs2/rs1 (e.g. vfmerge.vfm & "
+ "vfmv.v.f) — hover to see each and its status. Red is reserved for genuine bit-overlaps.| funct6 | "] + for cat in CATEGORY_ORDER: + P.append(f"{cat} | ") + P.append("|
|---|---|---|
| {f6:06b} 0x{f6:02x} | ")
+ for cat in CATEGORY_ORDER:
+ entries = grid.get((f6, cat))
+ if not entries:
+ P.append("" + " | ") + continue + cls, style, label, tip = cell_visual(entries, f"funct6=0x{f6:02x} {cat}") + P.append(f"" + f"{esc(label)} | ") + P.append("
| funct7 | ") + for f3 in range(8): + P.append(f"f3={f3} | ") + P.append("|
|---|---|---|
| {f7:07b} 0x{f7:02x} | ")
+ for f3 in range(8):
+ ents = cells.get((f7, f3))
+ if not ents:
+ P.append("" + " | ") + continue + cls, style, label, tip = cell_visual( + ents, f"funct7=0x{f7:02x} funct3={f3}") + P.append(f"" + f"{esc(label)} | ") + P.append("