valida-xyz / valida

A STARK-based VM focused on code reuse, performance, and modularity

Repository from Github https://github.comvalida-xyz/validaRepository from Github https://github.comvalida-xyz/valida

Update ISA spec

thealmarty opened this issue · comments

Our ISA spec is getting out of date as we actively develop. We should update it. E.g.,

  • Add READ_ADVICE:
    Operands: a
    Description: Read the content of the advice tape and write the next 4 byte values to those beginning at offset a.

  • Add WRITE:
    Operands: b(fp)
    Description: Follow the pointer stored at offset b from the current frame pointer and write the next 4 byte values to the output chip.

  • Remove `ISH{L,R}

  • Add DIVI

  • Add immediate versions of bitwise operations and, or, xor

  • Add NE:
    Operands: a, b(fp), c(fp)
    Description: If [b] != [c] then set a to 1. Otherwise, set a to 0.

  • Add MULHU:
    Operands: a, b(fp), c(fp)
    Description: Multiply [b] by [c] then set a to the top part of the result.

  • Add LOADFP(to be implemented):
    Operands: a, b(fp)
    Description: Stores the current value of fp plus the immediate operand b into the register numbered a. The operand c is always set to 0 (it is unused), while the operands d and e are always set to 1 (indicating that b and c are immediate operands).

  • Add ILT

@maxgillett is making a start on this. That said, I would caution us against premature documentation. Most of these opcodes are experimental and it's not clear that they will be included in a release. We can avoid unnecessary documentation effort and producing docs that will be quickly out of date by waiting until APIs stabilize before we document them.

Awesome start with #60, thanks! Yes we can fill out the doc more later but I'd like to keep track of it as we go as well.

As per #113 the spec for READ_ADVICE has been updated to:

Operands: a
Description: Read the content of the advice tape and write the next byte to the low byte of the word beginning at offset a. If the end of the advice tape is reached, write 0xFFFFFFFF instead.

As per #108 LOADFP is implemented.but not tested.