Skip to content

Commit 18a476e

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents eceecb0 + aeb39a3 commit 18a476e

2,337 files changed

Lines changed: 169400 additions & 632931 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
name: extract-instructions-from-subsection
3+
description: Extract RISC-V instruction names from a named subsection of an AsciiDoc file and write them to /tmp/<subsection-title>.yaml.
4+
argument-hint: <subsection-title> <adoc-file>
5+
allowed-tools: Read, Bash, Write
6+
---
7+
8+
Copyright (c) 2026 Qualcomm Technologies, Inc. and/or its subsidiaries.
9+
SPDX-License-Identifier: BSD-3-Clause-Clear
10+
11+
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`).
12+
13+
## Arguments
14+
15+
$ARGUMENTS
16+
17+
- **Argument 1**: The subsection title to search for (e.g., `"Multiplication Operations"` or `"Integer Register-Immediate Instructions"`).
18+
- **Argument 2**: Path to the AsciiDoc file (e.g., `ext/riscv-isa-manual/src/m-st-ext.adoc`).
19+
20+
If either argument is missing, ask the user to provide it.
21+
22+
## Steps
23+
24+
### 1. Read the AsciiDoc file
25+
26+
Read the full content of the AsciiDoc file given as argument 2.
27+
28+
### 2. Locate the subsection
29+
30+
Find the subsection whose title matches argument 1. AsciiDoc section headings use `=` prefixes:
31+
- `== Title` — level 1 (chapter)
32+
- `=== Title` — level 2
33+
- `==== Title` — level 3
34+
- `===== Title` — level 4
35+
36+
Match 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).
37+
38+
### 3. Identify NOTE blocks to skip
39+
40+
Before scanning for instructions, mark all NOTE blocks in the subsection so they can be excluded. AsciiDoc NOTE blocks appear in two forms:
41+
42+
- **Delimited block**: starts with `[NOTE]` followed by `====` on the next line, and ends at the closing `====`.
43+
- **Inline note**: a single line starting with `NOTE:` (no delimiter).
44+
45+
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.
46+
47+
### 4. Extract instruction names
48+
49+
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:
50+
51+
**Patterns that indicate an instruction name:**
52+
- All-uppercase tokens of at least 2 characters that consist only of letters, and optionally digits or dots (e.g., `ADD`, `ADDI`, `MULHSU`, `FENCE.TSO`, `LR.W`, `SC.D`, `C.ADD`, `C.ADDI16SP`)
53+
- Uppercase tokens inside backticks: `` `ADD` ``, `` `JALR` ``
54+
- Uppercase tokens in AsciiDoc index entries: `(((MUL, MULH)))` — extract each comma-separated token
55+
- Uppercase tokens in AsciiDoc comment lines like `//.Integer register-register` — skip these (they are labels, not instructions)
56+
57+
**Exclude pseudoinstructions:**
58+
The prose explicitly signals pseudoinstructions with the phrase "assembler pseudoinstruction" or "pseudoinstruction" adjacent to the name, e.g.:
59+
- `assembler pseudoinstruction SNEZ _rd, rs_`
60+
- `assembler pseudoinstruction MV _rd, rs1_`
61+
- `assembler pseudoinstruction SEQZ _rd, rs_`
62+
- `assembler pseudoinstruction NOT _rd, rs_`
63+
- `assembler pseudoinstruction J`
64+
- `assembler pseudoinstruction RET`
65+
- `assembler pseudoinstruction JR`
66+
67+
Any 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.
68+
69+
**Definitive exclusion list — never treat these as instructions:**
70+
`XLEN`, `RV32`, `RV64`, `RV32I`, `RV64I`, `RV128I`, `ISA`, `ABI`, `PC`, `CSR`, `IALIGN`, `BTB`, `RAS`, `FPGA`, `MIPS`, `RISC`, `RISCV`, `RISC-V`
71+
72+
Tokens that are register names (`x0``x31`, `rd`, `rs1`, `rs2`) — exclude them.
73+
74+
### 5. Deduplicate and normalize
75+
76+
- Convert all extracted names to **lowercase** (matching the RISC-V Unified Database YAML file naming convention, e.g., `ADD``add`, `MULHSU``mulhsu`, `FENCE.TSO``fence.tso`, `LR.W``lr.w`)
77+
- Remove duplicates
78+
- Sort alphabetically
79+
80+
### 6. Write the output
81+
82+
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:
83+
84+
```yaml
85+
instructions:
86+
- add
87+
- addi
88+
- mul
89+
- mulh
90+
```
91+
92+
Use the Write tool to create the file.
93+
94+
### 7. Report
95+
96+
Print a summary:
97+
- The subsection title found
98+
- The number of instructions extracted
99+
- The path written (e.g., `/tmp/multiplication-operations.yaml`)
100+
- The list of instructions
101+
102+
## Example
103+
104+
For subsection `"Multiplication Operations"` in `ext/riscv-isa-manual/src/m-st-ext.adoc`, the output file is `/tmp/multiplication-operations.yaml`:
105+
106+
```yaml
107+
instructions:
108+
- mul
109+
- mulh
110+
- mulhsu
111+
- mulhu
112+
- mulw
113+
```

.default-gems

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bundler -v 4.0.8

.devcontainer/Dockerfile

Lines changed: 56 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,117 @@
1-
FROM ubuntu:24.04
1+
FROM ubuntu:24.04@sha256:cd1dba651b3080c3686ecf4e3c4220f026b521fb76978881737d24f200828b2b
22
LABEL org.opencontainers.image.source=https://github.com/riscv/riscv-unified-db
33

44
ENV DEBIAN_FRONTEND=noninteractive
5+
ENV IN_UDB_CONTAINER=true
56

67
WORKDIR /workspace
78

89
# please keep pkgs sorted
910
RUN apt-get update && \
1011
apt-get install -y --no-install-recommends --fix-missing \
12+
bash-completion \
1113
build-essential \
1214
clang-format \
1315
clang-tidy \
14-
cmake \
1516
curl \
1617
ditaa \
1718
g++ \
1819
gcc-riscv64-linux-gnu \
1920
gcc-riscv64-unknown-elf \
2021
gdb \
21-
gh \
2222
git \
2323
gpg \
24+
gpg-agent \
2425
less \
2526
libc6-dev-riscv64-cross \
2627
libelf-dev \
2728
libgmp-dev \
2829
libnewlib-dev \
2930
libyaml-dev \
30-
libz3-dev \
31-
minisat \
32-
nodejs \
33-
npm \
3431
parallel \
35-
python3 \
36-
python3-pip \
37-
python3.12-venv \
38-
rustc \
39-
shellcheck \
32+
ssh \
4033
sudo \
4134
zlib1g-dev \
4235
\
4336
&& apt-get clean autoclean \
4437
&& apt-get autoremove -y \
4538
&& rm -rf /var/lib/{apt,dpkg,cache,log}/*
4639

47-
# build / install ruby
48-
COPY .ruby-version /opt/.ruby-version
49-
ENV RUBY_YJIT_ENABLE=1
50-
RUN git clone --depth=1 https://github.com/rbenv/ruby-build.git && \
51-
cd ruby-build && \
52-
./bin/ruby-build $(cat /opt/.ruby-version | tr -d "\n") /usr && \
53-
cd .. && \
54-
rm -rf ruby-build
55-
56-
# build/install eqntott
57-
RUN git clone --depth=1 https://github.com/TheProjecter/eqntott.git && \
58-
cd eqntott && \
59-
./configure && \
60-
make && make install && \
61-
cd .. && \
62-
rm -rf eqntott
40+
# Install mise for tool management
41+
# See: https://mise.jdx.dev/mise-cookbook/docker.html
42+
ENV MISE_DATA_DIR="/mise"
43+
ENV MISE_CONFIG_DIR="/mise"
44+
ENV MISE_CACHE_DIR="/mise/cache"
45+
ENV MISE_STATE_DIR="/mise/state"
46+
ENV MISE_INSTALL_PATH="/usr/local/bin/mise"
47+
ENV MISE_YES=1
48+
ENV MISE_TRUSTED_CONFIG_PATHS="/"
49+
ENV UV_CACHE_DIR="/tmp/uv-cache"
50+
ENV PATH="/mise/shims:$PATH"
6351

64-
# build/install espresso
65-
RUN git clone --depth=1 https://github.com/psksvp/espresso-ab-1.0.git && \
66-
cd espresso-ab-1.0 && \
67-
./configure && \
68-
make && make install && \
69-
cd .. && \
70-
rm -rf espresso-ab-1.0
52+
# renovate: datasource=github-releases depName=jdx/mise
53+
ARG MISE_VERSION=2026.4.4
54+
RUN MISE_VERSION=${MISE_VERSION} curl https://mise.run | sh
7155

72-
# build / install must
73-
# mcsmus/mcsmus/control.cc is missing #include <cstdio>, thus the sed below
74-
RUN git clone https://github.com/jar-ben/mustool.git && \
75-
cd mustool && \
76-
git checkout 17fa9f9542a9ce05328dfccd1cd410f05f741ab3 && \
77-
sed -i -e 's/#include <signal.h>/#include <signal.h>\n#include <cstdio>/' mcsmus/mcsmus/control.cc && \
78-
make -j && \
79-
install must -m 0777 /usr/bin/must && \
80-
cd .. && \
81-
rm -rf mustool
56+
# Install tools managed by mise (.mise.toml)
57+
COPY .mise.toml /mise/config.toml
58+
COPY .default-gems /mise/.default-gems
59+
RUN --mount=type=secret,id=MISE_GITHUB_TOKEN,env=MISE_GITHUB_TOKEN mise install
60+
RUN mise reshim
61+
RUN mkdir -p /mise/state && chmod -R 777 /mise
8262

83-
# Create Python virtual environment and install packages
84-
COPY requirements.txt /opt/requirements.txt
85-
RUN /usr/bin/python3 -m venv /opt/venv && \
86-
/opt/venv/bin/pip install -r /opt/requirements.txt && \
87-
rm /opt/requirements.txt
88-
ENV PATH="/opt/venv/bin:$PATH"
63+
# Sync Python project dependencies with uv
64+
COPY pyproject.toml uv.lock /opt/python/
65+
RUN cd /opt/python && uv sync
66+
ENV PATH="/opt/python/.venv/bin:$PATH"
67+
ENV UV_PROJECT_ENVIRONMENT="/opt/python/.venv"
68+
RUN mkdir -p /tmp/uv-cache && chmod -R 777 /tmp/uv-cache
8969

9070
# Install npm packages globally in the container
9171
COPY package.json package-lock.json /opt/node/
9272
RUN cd /opt/node && \
93-
/usr/bin/npm ci && \
73+
npm ci && \
9474
rm /opt/node/package.json /opt/node/package-lock.json
9575
ENV NODE_PATH="/opt/node/node_modules"
9676
ENV PATH="/opt/node/node_modules/.bin:$PATH"
97-
ENV IN_UDB_CONTAINER=true
9877

9978
# install gems
79+
ENV BUNDLE_PATH=/usr/local/bundle
80+
ENV BUNDLE_BIN=/usr/local/bundle/bin
81+
ENV GEM_HOME=/usr/local/bundle
82+
ENV GEM_PATH=/usr/local/bundle
83+
ENV PATH="/usr/local/bundle/bin:$PATH"
84+
85+
# Create the bundle directory
86+
RUN mkdir -p /usr/local/bundle \
87+
&& chmod 1777 /usr/local/bundle
88+
10089
COPY Gemfile /opt/Gemfile
10190
COPY Gemfile.lock /opt/Gemfile.lock
91+
COPY tools/ruby-gems/idlc/Gemfile /opt/tools/ruby-gems/idlc/
92+
COPY tools/ruby-gems/idlc/Gemfile.lock /opt/tools/ruby-gems/idlc/
10293
COPY tools/ruby-gems/idlc/idlc.gemspec /opt/tools/ruby-gems/idlc/
103-
COPY tools/ruby-gems/idlc/lib/gem_versions.rb /opt/tools/ruby-gems/idlc/lib/
10494
COPY tools/ruby-gems/idlc/lib/idlc/version.rb /opt/tools/ruby-gems/idlc/lib/idlc/
10595
COPY tools/ruby-gems/idl_highlighter/idl_highlighter.gemspec /opt/tools/ruby-gems/idl_highlighter/
10696
COPY tools/ruby-gems/idl_highlighter/lib/idl_highlighter/version.rb /opt/tools/ruby-gems/idl_highlighter/lib/idl_highlighter/
97+
COPY tools/ruby-gems/udb/Gemfile /opt/tools/ruby-gems/udb/
98+
COPY tools/ruby-gems/udb/Gemfile.lock /opt/tools/ruby-gems/udb/
10799
COPY tools/ruby-gems/udb/udb.gemspec /opt/tools/ruby-gems/udb/
108-
COPY tools/ruby-gems/udb/lib/gem_versions.rb /opt/tools/ruby-gems/udb/lib/
109100
COPY tools/ruby-gems/udb/lib/udb/version.rb /opt/tools/ruby-gems/udb/lib/udb/
101+
COPY tools/ruby-gems/udb/lib/udb/dep_versions.rb /opt/tools/ruby-gems/udb/lib/udb/
102+
COPY tools/ruby-gems/udb/ext/udb_download/extconf.rb /opt/tools/ruby-gems/udb/ext/udb_download/
103+
COPY tools/ruby-gems/udb-gen/Gemfile /opt/tools/ruby-gems/udb-gen/
104+
COPY tools/ruby-gems/udb-gen/Gemfile.lock /opt/tools/ruby-gems/udb-gen/
110105
COPY tools/ruby-gems/udb-gen/udb-gen.gemspec /opt/tools/ruby-gems/udb-gen/
111-
COPY tools/ruby-gems/udb-gen/lib/gem_versions.rb /opt/tools/ruby-gems/udb-gen/lib/
112106
COPY tools/ruby-gems/udb-gen/lib/udb-gen/version.rb /opt/tools/ruby-gems/udb-gen/lib/udb-gen/
113107
COPY tools/ruby-gems/udb_helpers/udb_helpers.gemspec /opt/tools/ruby-gems/udb_helpers/
114108
COPY tools/ruby-gems/udb_helpers/lib/udb_helpers/version.rb /opt/tools/ruby-gems/udb_helpers/lib/udb_helpers/
115-
RUN bundle install --gemfile /opt/Gemfile
109+
RUN bundle install --gemfile /opt/Gemfile --jobs $(nproc) \
110+
&& bundle install --gemfile /opt/tools/ruby-gems/idlc/Gemfile --jobs $(nproc) \
111+
&& bundle install --gemfile /opt/tools/ruby-gems/udb/Gemfile --jobs $(nproc) \
112+
&& bundle install --gemfile /opt/tools/ruby-gems/udb-gen/Gemfile --jobs $(nproc) \
113+
&& chmod -R a+rwX /usr/local/bundle \
114+
&& rm -f /usr/local/bundle/bin/bundle
116115

117116
# the binaries for gems need to be copied in
118117
RUN mkdir -p /workspace/bin/container

.devcontainer/devcontainer.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,16 @@
2323
},
2424
"extensions": [
2525
"asciidoctor.asciidoctor-vscode",
26-
"castwide.solargraph",
26+
"charliermarsh.ruff",
2727
"CraigMaslowski.erb",
2828
"HowerLimited.udb-extension-pack-vscode",
2929
"mathematic.vscode-pdf",
30+
"ms-azuretools.vscode-containers",
3031
"redhat.vscode-yaml",
31-
"zhwu95.riscv",
32+
"Shopify.ruby-lsp",
33+
"tamasfe.even-better-toml",
3234
"timonwong.shellcheck",
33-
"ms-azuretools.vscode-containers"
35+
"zhwu95.riscv"
3436
]
3537
}
3638
},

.devcontainer/docker-entrypoint.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@
33

44
# eclipse Xtext project owned by Ajit Dingankar
55
tools/eclipse @adingank-qualcomm @dhower-qc
6+
7+
# Renovate owned by Jordan Carlin
8+
renovate.json5 @jordancarlin

.github/actions/singularity-setup/action.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/autofix.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: autofix.ci # needed to securely identify the workflow
2+
3+
on:
4+
pull_request:
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
autofix:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
13+
with:
14+
fetch-depth: 0
15+
- uses: jdx/mise-action@v4
16+
- run: bundle install
17+
- run: IN_UDB_CONTAINER=1 BUNDLE_GEMFILE=$PWD/Gemfile ./bin/chore gen all
18+
- uses: autofix-ci/action@7a166d7532b277f34e16238930461bf77f9d7ed8 # v1.3.3

0 commit comments

Comments
 (0)