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

#include <alu_arithmetic.hpp>

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

Public Member Functions

 ALU_umul_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 > &mull_result, const pb_variable< FieldT > &mull_flag, const pb_variable< FieldT > &umulh_result, const pb_variable< FieldT > &umulh_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)
 

Public Attributes

const pb_variable< FieldT > mull_result
 
const pb_variable< FieldT > mull_flag
 
const pb_variable< FieldT > umulh_result
 
const pb_variable< FieldT > umulh_flag
 
- 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
 

Additional Inherited Members

- 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_umul_gadget< FieldT >

Definition at line 619 of file alu_arithmetic.hpp.

Constructor & Destructor Documentation

◆ ALU_umul_gadget()

template<typename FieldT >
libsnark::ALU_umul_gadget< FieldT >::ALU_umul_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 > &  mull_result,
const pb_variable< FieldT > &  mull_flag,
const pb_variable< FieldT > &  umulh_result,
const pb_variable< FieldT > &  umulh_flag,
const std::string &  annotation_prefix = "" 
)
inline

Definition at line 636 of file alu_arithmetic.hpp.

648  : ALU_arithmetic_gadget<FieldT>(
649  pb,
651  desval,
652  arg1val,
653  arg2val,
654  flag,
655  mull_result,
656  mull_flag,
658  , mul_result(
659  pb, 2 * pb.ap.w, FMT(this->annotation_prefix, " mul_result"))
664  {
665  mull_bits.insert(
666  mull_bits.end(),
667  mul_result.bits.begin(),
668  mul_result.bits.begin() + pb.ap.w);
669  umulh_bits.insert(
670  umulh_bits.end(),
671  mul_result.bits.begin() + pb.ap.w,
672  mul_result.bits.begin() + 2 * pb.ap.w);
673 
674  pack_mull_result.reset(new packing_gadget<FieldT>(
675  pb,
676  mull_bits,
677  mull_result,
678  FMT(this->annotation_prefix, " pack_mull_result")));
679  pack_umulh_result.reset(new packing_gadget<FieldT>(
680  pb,
681  umulh_bits,
682  umulh_result,
683  FMT(this->annotation_prefix, " pack_umulh_result")));
684 
685  result_flag.allocate(pb, FMT(this->annotation_prefix, " result_flag"));
686  compute_flag.reset(new disjunction_gadget<FieldT>(
687  pb,
688  umulh_bits,
689  result_flag,
690  FMT(this->annotation_prefix, " compute_flag")));
691  }
Here is the call graph for this function:

Member Function Documentation

◆ generate_r1cs_constraints()

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

◆ generate_r1cs_witness()

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

Member Data Documentation

◆ mull_flag

template<typename FieldT >
const pb_variable<FieldT> libsnark::ALU_umul_gadget< FieldT >::mull_flag

Definition at line 632 of file alu_arithmetic.hpp.

◆ mull_result

template<typename FieldT >
const pb_variable<FieldT> libsnark::ALU_umul_gadget< FieldT >::mull_result

Definition at line 631 of file alu_arithmetic.hpp.

◆ umulh_flag

template<typename FieldT >
const pb_variable<FieldT> libsnark::ALU_umul_gadget< FieldT >::umulh_flag

Definition at line 634 of file alu_arithmetic.hpp.

◆ umulh_result

template<typename FieldT >
const pb_variable<FieldT> libsnark::ALU_umul_gadget< FieldT >::umulh_result

Definition at line 633 of file alu_arithmetic.hpp.


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::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::ALU_umul_gadget::umulh_result
const pb_variable< FieldT > umulh_result
Definition: alu_arithmetic.hpp:633
libsnark::ALU_umul_gadget::umulh_flag
const pb_variable< FieldT > umulh_flag
Definition: alu_arithmetic.hpp:634
libsnark::ALU_umul_gadget::mull_result
const pb_variable< FieldT > mull_result
Definition: alu_arithmetic.hpp:631
libsnark::ALU_umul_gadget::mull_flag
const pb_variable< FieldT > mull_flag
Definition: alu_arithmetic.hpp:632
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