-
Notifications
You must be signed in to change notification settings - Fork 141
feat(doc): add schema doc generator and initial Docusaurus content #1758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 11 commits
dfc9ff7
5e144fa
e581557
fb46fbb
5c4f219
516890c
df61f79
ffe64d9
8450188
d7179f4
87334ac
03ffcf0
7f3f729
6d10308
f575fe1
fcb00ac
381880a
7b1b884
70ff5a8
12bdf08
f5cdaf8
4afe917
1665dbf
0e46a69
a091677
912da3d
eea3e5d
9153e67
8dd2b88
c4fd939
b8334db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,46 @@ | ||||||||||||||||||||||||||||||||||||||||
| name: Docs Preview | ||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||||||||||||||||
| branches: [doc_next] | ||||||||||||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||||||||||||||||
| pages: write | ||||||||||||||||||||||||||||||||||||||||
| id-token: write | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| concurrency: | ||||||||||||||||||||||||||||||||||||||||
| group: "docs-preview" | ||||||||||||||||||||||||||||||||||||||||
| cancel-in-progress: true | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||
| build-and-deploy: | ||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||
| environment: | ||||||||||||||||||||||||||||||||||||||||
| name: github-pages | ||||||||||||||||||||||||||||||||||||||||
| url: ${{ steps.deployment.outputs.page_url }} | ||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | ||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||
| submodules: recursive | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| - name: Install Node dependencies | ||||||||||||||||||||||||||||||||||||||||
| run: npm ci | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| - name: Build Docusaurus site | ||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||
| DOCUSAURUS_URL: https://dhower-qc.github.io | ||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this expected to remain (for now)? |
||||||||||||||||||||||||||||||||||||||||
| DOCUSAURUS_BASE_URL: /riscv-unified-db/ | ||||||||||||||||||||||||||||||||||||||||
| run: npm run build --workspace=doc | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+27
to
+34
|
||||||||||||||||||||||||||||||||||||||||
| - name: Install Node dependencies | |
| run: npm ci | |
| - name: Build Docusaurus site | |
| env: | |
| DOCUSAURUS_URL: https://dhower-qc.github.io | |
| DOCUSAURUS_BASE_URL: /riscv-unified-db/ | |
| run: npm run build --workspace=doc | |
| - name: Setup pinned toolchain | |
| uses: ./.github/actions/mise-setup | |
| - name: Install Node dependencies | |
| run: ./bin/npm ci | |
| - name: Build Docusaurus site | |
| env: | |
| DOCUSAURUS_URL: https://dhower-qc.github.io | |
| DOCUSAURUS_BASE_URL: /riscv-unified-db/ | |
| run: ./bin/npm run build --workspace=doc |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "label": "Concepts", | ||
| "position": 2, | ||
| "link": { | ||
| "type": "generated-index", | ||
| "description": "Core concepts for working with the RISC-V Unified Database." | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "label": "Configurations", | ||
| "position": 1, | ||
| "link": { | ||
| "type": "generated-index", | ||
| "description": "Understanding configuration files in UDB." | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| --- | ||
| sidebar_position: 1 | ||
| status: in-progress | ||
| --- | ||
|
|
||
| # Configurations Overview | ||
|
|
||
| :::warning[Status: In Progress] | ||
| This documentation is partially complete. Some sections may be missing or outdated. | ||
| ::: | ||
|
|
||
| A **configuration** is a YAML file that describes a RISC-V system or family of systems by specifying which extensions are implemented, what their parameter values are, and how implementation-defined behavior is resolved. Configurations control how UDB generates artifacts — from fully general tools to highly specialized ISS code — and also provide a **standard machine-readable format** for precisely describing RISC-V implementations (used, for example, in RISC-V certification applications). | ||
|
|
||
| Configurations are also where **spec overlays** are enabled, allowing vendor-specific customizations to be applied on top of the standard specification data (see [The Data Pipeline](../data-pipeline/overview.md)). | ||
|
|
||
| :::tip Schema Reference | ||
| For the complete technical schema definition including all fields and validation rules, see the [Configuration Schema Reference](/docs/schemas/v0.1/config_schema). | ||
| ::: | ||
|
|
||
| ## Why Configurations Exist | ||
|
|
||
| The RISC-V ISA is highly modular and leaves many details up to implementers: | ||
|
|
||
| - **Extension selection**: Does this system support floating-point? Vector? Compressed instructions? | ||
| - **MXLEN**: Is this a 32-bit or 64-bit M-mode machine (or does it support both)? | ||
| - **Parameters**: How wide is the physical address space? Are misaligned accesses supported? What exceptions are reported in `mtval`? | ||
| - **Optional features**: Is the `misa` CSR implemented? Can extensions be dynamically enabled/disabled? | ||
|
|
||
| UDB's specification data describes **all possible behaviors** across the entire RISC-V design space. A configuration lets you specify **how much you know** about the target system — from nothing (the full design space) to everything (a specific implementation) — and UDB generates artifacts appropriate to that level of specificity. | ||
|
|
||
| ## The Three Types of Configurations | ||
|
|
||
| UDB supports three levels of specificity, each serving different use cases: | ||
|
|
||
| ### 1. Fully Configured (`type: fully configured`) | ||
|
|
||
| **Specifies every parameter and extension** — represents a single concrete implementation. | ||
|
|
||
| Every implementation-defined choice is pinned to a value. This is what you use to model a real hardware design or generate an ISS for a specific chip. | ||
|
|
||
| **Example**: `cfgs/mc100-32-full-example.yaml` — a complete MC100-32 processor configuration with all extensions, parameters, and CSR behaviors fully specified. | ||
|
|
||
| **Use cases**: | ||
| - Generating a configuration-specific ISS for a shipping product | ||
| - Producing documentation for a specific chip | ||
| - Validating that a design conforms to a RISC-V profile | ||
| - Submitting a design for certification | ||
|
|
||
| **Key property**: All IDL code can be fully evaluated and optimized; no unknowns remain. Generated artifacts are tailored to this exact configuration. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We haven't really introduced "IDL" here. Shall we substitute "semantic", instead, throughout? |
||
|
|
||
| ### 2. Partially Configured (`type: partially configured`) | ||
|
|
||
| **Specifies some parameters and extensions, leaving others unspecified** — represents a family of implementations that share common characteristics. | ||
|
|
||
| **Example**: `cfgs/rv32.yaml` — specifies `MXLEN: 32` and requires the `I` and `Sm` extensions, but leaves all other parameters and optional extensions unspecified. This describes "any RV32 system." | ||
|
|
||
| **Use cases**: | ||
| - Generating documentation or test suites that apply to a range of implementations | ||
| - Building tools for a product line or processor family | ||
| - Exploring "what if" scenarios (e.g., "what instructions are available if we add the `V` extension?") | ||
| - Defining a baseline for vendor-specific customization | ||
|
|
||
| **Key property**: Some IDL expressions can be evaluated (those depending only on known parameters), but code paths that depend on unknown parameters remain conditional. Generated artifacts must handle the full range of possibilities for unspecified parameters. | ||
|
|
||
| ### 3. Unconfigured (`type: unconfigured`) | ||
|
|
||
| **Specifies nothing** — represents the entire RISC-V design space with no constraints. | ||
|
|
||
| The special configuration **`_`** (underscore) is the canonical unconfigured architecture. | ||
|
|
||
| **Example**: `cfgs/_.yaml` — describes "any RVI-standard architecture" with no parameters set, not even `MXLEN`. | ||
|
|
||
| **Use cases**: | ||
| - Generating the full RISC-V specification manual (covering all possible behaviors) | ||
| - Building general-purpose tooling that works across all RISC-V systems (assemblers, disassemblers, debuggers) | ||
| - Studying the full scope of the ISA without implementation assumptions | ||
| - Generating schemas and abstract models | ||
|
|
||
| **Key property**: No IDL expressions can be evaluated at compile time; all parameter-dependent behavior must be preserved in generated artifacts. Generated code must be maximally generic. | ||
|
|
||
| ## Configuration File Structure | ||
|
|
||
| All configuration files share a common YAML structure: | ||
|
|
||
| ```yaml | ||
| $schema: config_schema.json# | ||
| kind: architecture configuration | ||
| type: fully configured | partially configured | unconfigured | ||
| name: MyConfig | ||
| description: A brief description of this configuration | ||
|
|
||
| # Full configs only: exact extensions and versions | ||
| implemented_extensions: # Omit for partial/unconfigured | ||
| - [ExtName, "version"] | ||
|
|
||
| # Partial configs only: minimum extension requirements | ||
| mandatory_extensions: # Omit for full/unconfigured | ||
| - name: "ExtName" | ||
| version: ">= min_version" | ||
|
|
||
| # All configs: parameter values | ||
| params: # Omit for unconfigured | ||
|
Comment on lines
+101
to
+102
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These 2 lines appear to be contradictory. |
||
| PARAM_NAME: value | ||
|
|
||
| # Optional: spec overlay directory | ||
| arch_overlay: path/to/overlay # See Config File Format and Data Pipeline | ||
| ``` | ||
|
|
||
| :::note | ||
| `arch_overlay` is the current name for the spec overlay feature. This will be renamed to `spec_overlay` in a future version for clarity. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shall we make that change now? |
||
| ::: | ||
|
|
||
| See [Config File Format](./config-file-format.md) for the complete reference. | ||
|
|
||
| ## What's Next | ||
|
|
||
| More detailed documentation on configurations is coming soon, including: | ||
|
|
||
| - Full Configurations — Detailed format and examples | ||
| - Partial Configurations — Specifying requirements without full detail | ||
| - Unconfigured — The `_` config and when to use it | ||
| - Config File Format — Complete YAML reference | ||
| - Validating Configs — Checking compliance and catching errors | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,7 +37,7 @@ See [Naming Rules](./variables#naming-rules). | |
| `if (x)` is a compilation error. An `if` condition must have type `Boolean`. You must write an explicit comparison: | ||
|
|
||
| ```idl | ||
| XReg src1 = X[rs1]; | ||
| XReg src1 = X[xs1]; | ||
|
|
||
| if (src1 != 0) { ... } # correct | ||
| # if (src1) { ... } # compilation error | ||
|
|
@@ -135,7 +135,7 @@ A Verilog-style literal with an explicit width that is too narrow to hold the va | |
|
|
||
| ```idl | ||
| Bits<4> x = 4'd-1; # -1 in 4 bits = 0b1111 = 15 (unsigned) — OK | ||
| Bits<3> y = 3'd-1; # truncates to 3 bits: 0b111 = 7 — sign bit lost | ||
| Bits<3> y = 4'd-1; # truncates to 3 bits: 0b111 = 7 — sign bit lost | ||
| ``` | ||
|
Comment on lines
135
to
139
|
||
|
|
||
| When encoding negative values, ensure the width is sufficient to hold the sign bit. Or use the 2's complement positive equivalent: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this from testing, or expected to remain? If so, we need to document what's going on here.