113 if (op_code.
eq && op_code.
reset) {
116 if (!op_code.
add && !op_code.
mul && !op_code.
eq && !op_code.
reset) {
144 return num_ultra_gates + num_goblin_ecc_op_gates;
154 size_t rangecount = 0;
159 count, rangecount, romcount, ramcount, nnfcount);
162 size_t total = count + romcount + ramcount + rangecount + num_goblin_ecc_op_gates;
163 std::cout <<
"gates = " << total <<
" (arith " << count <<
", rom " << romcount <<
", ram " << ramcount
164 <<
", range " << rangecount <<
", non native field gates " << nnfcount <<
", goblin ecc op gates "
227 databus[
static_cast<size_t>(bus_idx)].append(witness_idx);
243 std::vector<uint8_t>
buffer;
247 for (
auto& block : blocks_ref.get()) {
249 for (
const auto& wire : block.wires) {
250 for (
const auto& idx : wire) {
256 auto selectors = block.get_selectors();
257 for (
auto& selector : selectors) {
258 for (
size_t i = 0; i < selector.size(); ++i) {
268 std::stringstream ss;
const std::vector< uint32_t > & public_inputs() const
size_t num_public_inputs() const
void set_goblin_ecc_op_code_constant_variables()
const BusVector & get_calldata() const
uint32_t add_accum_op_idx
void queue_ecc_random_op()
Mechanism for populating two rows with randomness. This "operation" doesn't return a tuple representi...
ecc_op_tuple queue_ecc_add_accum(const g1::affine_element &point)
Add simple point addition operation to the op queue and add corresponding gates.
ecc_op_tuple queue_ecc_mul_accum(const g1::affine_element &point, const FF &scalar, bool in_finalize=false)
Add point mul-then-accumulate operation to the op queue and add corresponding gates.
std::shared_ptr< ECCOpQueue > op_queue
void apply_databus_selectors(BusId bus_idx)
uint32_t read_secondary_calldata(const uint32_t &read_idx_witness_idx)
Read from secondary_calldata and create a corresponding databus read gate.
void add_mega_gates_to_ensure_all_polys_are_non_zero()
Ensure all polynomials have at least one non-zero coefficient to avoid commiting to the zero-polynomi...
uint32_t get_ecc_op_idx(const EccOpCode &op_code)
Convert op code to the witness index for the corresponding op index in the builder.
void add_ultra_and_mega_gates_to_ensure_all_polys_are_non_zero()
Ensure all polynomials have at least one non-zero coefficient to avoid commiting to the zero-polynomi...
ecc_op_tuple queue_ecc_eq(bool in_finalize=true)
Add point equality operation to the op queue based on the value of the internal accumulator and add c...
void print_num_estimated_finalized_gates() const override
Print the number and composition of gates in the circuit.
void create_databus_read_gate(const databus_lookup_gate_< FF > &in, BusId bus_idx)
Create a databus lookup/read gate.
static constexpr size_t DEFAULT_NON_NATIVE_FIELD_LIMB_BITS
const BusVector & get_secondary_calldata() const
const BusVector & get_return_data() const
MegaCircuitBuilder_(const size_t size_hint=0, std::shared_ptr< ECCOpQueue > op_queue_in=std::make_shared< ECCOpQueue >())
ecc_op_tuple queue_ecc_no_op()
Logic for a no-op operation.
MegaCircuitBuilder_(std::shared_ptr< ECCOpQueue > op_queue_in, auto &witness_values, const std::vector< uint32_t > &public_inputs, size_t varnum)
Constructor from data generated from ACIR.
MegaCircuitBuilder_(std::shared_ptr< ECCOpQueue > op_queue_in)
void append_to_bus_vector(const BusId bus_idx, const uint32_t &witness_idx)
size_t get_num_constant_gates() const override
void add_public_secondary_calldata(const uint32_t &in)
Add a witness variable to secondary_calldata.
void add_public_return_data(const uint32_t &in)
Add a witness variable to the public return_data.
void finalize_circuit(const bool ensure_nonzero)
uint32_t mul_accum_op_idx
uint32_t read_bus_vector(BusId bus_idx, const uint32_t &read_idx_witness_idx)
Read from a databus column.
uint32_t read_return_data(const uint32_t &read_idx_witness_idx)
Read from return_data and create a corresponding databus read gate.
std::string hash() const
Compute a hash of the circuit.
uint32_t read_calldata(const uint32_t &read_idx_witness_idx)
Read from calldata and create a corresponding databus read gate.
size_t get_estimated_num_finalized_gates() const override
Get the final number of gates in a circuit, which consists of the sum of: 1) Current number number of...
ecc_op_tuple populate_ecc_op_wires(const UltraOp &ultra_op, bool in_finalize=false)
Add goblin ecc op gates for a single operation.
void add_public_calldata(const uint32_t &in)
Add a witness variable to the public calldata.
typename ExecutionTrace::FF FF
void get_num_estimated_gates_split_into_components(size_t &count, size_t &rangecount, size_t &romcount, size_t &ramcount, size_t &nnfcount) const
Get the final number of gates in a circuit, which consists of the sum of: 1) Current number number of...
size_t get_estimated_num_finalized_gates() const override
Get the final number of gates in a circuit, which consists of the sum of: 1) Current number number of...
uint8_t buffer[RANDOM_BUFFER_SIZE]
Sha256Hash sha256(const ByteContainer &input)
Entry point for Barretenberg command-line interface.
std::array< BusVector, 3 > DataBus
The DataBus; facilitates storage of public circuit input/output.
void write(std::vector< uint8_t > &buf, ClientIVC::VerificationKey const &vk)
MegaCircuitBuilder_< field< Bn254FrParams > > MegaCircuitBuilder
void write(auto &buf, const msgpack_concepts::HasMsgPack auto &obj)
Automatically derived write for any object that defines .msgpack() (implicitly defined by MSGPACK_FIE...
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Defines the opcodes for ECC operations used in both the Ultra and ECCVM formats. There are three opco...
void throw_or_abort(std::string const &err)