Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arith machine (field operations only) for BabyBear field #1775

Merged
merged 4 commits into from
Jan 16, 2025
Merged

Conversation

qwang98
Copy link
Collaborator

@qwang98 qwang98 commented Sep 10, 2024

This is the 256 bit version decomposed to 16 bit limbs, but not immediately needed by our BabyBear RISCV VM. Keeping it here though in case needed in the future.

Adapted eq0 only from our original arith machine. Exposes one operation that should work for add, sub, mul, div. Inputs are 16 bits. Decomposed to 8 bit intermediate columns for constraints.

All original test vectors passed. Original comments not fully cleaned up though.

std/machines/arith_bb.asm Outdated Show resolved Hide resolved
@leonardoalt
Copy link
Member

build is failing. @qwang98 is this ready for review?

@qwang98 qwang98 enabled auto-merge January 16, 2025 11:08
@qwang98
Copy link
Collaborator Author

qwang98 commented Jan 16, 2025

@leonardoalt Can merge when approved.

Copy link
Member

@leonardoalt leonardoalt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to activate the test in Rust powdr_std.rs

@qwang98
Copy link
Collaborator Author

qwang98 commented Jan 16, 2025

You also need to activate the test in Rust powdr_std.rs

Fixed and let's wait for it to complete again :)

#[ignore = "Too slow"]
fn arith256_small_test() {
let f = "std/arith256_small_test.asm";
regular_test_small_field(f, &[]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, we already have a similar test though, didn't we merge this already? Check 2 tests up

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. It's different. Arith_small does 32 bit number mul and div, which combined with add_sub_small, satisfies our uses in the riscv machine.

Arith256 (this PR) does 256 bit number arith.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes true, I remember now

@qwang98 qwang98 added this pull request to the merge queue Jan 16, 2025
Merged via the queue into main with commit 77a3ca0 Jan 16, 2025
16 checks passed
@qwang98 qwang98 deleted the arith-bb branch January 16, 2025 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants