90 return sel.q_1_nz || (sel.q_m_nz && sel.gate_selector != 3) || sel.gate_selector == 3;
94 [](
const Selectors& sel) {
return sel.q_2_nz || (sel.q_m_nz && sel.gate_selector != 3); } },
98 {
Wire::W_4, [](
const Selectors& sel) {
return sel.q_4_nz || sel.gate_selector == 3; } },
101 [](
const Selectors& sel) {
return sel.gate_selector == 2 || sel.gate_selector == 3; } },
146namespace nnf_helpers {
159inline const GatePattern
175 [](
const Selectors& sel) {
return sel.q_m_nz || (sel.q_2_nz && sel.q_4_nz); } },
177 [](
const Selectors& sel) {
return sel.q_m_nz || (sel.q_2_nz && sel.q_4_nz); } },
193namespace memory_helpers {
213inline const GatePattern
375inline const GatePattern
437inline const GatePattern
442 return sel.gate_selector == 1 && (sel.q_m_nz || sel.q_5_nz || sel.q_1_nz);
445 [](
const Selectors& sel) {
return sel.gate_selector == 1 && (sel.q_m_nz || sel.q_2_nz); } },
447 [](
const Selectors& sel) {
return sel.gate_selector == 1 && (sel.q_5_nz || sel.q_3_nz); } },
448 {
Wire::W_4, [](
const Selectors& sel) {
return sel.gate_selector == 1 && sel.q_4_nz; } },
451inline const GatePattern
454 {
Wire::W_L, [](
const Selectors& sel) {
return sel.gate_selector == 2 && sel.q_1_nz; } },
455 {
Wire::W_R, [](
const Selectors& sel) {
return sel.gate_selector == 2 && sel.q_2_nz; } },
458inline const GatePattern
461 {
Wire::W_O, [](
const Selectors& sel) {
return sel.gate_selector == 2 && sel.q_3_nz; } },
462 {
Wire::W_4, [](
const Selectors& sel) {
return sel.gate_selector == 2 && sel.q_4_nz; } },
473 .q_m_nz = !block.q_m()[gate_index].is_zero(),
474 .q_1_nz = !block.q_1()[gate_index].is_zero(),
475 .q_2_nz = !block.q_2()[gate_index].is_zero(),
476 .q_3_nz = !block.q_3()[gate_index].is_zero(),
477 .q_4_nz = !block.q_4()[gate_index].is_zero(),
478 .q_5_nz = !block.q_5()[gate_index].is_zero(),
479 .q_c_nz = !block.q_c()[gate_index].is_zero(),
483template <
typename Block> uint32_t
get_wire(Block& block,
size_t gate_index,
Wire wire)
487 return block.w_l()[gate_index];
489 return block.w_r()[gate_index];
491 return block.w_o()[gate_index];
493 return block.w_4()[gate_index];
495 return block.w_l()[gate_index + 1];
497 return block.w_r()[gate_index + 1];
499 return block.w_o()[gate_index + 1];
501 return block.w_4()[gate_index + 1];
511template <
typename Block>
517 std::vector<uint32_t>
result;
518 for (
const auto& wire_spec : pattern.
wires) {
520 if (
is_shifted(wire_spec.wire) && gate_index + 1 >= block.size()) {
523 if (wire_spec.condition(selectors)) {
bool is_timestamp_check(const Selectors &sel)
bool is_rom_consistency(const Selectors &sel)
bool is_ram_consistency(const Selectors &sel)
bool is_limb_accum_2(const Selectors &sel)
bool is_product_3(const Selectors &sel)
const GatePattern POSEIDON2_TRANSITION_ENTRY
uint32_t get_wire(Block &block, size_t gate_index, Wire wire)
const GatePattern POSEIDON2_EXTERNAL
const GatePattern POSEIDON2_INTERNAL
Selectors read_selectors(Block &block, size_t gate_index, GateKind kind)
std::function< bool(const Selectors &)> Predicate
const GatePattern POSEIDON2_INITIAL_EXTERNAL
const GatePattern DATABUS
const GatePattern BATCHED_EQ_HALF_1
const GatePattern POSEIDON2_QUAD_INTERNAL_TERMINAL
const GatePattern NON_NATIVE_FIELD
const GatePattern ELLIPTIC
const GatePattern DELTA_RANGE
const GatePattern ARITHMETIC
const GatePattern BILINEAR
std::vector< uint32_t > extract_wires(Block &block, size_t gate_index, const GatePattern &pattern, const Selectors &selectors)
const GatePattern POSEIDON2_QUAD_INTERNAL
bool is_shifted(Wire wire)
const GatePattern BATCHED_EQ_HALF_2
FF read_gate_selector(const ExecutionTraceBlock< FF, NUM_WIRES > &block, GateKind kind, size_t idx)
Gate-selector value at (block, idx) for kind, returning zero if the block does not own this kind or t...
GateKind
Tag identifying which gate selector a block owns. Used by cross-block readers to decide whether (bloc...
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Pattern defining which wires are constrained by a gate type.
std::vector< WireSpec > wires
Selector values read from a gate.