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

Witness-generating implementation of bitwise AND/OR/XOR operations. More...

#include <bitwise.hpp>

Inheritance diagram for bb::avm2::simulation::Bitwise:
bb::avm2::simulation::BitwiseInterface

Public Member Functions

 Bitwise (EventEmitterInterface< BitwiseEvent > &event_emitter)
 
MemoryValue and_op (const MemoryValue &a, const MemoryValue &b) override
 Perform bitwise AND on two tagged memory values.
 
MemoryValue or_op (const MemoryValue &a, const MemoryValue &b) override
 Perform bitwise OR on two tagged memory values.
 
MemoryValue xor_op (const MemoryValue &a, const MemoryValue &b) override
 Perform bitwise XOR on two tagged memory values.
 
- Public Member Functions inherited from bb::avm2::simulation::BitwiseInterface
virtual ~BitwiseInterface ()=default
 

Private Attributes

EventEmitterInterface< BitwiseEvent > & events
 

Detailed Description

Witness-generating implementation of bitwise AND/OR/XOR operations.

Definition at line 13 of file bitwise.hpp.

Constructor & Destructor Documentation

◆ Bitwise()

bb::avm2::simulation::Bitwise::Bitwise ( EventEmitterInterface< BitwiseEvent > &  event_emitter)
inline
Parameters
event_emitterDestination for BitwiseEvent emissions consumed by tracegen.

Definition at line 18 of file bitwise.hpp.

Member Function Documentation

◆ and_op()

MemoryValue bb::avm2::simulation::Bitwise::and_op ( const MemoryValue a,
const MemoryValue b 
)
overridevirtual

Perform bitwise AND on two tagged memory values.

On success, emits a BitwiseEvent with the computed result and returns it. On error (FF tag or tag mismatch), emits the event with res=0, then throws.

Parameters
aLeft operand.
bRight operand.
Returns
The AND result with the same tag as the inputs.
Exceptions
BitwiseExceptionIf either tag is FF or tags don't match.

Implements bb::avm2::simulation::BitwiseInterface.

Definition at line 20 of file bitwise.cpp.

◆ or_op()

MemoryValue bb::avm2::simulation::Bitwise::or_op ( const MemoryValue a,
const MemoryValue b 
)
overridevirtual

Perform bitwise OR on two tagged memory values.

On success, emits a BitwiseEvent with the computed result and returns it. On error (FF tag or tag mismatch), emits the event with res=0, then throws.

Parameters
aLeft operand.
bRight operand.
Returns
The OR result with the same tag as the inputs.
Exceptions
BitwiseExceptionIf either tag is FF or tags don't match.

Implements bb::avm2::simulation::BitwiseInterface.

Definition at line 43 of file bitwise.cpp.

◆ xor_op()

MemoryValue bb::avm2::simulation::Bitwise::xor_op ( const MemoryValue a,
const MemoryValue b 
)
overridevirtual

Perform bitwise XOR on two tagged memory values.

On success, emits a BitwiseEvent with the computed result and returns it. On error (FF tag or tag mismatch), emits the event with res=0, then throws.

Parameters
aLeft operand.
bRight operand.
Returns
The XOR result with the same tag as the inputs.
Exceptions
BitwiseExceptionIf either tag is FF or tags don't match.

Implements bb::avm2::simulation::BitwiseInterface.

Definition at line 66 of file bitwise.cpp.

Member Data Documentation

◆ events

EventEmitterInterface<BitwiseEvent>& bb::avm2::simulation::Bitwise::events
private

Definition at line 27 of file bitwise.hpp.


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