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
    • 4 core
  • core addmod

core addmod · Changes

Page history
restyle docs authored Aug 07, 2024 by gzxu's avatar gzxu
Hide whitespace changes
Inline Side-by-side
Showing with 3 additions and 41 deletions
+3 -41
  • zkevm-docs/4-core/core-addmod.markdown zkevm-docs/4-core/core-addmod.markdown +3 -41
  • No files found.
zkevm-docs/4-core/core-addmod.markdown
View page @ efde6b52
......@@ -176,45 +176,7 @@ fn get_constraints(
#### get_lookups
这里的四个lookup, 类型为LookupEntry::State和LookupEntry::Arithmetic, 具体可以参考Witness Core Row部分的说明。
这里的5个lookup, 类型为LookupEntry::State和LookupEntry::Arithmetic, 具体可以参考:
参考代码如下:
```rust
fn get_lookups(
&self,
config: &ExecutionConfig<F, NUM_STATE_HI_COL, NUM_STATE_LO_COL>,
meta: &mut ConstraintSystem<F>,
) -> Vec<(String, LookupEntry<F>)> {
let stack_lookup_0 = query_expression(meta, |meta| config.get_state_lookup(meta, 0));
let stack_lookup_1 = query_expression(meta, |meta| config.get_state_lookup(meta, 1));
let stack_lookup_2 = query_expression(meta, |meta| config.get_state_lookup(meta, 2));
let stack_lookup_3 = query_expression(meta, |meta| config.get_state_lookup(meta, 3));
let arithmetic = query_expression(meta, |meta| config.get_arithmetic_lookup(meta));
vec![
("stack pop a".into(), stack_lookup_0),
("stack pop b".into(), stack_lookup_1),
("stack pop n".into(), stack_lookup_2),
("stack push".into(), stack_lookup_3),
("arithmetic lookup".into(), arithmetic),
]
}
pub(crate) fn get_arithmetic_lookup(&self, meta: &mut VirtualCells<F>) -> LookupEntry<F> {
let (hi_0, lo_0, hi_1, lo_1, hi_2, lo_2, hi_3, lo_3, tag) = (
meta.query_advice(self.vers[0], Rotation(-2)),
meta.query_advice(self.vers[1], Rotation(-2)),
meta.query_advice(self.vers[2], Rotation(-2)),
meta.query_advice(self.vers[3], Rotation(-2)),
meta.query_advice(self.vers[4], Rotation(-2)),
meta.query_advice(self.vers[5], Rotation(-2)),
meta.query_advice(self.vers[6], Rotation(-2)),
meta.query_advice(self.vers[7], Rotation(-2)),
meta.query_advice(self.vers[8], Rotation(-2)),
);
LookupEntry::Arithmetic {
tag,
values: [hi_0, lo_0, hi_1, lo_1, hi_2, lo_2, hi_3, lo_3],
}
}
```
\ No newline at end of file
- [5-state.markdown](../5-state.markdown)
- [8-arithmetic.markdown](../8-arithmetic.markdown)
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号