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
502 B

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