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

Fix tinyram prelude, tinyram read from aux input. #90

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,12 @@ void tinyram_cpu_checker<FieldT>::generate_r1cs_witness_other(tinyram_input_tape
}

this->pb.val(read_not1) = this->pb.val(opcode_indicators[tinyram_opcode_READ]) * (FieldT::one() - this->pb.val(arg2val->packed));
if (this->pb.val(read_not1) != FieldT::one())
if (this->pb.val(read_not1) != FieldT::zero())
{
/* reading from tape other than 0 raises the flag */
/* reading from tape other than 1 raises the flag */
this->pb.val(instruction_flags[tinyram_opcode_READ]) = FieldT::one();
}
else
else if (this->pb.val(opcode_indicators[tinyram_opcode_READ]) != FieldT::zero())
{
/* otherwise perform the actual read */
if (aux_it != aux_end)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void ensure_tinyram_opcode_value_map()
std::vector<tinyram_instruction> generate_tinyram_prelude(const tinyram_architecture_params &ap)
{
std::vector<tinyram_instruction> result;
const size_t increment = libff::log2(ap.w)/8;
const size_t increment = ap.w/8;
const size_t mem_start = 1ul<<(ap.w-1);
result.emplace_back(tinyram_instruction(tinyram_opcode_STOREW, true, 0, 0, 0)); // 0: store.w 0, r0
result.emplace_back(tinyram_instruction(tinyram_opcode_MOV, true, 0, 0, mem_start)); // 1: mov r0, 2^{W-1}
Expand Down