Skip to content

Commit

Permalink
Separate immediates into separate wavedrom files. (#1631)
Browse files Browse the repository at this point in the history
* Separate immediates into separate wavedrom files.

This separates the immediates into separate wavedrom files which allows us to
add the caption to the last immediate on the page (j-immediate) which puts it
after the grouping of wavedroms correctly.

* Remove page break

---------

Co-authored-by: Andrew Waterman <andrew@sifive.com>
  • Loading branch information
wmat and aswaterman committed Sep 6, 2024
1 parent 39e1fcc commit 4a4efdc
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 45 deletions.
12 changes: 12 additions & 0 deletions src/images/wavedrom/b-immediate.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//#### B-immediate

[wavedrom, ,svg]
....
{reg: [
{bits: 1, name: '0'},
{bits: 4, name: 'inst[11:8]'},
{bits: 6, name: 'inst[30:25]'},
{bits: 1, name: '[7]'},
{bits: 20, name: '— inst[31] —'},
], config:{fontsize: 12, label:{right: 'B-immediate'}}}
....
14 changes: 14 additions & 0 deletions src/images/wavedrom/i-immediate.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//### Figure 2.4
//Types of immediate produced by RISC-V instructions. The fields are labeled with the instruction bits used to construct their value. Sign extension always uses inst[31].
//#### I-immediate

[wavedrom, ,svg]
....
{reg: [
{bits: 1, name: '[20]'},
{bits: 4, name: 'inst[24:21]'},
{bits: 6, name: 'inst[30:25]'},
{bits: 21, name: '— inst[31] —'},
], config:{fontsize: 12, label:{right: 'I-immediate'}}}
....

43 changes: 0 additions & 43 deletions src/images/wavedrom/immediate.edn
Original file line number Diff line number Diff line change
Expand Up @@ -11,50 +11,7 @@
{bits: 21, name: '— inst[31] —'},
], config:{fontsize: 12, label:{right: 'I-immediate'}}}
....
//#### S-immediate

[wavedrom, ,svg]
....
{reg: [
{bits: 1, name: '[7]'},
{bits: 4, name: 'inst[11:8]'},
{bits: 6, name: 'inst[30:25]'},
{bits: 21, name: '— inst[31] —'},
], config:{fontsize: 12, label:{right: 'S-immediate'}}}
....
//#### B-immediate

[wavedrom, ,svg]
....
{reg: [
{bits: 1, name: '0'},
{bits: 4, name: 'inst[11:8]'},
{bits: 6, name: 'inst[30:25]'},
{bits: 1, name: '[7]'},
{bits: 20, name: '— inst[31] —'},
], config:{fontsize: 12, label:{right: 'B-immediate'}}}
....
//#### U-immediate

[wavedrom, ,svg]
....
{reg: [
{bits: 12, name: '0'},
{bits: 8, name: 'inst[19:12]'},
{bits: 11, name: 'inst[30:20]'},
{bits: 1, name: '[31]'},
], config:{fontsize: 12, label:{right: 'U-immediate'}}}
....
//#### J-immediate

[wavedrom, ,svg]
....
{reg: [
{bits: 1, name: '0'},
{bits: 4, name: 'inst[24:21]'},
{bits: 6, name: 'inst[30:25]'},
{bits: 1, name: '[20]'},
{bits: 8, name: 'inst[19:12]'},
{bits: 12, name: '— inst[31] —'},
], config:{fontsize: 12, label:{right: 'J-immediate'}}}
....
13 changes: 13 additions & 0 deletions src/images/wavedrom/j-immediate.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//#### J-immediate

[wavedrom, ,svg]
....
{reg: [
{bits: 1, name: '0'},
{bits: 4, name: 'inst[24:21]'},
{bits: 6, name: 'inst[30:25]'},
{bits: 1, name: '[20]'},
{bits: 8, name: 'inst[19:12]'},
{bits: 12, name: '— inst[31] —'},
], config:{fontsize: 12, label:{right: 'J-immediate'}}}
....
11 changes: 11 additions & 0 deletions src/images/wavedrom/s-immediate.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//#### S-immediate

[wavedrom, ,svg]
....
{reg: [
{bits: 1, name: '[7]'},
{bits: 4, name: 'inst[11:8]'},
{bits: 6, name: 'inst[30:25]'},
{bits: 21, name: '— inst[31] —'},
], config:{fontsize: 12, label:{right: 'S-immediate'}}}
....
11 changes: 11 additions & 0 deletions src/images/wavedrom/u-immediate.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//#### U-immediate

[wavedrom, ,svg]
....
{reg: [
{bits: 12, name: '0'},
{bits: 8, name: 'inst[19:12]'},
{bits: 11, name: 'inst[30:20]'},
{bits: 1, name: '[31]'},
], config:{fontsize: 12, label:{right: 'U-immediate'}}}
....
14 changes: 12 additions & 2 deletions src/rv32.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,19 @@ formats and with each other.
<<immtypes>> shows the immediates produced by
each of the base instruction formats, and is labeled to show which
instruction bit (inst[_y_]) produces each bit of the immediate value.

[[immtypes, Immediate types]]
.Types of immediate produced by RISC-V instructions.
include::images/wavedrom/immediate.edn[]
include::images/wavedrom/i-immediate.edn[]

include::images/wavedrom/s-immediate.edn[]

include::images/wavedrom/b-immediate.edn[]

include::images/wavedrom/u-immediate.edn[]

.Types of immediate produced by RISC-V instructions.
include::images/wavedrom/j-immediate.edn[]


The fields are labeled with the instruction bits used to construct their value. Sign extensions always uses inst[31].

Expand Down

0 comments on commit 4a4efdc

Please sign in to comment.