一键导入
extract-instructions-from-subsection
Extract RISC-V instruction names from a named subsection of an AsciiDoc file and write them to /tmp/<subsection-title>.yaml.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Extract RISC-V instruction names from a named subsection of an AsciiDoc file and write them to /tmp/<subsection-title>.yaml.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | extract-instructions-from-subsection |
| description | Extract RISC-V instruction names from a named subsection of an AsciiDoc file and write them to /tmp/<subsection-title>.yaml. |
| argument-hint | <subsection-title> <adoc-file> |
| allowed-tools | Read, Bash, Write |
Copyright (c) 2026 Qualcomm Technologies, Inc. and/or its subsidiaries. SPDX-License-Identifier: BSD-3-Clause-Clear
Extract all RISC-V instruction names mentioned in the specified subsection of the given AsciiDoc file, then write them to /tmp/<subsection-title>.yaml, where <subsection-title> is argument 1 lowercased with spaces replaced by hyphens (e.g., "Multiplication Operations" → /tmp/multiplication-operations.yaml).
$ARGUMENTS
"Multiplication Operations" or "Integer Register-Immediate Instructions").ext/riscv-isa-manual/src/m-st-ext.adoc).If either argument is missing, ask the user to provide it.
Read the full content of the AsciiDoc file given as argument 2.
Find the subsection whose title matches argument 1. AsciiDoc section headings use = prefixes:
== Title — level 1 (chapter)=== Title — level 2==== Title — level 3===== Title — level 4Match the subsection title case-insensitively. The subsection's content starts on the line after the heading and ends just before the next heading of equal or higher level (i.e., same or fewer = characters).
Before scanning for instructions, mark all NOTE blocks in the subsection so they can be excluded. AsciiDoc NOTE blocks appear in two forms:
[NOTE] followed by ==== on the next line, and ends at the closing ====.NOTE: (no delimiter).Any instruction name that appears only inside NOTE blocks — and nowhere else in the subsection — must be excluded from the output. If an instruction appears both inside and outside a NOTE block, include it.
Scan the non-NOTE text of the subsection for RISC-V instruction names. Instruction names appear as uppercase tokens in the prose. Use the following rules to identify them:
Patterns that indicate an instruction name:
ADD, ADDI, MULHSU, FENCE.TSO, LR.W, SC.D, C.ADD, C.ADDI16SP)`ADD`, `JALR`(((MUL, MULH))) — extract each comma-separated token//.Integer register-register — skip these (they are labels, not instructions)Exclude pseudoinstructions: The prose explicitly signals pseudoinstructions with the phrase "assembler pseudoinstruction" or "pseudoinstruction" adjacent to the name, e.g.:
assembler pseudoinstruction SNEZ _rd, rs_assembler pseudoinstruction MV _rd, rs1_assembler pseudoinstruction SEQZ _rd, rs_assembler pseudoinstruction NOT _rd, rs_assembler pseudoinstruction Jassembler pseudoinstruction RETassembler pseudoinstruction JRAny token introduced by "pseudoinstruction" (with or without "assembler") must be excluded, even if it appears elsewhere in the subsection outside a pseudoinstruction context. Collect all pseudoinstruction names first, then exclude them from the final list.
Definitive exclusion list — never treat these as instructions:
XLEN, RV32, RV64, RV32I, RV64I, RV128I, ISA, ABI, PC, CSR, IALIGN, BTB, RAS, FPGA, MIPS, RISC, RISCV, RISC-V
Tokens that are register names (x0–x31, rd, rs1, rs2) — exclude them.
ADD → add, MULHSU → mulhsu, FENCE.TSO → fence.tso, LR.W → lr.w)Derive the output filename from argument 1: lowercase it and replace spaces with hyphens (e.g., "Multiplication Operations" → multiplication-operations). Write /tmp/<derived-name>.yaml with the following format:
instructions:
- add
- addi
- mul
- mulh
Use the Write tool to create the file.
Print a summary:
/tmp/multiplication-operations.yaml)For subsection "Multiplication Operations" in ext/riscv-isa-manual/src/m-st-ext.adoc, the output file is /tmp/multiplication-operations.yaml:
instructions:
- mul
- mulh
- mulhsu
- mulhu
- mulw