Skip to content

Commit df82d4a

Browse files
committed
Add basic support for tagging text in the spec
This adds two things: 1. Custom CSS to add a subtle dotted underline on hover to any element with an ID starting with `qx_` (an arbitrary prefix unlikely to be used by chance). 2. An example tag `qx_x0_is_zero`, tagging the text that specifies that x0 is hardwired to 0. This just adds a single tag as an exmaple, but the intention is that such tags would be added throughout the spec, allowing coverage, test plans, tests, documentation, etc. to all link to specific parts of the spec. The text of these tags can also be extracted via Asciidoc's docbook output format, enabling more use cases such as monitoring for spec changes.
1 parent 89e3947 commit df82d4a

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ OPTIONS := --trace \
8383
-a mathematical-format=svg \
8484
-a pdf-fontsdir=docs-resources/fonts \
8585
-a pdf-theme=docs-resources/themes/riscv-pdf.yml \
86+
-a docinfo=shared \
8687
$(XTRA_ADOC_OPTS) \
8788
-D build \
8889
--failure-level=ERROR

src/docinfo.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<style>
2+
/*
3+
Any ID starting with 'qx_' (arbitrarily chosen to be unlikely to
4+
be used by accident) is a snippet of specification text that has been
5+
specifically tagged to allow referencing it robustly, for use cases
6+
such as:
7+
8+
* Linking coverage, tests plans, tests, assertions etc. to parts of
9+
the spec that they cover.
10+
* Detecting when parts of the spec change. You can extract these
11+
snippets via Asciidoc's docbook output and parsing the XML.
12+
* Linking documentation (e.g. the implementation defined parameter list)
13+
to the spec.
14+
15+
This adds a subtle decoration to make it easier to find tagged text.
16+
*/
17+
[id^="qx_"]:hover {
18+
text-decoration: underline;
19+
text-decoration-style: dotted;
20+
text-decoration-color: gray;
21+
}
22+
</style>

src/rv32.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ Most of the commentary for RV32I also applies to the RV64I base.
4040

4141
<<gprs>> shows the unprivileged state for the base
4242
integer ISA. For RV32I, the 32 `x` registers are each 32 bits wide,
43-
i.e., `XLEN=32`. Register `x0` is hardwired with all bits equal to 0.
43+
i.e., `XLEN=32`.
44+
[#qx_x0_is_zero]#Register `x0` is hardwired with all bits equal to 0.#
4445
General purpose registers `x1-x31` hold values that various
4546
instructions interpret as a collection of Boolean values, or as two's
4647
complement signed binary integers or unsigned binary integers.

0 commit comments

Comments
 (0)