Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
zkevm-circuits
zkevm-circuits
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Package Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

新注册的用户请输入邮箱并保存,随后登录邮箱激活账号。后续可直接使用邮箱登录!

  • zkp
  • zkevm-circuitszkevm-circuits
  • Wiki
    • Zkevm docs
  • 8 arithmetic

8 arithmetic · Changes

Page history
feat: update mul mod layout authored 1 year ago by xiaoranlu's avatar xiaoranlu
Show whitespace changes
Inline Side-by-side
Showing with 33 additions and 1 deletion
+33 -1
  • zkevm-docs/8-arithmetic.markdown zkevm-docs/8-arithmetic.markdown +33 -1
  • No files found.
zkevm-docs/8-arithmetic.markdown
View page @ 0c660873
......@@ -190,7 +190,7 @@ a * b + c = d
5. 取余结果值约束
为了保证mul乘法的有效当b==0时,我们设置d==a.(d是余数,b是除数)。但是在eth中计算取余时有b==0时,我们设置d==0.所以在core circuit部分我们需要增加b=0时d==0
```
```
## AddMod
......@@ -288,6 +288,38 @@ carry_2 = (t4 + (t5 << 64) + carry_1).saturating_sub(d_lo) >> 128
### layout
| cnt | o_0_hi | o_0_lo | o_1_hi | o_1_lo | u16s_0 |
| ---- | ------------------- | ------------------- | -------------- | -------------- | ------------------------ |
| 26 | | | | | k2n_carry_0 |
| 25 | | | | | k2n_carry_1 |
| 24 | | | | | k2n_carry_2 |
| 23 | | | | | r_lo_u16s |
| 22 | | | | | r_hi_u16s |
| 21 | | | | | k2_lo_u16s |
| 20 | | k2n_carry_2 | k2n_carry_1 | k2n_carry_0 | k2_hi_u16s |
| 19 | r_diff_hi | r_diff_lo | r_lt_hi | r_lt_lo | r_diff_lo_u16s |
| 18 | k2_hi | k2_lo | | | r_diff_hi_u16s |
| 17 | | | | | arb_carry_0 |
| 16 | | | | | arb_carry_1 |
| 15 | | | | | arb_carry_2 |
| 14 | | | | | d_lo_u16s |
| 13 | | | | | d_hi_u16s |
| 12 | | | | | e_lo_u16s |
| 11 | | | | | e_hi_u16s |
| 10 | | arb_carry_2 | arb_carry_1 | arb_carry_0 | b_lo_u16s |
| 9 | e_hi | e_lo | d_hi | d_lo | b_hi_u16s |
| 8 | | | | | a_remainder_diff_lo_u16s |
| 7 | | | | | a_remainder_diff_hi_u16s |
| 6 | | | | | a_rem_carry_lo_u16s |
| 5 | | | | | a_remainder_lo_u16s |
| 4 | a_remainder_diff_hi | a_remainder_diff_lo | a_rem_lt_hi | a_rem_lt_lo | a_remainder_hi_u16s |
| 3 | k1_carry_hi | k1_carry_lo | | | n_lo_u16s |
| 2 | k1_hi | k1_lo | a_remainder_hi | a_remainder_lo | n_hi_u16s |
| 1 | n_hi | n_lo | r_hi | r_lo | k1_lo_u16s |
| 0 | a_hi | a_lo | b_hi | b_lo | k1_hi_u16s |
## Length
arithmetic中的布局:
......
Clone repository
  • basics
    • evm
    • halo2
  • code notes
    • binary_number_with_real_selector
    • how to use macro
    • simple_lt
    • simple_lt_word
  • Home
  • image
  • zkevm docs
    • 1 introduction
    • 10 public
    • 11 fixed
    • 12 exp
    • 13 keccak
    • 14 comparisons
    • 15 differences
View All Pages

Copyright © 2024 ChainWeaver Org. All Rights Reserved. 版权所有。

京ICP备2023035722号-3

京公网安备 11010802044225号