Commit Graph

68 Commits

Author SHA1 Message Date
Gastón Zanitti
945d613f15 Remove lookups from PilStatement (#1782)
Co-authored-by: chriseth <chris@ethereum.org>
2024-09-12 10:02:46 +00:00
Lucas Clemente Vella
83e2c841e6 Trying buildjet CI runner (#1777) 2024-09-11 08:53:12 +00:00
Thibaut Schaeffer
7f259b43c7 Support degree ranges (#1667)
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.
2024-09-03 12:37:44 +00:00
Gastón Zanitti
2e7c473413 Impl parsing (#1490)
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>
2024-07-30 13:49:58 +00:00
Thibaut Schaeffer
5bfeea8b58 Extract range checks from riscv into std machines (#1594)
Also, allow vms to have links outside instructions.

---------

Co-authored-by: Leo Alt <leo@ethereum.org>
2024-07-23 09:22:42 +00:00
Gastón Zanitti
70e4f7c39b Trait parsing (#1489)
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>
2024-07-09 13:25:39 +00:00
Leandro Pacheco
72b4d739d7 merge compatible links from different instructions (#1467)
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)
2024-07-02 10:53:07 +00:00
Leandro Pacheco
2b5a308484 Machine arguments (#1356)
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;
    ...
}
```
2024-07-01 10:38:08 +00:00
Leandro Pacheco
abbe26618f Instructions with link statements (#1439)
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.
2024-06-18 17:31:38 +00:00
Gastón Zanitti
0d9669e26c SourceRef in expressions (#1357)
This PR solves issue https://github.com/powdr-labs/powdr/issues/1293.

Includes PRs that modify some Expression in order to match fields. It is
recommended to review/merge those first:
- #1351 
- #1352
- #1353
- #1354
- #1355


All comments are welcome :)

---------

Co-authored-by: chriseth <chris@ethereum.org>
2024-05-26 16:52:07 +00:00
chriseth
62c3eadc4c Re-enable non-inlined format args (#1362)
Fixes https://github.com/powdr-labs/powdr/issues/1360
2024-05-08 16:27:22 +00:00
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
Leandro Pacheco
edaf536500 Allow machines to be linked via permutation
by instructions and links using `~` instead of `=`.
Block machines must declare `call_selectors`.
2024-03-20 08:17:21 -03:00
Leo Alt
efe11f40fc enum declarations 2024-03-18 22:09:44 +01:00
Leandro Pacheco
ff8fda1563 Expressions in instr/link params
allow for `link` and RHS of `instr` params to use full on expressions
2024-03-18 14:04:08 -03:00
chriseth
349f9aa461 Parse numbers as integers. 2024-03-08 15:48:49 +01:00
Leandro Pacheco
f3e1802787 move link params to RHS and simplify the code
- added more checks for pc machines / constrained machines
- improve example and docs
2024-03-04 09:55:37 -03:00
Georg Wiese
39ab430595 For block machines, don't generate constraints on operation ID 2024-02-27 09:09:28 +01:00
Leo Alt
96cdbcdc3f disable diff monitor trace 2024-02-26 11:40:28 +01:00
Leandro Pacheco
2e1a8571a7 instr param mapping
allow RHS of `instr` declarations to control the usage of write and assignment
registers.
2024-02-14 13:31:19 -03:00
chriseth
8f6cd49969 Introduce identity operator. 2024-02-07 16:04:55 +01:00
Leandro Pacheco
36c3a78fe7 move LinkDeclaration SourceRef to enum (like other variants) 2024-02-06 10:13:11 -03:00
chriseth
ec75819cc0 Re-use parsers. 2024-02-05 17:16:45 +01:00
Leo Alt
607c0043d7 add powdr- prefix to all crates 2024-01-23 18:51:29 +01:00
Leandro Pacheco
c4b4f35771 make parser generate SourceRefs
also added a way for analyzing PILFile's directly without having to re-parse
from a string
2024-01-23 08:45:47 -03:00
chriseth
aee0846add Adjust paths. 2024-01-22 11:53:11 +01:00
chriseth
00dc038259 Move type check crate into analysis. 2024-01-22 11:29:51 +01:00
chriseth
252eaa070c Support pil at module level. 2024-01-15 10:03:38 +01:00
chriseth
1404e89063 Rename artifacts and document a bit more. 2024-01-03 19:38:49 +01:00
chriseth
7002712a49 Proper name resolution in PIL. 2024-01-02 09:31:21 +01:00
chriseth
46c1d83805 Formatting of machines inside modules. 2023-12-19 17:07:02 +01:00
chriseth
3691be7aff Some cleanup for SymbolPaths. 2023-12-19 16:54:39 +01:00
chriseth
6d75e5300f Run importer and resolver in tests. 2023-12-18 21:09:41 +01:00
Georg Wiese
54045fbcf7 Pipeline 2023-12-07 22:12:29 +01:00
chriseth
9946b863b4 Remove macros. 2023-11-28 15:57:29 +01:00
Leo
912cab8fa3 Merge pull request #759 from powdr-labs/arbitrary_function_calls
Allow arbitrary expressions to be function-called.
2023-11-27 14:45:22 +00:00
chriseth
47f71cd1a9 Allow arbitrary expressions to be function-called. 2023-11-27 15:07:40 +01:00
chriseth
86cf0df559 Replace Mapping enum alternative by Expression. 2023-11-24 17:57:41 +01:00
Lucas Clemente Vella
cd4449e65f RISCV executor 2023-11-24 11:42:35 +01:00
chriseth
99ea18a17a Allow namespaced names to be function-called. 2023-11-16 14:57:00 +01:00
chriseth
861e2c0bd9 Fix macro processing. 2023-11-15 16:55:46 +01:00
chriseth
d3de79ab98 Parse arbitrary expressions at pil statement level. 2023-11-15 16:55:46 +01:00
chriseth
e4d22a2fb9 Make index access a proper operation. 2023-11-02 17:47:52 +01:00
chriseth
7630446948 Parse next as operator. 2023-11-02 10:59:22 +01:00
schaeff
f71cd82d49 allow ommiting latch if no operations and operation_id if <= 1 operations 2023-10-22 09:32:37 +02:00
Georg Wiese
a28a037f19 Disallow prints in all crates 2023-10-05 08:11:23 +00:00
schaeff
a3ebf460fd remove constraints blocks 2023-10-04 12:52:59 +02:00
chriseth
8782d53441 Visitors as bound functions. 2023-10-04 11:06:07 +02:00
schaeff
56f5101abb replace empty enums with convert::Infallible 2023-10-03 18:55:26 +02:00
Georg Wiese
8ec6bffe96 Implement Multi-return 2023-09-28 21:22:32 +00:00