ThinkOpenly / sail

Sail architecture definition language
Other
11 stars 12 forks source link

Consider using Sail-to-Asciidoc to better format the implementation pseudocode #3

Closed ThinkOpenly closed 8 months ago

ThinkOpenly commented 10 months ago

In the JSON backend, pulling the "formal model"/implementation/pseudocode from the Sail parser, as is currently done, already munges the code a bit. For example, riscv_insts_base.sail, addiw looks like:

{
  let result : xlenbits = sign_extend(imm) + X(rs1);
  X(rd) = sign_extend(result[31..0]);
  RETIRE_SUCCESS
}

but as currently parsed, appears like:

{
  let result : xlenbits = add_bits(sign_extend(64, imm), rX_bits(rs1)) in {
    wX_bits(rd, sign_extend(64, subrange_bits(result, 31, 0)));
    RETIRE_SUCCESS
  }
}

There might be some way to leverage the work being done by the "Sail to Asciidoc" project (https://github.com/Alasdair/asciidoctor-sail) for better parsing of some of the content. [Related talk: Sail to Asciidoc]

ThinkOpenly commented 8 months ago

Fixed by c74756f1da068db7410e3faa5c6c640728b7fa2b.

Huge thanks, @rod7760! :tada: