rigless 0.2.1

Virtual hardware-in-the-loop runtime: run unmodified firmware on an emulated MCU with every peripheral, chip model and unit of virtual time in Rust, and a CPU core of its own that translates the firmware's instructions to host code
Documentation
// rigless svd from STM32H743.svd, sha256 28dd22d7923a16c1167bda9cfe6cb20cc9e98d44095dd930fd987029a839af58. Do not edit.
// Copyright (c) 2025 STMicroelectronics.
// SPDX-License-Identifier: Apache-2.0
//! Registers of `VREFBUF` and the instances derived from it.

use rigless::soc::{Access, FieldSpec, Layout, ReadAction, RegisterSpec, Width, WriteModify};

/// The registers by name, where a variant's index is its row in [`REGISTERS`].
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Register {
    /// `CSR` at offset `0x0`, resets to `0x0000_0002`, read-write.
    Csr = 0,
    /// `CCR` at offset `0x4`, resets to `0x0000_0000`, read-write.
    Ccr = 1,
}

impl Register {
    /// Every register, in table order.
    pub const ALL: [Self; 2] = [Self::Csr, Self::Ccr];
}

impl Layout for Register {
    const REGISTERS: &'static [RegisterSpec] = &REGISTERS;
    fn from_index(index: usize) -> Option<Self> {
        Self::ALL.get(index).copied()
    }
    fn index(self) -> usize {
        self as usize
    }
}

/// The fields of `CSR`.
pub mod csr {
    use super::FieldSpec;
    /// `ENVR`, bit 0.
    pub const ENVR: &FieldSpec = &super::REGISTERS[0].fields[0];
    /// `HIZ`, bit 1.
    pub const HIZ: &FieldSpec = &super::REGISTERS[0].fields[1];
    /// `VRR`, bit 3, read-only.
    pub const VRR: &FieldSpec = &super::REGISTERS[0].fields[2];
    /// `VRS`, bits 4..=6.
    pub const VRS: &FieldSpec = &super::REGISTERS[0].fields[3];
}

/// The fields of `CCR`.
pub mod ccr {
    use super::FieldSpec;
    /// `TRIM`, bits 0..=5.
    pub const TRIM: &FieldSpec = &super::REGISTERS[1].fields[0];
}

/// The register table.
pub static REGISTERS: [RegisterSpec; 2] = [
    RegisterSpec { name: "CSR", offset: 0x0, width: Width::W32, reset: 0x0000_0002, access: Access::ReadWrite, read: ReadAction::None, write: WriteModify::None, fields: &[
        FieldSpec { name: "ENVR", bit: 0, width: 1, access: Access::ReadWrite, read: ReadAction::None, write: WriteModify::None },
        FieldSpec { name: "HIZ", bit: 1, width: 1, access: Access::ReadWrite, read: ReadAction::None, write: WriteModify::None },
        FieldSpec { name: "VRR", bit: 3, width: 1, access: Access::ReadOnly, read: ReadAction::None, write: WriteModify::None },
        FieldSpec { name: "VRS", bit: 4, width: 3, access: Access::ReadWrite, read: ReadAction::None, write: WriteModify::None },
    ] },
    RegisterSpec { name: "CCR", offset: 0x4, width: Width::W32, reset: 0x0000_0000, access: Access::ReadWrite, read: ReadAction::None, write: WriteModify::None, fields: &[
        FieldSpec { name: "TRIM", bit: 0, width: 6, access: Access::ReadWrite, read: ReadAction::None, write: WriteModify::None },
    ] },
];