Replies: 7 comments 8 replies
-
Stepping up a level, there are several things we want to identify about each statement in the prose.
Given that, here is a strawman for how we might represent prose in the database: For the prose:
description:
- type: spec # short for normative
text: |
The `mimpid` CSR provides a unique encoding of the version of the processor implementation.
id: misa-01
- type: spec
text: |
This register must be readable in any implementation,
but a value of 0 can be returned to indicate that the field is not implemented.
misa-02
- type: spec
text: |
The Implementation value should reflect the design of the RISC-V processor itself
and not any surrounding system.
id: misa-03
- type: spec
text: |
The `mimpid` CSR is MXLEN (32) bits long.
cond: XLEN == 32
id: misa-04
- type: spec
text: |
The `mimpid` CSR is MXLEN (64) bits long.
cond: XLEN == 64
id: misa-05
- type: info # short for non-normative
text: |
The format of this field is left to the provider of the architecture source code,
but will often be printed by standard tools as a hexadecimal string without any leading
or trailing zeros, so the Implementation value can be left-justified (i.e., filled in from
most-significant nibble down) with subfields aligned on nibble boundaries to ease human
readability.
id: misa-06 Things I like:
Things I don't like:
Note that we can probably come up with a way to generate the ids so you would never have to hand-type those. Thoughts? |
Beta Was this translation helpful? Give feedback.
-
Those "id" fields might become a pain to maintain. Do they need to persist, forever associated with the text? If a statement gets split during editing, does the original "id" need to continue to be associated with each new statement? I guess there could be some CI magic that tried to maintain order, but even that seems challenging. (Maybe it's good that editing the spec will become very difficult, and require great attention to detail?) |
Beta Was this translation helpful? Give feedback.
-
I'm thinking that we'd add the tags into the adoc source using some standard format and then extract them from the adoc into the database. I'm meeting with @kbroch-rivosinc and @edolnx today at 2pm Pacific to discuss this. In particular, I'm wondering if adoc supports something like a macro that we can type into the adoc and then extract with something like the Ruby asciidoctor library. |
Beta Was this translation helpful? Give feedback.
-
Yes, it will be a challenge. Asciidoc tags are block-oriented. I'm not sure you can tag a since sentence in a paragraph, which we'd have to do to get the resolution James is looking for to get CSC requirement pointers. Or restructure the manual so each statement is a block/paragraph. FWIW, I've found the asciidoctor AST difficult to work with. There is no way (that I can find) to dump and reload the AST with modifications, so it'd be hard to programmatically add metadata to the AST without a custom version of asciidoctor. |
Beta Was this translation helpful? Give feedback.
-
I was imagining something like this:
|
Beta Was this translation helpful? Give feedback.
-
After brainstorming with Carl and Kevin, we think we have a plan. CTP (Certification Test Plans) will refer to rules (AKA assertions, AKA functional requirements) defined in the UDB appendices (extensions, instructions, CSRs) and then UDB will have links to the ISA manual and/or IDL. We use the standard adoc facilities for tagging (see riscv/riscv-isa-manual#1397) so that tags are only visible in the ISA manual adoc source. The tags provide static IDs. In the case when one rule in UDB needs to point to multiple tags in the ISA manual, we'll allow a UDB rule to be a list of tags (this is the one to many case). The inverse is also possible where one ISA manual tag is shared by several UDB rules (the many to one case). In either case, this is a 1:1 relationship between CTP coverage points and UDB rules. So, in summary, use UDB rules as a level of indirection between the CTP and ISA manuals. We also want to allow UDB rules to point to IDL code in addition to ISA manual adoc tags. So, I can imagine adding a section to the UDB appendices for a list of rules associated with its corresponding content (extension, instruction, or CSR) that then each have one or more ISA manual adoc tags and IDL tags. We'll have to invent a way to add tags to the IDL that get ignored when converting to things like C++ models but can become adoc tags in the UDB-generated appendices. I'll mock all this up for the M extension and then eventually MC100. |
Beta Was this translation helpful? Give feedback.
-
See the discussion in riscv/riscv-isa-manual#1397 for nuances about how to add anchors and cross references in AsciiDoc that I'm summarizing. |
Beta Was this translation helpful? Give feedback.
-
We've tried two methods to conditionally apply asciidoc source depending on parameters or equations.
First, we tried using ERB. It works fine but requires some basic knowledge of Ruby.
Second, we tried using a [when,"condition"] Asciidoc style. It works for asciidoctor.js because I made a plugin, but doesn't work with asciidoctor(-pdf) because there is no plugin there yet.
I'm not sold on either approach. More discussion is needed.
Beta Was this translation helpful? Give feedback.
All reactions