Skip to content

Instruction Set

Nick Pope edited this page Jun 19, 2013 · 26 revisions

Virtual Machine Instruction Set

NID Manipulations

add

Add two numeric NIDs together and put result into dest.

add $<dest> [$]<a> [$]<b>

sub

Subtract two numeric NIDs (b from a) and put result into dest.

sub $<dest> [$]<a> [$]<b>

div

div $<dest> [$]<a> [$]<b>

mul

mul $<dest> [$]<a> [$]<b>

shiftl

Shift value left by n bits and put into dest.

shiftl $<dest> [$]<value> [$]<n>

shiftr

Shift value right by n bits and put into dest.

shiftr $<dest> [$]<value> [$]<n>

and

and $<dest> [$]<a> [$]<b>

or

or $<dest> [$]<a> [$]<b>

xor

xor $<dest> [$]<a> [$]<b>

neg

`neg $ [$]

inc

inc $<value>

dec

dec $<value>

clear

Sets value to null.

clear $<value>

int

Convert value to an integer and put into dest.

int $<dest> [$]<value>

float

Convert value to a float and put into dest.

float $<dest> [$]<value>

Data

copy

Copy a value from source into dest.

copy $<dest> [$]<source>

ret

Return value.

ret [$]<value>

Branching

jump

jump :<label>

jeq

jeq :<label> [$]<a> [$]<b>

jneq

jneq :<label> [$]<a> [$]<b>

jleq

jleq :<label> [$]<a> [$]<b>

jgeq

jgeq :<label> [$]<a> [$]<b>

jlt

jlt :<label> [$]<a> [$]<b>

jgt

jgt :<label> [$]<a> [$]<b>

Hypergraph Access

read

Read a single value from the t1 t2 HARC into dest.

read $<dest> [$]<t1> [$]<t2>

define

Define the HARC t1 t2 as value. The value may be a constant or definition.

define [$]<t1> [$]<t2> [$]<value>

dep

Add a dependency where a1 a2 depends upon b1 b2. dep [$]<a1> [$]<a2> [$]<b1> [$]<b2>

new

Create a new NID in dest which matches the kind NID.

new $<dest> [$]<kind>

delete

Delete the HARC t1 t2.

delete [$]<t1> [$]<t2>

path

Follow a path through the graph, starting at element and putting the result into dest. Elements may be repeated any number of times and are separated by dots.

path $<dest> [$]<element>[.]*

Clone this wiki locally