Mill Computing, Inc. › Forums › The Mill › Tools › Simulators › Simulation › Reply To: Simulation
Warning: genAsm is very much a work in progress, and information here and on the Wiki is subject to change without notice.
For ordinary conditionals use the syntactic sugar of the ifClause. There will be similar sugar for looping constructs, TBD.
For the very lowest level you explicitly declare labels using labelDef. You transfer to them using the go pseudo-function. Labels are placed at a join, syntactically the label identifier followed by a colon.
Transfers to and fall-throughs into a join carry data. The widths of the carried data is declared in the labelDef, and the count of carried operands must fit on the belt. Like all ops and functions, go may be used in suffix, infix, or functional form; the target label is the final argument and any other arguments are carried data. The arguments to go (and the current data when falling into a label) must match the declaration of the label in number and width.
Labels are scoped based on the point of declaration. The corresponding join, and any go invocations targeting the label, must be in the same scope. And of course a label be declared before other use, and must appear in exactly one join.
Example:
label w lab;
if (b eql 0) then 17 go lab fi;
….
F(x,y,z) lab: + a -: c;
Here if b is zero then control transfers to lab carrying the data value of 17. Otherwise execution continues until the function call on F, whose return value become the fall-through value at the join at lab. However control reaches lab, the data is added to a and that is bound to c.