Clearmatics Libsnark  0.1
C++ library for zkSNARK proofs
Public Member Functions | List of all members
libsnark::ALU_add_gadget< FieldT > Class Template Reference

#include <alu_arithmetic.hpp>

Inheritance diagram for libsnark::ALU_add_gadget< FieldT >:
Inheritance graph
[legend]
Collaboration diagram for libsnark::ALU_add_gadget< FieldT >:
Collaboration graph
[legend]

Public Member Functions

 ALU_add_gadget (tinyram_protoboard< FieldT > &pb, const pb_variable_array< FieldT > &opcode_indicators, const word_variable_gadget< FieldT > &desval, const word_variable_gadget< FieldT > &arg1val, const word_variable_gadget< FieldT > &arg2val, const pb_variable< FieldT > &flag, const pb_variable< FieldT > &result, const pb_variable< FieldT > &result_flag, const std::string &annotation_prefix="")
 
void generate_r1cs_constraints ()
 
void generate_r1cs_witness ()
 
- Public Member Functions inherited from libsnark::ALU_arithmetic_gadget< FieldT >
 ALU_arithmetic_gadget (tinyram_protoboard< FieldT > &pb, const pb_variable_array< FieldT > &opcode_indicators, const word_variable_gadget< FieldT > &desval, const word_variable_gadget< FieldT > &arg1val, const word_variable_gadget< FieldT > &arg2val, const pb_variable< FieldT > &flag, const pb_variable< FieldT > &result, const pb_variable< FieldT > &result_flag, const std::string &annotation_prefix="")
 
- Public Member Functions inherited from libsnark::tinyram_standard_gadget< FieldT >
 tinyram_standard_gadget (tinyram_protoboard< FieldT > &pb, const std::string &annotation_prefix="")
 
- Public Member Functions inherited from libsnark::tinyram_gadget< FieldT >
 tinyram_gadget (tinyram_protoboard< FieldT > &pb, const std::string &annotation_prefix="")
 
- Public Member Functions inherited from libsnark::gadget< FieldT >
 gadget (protoboard< FieldT > &pb, const std::string &annotation_prefix)
 

Additional Inherited Members

- Public Attributes inherited from libsnark::ALU_arithmetic_gadget< FieldT >
const pb_variable_array< FieldT > opcode_indicators
 
const word_variable_gadget< FieldT > desval
 
const word_variable_gadget< FieldT > arg1val
 
const word_variable_gadget< FieldT > arg2val
 
const pb_variable< FieldT > flag
 
const pb_variable< FieldT > result
 
const pb_variable< FieldT > result_flag
 
- Protected Attributes inherited from libsnark::tinyram_gadget< FieldT >
tinyram_protoboard< FieldT > & pb
 
- Protected Attributes inherited from libsnark::gadget< FieldT >
protoboard< FieldT > & pb
 
const std::string annotation_prefix
 

Detailed Description

template<typename FieldT>
class libsnark::ALU_add_gadget< FieldT >

Definition at line 277 of file alu_arithmetic.hpp.

Constructor & Destructor Documentation

◆ ALU_add_gadget()

template<typename FieldT >
libsnark::ALU_add_gadget< FieldT >::ALU_add_gadget ( tinyram_protoboard< FieldT > &  pb,
const pb_variable_array< FieldT > &  opcode_indicators,
const word_variable_gadget< FieldT > &  desval,
const word_variable_gadget< FieldT > &  arg1val,
const word_variable_gadget< FieldT > &  arg2val,
const pb_variable< FieldT > &  flag,
const pb_variable< FieldT > &  result,
const pb_variable< FieldT > &  result_flag,
const std::string &  annotation_prefix = "" 
)
inline

Definition at line 286 of file alu_arithmetic.hpp.

296  : ALU_arithmetic_gadget<FieldT>(
297  pb,
299  desval,
300  arg1val,
301  arg2val,
302  flag,
303  result,
304  result_flag,
306  {
307  addition_result.allocate(
308  pb, FMT(this->annotation_prefix, " addition_result"));
309  res_word.allocate(
310  pb, pb.ap.w, FMT(this->annotation_prefix, " res_word"));
311 
312  res_word_and_flag = res_word;
313  res_word_and_flag.emplace_back(result_flag);
314 
315  unpack_addition.reset(new packing_gadget<FieldT>(
316  pb,
317  res_word_and_flag,
318  addition_result,
319  FMT(this->annotation_prefix, " unpack_addition")));
320  pack_result.reset(new packing_gadget<FieldT>(
321  pb,
322  res_word,
323  result,
324  FMT(this->annotation_prefix, " pack_result")));
325  }
Here is the call graph for this function:

Member Function Documentation

◆ generate_r1cs_constraints()

template<typename FieldT >
void libsnark::ALU_add_gadget< FieldT >::generate_r1cs_constraints ( )
virtual

◆ generate_r1cs_witness()

template<typename FieldT >
void libsnark::ALU_add_gadget< FieldT >::generate_r1cs_witness ( )
virtual

The documentation for this class was generated from the following file:
libsnark::ALU_arithmetic_gadget::arg2val
const word_variable_gadget< FieldT > arg2val
Definition: alu_arithmetic.hpp:32
libsnark::gadget::annotation_prefix
const std::string annotation_prefix
Definition: gadget.hpp:20
libsnark::ALU_arithmetic_gadget::result
const pb_variable< FieldT > result
Definition: alu_arithmetic.hpp:34
libsnark::ALU_arithmetic_gadget::desval
const word_variable_gadget< FieldT > desval
Definition: alu_arithmetic.hpp:30
libsnark::ALU_arithmetic_gadget::opcode_indicators
const pb_variable_array< FieldT > opcode_indicators
Definition: alu_arithmetic.hpp:29
libsnark::tinyram_gadget::pb
tinyram_protoboard< FieldT > & pb
Definition: tinyram_protoboard.hpp:34
libsnark::ALU_arithmetic_gadget::arg1val
const word_variable_gadget< FieldT > arg1val
Definition: alu_arithmetic.hpp:31
libsnark::ALU_arithmetic_gadget::flag
const pb_variable< FieldT > flag
Definition: alu_arithmetic.hpp:33
libsnark::ALU_arithmetic_gadget::result_flag
const pb_variable< FieldT > result_flag
Definition: alu_arithmetic.hpp:35