Constant ASM_YAML

Source
pub const ASM_YAML: &str = "Op:\n  description: |\n    All operations available to the Essential VM execution.\n  group:\n    Stack:\n      description: Operations related to stack manipulation.\n      group:\n        Push:\n          opcode: 0x01\n          description: Push one word onto the stack.\n          num_arg_bytes: 8\n          stack_out: [value]\n\n        Pop:\n          opcode: 0x02\n          description: Pop one word from the stack.\n          stack_in: [a]\n\n        Dup:\n          opcode: 0x03\n          description: Duplicate the top word on the stack.\n          stack_in: [value]\n          stack_out: [value, value]\n\n        DupFrom:\n          opcode: 0x04\n          short: DUPF\n          description: |\n            Duplicate the word at the given stack depth index.\n\n            `0` is the index of the element at the top of the stack.\n          stack_in: [index]\n          stack_out: [value_i]\n\n        Swap:\n          opcode: 0x05\n          description: Swap top two words on stack.\n          stack_in: [a, b]\n          stack_out: [b, a]\n\n        SwapIndex:\n          opcode: 0x06\n          short: SWAPI\n          description: |\n            Swap the top word on the stack with the word at the given stack depth index.\n\n            `0` is the index of the element at the top of the stack.\n          panics:\n            - Index is out of range.\n          stack_in: [a, b, c, d, index]\n          stack_out: [a, d, c, b]\n\n        Select:\n          opcode: 0x07\n          short: SEL\n          description: |\n            Conditionally keep one of the top two elements on the stack.\n\n            If condition is `true`, the top element is kept.\n          stack_in: [a, b, cond]\n          stack_out: [b]\n\n        SelectRange:\n          opcode: 0x08\n          short: SLTR\n          description: |\n            Conditionally keep one of the top two ranges on the stack.\n\n            If condition is `true`, the top range is kept.\n\n            The ranges must be of equal length.\n            The ranges must be stacked sequentially.\n            Here `N` is `len -1`.\n          stack_in: [arr_a_0, ..arr_a_N, arr_b_0, ..arr_b_N, len, cond]\n          stack_out: [arr_b_0, ..arr_b_N]\n\n        Repeat:\n          opcode: 0x09\n          short: REP\n          description: |\n            Repeat a section of code the number of times.\n            Takes a boolean to either count from 0 up or from the number of repeats down to 0.\n          stack_in: [num_repeats, count_up_bool]\n\n        RepeatEnd:\n          opcode: 0x0A\n          short: REPE\n          description: |\n            Increment or decrements the top counter on the repeat stack.\n            If the counter is counting up and `counter == limit - 1`\n            then this pops the counter and continues with the program.\n            If the counter is counting down and the counter is 0\n            then this pops the counter and continues with the program.\n            If it is `< limit - 1` or `> 0` respectively then the program jumps to\n            the last Repeat\n          panics:\n            - If there is no counter on the repeat stack.\n            - If there is no repeat registered to return to.\n\n        Reserve:\n          opcode: 0x0B\n          short: RES\n          description: |\n            Reserve space on the stack for `len` words.\n            The reserved space is set to 0.\n            Returns the index to the start of the reserved space.\n          stack_in: [len]\n          stack_out: [index]\n\n        Load:\n          opcode: 0x0C\n          short: LODS\n          description: |\n            Load the value at the given stack depth index relative to the bottom.\n\n            `0` is the index of the element at the bottom of the stack.\n          panics:\n            - Index is out of range.\n          stack_in: [index]\n          stack_out: [value]\n\n        Store:\n          opcode: 0x0D\n          short: STOS\n          description: |\n            Store the value at the given stack depth index relative to the bottom.\n\n            `0` is the index of the element at the bottom of the stack.\n          panics:\n            - Index is out of range.\n          stack_in: [value, index]\n\n        Drop:\n          opcode: 0x0E\n          short: DROP\n          description: Drop the top `n` elements from the stack.\n          stack_in: [n]\n\n    Pred:\n      description: Operations for computing predicates.\n      group:\n        Eq:\n          opcode: 0x10\n          description: Check equality of two words.\n          stack_in: [lhs, rhs]\n          stack_out: [\"lhs == rhs\"]\n\n        EqRange:\n          opcode: 0x11\n          short: EQRA\n          description: |\n            Check equality of two ranges on the stack.\n\n            The ranges must be of equal length.\n            The ranges must be stacked sequentially.\n            Here `N` is `len -1`.\n          stack_in: [arr_a_0, ..arr_a_N, arr_b_0, ..arr_b_N, len]\n          stack_out: [\"(top-(2*len))..(top - len) == (top - len)..top\"]\n\n        Gt:\n          opcode: 0x12\n          description: Check if left-hand side is greater than right-hand side.\n          stack_in: [lhs, rhs]\n          stack_out: [\"lhs > rhs\"]\n\n        Lt:\n          opcode: 0x13\n          description: Check if left-hand side is less than right-hand side.\n          stack_in: [lhs, rhs]\n          stack_out: [\"lhs < rhs\"]\n\n        Gte:\n          opcode: 0x14\n          description: Check if left-hand side is greater than or equal to right-hand side.\n          stack_in: [lhs, rhs]\n          stack_out: [\"lhs >= rhs\"]\n\n        Lte:\n          opcode: 0x15\n          description: Check if left-hand side is less than or equal to right-hand side.\n          stack_in: [lhs, rhs]\n          stack_out: [\"lhs <= rhs\"]\n\n        And:\n          opcode: 0x16\n          description: Logical AND of two words.\n          stack_in: [lhs, rhs]\n          stack_out: [\"lhs && rhs\"]\n\n        Or:\n          opcode: 0x17\n          description: Logical OR of two words.\n          stack_in: [lhs, rhs]\n          stack_out: [\"lhs || rhs\"]\n\n        Not:\n          opcode: 0x18\n          description: Logical NOT of a word.\n          stack_in: [a]\n          stack_out: [\"!a\"]\n\n        EqSet:\n          opcode: 0x19\n          short: EQST\n          description: |\n            Pop two sets off the stack and check if they are equal.\n            This is set equality so order does not matter.\n            Sets must be the same length.\n\n            Note the encoding of each set is:\n            `[elem_0_word_0, ...elem_0_word_I, elem_0_len, ...elem_N_word_0, ...elem_N_word_J, elem_N_len, set_len]`.\n\n            Note this differs from `EqRange` in that there is a size given at the end of both sets.\n          stack_in: [lhs, lhs_set_length, rhs, rhs_set_length]\n          stack_out: [set(lhs) == set(rhs)]\n\n        BitAnd:\n          opcode: 0x1A\n          short: BAND\n          description: Bitwise AND of two words.\n          stack_in: [lhs, rhs]\n          stack_out: [\"lhs & rhs\"]\n\n        BitOr:\n          opcode: 0x1B\n          short: BOR\n          description: Bitwise OR of two words.\n          stack_in: [lhs, rhs]\n          stack_out: [\"lhs | rhs\"]\n\n    Alu:\n      description: Operations for computing arithmetic and logic.\n      group:\n        Add:\n          opcode: 0x20\n          description: Add two words.\n          stack_in: [lhs, rhs]\n          stack_out: [\"lhs + rhs\"]\n\n        Sub:\n          opcode: 0x21\n          description: Subtract two words.\n          stack_in: [lhs, rhs]\n          stack_out: [\"lhs - rhs\"]\n\n        Mul:\n          opcode: 0x22\n          description: Multiply two words.\n          stack_in: [lhs, rhs]\n          stack_out: [\"lhs * rhs\"]\n\n        Div:\n          opcode: 0x23\n          description: Integer division.\n          stack_in: [lhs, rhs]\n          stack_out: [\"lhs / rhs\"]\n\n        Mod:\n          opcode: 0x24\n          description: Modulus of lhs by rhs.\n          stack_in: [lhs, rhs]\n          stack_out: [\"lhs % rhs\"]\n\n        Shl:\n          opcode: 0x25\n          description: Logical shift left by number of bits.\n          panics:\n            - Number of bits is negative.\n            - Number of bits is greater than a Word.\n          stack_in: [lhs, rhs, num_bits]\n          stack_out: [\"lhs << rhs\"]\n\n        Shr:\n          opcode: 0x26\n          description: Logical shift right by number of bits.\n          panics:\n            - Number of bits is negative.\n            - Number of bits is greater than a Word.\n          stack_in: [lhs, rhs]\n          stack_out: [\"lhs >> rhs\"]\n\n        ShrI:\n          opcode: 0x27\n          description: Arithmetic shift right by number of bits.\n          panics:\n            - Number of bits is negative.\n            - Number of bits is greater than a Word.\n          stack_in: [lhs, rhs]\n          stack_out: [\"lhs >> rhs\"]\n\n    Access:\n      description: Operations for accessing input data.\n      group:\n        ThisAddress:\n          opcode: 0x30\n          short: THIS\n          description: |\n            Get the content hash of this predicate.\n\n            This operation returns a list of words with a length of 4, representing the hash.\n          stack_out: [key]\n\n        ThisContractAddress:\n          opcode: 0x31\n          short: THISC\n          description: |\n            Get the content hash of the contract this predicate belongs to.\n\n            This operation returns a list of words with a length of 4, representing the contract\'s hash.\n          stack_out: [key]\n\n        # 0x32, 0x33, 0x34 reserved for potential new Address or related ops\n\n        # 0x35, 0x36, 0x37 reserved for potential keys and/or state-mutations ops\n\n        RepeatCounter:\n          opcode: 0x38\n          short: REPC\n          description: Access the top repeat counters current value.\n          stack_out: [counter_value]\n\n        # 0x39 reserved for repeat or related op\n\n        PredicateData:\n          opcode: 0x3A\n          short: DATA\n          description: |\n            Access a range of `len` words starting from `value_ix` within the\n            predicate data located at `slot_ix`.\n\n            Returns a list of predicate data words with length equal to the\n            specified len.\n          panics:\n            - slot_ix is out of range.\n            - The range `value_ix..(value_ix + len)` is out of range.\n          stack_in: [slot_ix, value_ix, len]\n          stack_out:\n            elem: word\n            len: len\n\n        PredicateDataLen:\n          opcode: 0x3B\n          short: DLEN\n          description: Get the length of a the predicate data value located at `slot_ix`.\n          panics:\n            - slot_ix is out of range.\n          stack_in: [slot_ix]\n          stack_out: [len]\n\n        PredicateDataSlots:\n          opcode: 0x3C\n          short: DSLT\n          description: Get the number of predicate data slots.\n          stack_out: [len]\n\n        PredicateExists:\n          opcode: 0x3D\n          short: PEX\n          description: |\n            Check if a solution to a predicate exists within the same solution\n            with the hash of the arguments and address.\n\n            Returns `true` if the predicate exists.\n          stack_in: [\"sha256(arg0len, arg0, argNlen, argN, contract_addr, predicate_addr)\"]\n          stack_out: [bool]\n\n        # 0x3E reserved for PredicateExists alternative with partial input (#222)\n\n    # 0x4* reserved for more Access ops\n\n    Crypto:\n      description: Operations providing cryptographic functionality.\n      group:\n        Sha256:\n          opcode: 0x50\n          short: SHA2\n          description: |\n            Produce a SHA 256 hash from the specified data.\n\n            Hashes are byte aligned so length is number of bytes **not** number of words.\n          panics:\n            - data_len * 8 is longer than the data.\n          stack_in: [data, data_len]\n          stack_out: [hash_w0, hash_w1, hash_w2, hash_w3]\n\n        VerifyEd25519:\n          opcode: 0x51\n          short: VRFYED\n          description: |\n            Validate an Ed25519 signature against a public key.\n\n            Data is byte aligned so length is number of bytes **not** number of words.\n          stack_in:\n            [\n              data,\n              data_len,\n              sig_w0,\n              sig_w1,\n              sig_w2,\n              sig_w3,\n              sig_w4,\n              sig_w5,\n              sig_w6,\n              sig_w7,\n              key_w0,\n              key_w1,\n              key_w2,\n              key_w3,\n            ]\n          stack_out: [bool]\n\n        RecoverSecp256k1:\n          opcode: 0x52\n          short: RSECP\n          description: |\n            Recover the public key from a secp256k1 signature.\n\n            If the signature is invalid, the operation will return all zeros.\n          stack_in:\n            [\n              hash_0,\n              hash_1,\n              hash_2,\n              hash_3,\n              sig_w0,\n              sig_w1,\n              sig_w2,\n              sig_w3,\n              sig_w4,\n              sig_w5,\n              sig_w6,\n              sig_w7,\n              sig_8,\n            ]\n          stack_out: [pub_key_w0, pub_key_w1, pub_key_w2, pub_key_w3, pub_key_4]\n\n    TotalControlFlow:\n      description: Control flow operations that keep the program total.\n      group:\n        Halt:\n          opcode: 0x60\n          short: HLT\n          description: End the execution of the program.\n\n        HaltIf:\n          opcode: 0x61\n          short: HLTIF\n          description: Halt the program if the value is true.\n          stack_in: [value]\n\n        JumpIf:\n          opcode: 0x62\n          short: JMPIF\n          description: Jump the given number of instructions if the value is true.\n          panics:\n            - The jump distance is zero.\n          stack_in: [n_instruction, condition]\n\n        PanicIf:\n          opcode: 0x63\n          short: PNCIF\n          description: |\n            Panic if the `condition` is true.\n\n            Returns the stack at the time of the panic\n            in the error message.\n          panics:\n            - The `condition` is true.\n          stack_in: [condition]\n\n    Memory:\n      description: Operations for memory.\n      group:\n        Alloc:\n          opcode: 0x70\n          short: ALOC\n          description: |\n            Allocate a new block of memory to the end.\n\n            Sets new memory to 0.\n\n            Returns the index to the start of the new block of memory.\n\n            Allocate 0 to get the current length of the memory.\n          panics:\n            - Max memory size reached.\n          stack_in: [size]\n          stack_out: [index]\n\n        Free:\n          opcode: 0x71\n          description: Truncate memory to the specified new length, freeing all that follows.\n          panics:\n            - The new length is negative.\n            - The new length is greater than the existing length.\n          stack_in: [new_length]\n\n        Load:\n          opcode: 0x72\n          short: LOD\n          description: Load the value at the given index from memory onto the stack.\n          panics:\n            - Index is out of bounds.\n          stack_in: [index]\n          stack_out: [value]\n\n        Store:\n          opcode: 0x73\n          short: STO\n          description: Store the value at the given index within memory.\n          panics:\n            - Index is out of bounds.\n          stack_in: [value, index]\n\n        LoadRange:\n          opcode: 0x74\n          short: LODR\n          description: Load a range of words starting at the index within memory.\n          panics:\n            - Index is out of bounds.\n            - Index + len is out of bounds.\n          stack_in: [index, len]\n          stack_out: [values]\n\n        StoreRange:\n          opcode: 0x75\n          short: STOR\n          description: Store a range of words starting at the index within memory.\n          panics:\n            - Index is out of bounds.\n            - Index + len is out of bounds.\n          stack_in: [values, len, index]\n\n    ParentMemory:\n      description: Operations for reading parent memory from within a compute context.\n      group:\n        Load:\n          opcode: 0x7A\n          short: LODP\n          description: Load the value at the given index from parent memory onto the stack.\n          panics:\n            - Not in compute context.\n            - Index is out of bounds.\n          stack_in: [index]\n          stack_out: [value]\n\n        LoadRange:\n          opcode: 0x7B\n          short: LODPR\n          description: Load a range of words starting at the index within parent memory.\n          panics:\n            - Not in compute context.\n            - Index is out of bounds.\n            - Index + len is out of bounds.\n          stack_in: [index, len]\n          stack_out: [values]\n\n    StateRead:\n      description: Operations related to reading state.\n      group:\n        KeyRange:\n          opcode: 0x80\n          short: KRNG\n          description: |\n            Read a range of values at each key from state starting at the key\n            into memory starting at the given memory address.\n\n            The key is lexographically incremented for each value read.\n            All keys are assumed to be the same length.\n\n            An [index, len] pair is written into memory for each value, followed by\n            the values themselves. E.g. when reading values *a* and *b*, they will\n            be laid out in memory from the given `mem_addr` as follows:\n            `[a_addr, a_len, b_addr, b_len, a_value, b_value]`\n          stack_in: [key_w0, ...key_wN, key_len, num_keys_to_read, mem_addr]\n\n        KeyRangeExtern:\n          opcode: 0x81\n          short: KREX\n          description: |\n            Read a range of values at each key from external state starting at the key\n            into memory starting at the given memory address.\n\n            The key is lexographically incremented for each value read.\n            All keys are assumed to be the same length.\n\n            The external state is at the `ext` address.\n\n            An [index, len] pair is written into memory for each value, followed by\n            the values themselves. E.g. when reading values *a* and *b*, they will\n            be laid out in memory from the given `mem_addr` as follows:\n            `[a_addr, a_len, b_addr, b_len, a_value, b_value]`\n          stack_in:\n            [ext_w0, ext_w1, ext_w2, ext_w3, key_w0, ...key_wN, key_len, num_keys_to_read, mem_addr]\n\n        PostKeyRange:\n          opcode: 0x82\n          short: PKRNG\n          description: |\n            Read a range of values at each key from post state starting at the key\n            into memory starting at the given memory address.\n\n            The key is lexographically incremented for each value read.\n            All keys are assumed to be the same length.\n\n            An [index, len] pair is written into memory for each value, followed by\n            the values themselves. E.g. when reading values *a* and *b*, they will\n            be laid out in memory from the given `mem_addr` as follows:\n            `[a_addr, a_len, b_addr, b_len, a_value, b_value]`\n          stack_in: [key_w0, ...key_wN, key_len, num_keys_to_read, mem_addr]\n\n        PostKeyRangeExtern:\n          opcode: 0x83\n          short: PKREX\n          description: |\n            Read a range of values at each key from external post state starting at the key\n            into memory starting at the given memory address.\n\n            The key is lexographically incremented for each value read.\n            All keys are assumed to be the same length.\n\n            The external state is at the `ext` address.\n\n            An [index, len] pair is written into memory for each value, followed by\n            the values themselves. E.g. when reading values *a* and *b*, they will\n            be laid out in memory from the given `mem_addr` as follows:\n            `[a_addr, a_len, b_addr, b_len, a_value, b_value]`\n          stack_in:\n            [ext_w0, ext_w1, ext_w2, ext_w3, key_w0, ...key_wN, key_len, num_keys_to_read, mem_addr]\n\n    Compute:\n      description: Operations related to VM compute execution.\n      group:\n        Compute:\n          opcode: 0x90\n          short: COM\n          description: |\n            Hand off execution to compute threads until ComputeEnd operation is encountered.\n            The computes read from a shared memory and write to their local memories, which are reconciled on thread join.\n          panics:\n            - Recursion limit (1) is reached.\n          stack_in: [n_computes]\n          stack_out: [compute_index]\n\n        ComputeEnd:\n          opcode: 0x91\n          short: COME\n          description: End of the execution of the compute program.\n";
Expand description

The raw YAML specification string.