|
|
# Bitwise
|
|
|
|
|
|
专门处理 AND OR 这些按位运算的指令的子电路。在此电路内,位数长的整数被拆成字节,以字节为单位进行逻辑运算。
|
|
|
|
|
|
## 设计
|
... | ... | @@ -81,7 +83,7 @@ pub struct BitwiseCircuitConfig<F: Field> { |
|
|
例如:0xabcdef AND 0xaabbcc
|
|
|
|
|
|
| tag | byte_0 | byte_1 | byte_2 | acc_0 | acc_1 | acc_2 | sum_2 | cnt | index |
|
|
|
| ---- | ------ | ------ | ------ | -------- | -------- | -------- | ----- | ---- | ----- |
|
|
|
| --- | ------ | ------ | ------ | -------- | -------- | -------- | ----- | --- | ----- |
|
|
|
| And | 0xab | 0xaa | 0xaa | 0xab | 0xaa | 0xaa | 0xaa | 0 | 16 |
|
|
|
| And | 0xcd | 0xbb | 0x89 | 0xabcd | 0xaabb | 0xaa89 | 0x133 | 1 | 16 |
|
|
|
| And | 0xef | 0xcc | 0xcc | 0xabcdef | 0xaabbcc | 0xaa89cc | 0x1ff | 2 | 16 |
|
... | ... | |