Skip to main content

ab_riscv_primitives/instructions/rv32/
b.rs

1//! RV32 B extension
2
3pub mod zba;
4pub mod zbb;
5pub mod zbc;
6pub mod zbs;
7
8use crate::instructions::Instruction;
9use crate::instructions::rv32::b::zba::Rv32ZbaInstruction;
10use crate::instructions::rv32::b::zbb::Rv32ZbbInstruction;
11use crate::instructions::rv32::b::zbs::Rv32ZbsInstruction;
12use crate::registers::general_purpose::Register;
13use ab_riscv_macros::instruction;
14use core::fmt;
15
16/// RISC-V RV32 B (Zba + Zbb + Zbs) instruction
17#[instruction(
18    inherit = [Rv32ZbaInstruction, Rv32ZbbInstruction, Rv32ZbsInstruction]
19)]
20#[derive(Debug, Clone, Copy)]
21#[derive_const(PartialEq, Eq)]
22pub enum Rv32BInstruction<Reg> {}
23
24#[instruction]
25const impl<Reg> Instruction for Rv32BInstruction<Reg>
26where
27    Reg: [const] Register<Type = u32>,
28{
29    const ALIGNMENT: u8 = align_of::<u32>() as u8;
30
31    type Reg = Reg;
32
33    #[inline(always)]
34    #[cfg_attr(feature = "no-panic", no_panic_const::no_panic(const))]
35    fn try_decode(instruction: u32) -> Option<Self> {
36        None
37    }
38
39    #[inline(always)]
40    fn size(&self) -> u8 {
41        size_of::<u32>() as u8
42    }
43}
44
45#[instruction]
46impl<Reg> fmt::Display for Rv32BInstruction<Reg>
47where
48    Reg: fmt::Display + Copy,
49{
50    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
51        match self {}
52    }
53}