1#![allow(
2 clippy::new_without_default,
3 clippy::field_reassign_with_default,
4 clippy::unnecessary_cast,
5 clippy::cast_abs_to_unsigned,
6 clippy::needless_range_loop,
7 clippy::type_complexity,
8 clippy::unnecessary_unwrap,
9 clippy::default_constructed_unit_structs,
10 clippy::box_default,
11 clippy::assign_op_pattern,
12 deprecated,
13 incomplete_features
14)]
15#![warn(unused_extern_crates)]
16#[macro_use]
17extern crate static_assertions;
18
19pub mod adapter;
20pub mod air;
21pub mod alu;
22pub mod bytes;
23pub mod control_flow;
24pub mod executor;
25pub mod global;
26pub mod io;
27pub mod memory;
28pub mod operations;
29pub mod program;
30pub mod range;
31pub mod riscv;
32pub mod syscall;
33pub mod utils;
34pub mod utype;
35
36pub mod recursion {
41 pub use sp1_core_executor::SP1RecursionProof;
42}
43
44#[cfg(test)]
45pub mod programs {
46 #[allow(dead_code)]
47 #[allow(missing_docs)]
48 pub mod tests {
49 use sp1_core_executor::{add_halt, Instruction, Opcode, Program};
50
51 pub use test_artifacts::{
52 FIBONACCI_ELF, KECCAK_PERMUTE_ELF, PANIC_ELF, SECP256R1_ADD_ELF, SECP256R1_DOUBLE_ELF,
53 SSZ_WITHDRAWALS_ELF, U256XU2048_MUL_ELF,
54 };
55
56 #[must_use]
57 pub fn simple_program() -> Program {
58 let mut instructions = vec![
59 Instruction::new(Opcode::ADDI, 29, 0, 5, false, true),
60 Instruction::new(Opcode::ADDI, 30, 0, 37, false, true),
61 Instruction::new(Opcode::ADD, 31, 30, 29, false, false),
62 ];
63 add_halt(&mut instructions);
64 Program::new(instructions, 0, 0)
65 }
66
67 #[must_use]
73 pub fn fibonacci_program() -> Program {
74 Program::from(&FIBONACCI_ELF).unwrap()
75 }
76
77 #[must_use]
83 pub fn secp256r1_add_program() -> Program {
84 Program::from(&SECP256R1_ADD_ELF).unwrap()
85 }
86
87 #[must_use]
93 pub fn secp256r1_double_program() -> Program {
94 Program::from(&SECP256R1_DOUBLE_ELF).unwrap()
95 }
96
97 #[must_use]
103 pub fn u256xu2048_mul_program() -> Program {
104 Program::from(&U256XU2048_MUL_ELF).unwrap()
105 }
106
107 #[must_use]
113 pub fn ssz_withdrawals_program() -> Program {
114 Program::from(&SSZ_WITHDRAWALS_ELF).unwrap()
115 }
116
117 #[must_use]
123 pub fn keccak_permute_program() -> Program {
124 Program::from(&KECCAK_PERMUTE_ELF).unwrap()
125 }
126
127 #[must_use]
133 pub fn panic_program() -> Program {
134 Program::from(&PANIC_ELF).unwrap()
135 }
136
137 #[must_use]
138 #[allow(clippy::unreadable_literal)]
139 pub fn simple_memory_program() -> Program {
140 let instructions = vec![
141 Instruction::new(Opcode::ADDI, 29, 0, 0x12348765, false, true),
142 Instruction::new(Opcode::SW, 29, 0, 0x27654320, false, true),
144 Instruction::new(Opcode::LW, 28, 0, 0x27654320, false, true),
145 Instruction::new(Opcode::LBU, 27, 0, 0x27654320, false, true),
147 Instruction::new(Opcode::LBU, 26, 0, 0x27654321, false, true),
148 Instruction::new(Opcode::LBU, 25, 0, 0x27654322, false, true),
149 Instruction::new(Opcode::LBU, 24, 0, 0x27654323, false, true),
150 Instruction::new(Opcode::LB, 23, 0, 0x27654320, false, true),
152 Instruction::new(Opcode::LB, 22, 0, 0x27654321, false, true),
153 Instruction::new(Opcode::LHU, 21, 0, 0x27654320, false, true),
155 Instruction::new(Opcode::LHU, 20, 0, 0x27654322, false, true),
156 Instruction::new(Opcode::LH, 19, 0, 0x27654320, false, true),
158 Instruction::new(Opcode::LH, 18, 0, 0x27654322, false, true),
159 Instruction::new(Opcode::ADDI, 17, 0, 0x38276525, false, true),
161 Instruction::new(Opcode::SW, 29, 0, 0x43627530, false, true),
163 Instruction::new(Opcode::SB, 17, 0, 0x43627530, false, true),
164 Instruction::new(Opcode::LW, 16, 0, 0x43627530, false, true),
165 Instruction::new(Opcode::SB, 17, 0, 0x43627531, false, true),
166 Instruction::new(Opcode::LW, 15, 0, 0x43627530, false, true),
167 Instruction::new(Opcode::SB, 17, 0, 0x43627532, false, true),
168 Instruction::new(Opcode::LW, 14, 0, 0x43627530, false, true),
169 Instruction::new(Opcode::SB, 17, 0, 0x43627533, false, true),
170 Instruction::new(Opcode::LW, 13, 0, 0x43627530, false, true),
171 Instruction::new(Opcode::SW, 29, 0, 0x43627530, false, true),
174 Instruction::new(Opcode::SH, 17, 0, 0x43627530, false, true),
175 Instruction::new(Opcode::LW, 12, 0, 0x43627530, false, true),
176 Instruction::new(Opcode::SH, 17, 0, 0x43627532, false, true),
177 Instruction::new(Opcode::LW, 11, 0, 0x43627530, false, true),
178 ];
179 Program::new(instructions, 0, 0)
180 }
181 }
182}