We currently hardcode the range of degrees that variable degree machines
are preprocessed for. Expose that in machines instead.
This changes pil namespaces to accept a min and max degree:
```
namespace main(123..456);
namespace main(5); // allowed for backward compatibility, translates to `5..5`
```
It adds two new builtins:
```
std::prover::min_degree
std::prover::max_degree
```
And sets the behavior of the `std::prover::degree` builtin to only
succeed if `min_degree` and `max_degree` are equal.
This PR splits from the main Trait implementation PR
https://github.com/powdr-labs/powdr/pull/1450 to simplify the review
process.
It includes only the parsing of the impls (trait parsing PR here: #1489
) and some functionality necessary for the code to compile.
---------
Co-authored-by: chriseth <chris@ethereum.org>
This PR splits from the main Trait implementation PR #1450 to simplify
the review process.
It includes only the parsing of the traits (not impls) and some
functionality necessary for the code to compile.
---------
Co-authored-by: chriseth <chris@ethereum.org>
Merge compatible `link`s into a single permutation/lookup.
We only consider merging links from different instructions, as a single
instruction can be active at a time.
Links with next references are ignored due to a limitation in witgen
(left a TODO so its easily fixed upon witgen support)
Fixes#1493
Allow passing machines as argument when instantiating submachines, as
in:
```
use std::machines::binary::Binary;
machine Main with degree: 262144 {
reg pc[@pc];
reg X[<=];
reg Y[<=];
reg Z[<=];
reg A;
Binary binary;
WithArg sub(binary);
instr and X, Y -> Z ~ binary.and;
instr or X, Y -> Z ~ binary.or;
instr xor X, Y -> Z ~ binary.xor;
...
}
machine WithArg(bin: Binary) {
reg pc[@pc];
reg X[<=];
reg Y[<=];
reg Z[<=];
reg A;
reg B;
instr and X, Y -> Z ~ bin.and;
instr or X, Y -> Z ~ bin.or;
instr xor X, Y -> Z ~ bin.xor;
...
}
```
Allow VM instructions to use the `link` notation, unifying the way
machines are linked from VMs and block machines.
Previous syntax for "external instructions" not allowed anymore, and
should use the new `link` syntax.