|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include <ram_table.hpp>
Public Member Functions | |
| ram_table () | |
| ram_table (Builder *builder, const std::vector< field_pt > &table_entries) | |
| Construct a new RAM table, i.e., dynamic memory with a fixed length. | |
| ram_table (const std::vector< field_pt > &table_entries) | |
| Construct a new RAM table, i.e., dynamic memory with a fixed length. | |
| ram_table (const ram_table &other) | |
| ram_table (ram_table &&other) | |
| void | initialize_table () const |
| internal method, is used to call Builder methods that will generate RAM table. | |
| ram_table & | operator= (const ram_table &other) |
| ram_table & | operator= (ram_table &&other) |
| field_pt | read (const field_pt &index) const |
| Read a field element from the RAM table at an index value. | |
| void | write (const field_pt &index, const field_pt &value) |
| Write a field element from the RAM table at an index value. | |
| size_t | size () const |
| Builder * | get_context () const |
| bool | check_indices_initialized () const |
Private Types | |
| typedef field_t< Builder > | field_pt |
Private Attributes | |
| std::vector< field_pt > | raw_entries |
| std::vector< OriginTag > | _tags |
| std::vector< bool > | index_initialized |
| size_t | length = 0 |
| size_t | ram_id = 0 |
| bool | ram_table_generated_in_builder = false |
| bool | all_entries_written_to_with_constant_index = false |
| Builder * | context = nullptr |
Definition at line 16 of file ram_table.hpp.
|
private |
Definition at line 18 of file ram_table.hpp.
|
inline |
Definition at line 21 of file ram_table.hpp.
| bb::stdlib::ram_table< Builder >::ram_table | ( | Builder * | builder, |
| const std::vector< field_pt > & | table_entries | ||
| ) |
Construct a new RAM table, i.e., dynamic memory with a fixed length.
This constructor is used in DSL, where we need to initialize a table with a builder to prevent the case in which a read operation happens before the context has been set.
Definition at line 24 of file ram_table.cpp.
| bb::stdlib::ram_table< Builder >::ram_table | ( | const std::vector< field_pt > & | table_entries | ) |
Construct a new RAM table, i.e., dynamic memory with a fixed length.
This constructor is used internally in barretenberg to construct tables without the need to specify the builder. It is especially useful when methods create new rom tables operating on in-circuit values which a priori we don't know whether they are constant or witnesses.
Definition at line 49 of file ram_table.cpp.
|
default |
|
default |
|
inline |
Definition at line 40 of file ram_table.hpp.
|
inline |
Definition at line 38 of file ram_table.hpp.
| void bb::stdlib::ram_table< Builder >::initialize_table | ( | ) | const |
internal method, is used to call Builder methods that will generate RAM table.
initialize the table once we perform a read. This ensures we always have a pointer to a Builder. (if both the table entries and the index are constant, we don't need a builder as we can directly extract the desired value fram raw_entries)
| Builder |
Definition at line 83 of file ram_table.cpp.
|
default |
|
default |
| field_t< Builder > bb::stdlib::ram_table< Builder >::read | ( | const field_pt & | index | ) | const |
Read a field element from the RAM table at an index value.
| Builder |
| index |
Definition at line 131 of file ram_table.cpp.
|
inline |
Definition at line 36 of file ram_table.hpp.
| void bb::stdlib::ram_table< Builder >::write | ( | const field_pt & | index, |
| const field_pt & | value | ||
| ) |
Write a field element from the RAM table at an index value.
| Builder |
| index | |
| value |
Definition at line 180 of file ram_table.cpp.
|
mutableprivate |
Definition at line 59 of file ram_table.hpp.
|
mutableprivate |
Definition at line 64 of file ram_table.hpp.
|
mutableprivate |
Definition at line 65 of file ram_table.hpp.
|
mutableprivate |
Definition at line 60 of file ram_table.hpp.
|
private |
Definition at line 61 of file ram_table.hpp.
|
mutableprivate |
Definition at line 62 of file ram_table.hpp.
|
mutableprivate |
Definition at line 63 of file ram_table.hpp.
|
private |
Definition at line 57 of file ram_table.hpp.