Skip to content

Commit 46b4024

Browse files
authored
spec: cleanup before v0.2 (#479)
* spec: add backticks to section titles * spec: replace "columns" headers with "variables" * spec: auto count nr_variables * spec: standardize "optimizations"-section headers * spec/config: add missing spaces * spec/chip: rename *_column_table as *_variable_table * spec: drop table captions * spec/v0.2: turn note into aside * spec: place correctness arguments in separate section
1 parent 34afbba commit 46b4024

22 files changed

Lines changed: 101 additions & 105 deletions

spec/about_ecalls.typ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#import "/book.typ": book-page, aside
22
#import "/src.typ": load_config, load_chip
33
#import "/chip.typ": (
4-
render_chip_column_table,
4+
render_chip_variable_table,
55
total_nr_variables,
66
total_nr_instantiated_columns,
77
render_constraint_table,

spec/add.typ

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#import "/book.typ": book-page, et
22
#import "/src.typ": load_config, load_chip
3-
#import "/chip.typ": render_chip_column_table, render_chip_assumptions, render_constraint_table, set_nr_interactions, compute_nr_interactions,
3+
#import "/chip.typ": render_chip_variable_table, render_chip_assumptions, render_constraint_table, set_nr_interactions, compute_nr_interactions,
44

55
#let config = load_config()
66
#let chip = load_chip("src/add.toml", config)
@@ -23,7 +23,7 @@ It constrains that $#`diff` equiv #`lhs` - #`rhs` (mod 2^64)$ when the expressio
2323

2424
= Variables
2525
This template introduces #nr_interactions interaction(s).
26-
#render_chip_column_table(chip, config)
26+
#render_chip_variable_table(chip, config)
2727

2828
= Assumptions
2929
#render_chip_assumptions(chip, config)

spec/bitwise.typ

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#import "/src.typ": load_config, load_chip
33
#import "/chip.typ": (
44
render_chip_assumptions,
5-
render_chip_column_table,
5+
render_chip_variable_table,
66
total_nr_variables,
77
total_nr_instantiated_columns,
88
render_constraint_table,
@@ -19,14 +19,14 @@
1919
The #bitwise chips deal with precomputed lookup tables for bitwise boolean operations
2020
and convenience functionalities over small domains.
2121

22-
= Columns
22+
= Variables
2323
#let nr_variables = total_nr_variables(chip)
2424
#let nr_columns = total_nr_instantiated_columns(chip, config)
2525
#let nr_precomputed = ("input", "output").map(c => chip.variables.at(c)).flatten().len()
2626

2727
The #bitwise chip is comprised of #nr_variables variables that are expressed using #nr_columns columns.
2828
Of these, the _input_ and _output_ variables (#nr_precomputed in total) are precomputed.
29-
#render_chip_column_table(chip, config)
29+
#render_chip_variable_table(chip, config)
3030

3131
*Note*: This table contains one row for every possible value of `(X, Y, Z)`.
3232
As such, it has length $2^8 dot 2^8 dot 2^4 = 2^(20)$.
@@ -35,7 +35,7 @@ As such, it has length $2^8 dot 2^8 dot 2^4 = 2^(20)$.
3535
This chip adds the following interactions to the lookup:
3636
#render_constraint_table(chip, config)
3737

38-
= Areas of Optimization
38+
= Notes/Optimizations
3939
The following ideas may prove to be optimizations for the #bitwise chip:
4040
+ Extend `IS_BYTE[X]` to `ARE_BYTES[X, Y]`, such that two bytes are range checked at once.
4141
When only a single check is required, one can still execute `IS_BYTE[X] := ARE_BYTES[X, 0]`.

spec/book.typ

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,39 @@
99
version: "0.2",
1010
summary: (
1111
("PROOF SYSTEM", (
12-
("logup.typ", [LogUp argument], <logup>),
12+
("logup.typ", [`LogUp` argument], <logup>),
1313
("memory.typ", [Memory argument], <memory>),
1414
)),
1515
("OVERVIEW", (
1616
("variables.typ", [Variables], <vars>),
1717
("signatures.typ", [Signatures], <signatures>),
1818
)),
1919
("TEMPLATES", (
20-
("is_bit.typ", [IS_BIT template], <isbit>),
21-
("sign.typ", [SIGN template], <sign>),
22-
("add.typ", [ADD/SUB template], <add>),
23-
("neg.typ", [NEG template], <neg>),
20+
("is_bit.typ", [`IS_BIT` template], <isbit>),
21+
("sign.typ", [`SIGN` template], <sign>),
22+
("add.typ", [`ADD`/`SUB` template], <add>),
23+
("neg.typ", [`NEG` template], <neg>),
2424
)),
2525
("MEMORY", (
26-
("memw.typ", [MEMW chip], <memw>),
26+
("memw.typ", [`MEMW` chip], <memw>),
2727
)),
2828
("CPU", (
29-
("decode.typ", [DECODE table], <decode>),
30-
("cpu.typ", [CPU chip], <cpu>),
29+
("decode.typ", [`DECODE` table], <decode>),
30+
("cpu.typ", [`CPU` chip], <cpu>),
3131
)),
3232
("ALU", (
33-
("shift.typ", [SHIFT chip], <shift>),
34-
("branch.typ", [BRANCH chip], <branch>),
35-
("lt.typ", [LT chip], <lt>),
36-
("mul.typ", [MUL chip], <mul>),
37-
("dvrm.typ", [DVRM chip], <dvrm>),
38-
("load.typ", [LOAD chip], <load>),
39-
("bitwise.typ", [BITWISE chips], <bitwise>),
33+
("shift.typ", [`SHIFT` chip], <shift>),
34+
("branch.typ", [`BRANCH` chip], <branch>),
35+
("lt.typ", [`LT` chip], <lt>),
36+
("mul.typ", [`MUL` chip], <mul>),
37+
("dvrm.typ", [`DVRM` chip], <dvrm>),
38+
("load.typ", [`LOAD` chip], <load>),
39+
("bitwise.typ", [`BITWISE` chips], <bitwise>),
4040
)),
4141
("ECALLS", (
42-
("about_ecalls.typ", [About ECALL], <ecall>),
43-
("halt.typ", [HALT chip], <halt>),
44-
("commit.typ", [COMMIT chip], <commit>),
42+
("about_ecalls.typ", [About `ECALL`], <ecall>),
43+
("halt.typ", [`HALT` chip], <halt>),
44+
("commit.typ", [`COMMIT` chip], <commit>),
4545
))
4646
)
4747
)

spec/branch.typ

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#import "/src.typ": load_config, load_chip
33
#import "/chip.typ": (
44
render_chip_assumptions,
5-
render_chip_column_table,
5+
render_chip_variable_table,
66
compute_nr_interactions,
77
total_nr_variables,
88
total_nr_instantiated_columns,
@@ -18,13 +18,13 @@
1818

1919
The #branch chip computes the target address of a branching instruction.
2020

21-
= Columns
21+
= Variables
2222
#let nr_variables = total_nr_variables(chip)
2323
#let nr_columns = total_nr_instantiated_columns(chip, config)
2424
#let nr_interactions = compute_nr_interactions(chip)
2525

2626
The #branch chip is comprised of #nr_variables variables that are expressed using #nr_columns columns and leverages #nr_interactions interaction(s):
27-
#render_chip_column_table(chip, config)
27+
#render_chip_variable_table(chip, config)
2828

2929
= Assumptions
3030

spec/chip.typ

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@
142142
([#raw(var.name)], [$:=$], [#expr_to_math(var.pad)],)
143143
}
144144
},
145-
), caption: [Overview of padding values for #chip.name chip.])
145+
))
146146
}
147147

148-
/// Generates a table listing `chip`'s columns.
149-
#let render_chip_column_table(chip, config) = {
148+
/// Generates a table listing `chip`'s variables.
149+
#let render_chip_variable_table(chip, config) = {
150150

151151
// Render a definition's iterators
152152
let render_def_iters(iters) = {
@@ -235,7 +235,7 @@
235235
}
236236
(table.cell(colspan: 4, []), )
237237
},
238-
), caption: [Column overview of #chip.name chip.])
238+
))
239239
}
240240

241241
#let cref(obj, body) = {
@@ -278,7 +278,7 @@
278278
..for assumption in chip.assumptions {
279279
([#tag(assumption)], [#iters(assumption)], [#eval(assumption.desc, mode: "markup")])
280280
},
281-
), caption: [Assumption overview of #chip.name chip.])
281+
))
282282
}
283283

284284
/// Generates a table listing all interactions initiated by `chip`'s.
@@ -389,5 +389,5 @@
389389
}
390390
}
391391
}
392-
), caption: [Constraint overview of #chip.name chip.])
392+
))
393393
}

spec/commit.typ

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#import "/book.typ": book-page, aside
22
#import "/src.typ": load_config, load_chip
33
#import "/chip.typ": (
4-
render_chip_column_table,
4+
render_chip_variable_table,
55
total_nr_variables,
66
total_nr_instantiated_columns,
77
compute_nr_interactions,
@@ -16,13 +16,13 @@
1616
#let chip = load_chip("src/commit.toml", config)
1717
#let commit = raw(chip.name)
1818

19-
= Columns
19+
= Variables
2020
#let nr_variables = total_nr_variables(chip)
2121
#let nr_columns = total_nr_instantiated_columns(chip, config)
2222
#let nr_interactions = compute_nr_interactions(chip)
2323

2424
The #commit chip leverages #nr_variables variables, spanning #nr_columns columns and leverages #nr_interactions interactions:
25-
#render_chip_column_table(chip, config)
25+
#render_chip_variable_table(chip, config)
2626

2727
= Constraints
2828
In this VM, committing is considered equivalent to writing a value to `stdout`.

spec/cpu.typ

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#import "/src.typ": load_config, load_chip
33
#import "/chip.typ": (
44
render_chip_assumptions,
5-
render_chip_column_table,
5+
render_chip_variable_table,
66
total_nr_variables,
77
total_nr_instantiated_columns,
88
compute_nr_interactions,
@@ -19,13 +19,13 @@
1919
The #cpu chip coordinates memory accesses and dispatches to other chips for arithmetic and logical operations.
2020
It bases its decisions on the entry of the `DECODE` table (@decode) corresponding the the current program counter (PC).
2121

22-
= Columns
22+
= Variables
2323
#let nr_variables = total_nr_variables(chip)
2424
#let nr_columns = total_nr_instantiated_columns(chip, config)
2525
#let nr_interactions = compute_nr_interactions(chip)
2626

2727
The #cpu chip is comprised of #nr_variables variables that are expressed using #nr_columns columns and leverages #nr_interactions interaction(s):
28-
#render_chip_column_table(chip, config)
28+
#render_chip_variable_table(chip, config)
2929

3030
= Assumptions
3131
#render_chip_assumptions(chip, config)

spec/decode.typ

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#import "/src.typ": load_config, load_chip
33
#import "/chip.typ": (
44
render_chip_assumptions,
5-
render_chip_column_table,
5+
render_chip_variable_table,
66
total_nr_variables,
77
total_nr_instantiated_columns,
88
render_constraint_table,
@@ -21,12 +21,12 @@ For reasons of efficiency, data in this table is significantly compressed.
2121
Since reasoning about this compressed form is needlessly complex, the `decode (uncompressed)` section presents the same table in uncompressed form, and explains how to decode `RV64IM` assembly instructions to it.
2222
Instructions on how to compress the uncompressed table to form the compressed decode table, can be derived from the `packed_decode` variable provided below.
2323

24-
= Columns
24+
= Variables
2525
#let nr_variables = total_nr_variables(chip)
2626
#let nr_columns = total_nr_instantiated_columns(chip, config)
2727

2828
The #decode table is comprised of #nr_variables variables that are expressed using #nr_columns columns:
29-
#render_chip_column_table(chip, config)
29+
#render_chip_variable_table(chip, config)
3030

3131
= Padding
3232
The #decode table must be padded to a length that is a power of two.
@@ -46,7 +46,7 @@ Note that the below table is _not_ used in practice: it is solely used for the p
4646
#let config = load_config()
4747
#let uncompressed_chip = load_chip("src/decode_uncompressed.toml", config)
4848

49-
#render_chip_column_table(uncompressed_chip, config)
49+
#render_chip_variable_table(uncompressed_chip, config)
5050

5151
We will illustrate how each instruction should be expressed in this (uncompressed) decoding table.
5252
The columns of the accompanying table represent the following:
@@ -93,9 +93,7 @@ To indicate an instruction is provided in compressed form, the `c_type` flag is
9393
..lines.flatten(),
9494
table.hline(stroke: 1.5pt),
9595
table.footer([*Operation*], [*op-flag*], [*`w_instr`*], [*`signed`*], [*other*]),
96-
),
97-
caption: [Decoding table]
98-
)
96+
))
9997
}
10098

10199
#let decoding = (

spec/dvrm.typ

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#import "/book.typ": book-page
22
#import "/src.typ": load_config, load_chip
33
#import "/chip.typ": (
4-
render_chip_column_table,
4+
render_chip_variable_table,
55
total_nr_variables,
66
total_nr_instantiated_columns,
77
compute_nr_interactions,
@@ -19,13 +19,13 @@
1919

2020
The #dvrm chip provides division and remainder functionality, both signed and unsigned.
2121

22-
= Columns
22+
= Variables
2323
#let nr_variables = total_nr_variables(chip)
2424
#let nr_columns = total_nr_instantiated_columns(chip, config)
2525
#let nr_interactions = compute_nr_interactions(chip)
2626

2727
The #dvrm chip is comprised of #nr_variables variables that are expressed using #nr_columns columns and leverages #nr_interactions interaction(s):
28-
#render_chip_column_table(chip, config)
28+
#render_chip_variable_table(chip, config)
2929

3030
= Assumptions
3131
#render_chip_assumptions(chip, config)

0 commit comments

Comments
 (0)