Skip to content

Commit dd6fdde

Browse files
committed
Address review comments
1 parent a96adf7 commit dd6fdde

3 files changed

Lines changed: 13 additions & 11 deletions

File tree

spec/cpu.typ

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,13 @@ The interactions with the memory, both for register loading and storing, as for
6262
Note that since registers need no byte-addressing, we store them in the memory argument with `Word` limbs.
6363
The `pc` register behaves very predictably with respect to its timestamps and when it is being read,
6464
so for performance reasons, we inline its memory interactions directly into the #cpu chip.
65-
The timestamps are ensured to be disjoint for disjoint memory locations.
65+
66+
Potentially overlapping memory accesses are ensured to have disjoint timestamps.
6667
One consequence of that is that `next_pc` is written at `timestamp + 1`
67-
to ensure the access is disjoint with the `pc` read into `rv1` as part of the `AUIPC` instruction.
68-
Constraints on `pc_double_read` corresponding to an `AUIPC` instruction are not necessary,
68+
to ensure the access is disjoint with the `pc` read into `rv1` as part of the `AUIPC` instruction (see @cpu:c:read_rv1 and @decode:decoding-overview).
69+
Constraints regarding whether `pc_double_read` corresponds to an `AUIPC` instruction are not necessary,
6970
as regardless of its value, the old timestamp is guaranteed smaller than the new timestamp,
70-
and the integrity of the memory argument therefor ensures the correctness of this bit.
71+
and the integrity of the memory argument therefore ensures the correctness of this bit.
7172

7273
#render_constraint_table(chip, config, groups: "mem")
7374

spec/decode.typ

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Given that `CPU` asserts that `EBREAK = 0` (see @cpu:c:ebreak_traps), using this
3939
Note moreover that the `pc` is set to $7$.
4040
This value is the _smallest odd number_ (i.e., not reachable during regular execution) that is more than _$4$_ (i.e., the max `pc`-increment) greater than _$1$_ (i.e., the `pc`-value used in the #link(<cpu-padding-decode-row>)[additional instruction] referred to by `CPU`-padding lines).
4141

42-
= Decoding
42+
= Decoding<decode:decoding-overview>
4343
For the purposes of explaining decoding, we decompress #decode's `packed_decode` variable into its constituent variables.
4444
Note that the below table is _not_ used in practice: it is solely used for the purposes of this explanation.
4545

@@ -64,12 +64,6 @@ For the purpose of brevity and readability, the table uses the following rules-o
6464

6565
Further clarification is provided in the notes following the table.
6666

67-
== C-type instructions
68-
The `RV64C` extension for compressed instructions specifies that \~50% of all instructions can be represented using a 16-bit instruction (rather than 32-bits), saving \~25% in code size.
69-
This execution of assembly code is _not_ agnostic to an instruction's compression state; after executing a compressed instruction, the `pc` should be incremented by $2$ rather than $4$.
70-
To indicate an instruction is provided in compressed form, the `c_type` flag is introduced.
71-
*This flag should be set to $1$ whenever the decoded instruction is provided in compressed form and $0$ otherwise.*
72-
7367
/// Add a reference to one or more notes following this table.
7468
#let ref_note(..refs) = {
7569
super("[" + refs.pos().map(r => ref(r)).join(",") + "]")
@@ -152,6 +146,12 @@ To indicate an instruction is provided in compressed form, the `c_type` flag is
152146

153147
#decoding_table(decoding)
154148

149+
== C-type instructions
150+
The `RV64C` extension for compressed instructions specifies that \~50% of all instructions can be represented using a 16-bit instruction (rather than 32-bits), saving \~25% in code size.
151+
This execution of assembly code is _not_ agnostic to an instruction's compression state; after executing a compressed instruction, the `pc` should be incremented by $2$ rather than $4$.
152+
To indicate an instruction is provided in compressed form, the `c_type` flag is introduced.
153+
*This flag should be set to $1$ whenever the decoded instruction is provided in compressed form and $0$ otherwise.*
154+
155155
// Construct a note that can be referenced through `lbl`
156156
#let referenceable_note(lbl, note) = {
157157
show figure: (it) => align(left, [#it])

spec/src/cpu.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ tag = "MEMW"
664664
input = [1, ["*", ["cast", 2, "DWordWL"], "rs1"], ["arr", ["idx", ["cast", "rv1", "DWordWL"], 0], ["idx", ["cast", "rv1", "DWordWL"], 1], 0, 0, 0, 0, 0, 0], ["+", "timestamp", ["cast", 0, "DWordWL"]], 1, 0, 0]
665665
output = ["arr", ["idx", ["cast", "rv1", "DWordWL"], 0], ["idx", ["cast", "rv1", "DWordWL"], 1], 0, 0, 0, 0, 0, 0]
666666
multiplicity = "read_register1"
667+
ref = "cpu:c:read_rv1"
667668

668669
[[constraints.mem]]
669670
kind = "arith"

0 commit comments

Comments
 (0)