8
8
#include " barretenberg/vm2/constraining/testing/check_relation.hpp"
9
9
#include " barretenberg/vm2/generated/flavor_settings.hpp"
10
10
#include " barretenberg/vm2/generated/relations/bitwise.hpp"
11
+ #include " barretenberg/vm2/generated/relations/lookups_bitwise.hpp"
11
12
#include " barretenberg/vm2/testing/fixtures.hpp"
12
13
#include " barretenberg/vm2/testing/macros.hpp"
13
14
#include " barretenberg/vm2/tracegen/bitwise_trace.hpp"
15
+ #include " barretenberg/vm2/tracegen/lib/lookup_into_bitwise.hpp"
16
+ #include " barretenberg/vm2/tracegen/lib/lookup_into_indexed_by_clk.hpp"
17
+ #include " barretenberg/vm2/tracegen/precomputed_trace.hpp"
14
18
#include " barretenberg/vm2/tracegen/test_trace_container.hpp"
15
19
16
20
namespace bb ::avm2::constraining {
@@ -22,6 +26,12 @@ using FF = AvmFlavorSettings::FF;
22
26
using C = Column;
23
27
using bitwise = bb::avm2::bitwise<FF>;
24
28
29
+ using tracegen::LookupIntoBitwise;
30
+ using tracegen::LookupIntoIndexedByClk;
31
+ using tracegen::PrecomputedTraceBuilder;
32
+ using lookup_bitwise_byte_operations = bb::avm2::lookup_bitwise_byte_operations_relation<FF>;
33
+ using lookup_bitwise_integral_tag_length = bb::avm2::lookup_bitwise_integral_tag_length_relation<FF>;
34
+
25
35
TEST (BitwiseConstrainingTest, EmptyRow)
26
36
{
27
37
check_relation<bitwise>(testing::empty_trace ());
@@ -315,5 +325,34 @@ TEST(BitwiseConstrainingTest, NegativeWrongAccumulation)
315
325
EXPECT_THROW_WITH_MESSAGE (check_relation<bitwise>(trace, bitwise::SR_BITW_ACC_REL_C), " BITW_ACC_REL_C" );
316
326
}
317
327
328
+ TEST (BitwiseConstrainingTest, MixedOperationsInteractions)
329
+ {
330
+ TestTraceContainer trace;
331
+ BitwiseTraceBuilder builder;
332
+ PrecomputedTraceBuilder precomputed_builder;
333
+
334
+ builder.process (
335
+ {
336
+ { .operation = BitwiseOperation::OR, .tag = MemoryTag::U1, .a = 1 , .b = 0 , .res = 1 },
337
+ { .operation = BitwiseOperation::AND, .tag = MemoryTag::U32, .a = 13793 , .b = 10590617 , .res = 4481 },
338
+ { .operation = BitwiseOperation::XOR, .tag = MemoryTag::U16, .a = 5323 , .b = 321 , .res = 5514 },
339
+ { .operation = BitwiseOperation::XOR, .tag = MemoryTag::U32, .a = 13793 , .b = 10590617 , .res = 10595448 },
340
+ { .operation = BitwiseOperation::AND, .tag = MemoryTag::U8, .a = 85 , .b = 175 , .res = 5 },
341
+ { .operation = BitwiseOperation::AND, .tag = MemoryTag::U8, .a = 85 , .b = 175 , .res = 5 },
342
+ },
343
+ trace);
344
+
345
+ precomputed_builder.process_misc (trace, 256 * 256 * 3 );
346
+ precomputed_builder.process_bitwise (trace);
347
+ precomputed_builder.process_integral_tag_length (trace);
348
+
349
+ LookupIntoBitwise<lookup_bitwise_byte_operations::Settings>().process (trace);
350
+ LookupIntoIndexedByClk<lookup_bitwise_integral_tag_length::Settings>().process (trace);
351
+
352
+ check_relation<bitwise>(trace);
353
+ check_interaction<lookup_bitwise_byte_operations>(trace);
354
+ check_interaction<lookup_bitwise_integral_tag_length>(trace);
355
+ }
356
+
318
357
} // namespace
319
- } // namespace bb::avm2::constraining
358
+ } // namespace bb::avm2::constraining
0 commit comments