Skip to content

Add u32_mul#12

Merged
RobinLinus merged 5 commits intoBitVM:mainfrom
weikengchen:main
Mar 16, 2024
Merged

Add u32_mul#12
RobinLinus merged 5 commits intoBitVM:mainfrom
weikengchen:main

Conversation

@weikengchen
Copy link
Copy Markdown
Collaborator

This PR presents an implementation of the u32_mul, which can be used for ASM_MUL, for 32-bit integers.

It implements:

  • u8_to_bits, convert a u8 into bits
  • u32_to_bits, convert a u32 (represented as four u8 in the stack) into bits
  • u32_double, double a u32
  • u32_mul_drop, multiplication of two u32

And their integration tests.

The instruction deals with overflow and resembles RISC-V behavior. It only maintains the keeps the lower 4 bytes of the 32 bit integers. It is possible to similarly implement 64-bit integer operations, but it depends on the ISA.

u32_mul_drop takes 6118 bytes
u32_add takes 85 bytes

roughly 72x, which is expected because u32_mul_drop calls u32_add already 64 times for double-and-add

@weikengchen
Copy link
Copy Markdown
Collaborator Author

A new implementation is added, which reduces the number of bytes to 3705.

@RobinLinus RobinLinus merged commit a86fb01 into BitVM:main Mar 16, 2024
@cahngdoudoulove
Copy link
Copy Markdown

great

justin-elementlabs referenced this pull request in elementlabs42/BitVM Jul 11, 2024
Extract network setting from lower level functions
lucidLuckylee pushed a commit that referenced this pull request Dec 18, 2024
VanhGer pushed a commit to VanhGer/BitVM that referenced this pull request Feb 24, 2026
)

* remove length-prefix when get groth16 pubin

* fix guest inputs verify script
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