riscy_isa/opcode/
misc_mem.rs

1#[derive(Copy, Clone, Debug, PartialEq)]
2pub enum MiscMemFunction {
3    FENCE,
4    FENCEI,
5}
6
7impl MiscMemFunction {
8    pub fn from_func3(func3: u8) -> Self {
9        match func3 {
10            0b000 => MiscMemFunction::FENCE,
11            0b001 => MiscMemFunction::FENCEI,
12
13            _ => unimplemented!("MISC-MEM for func3={:#03b}", func3),
14        }
15    }
16
17    pub fn to_func3(&self) -> i32 {
18        match self {
19            MiscMemFunction::FENCE => 0b000,
20            MiscMemFunction::FENCEI => 0b001,
21        }
22    }
23}