Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
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 Apr 24, 2024 by sen0324's avatar sen0324
Show whitespace changes
Inline Side-by-side
Showing with 4 additions and 5 deletions
+4 -5
  • zkevm-docs/9-bitwise.markdown zkevm-docs/9-bitwise.markdown +4 -5
  • No files found.
zkevm-docs/9-bitwise.markdown
View page @ 17cfe906
专门处理 AND OR XOR BYTE 这些按位运算的指令的子电路。在此电路内,位数长的整数被拆成字节,以字节为单位进行逻辑运算。 专门处理 AND OR BYTE 这些按位运算的指令的子电路。在此电路内,位数长的整数被拆成字节,以字节为单位进行逻辑运算。
## 设计 ## 设计
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
```rust ```rust
pub struct Row { pub struct Row {
/// The operation tag, one of AND, OR, XOR /// The operation tag, one of AND, OR
pub tag: Tag, pub tag: Tag,
/// The byte value of operand 0 /// The byte value of operand 0
pub byte_0: U256, pub byte_0: U256,
...@@ -33,7 +33,6 @@ pub enum Tag { ...@@ -33,7 +33,6 @@ pub enum Tag {
Nil, Nil,
And, And,
Or, Or,
Xor,
} }
``` ```
...@@ -67,7 +66,7 @@ pub struct BitwiseCircuitConfig<F: Field> { ...@@ -67,7 +66,7 @@ pub struct BitwiseCircuitConfig<F: Field> {
### 列的含义 ### 列的含义
`BitwiseCircuit`主要用于对两个长度最长的整数进行AND、OR、XOR运算,每一个整数都会被拆成一个一个字节,实际运算时分别对相应位置的byte进行运算。 `BitwiseCircuit`主要用于对两个长度最长的整数进行AND、OR运算,每一个整数都会被拆成一个一个字节,实际运算时分别对相应位置的byte进行运算。
`byte_0`和`byte_1`分别是两个数值的某一个位置上的byte,`byte_2`为`byte_0`和`byte_1`的运算结果,`acc_0`、`acc_1`、`acc_2`分别是`byte_0`、`byte_1`、`byte_2`的累加值,即`acc=byte+acc_pre*256`,`sum_2`为`byte_2`的累加和,即`sum=byte+sum_pre`。 `byte_0`和`byte_1`分别是两个数值的某一个位置上的byte,`byte_2`为`byte_0`和`byte_1`的运算结果,`acc_0`、`acc_1`、`acc_2`分别是`byte_0`、`byte_1`、`byte_2`的累加值,即`acc=byte+acc_pre*256`,`sum_2`为`byte_2`的累加和,即`sum=byte+sum_pre`。
...@@ -91,7 +90,7 @@ pub struct BitwiseCircuitConfig<F: Field> { ...@@ -91,7 +90,7 @@ pub struct BitwiseCircuitConfig<F: Field> {
### 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 的计算的枚举)
注:只对Tag不为Nil的行进行LookUp 注:只对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号