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.

35 lines
608 B

5 years ago
  1. include "../../circuits/mux2.circom";
  2. include "../../circuits/bitify.circom";
  3. template Constants() {
  4. var i;
  5. signal output out[4];
  6. out[0] <== 37;
  7. out[1] <== 47;
  8. out[2] <== 53;
  9. out[3] <== 71;
  10. }
  11. template Main() {
  12. var i;
  13. signal private input selector;
  14. signal output out;
  15. component mux = Mux2();
  16. component n2b = Num2Bits(2);
  17. component cst = Constants();
  18. selector ==> n2b.in;
  19. for (i=0; i<2; i++) {
  20. n2b.out[i] ==> mux.s[i];
  21. }
  22. for (i=0; i<4; i++) {
  23. cst.out[i] ==> mux.c[i];
  24. }
  25. mux.out ==> out;
  26. }
  27. component main = Main();