Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions about TinyRAM #15

Open
jimouris opened this issue Dec 5, 2018 · 2 comments
Open

Questions about TinyRAM #15

jimouris opened this issue Dec 5, 2018 · 2 comments

Comments

@jimouris
Copy link

jimouris commented Dec 5, 2018

Hello,

I have some questions about TinyRAM. Does TinyRAM support labels and comments as claimed in the documentation?

Also, how can I see the result of the ANSWER instruction?

How I can give input? It seems that there are two tapes, for primary and auxiliary input respectively, and that there is a read instruction that reads from the tapes, however, I could not find any example on how to use it.

Finally, UMOD seems to be broken. I have filled some registers with values and when I call UMOD I get ERROR: Fatal error encoutered. Run debug build for more information and stack trace. Example usage:

MOV r0 r0 9
MOV r1 r0 4
UMOD r5 r0 r1
ANSWER r5 r5 r5

Thanks in advance,
Dimitris Mouris

@iddo333
Copy link
Collaborator

iddo333 commented Dec 6, 2018

About labels, the current implementation is rather low-level and the programmer needs to take care of label handling.
You can see for example in the file tinyram/stark-tinyram-tests/ConstraintsSystem2Bair_UTEST.cpp that there are label comments such as /L5/ to represent line#5 in MachineInstruction instruction2(Opcode::CJMP, true, 0, 0, 20 /L5/);
It is also presented a little more clearly in Appendix C of https://eprint.iacr.org/2016/646

About the output of the ANSWER instruction, it is implemented in ALU_ANSWER_Gadget::generateWitness() of tinyram/stark-tinyram/src/TinyRAMtoBair/RamToContraintSystem/ALU.cpp (the current code has verbose printout at the end of this function but it's commented-out, you can comment-in this code).

jimouris added a commit to jimouris/libSTARK that referenced this issue Dec 7, 2018
@jimouris
Copy link
Author

jimouris commented Dec 7, 2018

@iddo333 Thanks for your reply.

I saw the L5 that you mention in the source code and also the Line#linenumber notation in the paper, but it seems that TinyRAM uses just a line number in jump instructions. It's line-numbers not PC numbers, thanks.

About the ANSWER, it didn't compile at first since #include <iostream> was missing from ALU.cpp, but with this addition it worked fine. I already had a pull request #16 about another typo in ALU.cpp, I also added the forgotten iostream.

What about the input tapes with the read instruction? Is there another way to give input to a TinyRAM program?

Finally, are all the hardcoded inputs in the asm programs public? For example, in a MOV r0 r0 5, is 5 public (shared with the verifier), or it remains private (only the prover knows it)? In either case, how can I have private variables?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants