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

#include <alu_arithmetic.hpp>

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

Public Member Functions

 ALU_smul_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 > &smulh_result, const pb_variable< FieldT > &smulh_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 > smulh_result
 
const pb_variable< FieldT > smulh_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_smul_gadget< FieldT >

Definition at line 701 of file alu_arithmetic.hpp.

Constructor & Destructor Documentation

◆ ALU_smul_gadget()

template<typename FieldT >
libsnark::ALU_smul_gadget< FieldT >::ALU_smul_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 > &  smulh_result,
const pb_variable< FieldT > &  smulh_flag,
const std::string &  annotation_prefix = "" 
)
inline

Definition at line 720 of file alu_arithmetic.hpp.

730  : ALU_arithmetic_gadget<FieldT>(
731  pb,
733  desval,
734  arg1val,
735  arg2val,
736  flag,
737  smulh_result,
738  smulh_flag,
740  , mul_result(
741  pb, 2 * pb.ap.w + 1, FMT(this->annotation_prefix, " mul_result"))
742  , /* see witness map for explanation for 2w+1 */
745  {
746  smulh_bits.insert(
747  smulh_bits.end(),
748  mul_result.bits.begin() + pb.ap.w,
749  mul_result.bits.begin() + 2 * pb.ap.w);
750 
751  pack_smulh_result.reset(new packing_gadget<FieldT>(
752  pb,
753  smulh_bits,
754  smulh_result,
755  FMT(this->annotation_prefix, " pack_smulh_result")));
756 
757  top.allocate(pb, FMT(this->annotation_prefix, " top"));
758  pack_top.reset(new packing_gadget<FieldT>(
759  pb,
760  pb_variable_array<FieldT>(
761  mul_result.bits.begin() + pb.ap.w - 1,
762  mul_result.bits.begin() + 2 * pb.ap.w),
763  top,
764  FMT(this->annotation_prefix, " pack_top")));
765 
766  is_top_empty.allocate(
767  pb, FMT(this->annotation_prefix, " is_top_empty"));
768  is_top_empty_aux.allocate(
769  pb, FMT(this->annotation_prefix, " is_top_empty_aux"));
770 
771  is_top_full.allocate(pb, FMT(this->annotation_prefix, " is_top_full"));
772  is_top_full_aux.allocate(
773  pb, FMT(this->annotation_prefix, " is_top_full_aux"));
774 
775  result_flag.allocate(pb, FMT(this->annotation_prefix, " result_flag"));
776  }
Here is the call graph for this function:

Member Function Documentation

◆ generate_r1cs_constraints()

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

◆ generate_r1cs_witness()

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

Member Data Documentation

◆ smulh_flag

template<typename FieldT >
const pb_variable<FieldT> libsnark::ALU_smul_gadget< FieldT >::smulh_flag

Definition at line 718 of file alu_arithmetic.hpp.

◆ smulh_result

template<typename FieldT >
const pb_variable<FieldT> libsnark::ALU_smul_gadget< FieldT >::smulh_result

Definition at line 717 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::tinyram_gadget::pb
tinyram_protoboard< FieldT > & pb
Definition: tinyram_protoboard.hpp:34
libsnark::ALU_smul_gadget::smulh_flag
const pb_variable< FieldT > smulh_flag
Definition: alu_arithmetic.hpp:718
libsnark::ALU_arithmetic_gadget::arg1val
const word_variable_gadget< FieldT > arg1val
Definition: alu_arithmetic.hpp:31
libsnark::ALU_smul_gadget::smulh_result
const pb_variable< FieldT > smulh_result
Definition: alu_arithmetic.hpp:717
libsnark::ALU_arithmetic_gadget::flag
const pb_variable< FieldT > flag
Definition: alu_arithmetic.hpp:33