sp1_core_executor/events/
instr.rs1use serde::{Deserialize, Serialize};
2
3use crate::Opcode;
4
5use super::MemoryRecordEnum;
6
7#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
11#[repr(C)]
12pub struct AluEvent {
13 pub pc: u32,
15 pub opcode: Opcode,
17 pub a: u32,
19 pub b: u32,
21 pub c: u32,
23 pub op_a_0: bool,
25}
26
27impl AluEvent {
28 #[must_use]
30 pub fn new(pc: u32, opcode: Opcode, a: u32, b: u32, c: u32, op_a_0: bool) -> Self {
31 Self { pc, opcode, a, b, c, op_a_0 }
32 }
33}
34
35#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
39#[repr(C)]
40pub struct MemInstrEvent {
41 pub shard: u32,
43 pub clk: u32,
45 pub pc: u32,
47 pub opcode: Opcode,
49 pub a: u32,
51 pub b: u32,
53 pub c: u32,
55 pub op_a_0: bool,
57 pub mem_access: MemoryRecordEnum,
59}
60
61impl MemInstrEvent {
62 #[must_use]
64 #[allow(clippy::too_many_arguments)]
65 pub fn new(
66 shard: u32,
67 clk: u32,
68 pc: u32,
69 opcode: Opcode,
70 a: u32,
71 b: u32,
72 c: u32,
73 op_a_0: bool,
74 mem_access: MemoryRecordEnum,
75 ) -> Self {
76 Self { shard, clk, pc, opcode, a, b, c, op_a_0, mem_access }
77 }
78}
79
80#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
84#[repr(C)]
85pub struct BranchEvent {
86 pub pc: u32,
88 pub next_pc: u32,
90 pub opcode: Opcode,
92 pub a: u32,
94 pub b: u32,
96 pub c: u32,
98 pub op_a_0: bool,
100}
101
102impl BranchEvent {
103 #[must_use]
105 #[allow(clippy::too_many_arguments)]
106 pub fn new(
107 pc: u32,
108 next_pc: u32,
109 opcode: Opcode,
110 a: u32,
111 b: u32,
112 c: u32,
113 op_a_0: bool,
114 ) -> Self {
115 Self { pc, next_pc, opcode, a, b, c, op_a_0 }
116 }
117}
118
119#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
123#[repr(C)]
124pub struct JumpEvent {
125 pub pc: u32,
127 pub next_pc: u32,
129 pub opcode: Opcode,
131 pub a: u32,
133 pub b: u32,
135 pub c: u32,
137 pub op_a_0: bool,
139}
140
141impl JumpEvent {
142 #[must_use]
144 #[allow(clippy::too_many_arguments)]
145 pub fn new(
146 pc: u32,
147 next_pc: u32,
148 opcode: Opcode,
149 a: u32,
150 b: u32,
151 c: u32,
152 op_a_0: bool,
153 ) -> Self {
154 Self { pc, next_pc, opcode, a, b, c, op_a_0 }
155 }
156}
157#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
161#[repr(C)]
162pub struct AUIPCEvent {
163 pub pc: u32,
165 pub opcode: Opcode,
167 pub a: u32,
169 pub b: u32,
171 pub c: u32,
173 pub op_a_0: bool,
175}
176
177impl AUIPCEvent {
178 #[must_use]
180 pub fn new(pc: u32, opcode: Opcode, a: u32, b: u32, c: u32, op_a_0: bool) -> Self {
181 Self { pc, opcode, a, b, c, op_a_0 }
182 }
183}