Memory procedures
Module std::mem contains a set of utility procedures for working with random access memory.
| Procedure | Description |
|---|---|
| memcopy_words | Copies n words from read_ptr to write_ptr.read_ptr and write_ptr must be word-aligned.Stack transition looks as follows: [n, read_ptr, write_ptr, ...] -> [...] cycles: 15 + 16n |
| pipe_double_words_to_memory | Copies an even number of words from the advice_stack to memory. Input: [C, B, A, write_ptr, end_ptr, ...] Output: [C, B, A, write_ptr, ...] Where: - The words C, B, and A are the RPO hasher state - A is the capacity - C,B are the rate portion of the state - The value words = end_ptr - write_ptr must be positive and a multiple of 8Cycles: 9 + 6 * word_pairs |
| pipe_words_to_memory | Copies an arbitrary number of words from the advice stack to memory Input: [num_words, write_ptr, ...] Output: [C, B, A, write_ptr', ...] Cycles: even num_words: 43 + 9 * num_words / 2 odd num_words: 60 + 9 * round_down(num_words / 2) |
| pipe_preimage_to_memory | Moves an arbitrary number of words from the advice stack to memory and asserts it matches the commitment. Input: [num_words, write_ptr, COM, ...] Output: [write_ptr', ...] Cycles: even num_words: 62 + 9 * num_words / 2 odd num_words: 79 + 9 * round_down(num_words / 2) |
| pipe_double_words_preimage_to_memory | Moves an even number of words from the advice stack to memory and asserts it matches the commitment. Input: [num_words, write_ptr, COM, ...] Output: [write_ptr', ...] Cycles: 56 + 3 * num_words / 2 |