Files
powdr/test_data/asm/vm_to_block_array.asm
Leandro Pacheco cea207ff3f Machine properties using with syntax (#1267)
This implements issue #1251.
Basically `machine Foo(a,b) { ... }` is now `machine Foo with latch: a,
operation_id: b { ... }`
2024-04-25 16:02:01 +00:00

37 lines
765 B
Rust

machine Main with degree: 256 {
Arith arith;
reg pc[@pc];
reg X[<=];
reg Y[<=];
reg A;
reg Z[<=]; // we declare this assignment register last to test that the ordering does not matter
instr add X, Y -> Z = arith.add;
instr mul X, Y -> Z = arith.mul;
instr assert_eq X, Y { X = Y }
function main {
A <== add(2, 1);
A <== mul(A, 9);
assert_eq A, 27;
return;
}
}
machine Arith with
latch: latch,
operation_id: operation_id
{
operation add<0> x[0], x[1] -> y;
operation mul<1> x[0], x[1] -> y;
col fixed latch = [1]*;
col witness operation_id;
col witness x[2];
col witness y;
y = operation_id * (x[0] * x[1]) + (1 - operation_id) * (x[0] + x[1]);
}