Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
instruction_builder.cpp
Go to the documentation of this file.
1
#include "
barretenberg/vm2/testing/instruction_builder.hpp
"
2
3
namespace
bb::avm2::testing
{
4
5
simulation::Instruction
InstructionBuilder::build
()
const
6
{
7
// First we compute the indirect and relative contributions of each operand.
8
uint16_t
indirect
= 0;
9
for
(
size_t
i = 0; i <
operands
.size(); ++i) {
10
if
(
operands
[i].is_relative) {
11
indirect
|=
static_cast<
uint16_t
>
(1 << (i * 2 + 1));
12
}
13
if
(
operands
[i].is_indirect) {
14
indirect
|=
static_cast<
uint16_t
>
(1 << (i * 2));
15
}
16
}
17
18
// Then we build the instruction.
19
std::vector<simulation::Operand>
operands_vec;
20
operands_vec.reserve(
operands
.size());
21
for
(
const
auto
&
operand
:
operands
) {
22
operands_vec.push_back(
operand
.
operand
);
23
}
24
return
simulation::Instruction
(
opcode
,
indirect
,
std::move
(operands_vec));
25
}
26
27
}
// namespace bb::avm2::testing
bb::avm2::testing::InstructionBuilder::build
simulation::Instruction build() const
Definition
instruction_builder.cpp:5
bb::avm2::testing::InstructionBuilder::operand
InstructionBuilder & operand(OperandBuilder operand)
Definition
instruction_builder.hpp:44
bb::avm2::testing::InstructionBuilder::operands
std::vector< OperandBuilder > operands
Definition
instruction_builder.hpp:37
bb::avm2::testing::InstructionBuilder::indirect
InstructionBuilder & indirect()
Definition
instruction_builder.hpp:56
bb::avm2::testing::InstructionBuilder::opcode
WireOpCode opcode
Definition
instruction_builder.hpp:36
instruction_builder.hpp
bb::avm2::testing
Definition
fixtures.cpp:17
std::get
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition
tuple.hpp:13
bb::avm2::simulation::Instruction
Definition
serialization.hpp:30
src
barretenberg
vm2
testing
instruction_builder.cpp
Generated by
1.9.8