miden-core-lib 0.22.2

Miden VM core library
Documentation
1
2
3
4
5
6
7
8
9
10

## miden::core::mem
| Procedure | Description |
| ----------- | ------------- |
| memcopy_words | Copies `n` words from `read_ptr` to `write_ptr`.<br /><br />`read_ptr` and `write_ptr` pointers *must be* word-aligned.<br /><br />Inputs:  [n, read_ptr, write_ptr]<br />Outputs: []<br /><br />Where:<br />- n is the number of words which should be copied.<br />- read_ptr is the memory pointer where the words to copy are stored.<br />- write_ptr is the memory pointer where the words will be copied.<br /><br />Total cycles: 15 + 16 * num_words<br /> |
| memcopy_elements | Copies `n` elements from `read_ptr` to `write_ptr`.<br /><br />Inputs:  [n, read_ptr, write_ptr]<br />Outputs: []<br /><br />Where:<br />- n is the number of elements which should be copied.<br />- read_ptr is the memory pointer where the elements to copy are stored.<br />- write_ptr is the memory pointer where the elements will be copied.<br /><br />Total cycles: 7 + 14 * num_elements<br /> |
| pipe_double_words_to_memory | Copies an even number of words from the advice_stack to memory, computing their permutation.<br /><br />Inputs:  [R0, R1, C, write_ptr, end_ptr]<br />Outputs: [R0', R1', C', write_ptr]<br /><br />Where:<br />- R0 is the first rate word (positions 0-3, on top of stack).<br />- R1 is the second rate word / digest (positions 4-7).<br />- C is the capacity word (positions 8-11).<br />- write_ptr is the memory pointer where the words will be copied.<br />- end_ptr is the memory pointer where the copying should end.<br /><br />Notice that the `end_ptr - write_ptr` value must be positive and a multiple of 8.<br /><br />Total cycles: 9 + 6 * num_word_pairs<br /> |
| pipe_words_to_memory | Copies an arbitrary number of words from the advice stack to memory, computing their permutation.<br /><br />Inputs:  [num_words, write_ptr]<br />Outputs: [R0, R1, C, write_ptr']<br /><br />Where:<br />- num_words is the number of words which will be copied to the memory.<br />- write_ptr is the memory pointer where the words will be copied.<br />- write_ptr' is the memory pointer to the end of the copied words.<br />- R0, R1, C are the final Poseidon2 hasher state (R0 on top).<br /><br />Total cycles:<br />- Even `num_words`: 43 + 9 * num_words / 2<br />- Odd `num_words`: 60 + 9 * round_down(num_words / 2)<br /> |
| pipe_preimage_to_memory | Moves an arbitrary number of words from the advice stack to memory and asserts it matches the<br />commitment.<br /><br />Inputs:  [num_words, write_ptr, COMMITMENT]<br />Outputs: [write_ptr']<br /><br />Where:<br />- num_words is the number of words which will be copied to the memory.<br />- write_ptr is the memory pointer where the words will be copied.<br />- write_ptr' is the memory pointer to the end of the copied words.<br />- COMMITMENT is the commitment that the one calculated during this procedure will be compared<br />with.<br /><br />Total cycles:<br />- Even `num_words`: 62 + 9 * num_words / 2<br />- Odd `num_words`: 79 + 9 * round_down(num_words / 2)<br /> |
| pipe_double_words_preimage_to_memory | Moves an even number of words from the advice stack to memory and asserts that their sequential<br />hash matches a given commitment.<br /><br />Inputs:  [num_words, write_ptr, COMMITMENT]<br />Outputs: [write_ptr']<br /><br />Where:<br />- num_words is the number of words which will be copied to the memory.<br />- write_ptr is the memory pointer where the words will be copied.<br />- write_ptr' is the memory pointer to the end of the copied words.<br />- COMMITMENT is the commitment that the one calculated during this procedure will be compared<br />with.<br /><br />Total cycles: 56 + 3 * num_words / 2<br /> |