Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::avm2::simulation::Addressing Class Referencefinal

#include <addressing.hpp>

Inheritance diagram for bb::avm2::simulation::Addressing:
bb::avm2::simulation::AddressingInterface

Public Member Functions

 Addressing (const InstructionInfoDBInterface &instruction_info_db, GreaterThanInterface &gt, EventEmitterInterface< AddressingEvent > &event_emitter)
 
std::vector< Operandresolve (const Instruction &instruction, MemoryInterface &memory) override
 Resolve the operands of an instruction. If the operands are non-addresses, they are returned as is. If the operands are addresses, we apply relative addressing and indirection to them. We emit an event of type AddressingEvent with the resolution information.
 
- Public Member Functions inherited from bb::avm2::simulation::AddressingInterface
virtual ~AddressingInterface ()=default
 

Private Member Functions

bool is_address_out_of_range (uint64_t address)
 Checks if an address as uint64_t is out of range. Emits a gt event comparing the address to AVM_HIGHEST_MEM_ADDRESS.
 

Private Attributes

const InstructionInfoDBInterfaceinstruction_info_db
 
GreaterThanInterfacegt
 
EventEmitterInterface< AddressingEvent > & events
 

Detailed Description

Definition at line 16 of file addressing.hpp.

Constructor & Destructor Documentation

◆ Addressing()

bb::avm2::simulation::Addressing::Addressing ( const InstructionInfoDBInterface instruction_info_db,
GreaterThanInterface gt,
EventEmitterInterface< AddressingEvent > &  event_emitter 
)
inline

Definition at line 18 of file addressing.hpp.

Member Function Documentation

◆ is_address_out_of_range()

bool bb::avm2::simulation::Addressing::is_address_out_of_range ( uint64_t  address)
private

Checks if an address as uint64_t is out of range. Emits a gt event comparing the address to AVM_HIGHEST_MEM_ADDRESS.

Parameters
addressas uint64_t
Returns
true if the address is out of range, false otherwise

Definition at line 182 of file addressing.cpp.

◆ resolve()

std::vector< Operand > bb::avm2::simulation::Addressing::resolve ( const Instruction instruction,
MemoryInterface memory 
)
overridevirtual

Resolve the operands of an instruction. If the operands are non-addresses, they are returned as is. If the operands are addresses, we apply relative addressing and indirection to them. We emit an event of type AddressingEvent with the resolution information.

Parameters
instructionthe instruction to resolve
memorythe memory to use
Returns
std::vector<Operand> the resolved operands
Exceptions
AddressingExceptionif an error occurs:
  • BASE_ADDRESS_INVALID: the base address is invalid
  • RELATIVE_COMPUTATION_OOB: the relative address computation overflowed
  • INVALID_ADDRESS_AFTER_INDIRECTION: the address obtained after applying indirection is invalid Note: We always process all operands even if an error occurs in one of them as we need error information for each operand in the event to correctly perform the trace generation.

Implements bb::avm2::simulation::AddressingInterface.

Definition at line 32 of file addressing.cpp.

Member Data Documentation

◆ events

EventEmitterInterface<AddressingEvent>& bb::avm2::simulation::Addressing::events
private

Definition at line 31 of file addressing.hpp.

◆ gt

GreaterThanInterface& bb::avm2::simulation::Addressing::gt
private

Definition at line 30 of file addressing.hpp.

◆ instruction_info_db

const InstructionInfoDBInterface& bb::avm2::simulation::Addressing::instruction_info_db
private

Definition at line 29 of file addressing.hpp.


The documentation for this class was generated from the following files: