mirror of
https://github.com/arnaucube/circom.git
synced 2026-02-07 03:06:42 +01:00
All Bit and logical operators working
This commit is contained in:
12
test/circuits/ops3.circom
Normal file
12
test/circuits/ops3.circom
Normal file
@@ -0,0 +1,12 @@
|
||||
template Ops3() {
|
||||
signal input in[2];
|
||||
signal output neg1;
|
||||
signal output neg2;
|
||||
signal output pow;
|
||||
|
||||
neg1 <-- -in[0];
|
||||
neg2 <-- -in[1];
|
||||
pow <-- in[0] ** in[1];
|
||||
}
|
||||
|
||||
component main = Ops3();
|
||||
18
test/circuits/opsbit.circom
Normal file
18
test/circuits/opsbit.circom
Normal file
@@ -0,0 +1,18 @@
|
||||
template OpsBit() {
|
||||
signal input in[2];
|
||||
signal output and;
|
||||
signal output or;
|
||||
signal output xor;
|
||||
signal output not1;
|
||||
signal output shl;
|
||||
signal output shr;
|
||||
|
||||
and <-- in[0] & in[1];
|
||||
or <-- in[0] | in[1];
|
||||
xor <-- in[0] ^ in[1];
|
||||
not1 <-- ~in[0];
|
||||
shl <-- in[0] << in[1];
|
||||
shr <-- in[0] >> in[1];
|
||||
}
|
||||
|
||||
component main = OpsBit();
|
||||
18
test/circuits/opscmp.circom
Normal file
18
test/circuits/opscmp.circom
Normal file
@@ -0,0 +1,18 @@
|
||||
template OpsCmp() {
|
||||
signal input in[2];
|
||||
signal output lt;
|
||||
signal output leq;
|
||||
signal output eq;
|
||||
signal output neq;
|
||||
signal output geq;
|
||||
signal output gt;
|
||||
|
||||
lt <-- in[0] < in[1];
|
||||
leq <-- in[0] <= in[1];
|
||||
eq <-- in[0] == in[1];
|
||||
neq <-- in[0] != in[1];
|
||||
geq <-- in[0] >= in[1];
|
||||
gt <-- in[0] > in[1];
|
||||
}
|
||||
|
||||
component main = OpsCmp();
|
||||
12
test/circuits/opslog.circom
Normal file
12
test/circuits/opslog.circom
Normal file
@@ -0,0 +1,12 @@
|
||||
template OpsLog() {
|
||||
signal input in[2];
|
||||
signal output and;
|
||||
signal output or;
|
||||
signal output not1;
|
||||
|
||||
and <-- in[0] && in[1];
|
||||
or <-- in[0] || in[1];
|
||||
not1 <-- !in[0];
|
||||
}
|
||||
|
||||
component main = OpsLog();
|
||||
Reference in New Issue
Block a user