Skip to main content
Version: 0.12 (unstable)

System Operations

In this section we describe the AIR constraints for Miden VM system operations.

NOOP

The NOOP operation advances the cycle counter but does not change the state of the operand stack (i.e., the depth of the stack and the values on the stack remain the same).

The NOOP operation does not impose any constraints besides the ones needed to ensure that the entire state of the stack is copied over. This constraint looks like so:

sisi=0  for i[0,16) | degree=1s'_i - s_i = 0 \ \text{ for } i \in [0, 16) \text { | degree} = 1

EMIT

The EMIT operation interrupts execution for a single cycle and hands control to the host. During this interruption, the host can read the current state of the execution and modify the advice provider as it sees fit. From the VM's perspective, this operation has exactly the same semantics as NOOP - the operand stack remains completely unchanged.

By convention, the top element of the stack is used to encode an event ID (see the events documentation for details on event structure and usage). The host can use this event ID to determine what actions to take during the execution interruption.

ASSERT

The ASSERT operation pops an element off the stack and checks if the popped element is equal to 11. If the element is not equal to 11, program execution fails.

assert

Stack transition for this operation must satisfy the following constraints:

s01=0 | degree=1s_0 - 1 = 0 \text{ | degree} = 1

The effect on the rest of the stack is:

  • Left shift starting from position 11.

CLK

The CLK operation pushes the current value of the clock cycle onto the stack. The diagram below illustrates this graphically.

clk

The stack transition for this operation must follow the following constraint:

s0clk=0 | degree=1s_0' - clk = 0 \text{ | degree} = 1

The effect on the rest of the stack is:

  • Right shift starting from position 00.