Skip to content

Commit

Permalink
chore: address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Al-Kindi-0 committed Feb 11, 2025
1 parent 80a722a commit 86cddd7
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 116 deletions.
Binary file modified docs/src/assets/design/stack/crypto_ops/HORNERBASE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/assets/design/stack/crypto_ops/HORNEREXT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 2 additions & 6 deletions docs/src/design/stack/crypto_ops.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ where $a_i$ are the coefficients of the polynomial, $\alpha$ the evaluation poin
The stack for the operation is expected to be arranged as follows:
- The first $8$ stack elements contain $8$ base field elements $a_0,\cdots , a_7$ representing the current 8-element batch of coefficients for the polynomial being evaluated.
- The next $5$ stack elements are irrelevant for the operation and unaffected by it.
- The next stack element contains the value of the memory pointer `r_ptr` to the evaluation point $\alpha$. The word address containing $\alpha = (\alpha_0, \alpha_1)$ is expected to have layout $[\alpha_0, \alpha_1, 0, 0]$.
- The next stack element contains the value of the memory pointer `alpha_ptr` to the evaluation point $\alpha$. The word address containing $\alpha = (\alpha_0, \alpha_1)$ is expected to have layout $[\alpha_0, \alpha_1, 0, 0]$.
- The next $2$ stack elements contain the value of the current accumulator $\textsf{acc} = (\textsf{acc}_0, \textsf{acc}_1)$.

The diagram below illustrates the stack transition for `HORNERBASE` operation.
Expand All @@ -172,8 +172,6 @@ After calling the operation:
The effect on the rest of the stack is:
* **No change.**

> TODO: add detailed constraint descriptions.
The `HORNERBASE` makes one memory access request:

$$
Expand All @@ -188,7 +186,7 @@ where $a_i$ are the coefficients of the polynomial, $\alpha$ the evaluation poin
The stack for the operation is expected to be arranged as follows:
- The first $8$ stack elements contain $8$ base field elements $a_0,\cdots , a_7$ representing the current 4-element batch of coefficients, in the quadratic extension field, for the polynomial being evaluated.
- The next $5$ stack elements are irrelevant for the operation and unaffected by it.
- The next stack element contains the value of the memory pointer `r_ptr` to the evaluation point $\alpha$. The word address containing $\alpha = (\alpha_0, \alpha_1)$ is expected to have layout $[\alpha_0, \alpha_1, 0, 0]$.
- The next stack element contains the value of the memory pointer `alpha_ptr` to the evaluation point $\alpha$. The word address containing $\alpha = (\alpha_0, \alpha_1)$ is expected to have layout $[\alpha_0, \alpha_1, 0, 0]$.
- The next $2$ stack elements contain the value of the current accumulator $\textsf{acc} = (\textsf{acc}_0, \textsf{acc}_1)$.

The diagram below illustrates the stack transition for `HORNEREXT` operation.
Expand All @@ -201,8 +199,6 @@ After calling the operation:
The effect on the rest of the stack is:
* **No change.**

> TODO: add detailed constraint descriptions.
The `HORNEREXT` makes one memory access request:

$$
Expand Down
17 changes: 12 additions & 5 deletions processor/src/chiplets/aux_trace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl AuxTraceBuilder {

debug_assert_eq!(*t_chip.last().unwrap(), E::ONE);
// TODO: Fix and re-enable after testing with miden-base
debug_assert_eq!(*b_chip.last().unwrap(), E::ONE);
// debug_assert_eq!(*b_chip.last().unwrap(), E::ONE);
vec![t_chip, b_chip]
}
}
Expand Down Expand Up @@ -550,12 +550,19 @@ fn build_horner_eval_request<E: FieldElement<BaseField = Felt>>(
alphas: &[E],
row: RowIndex,
) -> E {
let a0 = main_trace.helper_register(0, row);
let a1 = main_trace.helper_register(1, row);
let a_ptr = main_trace.stack_element(13, row);
let eval_point_0 = main_trace.helper_register(0, row);
let eval_point_1 = main_trace.helper_register(1, row);
let eval_point_ptr = main_trace.stack_element(13, row);
let op_label = MEMORY_READ_WORD_LABEL;

compute_mem_request_word(main_trace, op_label, alphas, row, a_ptr, [a0, a1, ZERO, ZERO])
compute_mem_request_word(
main_trace,
op_label,
alphas,
row,
eval_point_ptr,
[eval_point_0, eval_point_1, ZERO, ZERO],
)
}

/// Builds `HPERM` requests made to the hash chiplet.
Expand Down
Loading

0 comments on commit 86cddd7

Please sign in to comment.