Skip to main content

miden_air/trace/chiplets/
ace.rs

1use crate::trace::chiplets::Felt;
2
3// --- CONSTANTS ----------------------------------------------------------------------------------
4
5/// Unique label ACE operation, computed as the chiplet selector with the bits reversed, plus one.
6/// `selector = [1, 1, 1, 0]`, `flag = rev(selector) + 1 = [0, 1, 1, 1] + 1 = 8`
7pub const ACE_INIT_LABEL: Felt = Felt::new(0b0111 + 1);
8
9/// Total number of columns making up the ACE chiplet.
10pub const ACE_CHIPLET_NUM_COLS: usize = 16;
11
12/// Offset of the `ID1` wire used when encoding an ACE instruction.
13pub const ACE_INSTRUCTION_ID1_OFFSET: Felt = Felt::new(1 << 30);
14
15/// Offset of the `ID2` wire used when encoding an ACE instruction.
16pub const ACE_INSTRUCTION_ID2_OFFSET: Felt = Felt::new(1 << 60);
17
18// --- OPERATION SELECTORS ------------------------------------------------------------------------
19
20/// The index of the column containing the flag indicating the start of a new circuit evaluation.
21pub const SELECTOR_START_IDX: usize = 0;
22
23/// The index of the column containing the flag indicating whether the current row performs
24/// a READ or EVAL operation.
25pub const SELECTOR_BLOCK_IDX: usize = 1;
26
27// --- OPERATION IDENTIFIERS ----------------------------------------------------------------------
28
29/// The index of the column containing memory context.
30pub const CTX_IDX: usize = 2;
31
32/// The index of the column containing the pointer from which to read the next two variables
33/// or instruction.
34pub const PTR_IDX: usize = 3;
35
36/// The index of the column containing memory clk at which the memory read is performed.
37pub const CLK_IDX: usize = 4;
38
39/// The index of the column containing the index of the first wire being evaluated.
40pub const READ_NUM_EVAL_IDX: usize = 12;
41
42// --- ARITHMETIC GATES ---------------------------------------------------------------------------
43
44/// The index of the column containing the flag indicating which arithmetic operation to perform.
45pub const EVAL_OP_IDX: usize = 5;
46
47/// The index of the column containing ID of the first wire.
48pub const ID_0_IDX: usize = 6;
49
50/// The index of the column containing the first base-field element of the value of the first wire.
51pub const V_0_0_IDX: usize = 7;
52
53/// The index of the column containing the second base-field element of the value of the first wire.
54pub const V_0_1_IDX: usize = 8;
55
56/// The index of the column containing the multiplicity of the first wire.
57pub const M_0_IDX: usize = 15;
58
59/// The index of the column containing ID of the second wire.
60pub const ID_1_IDX: usize = 9;
61
62/// The index of the column containing the first base-field element of the value of the second wire.
63pub const V_1_0_IDX: usize = 10;
64
65/// The index of the column containing the second base-field element of the value of the second
66/// wire.
67pub const V_1_1_IDX: usize = 11;
68
69/// The index of the column containing the multiplicity of the second wire.
70/// This column has the meaning of a multiplicity column only when the rows are `READ` rows, else
71/// it should be interpreted as containing the second base-field element of the value of the third
72/// wire.
73pub const M_1_IDX: usize = 14;
74
75/// The index of the column containing ID of the third wire.
76pub const ID_2_IDX: usize = 12;
77
78/// The index of the column containing the first base-field element of the value of the third wire.
79pub const V_2_0_IDX: usize = 13;
80
81/// The index of the column containing the second base-field element of the value of the third wire.
82pub const V_2_1_IDX: usize = 14;