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.

39 lines
706 B

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