Skip to content

Commit

Permalink
Add basic support for tagging text in the spec
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Timmmm committed Dec 11, 2024
1 parent 89e3947 commit df82d4a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ OPTIONS := --trace \
-a mathematical-format=svg \
-a pdf-fontsdir=docs-resources/fonts \
-a pdf-theme=docs-resources/themes/riscv-pdf.yml \
-a docinfo=shared \
$(XTRA_ADOC_OPTS) \
-D build \
--failure-level=ERROR
Expand Down
22 changes: 22 additions & 0 deletions src/docinfo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<style>
/*
Any ID starting with 'qx_' (arbitrarily chosen to be unlikely to
be used by accident) is a snippet of specification text that has been
specifically tagged to allow referencing it robustly, for use cases
such as:
* Linking coverage, tests plans, tests, assertions etc. to parts of
the spec that they cover.
* Detecting when parts of the spec change. You can extract these
snippets via Asciidoc's docbook output and parsing the XML.
* Linking documentation (e.g. the implementation defined parameter list)
to the spec.
This adds a subtle decoration to make it easier to find tagged text.
*/
[id^="qx_"]:hover {
text-decoration: underline;
text-decoration-style: dotted;
text-decoration-color: gray;
}
</style>
3 changes: 2 additions & 1 deletion src/rv32.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ Most of the commentary for RV32I also applies to the RV64I base.

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

0 comments on commit df82d4a

Please sign in to comment.