
All opcodes operate on argument values of arbitrary size. The argument types specify the actual amount of bits (wires) in the argument and result values. The examples use the following format for values:
{0,0}typeSize$constwhere:
is the argument name. The special name %_ specifies an anonymous
value.
{0,0}is the argument scope and version information. In the examples
below, these will always be {0,0}.
is the argument type specifier:
i signed integeru unsigned integerarr arrayis the argument size in bits
$constis a constant value.
iadd a{0,0}i32 b{0,0}i32 r{0,0}i32
The iadd instruction adds the signed integer arguments a and b
together and sets the result to the result value r.
uadd a{1,0}u32 b{1,0}u32 r{0,0}u32
The uadd instruction adds the unsigned integer arguments a and b
together and sets the result to the result value r.
fadd a{1,0}f32 b{1,0}f32 r{0,0}f32
The fadd instruction adds the floating point arguments a and b
together and sets the result to the result value r.
isub a{0,0}i32 b{0,0}i32 r{0,0}i32
The isub instruction subtracts the signed integer arguments a and
b and sets the result to the result value r.
usub a{0,0}u32 b{0,0}u32 r{0,0}u32
The usub instruction subtracts the unsigned integer arguments a
and b and sets the result to the result value r.
fsub a{0,0}f32 b{0,0}f32 r{0,0}f32
The fsub instruction subtracts the floating point arguments a and
b and sets the result to the result value r.
bor a{0,0}u32 b{0,0}u32 r{0,0}u32
The bor instruction compute the binary OR a|b and sets the result
to the result value r.
bxor a{0,0}u32 b{0,0}u32 r{0,0}u32
The bxor instruction compute the binary XOR a^b and sets the
result to the result value r.
band a{0,0}u32 b{0,0}u32 r{0,0}u32
The band instruction compute the binary AND a^b and sets the
result to the result value r.
amov val{0,0}u8 base{0,0}arr32 $from $to r{0,0}arr32
The amov instruction overwrite the range from-to of base with
val and set the resulting value to r. For example, if base has
the value 0xaabbccdd and val is 0x22 the following example sets
r to 0xaa22ccdd:
amov $34 0xaabbccdd $8 $16 r{0,0}arr32 ⇒ r{0,0}=0xaa22ccdd
In this example we assume that val and base bit indices are counted
from left.
phi cond{0,0}b1 t{0,0}i32 f{1,2}i32 r{0,1}i32
The phi instruction selects true t or false f value based on the
condition cond and sets the selected value into r.
ret %ret0{0,0}i32 %ret1{0,0}i32
The ret instruction returns the function return values to the
caller. The number and types of the return values depend on the
function signature.
circ arg{0,707}u1024 arg{1,0}u512 {G=349617, W=351153} r{0,708}u512
Copyright © 2024 Markku Rossi