对于 custom gate 约束的理解 #54
-
如下是一个 Fibonacci 的加法门: meta.create_gate("add", |meta| {
//
// advice | selector
// a | s
// b |
// c |
//
let s = meta.query_selector(selector);
let a = meta.query_advice(advice, Rotation::cur());
let b = meta.query_advice(advice, Rotation::next());
let c = meta.query_advice(advice, Rotation(2));
vec![s * (a + b - c)]
}); 我的问题在于 —— 是不是说,对于所有 比如有 100 个
所以,我们就不需要在 meta.custom gate 这里写循环(我之前一直疑惑这个问题),我们唯一需要在 custom gate 这里做的,就是构造最小的约束逻辑单元: 所以说,我在写 assign 给电路赋值的时候,每当要给一个 Selector 赋值为 1 ,都要清晰地认识到:未来在电路 synthesize() 的时候,依据 custom gate 里的约束,这里都会有一个门贴合过来,去检查以 selector 为基准的这个门里覆盖到的所有 cell & region (是否满足定义的约束) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Since the original description using analogy, I am not I am not 100% I understood it. |
Beta Was this translation helpful? Give feedback.
Since the original description using analogy, I am not I am not 100% I understood it.
Based on my understanding, I would say that I got same ‘feeling’. The examination you could do here is to check what on earth Rotation is. In fact, Rotation gives you a relative row indicator and it is implemented by +1/0/-1. And from its implementation you can easily derive that, it is describing a relative relationship, or say, recursion.
In a Region, all recursive relationships are enforced.
So the recursive relationship you defined determines a basic shape on the region.
Just like Tetris( sorry using analogy as well)