Fix tinyram prelude, tinyram read from aux input. #90
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When trying to get a simple example (attached) to function with the
demo_ram_ppzksnark
executable, I encountered a problem that theread
opcode wasn't functioning as specified.Two mistakes I noticed there were:
a) the flag on
read
was being incorrectly set whenread_not1
was != 1, while it should be whenread_not1
is != 0 (this matches the r1cs constraints oneread_not1
, and further correctly sets the flag for tape 0 and not for tape 1).b) Fixing this resulted in values being consumed from tape 1 regardless of opcode, as the tape reading did not expicitly check for a
read
opcode.Unrelated during my debugging of this, I found that the prelude generation of tinyram increments by
log(w)/8
. This is clearly a mistake, asw
is already a size in bits.The example I was using which did not work before:
command:
simple.s
:simple.proc
simple.params
:simple.bounds
:simple.input
:P.S. Is there a public assember for TinyRAM? I had to write the processed assembly by hand, and while it'd be easy enough to write one, I'd prefer to avoid duplicating effort.