-
Notifications
You must be signed in to change notification settings - Fork 0
spec: ARE_BYTES
#532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
spec: ARE_BYTES
#532
Changes from all commits
e89a0e2
7e86d3d
9f93d5c
285ee04
ca217ff
315ebdc
c2c13d7
f8a0595
75216c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #import "/book.typ": book-page | ||
| #import "/src.typ": load_config, load_chip | ||
| #import "/chip.typ": render_chip_variable_table, render_constraint_table, compute_nr_interactions, total_nr_variables, total_nr_instantiated_columns | ||
|
|
||
| #let config = load_config() | ||
| #let chip = load_chip("src/is_byte.toml", config) | ||
|
|
||
| #show: book-page(chip.name) | ||
| #let is_byte = raw(chip.name) | ||
|
|
||
| #is_byte is a constraint template that is used to assert that a variable lies in the range $[0, 255]$ under the condition that `cond` is non-zero. Note: when `cond` is omitted, it defaults to $1$. | ||
|
|
||
| When a chip leverages this template twice or more, implementors are encouraged to merge pairs of #is_byte interactions with identical conditions into `ARE_BYTES` interactions; the #is_byte template is included for convenience of notation, and to complete the specification of chips that use an odd number of #is_byte range checks. | ||
|
|
||
| = Variables | ||
| #let nr_interactions = compute_nr_interactions(chip) | ||
|
|
||
| The #is_byte template leverages #nr_interactions interaction(s): | ||
| #render_chip_variable_table(chip, config) | ||
|
|
||
| = Constraints | ||
| #render_constraint_table(chip, config) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| name = "IS_BYTE" | ||
|
|
||
| [[variables.condition]] | ||
| name = "cond" | ||
| type = "BaseField" | ||
| desc = "" | ||
|
|
||
| [[variables.input]] | ||
| name = "X" | ||
| type = "BaseField" | ||
| desc = "Value for which to assert that it lies in the range $[0, 255]$." | ||
|
|
||
| [[constraint_groups]] | ||
| name = "all" | ||
|
|
||
| [[constraints.all]] | ||
| kind = "interaction" | ||
| tag = "ARE_BYTES" | ||
| input = [0, "X"] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Low – Constant
This is by design (the template exists for chips with an odd number of byte range-checks), but it's worth noting in the spec that the "waste" is intentional and that implementors should prefer pairing directly into No code change required — just flagging for visibility.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This is exactly what is written in the IS_BYTE template description. |
||
| multiplicity = "cond" | ||
| ref = "isbyte:c:isbyte" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Medium – Dead multiplicity variable
μ_IS_BYTEis no longer referenced in any constraint in this file. SinceIS_BYTEis now a template (not an interaction), BITWISE no longer contributes to anIS_BYTEinteraction, so this multiplicity column serves no purpose. It should be removed.