Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

XQVM Reference

XQVM is the virtual machine at the core of XQuad: a stack-based interpreter with a 256-slot register file that executes compiled quadratic-optimisation programs. This section is the reference for that machine – its execution model, assembly language, instruction set, binary format, and verifier. For what a QUBO/Ising model is and why you would want one, start at Concepts instead; this section assumes you already have a program, or want to write one directly in .xqasm, and want to know exactly what the machine does with it.

A minimal program

Save this as add.xqasm, then assemble and run it:

; push two integers and add them
PUSH 10
PUSH 32
ADD
HALT
$ xquad asm add.xqasm -o add.xqb
assembled 4 instructions (21 bytes) -> add.xqb
$ xquad run add.xqb
stack (bottom to top):
  42

The program pushes 10 and 32 onto the value stack, adds them, and halts. The result remains on the stack and is printed by xquad run. xquad run --text add.xqasm skips the separate assembly step and runs the source directly.

What this section covers