eva_asm/instruction/
storage.rs

1//! Storage Operations.
2
3use derive_more::Display;
4
5use crate::{
6    instruction::Instruction,
7    opcode::{Mnemonic, OpCode},
8};
9
10/// Load word from storage.
11#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Display)]
12#[display("{}", self.opcode())]
13pub struct SLoad;
14
15impl Instruction for SLoad {
16    fn opcode(&self) -> OpCode {
17        OpCode::Known(Mnemonic::SLOAD)
18    }
19}
20
21/// Save word to storage.
22#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Display)]
23#[display("{}", self.opcode())]
24pub struct SStore;
25
26impl Instruction for SStore {
27    fn opcode(&self) -> OpCode {
28        OpCode::Known(Mnemonic::SSTORE)
29    }
30}
31
32/// Load word from transient storage.
33#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Display)]
34#[display("{}", self.opcode())]
35pub struct TLoad;
36
37impl Instruction for TLoad {
38    fn opcode(&self) -> OpCode {
39        OpCode::Known(Mnemonic::TLOAD)
40    }
41}
42
43/// Save word to transient storage.
44#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Display)]
45#[display("{}", self.opcode())]
46pub struct TStore;
47
48impl Instruction for TStore {
49    fn opcode(&self) -> OpCode {
50        OpCode::Known(Mnemonic::TSTORE)
51    }
52}