Skip to content

Commit

Permalink
Merge pull request #230 from a16z/fix/instruction-flags-constraint
Browse files Browse the repository at this point in the history
Instruction flag constraint with LUI fix
  • Loading branch information
moodlezoup authored Mar 28, 2024
2 parents 0bd01d4 + dafee07 commit e61401e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions jolt-core/src/jolt/trace/rv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ impl TryFrom<&ELFInstruction> for RV32I {

RV32IM::JAL => Ok(ADDInstruction::default().into()),
RV32IM::JALR => Ok(ADDInstruction::default().into()),
RV32IM::LUI => Ok(ADDInstruction::default().into()),
RV32IM::AUIPC => Ok(ADDInstruction::default().into()),

RV32IM::SB => Ok(SBInstruction::default().into()),
Expand Down
2 changes: 1 addition & 1 deletion jolt-core/src/r1cs/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ impl R1CSBuilder {
// TODO(arasuarun): this should be done after fixing the padding issue for prog_a_rw

// Combine flag_bits and check that they equal op_flags_packed.
// R1CSBuilder::combine_constraint(instance, GET_INDEX(InputType::OpFlags, 0), 1, N_FLAGS, op_flags_packed);
R1CSBuilder::combine_constraint(instance, GET_INDEX(InputType::OpFlags, 0), 1, N_FLAGS, op_flags_packed);

// Constriant: signal immediate <== if_else()([is_lui_auipc, immediate_before_processing, immediate_before_processing * (2**12)]);
let immediate: usize = R1CSBuilder::if_else(instance, smallvec![(is_lui_auipc, 1)], smallvec![(immediate_before_processing, 1)], smallvec![(immediate_before_processing, 1<<12)]);
Expand Down

0 comments on commit e61401e

Please sign in to comment.