Skip to main content
Version: Next (unstable)

Memory procedures

Module miden::core::mem contains a set of utility procedures for working with random access memory.

ProcedureDescription
memcopy_wordsCopies n words from read_ptr to write_ptr.

read_ptr and write_ptr pointers must be word-aligned.

Inputs: [n, read_ptr, write_ptr]
Outputs: []

Total cycles: 15+16∗num_words15 + 16 * num\_words
memcopy_elementsCopies n elements from read_ptr to write_ptr.

Inputs: [n, read_ptr, write_ptr]
Outputs: []

Total cycles: 7+14∗num_elements7 + 14 * num\_elements
pipe_double_words_to_memoryCopies an even number of words from the advice stack to memory while updating an Eidos state.

Inputs: [BLOCK_LO, BLOCK_HI, CV, write_ptr, end_ptr]
Outputs: [BLOCK_LO', BLOCK_HI', CV', write_ptr]

Where BLOCK_LO and BLOCK_HI are the two block words and CV is the Eidos chaining word (BLOCK_LO on top).

Notice that the end_ptr - write_ptr value must be positive and a multiple of 8.
pipe_words_to_memoryCopies an arbitrary number of words from the advice stack to memory while updating an Eidos state.

Inputs: [num_words, write_ptr]
Outputs: [BLOCK_LO, BLOCK_HI, CV, write_ptr']

Where BLOCK_LO and BLOCK_HI are the final block words and CV is the final Eidos chaining word (BLOCK_LO on top).
pipe_preimage_to_memoryMoves an arbitrary number of words from the advice stack to memory and asserts it matches the commitment.

Inputs: [num_words, write_ptr, COMMITMENT]
Outputs: [write_ptr']
pipe_double_words_preimage_to_memoryMoves an even number of words from the advice stack to memory and asserts it matches the commitment.

Inputs: [num_words, write_ptr, COMMITMENT]
Outputs: [write_ptr']