You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
536 B

6 years ago
  1. include "../../circuits/bitify.circom"
  2. include "../../circuits/binsub.circom"
  3. template A() {
  4. signal private input a;
  5. signal input b;
  6. signal output out;
  7. component n2ba = Num2Bits(16);
  8. component n2bb = Num2Bits(16);
  9. component sub = BinSub(16);
  10. component b2n = Bits2Num(16);
  11. n2ba.in <== a;
  12. n2bb.in <== b;
  13. for (var i=0; i<16; i++) {
  14. sub.in[0][i] <== n2ba.out[i];
  15. sub.in[1][i] <== n2bb.out[i];
  16. b2n.in[i] <== sub.out[i];
  17. }
  18. out <== b2n.out;
  19. }
  20. component main = A();