Skip to content
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

docs: making table headers consistent #1410

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions air/src/constraints/chiplets/hasher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ pub fn get_transition_constraint_count() -> usize {
/// Enforces constraints for the hasher chiplet.
///
/// - The `hasher_flag` determines if the hasher chiplet is currently enabled. It should be
/// computed by the caller and set to `Felt::ONE`
/// computed by the caller and set to `Felt::ONE`
/// - The `transition_flag` indicates whether this is the last row this chiplet's execution trace,
/// and therefore the constraints should not be enforced.
/// and therefore the constraints should not be enforced.
pub fn enforce_constraints<E: FieldElement<BaseField = Felt>>(
frame: &EvaluationFrame<E>,
periodic_values: &[E],
Expand Down
8 changes: 4 additions & 4 deletions air/src/constraints/stack/field_ops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ pub fn enforce_incr_constraints<E: FieldElement>(
/// enforced:
/// - The top element should be a binary. It is enforced as a general constraint.
/// - The first element of the next frame should be a binary not of the first element of
/// the current frame. s0` + s0 = 1.
/// the current frame. s0` + s0 = 1.
pub fn enforce_not_constraints<E: FieldElement>(
frame: &EvaluationFrame<E>,
result: &mut [E],
Expand All @@ -207,7 +207,7 @@ pub fn enforce_not_constraints<E: FieldElement>(
/// Enforces constraints of the AND operation. The AND operation computes the bitwise and of the
/// first two elements in the current trace. Therefore, the following constraints are enforced:
/// - The top two element in the current frame of the stack should be binary. s0^2 - s0 = 0,
/// s1^2 - s1 = 0. The top element is binary or not is enforced as a general constraint.
/// s1^2 - s1 = 0. The top element is binary or not is enforced as a general constraint.
/// - The first element of the next frame should be a binary and of the first two elements in the
/// current frame. s0` - s0 * s1 = 0.
pub fn enforce_and_constraints<E: FieldElement>(
Expand All @@ -234,7 +234,7 @@ pub fn enforce_and_constraints<E: FieldElement>(
/// Enforces constraints of the OR operation. The OR operation computes the bitwise or of the
/// first two elements in the current trace. Therefore, the following constraints are enforced:
/// - The top two element in the current frame of the stack should be binary. s0^2 - s0 = 0,
/// s1^2 - s1 = 0. The top element is binary or not is enforced as a general constraint.
/// s1^2 - s1 = 0. The top element is binary or not is enforced as a general constraint.
/// - The first element of the next frame should be a binary or of the first two elements in the
/// current frame. s0` - ( s0 + s1 - s0 * s1 ) = 0.
pub fn enforce_or_constraints<E: FieldElement>(
Expand Down Expand Up @@ -321,7 +321,7 @@ pub fn enforce_eqz_constraints<E: FieldElement>(
/// - The first element in the next frame should be a binary which is enforced as a general constraint.
/// - The exp value in the next frame should be the square of exp value in the current frame.
/// - The accumulation value in the next frame is the product of the accumulation value in the
/// current frame and the value which needs to be included in this turn.
/// current frame and the value which needs to be included in this turn.
/// - The b value is right shifted by 1 bit.
pub fn enforce_expacc_constraints<E: FieldElement>(
frame: &EvaluationFrame<E>,
Expand Down
2 changes: 1 addition & 1 deletion air/src/constraints/stack/op_flags/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl<E: FieldElement> OpFlags<E> {
/// - composite flag for the stack if the stack has been shifted to the right.
/// - composite flag if the current operation being executed is a control flow operation or not.
/// - composite flag if the current operation being executed has a binary element constraint on
/// the top element in the stack.
/// the top element in the stack.
pub fn new(frame: &EvaluationFrame<E>) -> Self {
// intermediary array to cache the value of intermediate flags.
let mut degree7_op_flags = [E::ZERO; NUM_DEGREE_7_OPS];
Expand Down
6 changes: 3 additions & 3 deletions air/src/constraints/stack/overflow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub fn enforce_stack_depth_constraints<E: FieldElement>(
/// Enforces constraints on the overflow flag h0. Therefore, the following constraints
/// are enforced:
/// - If overflow table has values, then, h0 should be set to ONE, otherwise it should
/// be ZERO.
/// be ZERO.
pub fn enforce_overflow_flag_constraints<E: FieldElement>(
frame: &EvaluationFrame<E>,
result: &mut [E],
Expand All @@ -108,9 +108,9 @@ pub fn enforce_overflow_flag_constraints<E: FieldElement>(

/// Enforces constraints on the bookkeeping index `b1`. The following constraints are enforced:
/// - In the case of a right shift operation, the next b1 index should be updated with current
/// `clk` value.
/// `clk` value.
/// - In the case of a left shift operation, the last stack item should be set to ZERO when the
/// depth of the stack is 16.
/// depth of the stack is 16.
pub fn enforce_overflow_index_constraints<E: FieldElement>(
frame: &EvaluationFrame<E>,
result: &mut [E],
Expand Down
4 changes: 2 additions & 2 deletions air/src/constraints/stack/stack_manipulation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub fn enforce_pad_constraints<E: FieldElement>(
/// at depth n in the stack and pushes the copy onto the stack, whereas MOVUPn opearation moves the
/// element at depth n to the top of the stack. Therefore, the following constraints are enforced:
/// - The top element in the next frame should be equal to the element at depth n in the
/// current frame. s0` - sn = 0.
/// current frame. s0` - sn = 0.
pub fn enforce_dup_movup_n_constraints<E: FieldElement>(
frame: &EvaluationFrame<E>,
result: &mut [E],
Expand Down Expand Up @@ -246,7 +246,7 @@ pub fn enforce_swapwx_constraints<E: FieldElement>(
/// Enforces constraints of the MOVDNn operation. The MOVDNn operation moves the top element
/// to depth n in the stack. Therefore, the following constraints are enforced:
/// - The top element in the current frame should be equal to the element at depth n in the
/// next frame. s0 - sn` = 0.
/// next frame. s0 - sn` = 0.
pub fn enforce_movdnn_constraints<E: FieldElement>(
frame: &EvaluationFrame<E>,
result: &mut [E],
Expand Down
8 changes: 4 additions & 4 deletions air/src/constraints/stack/u32_ops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub fn enforce_u32split_constraints<E: FieldElement<BaseField = Felt>>(
/// elements in the current trace of the stack. Therefore, the following constraints are
/// enforced:
/// - The aggregation of limbs from the helper registers is equal to the sum of the top two
/// element in the stack.
/// element in the stack.
pub fn enforce_u32add_constraints<E: FieldElement<BaseField = Felt>>(
frame: &EvaluationFrame<E>,
result: &mut [E],
Expand All @@ -139,7 +139,7 @@ pub fn enforce_u32add_constraints<E: FieldElement<BaseField = Felt>>(
/// elements in the current trace of the stack. Therefore, the following constraints are
/// enforced:
/// - The aggregation of limbs from the helper registers is equal to the sum of the top three
/// elements in the stack.
/// elements in the stack.
pub fn enforce_u32add3_constraints<E: FieldElement<BaseField = Felt>>(
frame: &EvaluationFrame<E>,
result: &mut [E],
Expand Down Expand Up @@ -287,9 +287,9 @@ pub fn enforce_check_element_validity<E: FieldElement<BaseField = Felt>>(
/// Enforces constraints of the general operation. The constaints checks if the lower 16-bits limbs
/// are aggregated correctly or not. Therefore, the following constraints are enforced:
/// - The aggregation of lower two lower 16-bits limbs in the helper registers is equal to the second
/// element in the next row.
/// element in the next row.
/// - The aggregation of lower two upper 16-bits limbs in the helper registers is equal to the first
/// element in the next row.
/// element in the next row.
pub fn enforce_limbs_agg<E: FieldElement<BaseField = Felt>>(
frame: &EvaluationFrame<E>,
result: &mut [E],
Expand Down
2 changes: 1 addition & 1 deletion core/src/operations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub enum Operation {
///
/// The top 4 elements of the stack are expected to be arranged as follows (form the top):
/// - least significant bit of the exponent in the previous trace if there's an expacc call,
/// otherwise ZERO
/// otherwise ZERO
/// - exponent of base number `a` for this turn
/// - accumulated power of base number `a` so far
/// - number which needs to be shifted to the right
Expand Down
2 changes: 1 addition & 1 deletion docs/src/user_docs/assembly/field_operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The arithmetic operations below are performed in a 64-bit [prime field](https://

### Extension Field Operations

| Instruction | Stack Input | Stack Output | Notes |
| Instruction | Stack_input | Stack_output | Notes |
| ---------------------------------- | --------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------- |
| ext2add <br> - *(5 cycles)* <br> | [b1, b0, a1, a0, ...] | [c1, c0, ...] | $c1 \leftarrow (a1 + b1) \mod p$ and <br> $c0 \leftarrow (a0 + b0) \mod p$ |
| ext2sub <br> - *(7 cycles)* <br> | [b1, b0, a1, a0, ...] | [c1, c0, ...] | $c1 \leftarrow (a1 - b1) \mod p$ and <br> $c0 \leftarrow (a0 - b0) \mod p$ |
Expand Down
2 changes: 1 addition & 1 deletion docs/src/user_docs/assembly/io_operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ The second category injects new data into the advice provider. These operations

Advice injectors fall into two categories: (1) injectors which push new data onto the advice stack, and (2) injectors which insert new data into the advice map.

| Instruction | Stack_input | Stack_output | Notes |
| Instruction | Stack_input | Stack_output | Notes |
| -------------------------------------------- | -------------------------- | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| adv.push_mapval <br> adv.push_mapval.*s* | [K, ... ] | [K, ... ] | Pushes a list of field elements onto the advice stack. The list is looked up in the advice map using word $K$ as the key. If offset $s$ is provided, the key is taken starting from item $s$ on the stack. |
| adv.push_mapvaln <br> adv.push_mapvaln.*s* | [K, ... ] | [K, ... ] | Pushes a list of field elements together with the number of elements onto the advice stack. The list is looked up in the advice map using word $K$ as the key. If offset $s$ is provided, the key is taken starting from item $s$ on the stack. |
Expand Down
8 changes: 4 additions & 4 deletions docs/src/user_docs/assembly/u32_operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ In all the table below, the number of cycles it takes for the VM to execute each

### Conversions and tests

| Instruction | Stack input | Stack output | Notes |
| Instruction | Stack_input | Stack_output | Notes |
| ---------------------------------------------- | ----------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| u32test <br> - *(5 cycles)* | [a, ...] | [b, a, ...] | $b \leftarrow \begin{cases} 1, & \text{if}\ a < 2^{32} \\ 0, & \text{otherwise}\ \end{cases}$ |
| u32testw <br> - *(23 cycles)* | [A, ...] | [b, A, ...] | $b \leftarrow \begin{cases} 1, & \text{if}\ \forall\ i \in \{0, 1, 2, 3\}\ a_i < 2^{32} \\ 0, & \text{otherwise}\ \end{cases}$ |
Expand All @@ -26,7 +26,7 @@ If the error code is omitted, the default value of $0$ is assumed.

### Arithmetic operations

| Instruction | Stack input | Stack output | Notes |
| Instruction | Stack_input | Stack_output | Notes |
| ----------------------------------------------------------------------------------------- | -------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| u32overflowing_add <br> - *(1 cycle)* <br> u32overflowing_add.*b* <br> - *(2-3 cycles)* | [b, a, ...] | [d, c, ...] | $c \leftarrow (a + b) \mod 2^{32}$ <br> $d \leftarrow \begin{cases} 1, & \text{if}\ (a + b) \ge 2^{32} \\ 0, & \text{otherwise}\ \end{cases}$ <br> Undefined if $max(a, b) \ge 2^{32}$ |
| u32wrapping_add <br> - *(2 cycles)* <br> u32wrapping_add.*b* <br> - *(3-4 cycles)* | [b, a, ...] | [c, ...] | $c \leftarrow (a + b) \mod 2^{32}$ <br> Undefined if $max(a, b) \ge 2^{32}$ |
Expand All @@ -44,7 +44,7 @@ If the error code is omitted, the default value of $0$ is assumed.

### Bitwise operations

| Instruction | Stack input | Stack output | Notes |
| Instruction | Stack_input | Stack_output | Notes |
| ------------------------------------------------------------------------------------- | -------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| u32and <br> - *(1 cycle)* | [b, a, ...] | [c, ...] | Computes $c$ as a bitwise `AND` of binary representations of $a$ and $b$. <br> Fails if $max(a,b) \ge 2^{32}$ |
| u32or <br> - *(6 cycle)s* | [b, a, ...] | [c, ...] | Computes $c$ as a bitwise `OR` of binary representations of $a$ and $b$. <br> Fails if $max(a,b) \ge 2^{32}$ |
Expand All @@ -63,7 +63,7 @@ If the error code is omitted, the default value of $0$ is assumed.

### Comparison operations

| Instruction | Stack input | Stack output | Notes |
| Instruction | Stack_input | Stack_output | Notes |
| -------------------------------------------------------------------------------- | ------------ | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| u32lt <br> - *(3 cycles)* | [b, a, ...] | [c, ...] | $c \leftarrow \begin{cases} 1, & \text{if}\ a < b \\ 0, & \text{otherwise}\ \end{cases}$ <br> Undefined if $max(a, b) \ge 2^{32}$ |
| u32lte <br> - *(5 cycles)* | [b, a, ...] | [c, ...] | $c \leftarrow \begin{cases} 1, & \text{if}\ a \le b \\ 0, & \text{otherwise}\ \end{cases}$ <br> Undefined if $max(a, b) \ge 2^{32}$ |
Expand Down
20 changes: 10 additions & 10 deletions processor/src/chiplets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,38 +38,38 @@ mod tests;
///
/// The module's trace can be thought of as 5 stacked chiplet segments in the following form:
/// * Hasher segment: contains the trace and selector for the hasher chiplet *
/// This segment fills the first rows of the trace up to the length of the hasher `trace_len`.
/// This segment fills the first rows of the trace up to the length of the hasher `trace_len`.
/// - column 0: selector column with values set to ZERO
/// - columns 1-17: execution trace of hash chiplet
///
/// * Bitwise segment: contains the trace and selectors for the bitwise chiplet *
/// This segment begins at the end of the hasher segment and fills the next rows of the trace for
/// the `trace_len` of the bitwise chiplet.
/// This segment begins at the end of the hasher segment and fills the next rows of the trace for
/// the `trace_len` of the bitwise chiplet.
/// - column 0: selector column with values set to ONE
/// - column 1: selector column with values set to ZERO
/// - columns 2-14: execution trace of bitwise chiplet
/// - columns 15-17: unused columns padded with ZERO
///
/// * Memory segment: contains the trace and selectors for the memory chiplet *
/// This segment begins at the end of the bitwise segment and fills the next rows of the trace for
/// the `trace_len` of the memory chiplet.
/// This segment begins at the end of the bitwise segment and fills the next rows of the trace for
/// the `trace_len` of the memory chiplet.
/// - column 0-1: selector columns with values set to ONE
/// - column 2: selector column with values set to ZERO
/// - columns 3-14: execution trace of memory chiplet
/// - columns 15-17: unused column padded with ZERO
///
/// * Kernel ROM segment: contains the trace and selectors for the kernel ROM chiplet *
/// This segment begins at the end of the memory segment and fills the next rows of the trace for
/// the `trace_len` of the kernel ROM chiplet.
/// This segment begins at the end of the memory segment and fills the next rows of the trace for
/// the `trace_len` of the kernel ROM chiplet.
/// - column 0-2: selector columns with values set to ONE
/// - column 3: selector column with values set to ZERO
/// - columns 4-9: execution trace of kernel ROM chiplet
/// - columns 10-17: unused column padded with ZERO
///
/// * Padding segment: unused *
/// This segment begins at the end of the kernel ROM segment and fills the rest of the execution
/// trace minus the number of random rows. When it finishes, the execution trace should have
/// exactly enough rows remaining for the specified number of random rows.
/// This segment begins at the end of the kernel ROM segment and fills the rest of the execution
/// trace minus the number of random rows. When it finishes, the execution trace should have
/// exactly enough rows remaining for the specified number of random rows.
/// - columns 0-3: selector columns with values set to ONE
/// - columns 3-17: unused columns padded with ZERO
///
Expand Down
Loading
Loading