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
  • 9 bitwise

9 bitwise · Changes

Page history
chore: update bitwise doc authored 1 year ago by qingyun Ma's avatar qingyun Ma
Show whitespace changes
Inline Side-by-side
Showing with 12 additions and 2 deletions
+12 -2
  • zkevm-docs/9-bitwise.markdown zkevm-docs/9-bitwise.markdown +12 -2
  • No files found.
zkevm-docs/9-bitwise.markdown
View page @ 48c7c218
...@@ -30,6 +30,7 @@ pub struct Row { ...@@ -30,6 +30,7 @@ pub struct Row {
pub enum Tag { pub enum Tag {
#[default] #[default]
Nil
And, And,
Or, Or,
Xor, Xor,
...@@ -80,10 +81,19 @@ pub struct BitwiseCircuitConfig<F: Field> { ...@@ -80,10 +81,19 @@ pub struct BitwiseCircuitConfig<F: Field> {
### 门约束 ### 门约束
- cnt=0 ---> acc_0=byte_0、acc_1=byte_1、acc_2=byte_2、sum_2=byte_2 电路中的行数不可能是16的整数倍,因为存在一些填充值(如begin_padding),电路自动padding的行使用Tag::Nil进行约束,Tag为Nil的行的值都为默认值,即为0
- cnt != 0 ---> `acc_0=byte_0+acc_0_pre*256`,`acc_1=byte_1+acc_1_pre*256`,`acc_2=acc_2_pre*256`, `sum_2=byte_2+sum2_pre`,`tag=tag_pre`
- tag_is_not_nil,cnt=0 ---> acc_0=byte_0、acc_1=byte_1、acc_2=byte_2、sum_2=byte_2 ,`cnt=0-->pre_cnt=15(暂未使用)`
- tag_is_not_nil,cnt != 0 ---> `acc_0=byte_0+acc_0_pre*256`,`acc_1=byte_1+acc_1_pre*256`,`acc_2=acc_2_pre*256`, `sum_2=byte_2+sum2_pre`,`cnt=cnt_pre+1`,`tag=tag_pre`
- tag_is_not_nil,next_cnt=0 --> cnt=15
- tag_is_nil ---> byte_0=0, byte_1=0, byte_2=0, acc_0=0, acc_1=0, acc_2=0, sum_2=0, cnt=0
next_cnt=0--->cnt=15 (同时也验证了,只要cnt=15则next_cnt=0)
### LookUp约束 ### LookUp约束
使用lookup对`<tag、byte_0、byte1、byte_2>`进行证明,来源:bitwise,去向:fixed (fxed子电路中有对256位的数值的and、or、xor的计算的枚举) 使用lookup对`<tag、byte_0、byte1、byte_2>`进行证明,来源:bitwise,去向:fixed (fxed子电路中有对256位的数值的and、or、xor的计算的枚举)
注:只对Tag不为Nil的行进行LookUp
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号