... | ... | @@ -71,6 +71,7 @@ operand* 用来存放算术中的参数值,如 a+b=c+overflow 指令中的 a,b |
|
|
- c hi + carry hi \* 2^128 = a hi + b hi + carry lo
|
|
|
|
|
|
- Sub_Lt_Gt (a+b=c+overflow\*2^256) (可以使用 select struct)
|
|
|
|
|
|
- 如果是 0 行,则 cnt_prev=1,cnt_prev_prev=0
|
|
|
- carry hi is bool
|
|
|
- carry lo is bool
|
... | ... | @@ -79,8 +80,38 @@ operand* 用来存放算术中的参数值,如 a+b=c+overflow 指令中的 a,b |
|
|
- if tag is sub 有 c_lo = u16 sum(rotation cur),c_hi = u16 sum(rotation prev) and carry_hi iszero
|
|
|
- if tag is lt 则有 carry_hi iszero
|
|
|
- if tag is gt 则有 carry_hi 1
|
|
|
- Div_Mod
|
|
|
- Mul
|
|
|
|
|
|
- Div_Mod (a\*b+c=d 同时约束 c 小于 b)
|
|
|
|
|
|
- define t_lo=operand3_0*operand1_0+(operand3_0*operand1_1+operand3_1*operand1_0)*2^64
|
|
|
- define t_hi=(operand3_0*operand1_2+operand3_1*operand1_1+operand3_2*operand1_0)+(operand3_0*operand1_3+operand3_1*operand1_2+operand3_2*operand1_1+operand3_3*operand1_0)*2^64
|
|
|
- 如果是 0 行,约束 num_row is 8,并且约束 cnt 自增的有效性
|
|
|
- a_lo = u16 sum(rotation cur)
|
|
|
- a_hi = u16 sum(rotation -1)
|
|
|
- b_lo = u16 sum(rotation -2)
|
|
|
- b_hi = u16 sum(rotation -3)
|
|
|
- c_lo = u16 sum(rotation -4)
|
|
|
- c_hi = u16 sum(rotation -5)
|
|
|
- d_lo = u16 sum(rotation -6)
|
|
|
- d_hi = u16 sum(rotation -7)
|
|
|
- (t_lo+operand2_3+operand2_2*2^64-car_lo*2^128) - (operand0_3+operand0_2\*2^64)
|
|
|
- (t_hi+operand2_0+operand2_1*2^64+car_lo-car_hi*2^128) - (operand0_1+operand0_0\*2^64)
|
|
|
- 约束 c lt d
|
|
|
|
|
|
- Mul(需要 6 行对 a,b,c lookup ) 其中 operand0 是 a,operand1 是 b
|
|
|
|
|
|
- define t_lo=operand0_0*operand1_0+(operand0_0*operand1_1+operand0_1*operand1_0)*2^64
|
|
|
- define t_hi=(operand0_0*operand1_2+operand0_1*operand1_1+operand0_2*operand1_0)+(operand0_0*operand1_3+operand0_1*operand1_2+operand0_2*operand1_1+operand0_3*operand1_0)*2^64
|
|
|
- 如果是 0 行,约束 num_row is 6,并且约束 cnt 自增的有效性
|
|
|
- a_lo = u16 sum(rotation cur)
|
|
|
- a_hi = u16 sum(rotation -1)
|
|
|
- b_lo = u16 sum(rotation -2)
|
|
|
- b_hi = u16 sum(rotation -3)
|
|
|
- c_lo = u16 sum(rotation -4)
|
|
|
- c_hi = u16 sum(rotation -5)
|
|
|
- (t_lo-car_lo*2^128) -(operand2_3+operand2_2*2^64)
|
|
|
- (t_hi+car_lo-car_hi*2^128)- (operand2_1+operand2_0*2^64)
|
|
|
|
|
|
- Slt_Sgt
|
|
|
- Sdiv_Smod
|
|
|
- Addmod
|
... | ... | |