Commit Graph

55 Commits

Author SHA1 Message Date
chriseth
6096afb218 Patterns in let statements and function parameters (#1214)
Co-authored-by: Leo <leo@powdrlabs.com>
2024-04-03 18:39:19 +00:00
chriseth
f46d59dfe1 Basic version of patterns. (#1205)
Depends on #1187 

Implements part of https://github.com/powdr-labs/powdr/issues/982

Will document in https://github.com/powdr-labs/powdr/pull/1214
2024-04-03 09:30:42 +00:00
chriseth
28f0bb9c1d Statements in blocks and function annotations (#1187)
Adds statements at block level and introduces function kinds to be
either pure, constr or query.

closes https://github.com/powdr-labs/powdr/issues/960

---------

Co-authored-by: Leo <leo@powdrlabs.com>
2024-04-02 08:23:39 +00:00
Georg Wiese
96893cc143 Add Write-once memory to STD (#1202)
Fixes #844

This PR adds a new machine to the STD: `WriteOnceMemory`. This can be
used in our RISC-V machine for bootloader inputs (#1203).

Most of the issues mentioned in the issue were fixed in the meantime or
had a simple workaround (like defining `let LATCH = 1`). The only
remaining issues were in the machine detection, which I fixed here.

I also re-factor two existing tests.
2024-03-26 18:50:30 +00:00
chriseth
f42ca35f83 Let statements in expressions. (#1138)
Allows braced blocks everywhere where expressions are expected.
The statements in those blocks can be `let x` or `let x = ...`.
The former declares a new witness column, the latter just binds a local
variable.

fixes #959
2024-03-25 21:08:45 +00:00
Georg Wiese
a18577fed2 Add read/write memory to standard library (#1129)
With the recent changes by @pacheco, we can extract our [memory
machine](https://github.com/powdr-labs/powdr/blob/main/riscv/src/compiler.rs#L687-L841)
as a separate machine and add it to the standard library.

The result should be the same as calling the function linked above with
`with_bootloader=false`, except that the memory alignment stuff is not
inlined. For this reason, the machine is not yet used by the RISC-V
machine, but it could be after #1077 is implemented.

[This](eb320dca0c) shows the diff from
what we have in `compiler.rs`.

<!--

Please follow this protocol when creating or reviewing PRs in this
repository:

- Leave the PR as draft until review is required.
- When reviewing a PR, every reviewer should assign themselves as soon
as they
start, so that other reviewers know the PR is covered. You should not be
discouraged from reviewing a PR with assignees, but you will know it is
not
  strictly needed.
- Unless the PR is very small, help the reviewers by not making forced
pushes, so
that GitHub properly tracks what has been changed since the last review;
use
  "merge" instead of "rebase". It can be squashed after approval.
- Once the comments have been addressed, explicitly let the reviewer
know the PR
  is ready again.

-->
2024-03-25 17:33:55 +00:00
Georg Wiese
10aeae6cb5 Allow and use permutation in all std machines 2024-03-21 17:20:18 +01:00
chriseth
e1753fd88e Challenges and stages. 2024-03-20 12:40:51 +01:00
Leo Alt
efe11f40fc enum declarations 2024-03-18 22:09:44 +01:00
Georg Wiese
3f863b77a0 Fix hints in split machines 2024-03-18 17:12:44 +01:00
Georg Wiese
f87a760071 Hints for arithmetic machine 2024-03-18 11:57:40 +01:00
chriseth
78d87a8b9c Document and test conversion to expr. 2024-03-14 13:16:36 +01:00
chriseth
dc96509070 Make expressions and constraints native values. 2024-03-05 11:22:12 +01:00
chriseth
97ed14c48b Type checking. 2024-03-01 17:36:54 +01:00
Leo
41d856c698 Merge pull request #1068 from powdr-labs/poseidon-latch-first-row
Poseidon Machines: Change latch to be on first row
2024-02-27 12:49:28 +00:00
Georg Wiese
39ab430595 For block machines, don't generate constraints on operation ID 2024-02-27 09:09:28 +01:00
Georg Wiese
f2c6caa991 Poseidon Machines: Change latch to be on first row 2024-02-26 11:59:36 +01:00
chriseth
ed6b4d8ebf Merge pull request #1067 from powdr-labs/refactor-poseidon-gl
Refactor PoseidonGL machine
2024-02-26 10:47:37 +00:00
chriseth
daffb65c0c Add type schemes. 2024-02-22 13:39:39 +01:00
Georg Wiese
e82d6f5249 Refactor PoseidonGL machine 2024-02-21 14:11:16 +01:00
Georg Wiese
d5825738f3 PoseidonBN254: Use intermediate polynomials instead of witness columns 2024-02-21 12:24:01 +01:00
Leo
1485f50cf6 Merge pull request #1058 from powdr-labs/update_utils
Some more uses of cross_product
2024-02-19 10:48:09 +00:00
Georg Wiese
aa3955801c Refactor PoseidonBN254 2024-02-15 18:15:08 +01:00
chriseth
e644be4d39 Update utils. 2024-02-14 16:52:30 +01:00
Georg Wiese
076f7b5129 Improve error message in std::math::ff:inverse 2024-02-14 13:12:46 +01:00
chriseth
259f35d4ac Merge pull request #1031 from powdr-labs/split_bits
cross product utility function.
2024-02-09 15:31:21 +00:00
chriseth
b04439d405 cross_product utility function. 2024-02-09 09:42:38 +01:00
chriseth
f4113cbb32 Adjust arith.asm. 2024-02-09 08:18:04 +01:00
Georg Wiese
40fe394c19 Add equations 1-4 2024-02-08 11:41:53 +01:00
chriseth
8f6cd49969 Introduce identity operator. 2024-02-07 16:04:55 +01:00
chriseth
31e4c1ad97 Support arrays of fixed columns. 2024-02-07 11:55:16 +01:00
Georg Wiese
9ea67369ce Arithmetic machine: Add equation selectors 2024-02-06 16:55:20 +01:00
chriseth
2765e59a9f Add types. 2024-02-06 10:25:04 +01:00
chriseth
fc15d92744 Modular operations. 2024-02-01 12:13:12 +01:00
Georg Wiese
321edb891f Merge pull request #967 from powdr-labs/arith-eq0
Arith machine, Equation 0
2024-02-01 10:36:02 +00:00
Georg Wiese
f91823e0ef Arith machine, Equation 0 2024-01-31 19:05:53 +01:00
chriseth
a71488710a Remove dbg.asm. 2024-01-30 12:42:51 +01:00
chriseth
f37058acb8 Distinguish between integer and field element. 2024-01-25 17:40:23 +01:00
chriseth
a1ba5707a9 Fix poseidon parsing on goldilocks. 2024-01-25 16:12:55 +01:00
chriseth
73ecd745d1 Print builtin 2024-01-24 12:59:20 +01:00
chriseth
3e3349d4f5 Add assertion function. 2024-01-23 20:29:59 +01:00
chriseth
6ba444213d Improve stdlib. 2024-01-23 20:29:59 +01:00
chriseth
b0f5a80cf7 Builtin functions. 2024-01-23 20:29:59 +01:00
chriseth
61c7f8e6a8 Add and use pil stdlib utilities. 2024-01-16 09:08:36 +01:00
chriseth
4262e6a9f8 Use functions in poseidon 2023-11-30 13:52:40 +01:00
Leo
b8e6c2468b Merge pull request #790 from powdr-labs/support_array_elemes_in_operation
Support array elements in operations.
2023-11-28 16:53:43 +00:00
chriseth
9946b863b4 Remove macros. 2023-11-28 15:57:29 +01:00
chriseth
59fa1431c4 Use arrays in poseidon_gl. 2023-11-24 17:44:04 +01:00
chriseth
7fc93cc61e Transform references in query strings. 2023-11-21 16:34:16 +01:00
Leo Alt
6ec74de4cc choose degree automatically from program size 2023-11-02 10:24:53 +01:00