/*
 * Copyright (c) 2022, Shenzhen CVA Innovation CO.,LTD
 * All rights reserved.
 *
 * Shenzhen CVA Innovation CO.,LTD (CVA chip) is supplying this file for use
 * exclusively with CVA's microcontroller products. This file can be freely
 * distributed within development tools that are supporting such microcontroller
 * products.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
 * CVA SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
 * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 */

#ifndef _SIM_REG_H_
#define _SIM_REG_H_

/*! \brief Contains public interface to various functions related
 *         to the SIM (System Integration Module) Registers
 */

/*******************************************************************************
 * the includes
 ******************************************************************************/

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

/*******************************************************************************
 * the defines
 ******************************************************************************/

/* CHIP Bit Fields */
#define SIM_CHIP_SRAM_SIZE_MASK          (0x1000u)
#define SIM_CHIP_SRAM_SIZE_SHIFT         (12u)
#define SIM_CHIP_SRAM_SIZE_WIDTH         (1u)
#define SIM_CHIP_PFLS_SIZE_MASK          (0x100u)
#define SIM_CHIP_PFLS_SIZE_SHIFT         (8u)
#define SIM_CHIP_PFLS_SIZE_WIDTH         (1u)
#define SIM_CHIP_SRAM_INIT_ST_MASK       (0x20u)
#define SIM_CHIP_SRAM_INIT_ST_SHIFT      (5u)
#define SIM_CHIP_SRAM_INIT_ST_WIDTH      (1u)
#define SIM_CHIP_SRAM_INIT_MASK          (0x8u)
#define SIM_CHIP_SRAM_INIT_SHIFT         (3u)
#define SIM_CHIP_SRAM_INIT_WIDTH         (1u)
#define SIM_CHIP_SRAM_RETEN_MASK         (0x2u)
#define SIM_CHIP_SRAM_RETEN_SHIFT        (1u)
#define SIM_CHIP_SRAM_RETEN_WIDTH        (1u)

/* PWM_CTRL0 Bit Fields */
#define SIM_PWM_CTRL0_PWM_FUNC5_MASK     (0xF00000u)
#define SIM_PWM_CTRL0_PWM_FUNC5_SHIFT    (20u)
#define SIM_PWM_CTRL0_PWM_FUNC5_WIDTH    (4u)
#define SIM_PWM_CTRL0_PWM_FUNC4_MASK     (0xF0000u)
#define SIM_PWM_CTRL0_PWM_FUNC4_SHIFT    (16u)
#define SIM_PWM_CTRL0_PWM_FUNC4_WIDTH    (4u)
#define SIM_PWM_CTRL0_PWM_FUNC3_MASK     (0xF000u)
#define SIM_PWM_CTRL0_PWM_FUNC3_SHIFT    (12u)
#define SIM_PWM_CTRL0_PWM_FUNC3_WIDTH    (4u)
#define SIM_PWM_CTRL0_PWM_FUNC2_MASK     (0xF00u)
#define SIM_PWM_CTRL0_PWM_FUNC2_SHIFT    (8u)
#define SIM_PWM_CTRL0_PWM_FUNC2_WIDTH    (4u)
#define SIM_PWM_CTRL0_PWM_FUNC1_MASK     (0xF0u)
#define SIM_PWM_CTRL0_PWM_FUNC1_SHIFT    (4u)
#define SIM_PWM_CTRL0_PWM_FUNC1_WIDTH    (4u)
#define SIM_PWM_CTRL0_PWM_FUNC0_MASK     (0xFu)
#define SIM_PWM_CTRL0_PWM_FUNC0_SHIFT    (0u)
#define SIM_PWM_CTRL0_PWM_FUNC0_WIDTH    (4u)

/* PWM_CTRL1 Bit Fields */
#define SIM_PWM_CTRL1_PWM_FUNC5_MASK     (0xF00000u)
#define SIM_PWM_CTRL1_PWM_FUNC5_SHIFT    (20u)
#define SIM_PWM_CTRL1_PWM_FUNC5_WIDTH    (4u)
#define SIM_PWM_CTRL1_PWM_FUNC4_MASK     (0xF0000u)
#define SIM_PWM_CTRL1_PWM_FUNC4_SHIFT    (16u)
#define SIM_PWM_CTRL1_PWM_FUNC4_WIDTH    (4u)
#define SIM_PWM_CTRL1_PWM_FUNC3_MASK     (0xF000u)
#define SIM_PWM_CTRL1_PWM_FUNC3_SHIFT    (12u)
#define SIM_PWM_CTRL1_PWM_FUNC3_WIDTH    (4u)
#define SIM_PWM_CTRL1_PWM_FUNC2_MASK     (0xF00u)
#define SIM_PWM_CTRL1_PWM_FUNC2_SHIFT    (8u)
#define SIM_PWM_CTRL1_PWM_FUNC2_WIDTH    (4u)
#define SIM_PWM_CTRL1_PWM_FUNC1_MASK     (0xF0u)
#define SIM_PWM_CTRL1_PWM_FUNC1_SHIFT    (4u)
#define SIM_PWM_CTRL1_PWM_FUNC1_WIDTH    (4u)
#define SIM_PWM_CTRL1_PWM_FUNC0_MASK     (0xFu)
#define SIM_PWM_CTRL1_PWM_FUNC0_SHIFT    (0u)
#define SIM_PWM_CTRL1_PWM_FUNC0_WIDTH    (4u)

/* MFT_CTRL0 Bit Fields */
#define SIM_MFT_CTRL0_MFT1_FLT_SEL_MASK  (0x700000u)
#define SIM_MFT_CTRL0_MFT1_FLT_SEL_SHIFT (20u)
#define SIM_MFT_CTRL0_MFT1_FLT_SEL_WIDTH (3u)
#define SIM_MFT_CTRL0_MFT0_FLT_SEL_MASK  (0x70000u)
#define SIM_MFT_CTRL0_MFT0_FLT_SEL_SHIFT (16u)
#define SIM_MFT_CTRL0_MFT0_FLT_SEL_WIDTH (3u)
#define SIM_MFT_CTRL0_GLDOK_MASK         (0x01u)
#define SIM_MFT_CTRL0_GLDOK_SHIFT        (0u)
#define SIM_MFT_CTRL0_GLDOK_WIDTH        (1u)

/* MFT_CTRL1 Bit Fields */
#define SIM_MFT_CTRL1_MFT1SYNCBIT_MASK   (0x2000000u)
#define SIM_MFT_CTRL1_MFT1SYNCBIT_SHIFT  (25u)
#define SIM_MFT_CTRL1_MFT1SYNCBIT_WIDTH  (1u)
#define SIM_MFT_CTRL1_MFT0SYNCBIT_MASK   (0x1000000u)
#define SIM_MFT_CTRL1_MFT0SYNCBIT_SHIFT  (24u)
#define SIM_MFT_CTRL1_MFT0SYNCBIT_WIDTH  (1u)
#define SIM_MFT_CTRL1_MFT1CH1SEL_MASK    (0x40000u)
#define SIM_MFT_CTRL1_MFT1CH1SEL_SHIFT   (18u)
#define SIM_MFT_CTRL1_MFT1CH1SEL_WIDTH   (1u)
#define SIM_MFT_CTRL1_MFT0_OUTSEL_MASK   (0xFF00u)
#define SIM_MFT_CTRL1_MFT0_OUTSEL_SHIFT  (8u)
#define SIM_MFT_CTRL1_MFT0_OUTSEL_WIDTH  (8u)

/* FLASH Bit Fields */
#define SIM_FLASH_EEERST_MASK            (0x800u)
#define SIM_FLASH_EEERST_SHIFT           (11u)
#define SIM_FLASH_EEERST_WIDTH           (1u)
#define SIM_FLASH_EEEVLD_MASK            (0x400u)
#define SIM_FLASH_EEEVLD_SHIFT           (10u)
#define SIM_FLASH_EEEVLD_WIDTH           (1u)
#define SIM_FLASH_LOAD_DONE_MASK         (0x200u)
#define SIM_FLASH_LOAD_DONE_SHIFT        (9u)
#define SIM_FLASH_LOAD_DONE_WIDTH        (1u)
#define SIM_FLASH_VIRGIN_FLAG_MASK       (0x100u)
#define SIM_FLASH_VIRGIN_FLAG_SHIFT      (8u)
#define SIM_FLASH_VIRGIN_FLAG_WIDTH      (1u)
#define SIM_FLASH_DFLS_FLUSH_EN_MASK     (0x08u)
#define SIM_FLASH_DFLS_FLUSH_EN_SHIFT    (3u)
#define SIM_FLASH_DFLS_FLUSH_EN_WIDTH    (1u)
#define SIM_FLASH_PFLS_FLUSH_EN_MASK     (0x04u)
#define SIM_FLASH_PFLS_FLUSH_EN_SHIFT    (2u)
#define SIM_FLASH_PFLS_FLUSH_EN_WIDTH    (1u)
#define SIM_FLASH_DFLS_PFB_EN_MASK       (0x02u)
#define SIM_FLASH_DFLS_PFB_EN_SHIFT      (1u)
#define SIM_FLASH_DFLS_PFB_EN_WIDTH      (1u)
#define SIM_FLASH_PFLS_PFB_EN_MASK       (0x01u)
#define SIM_FLASH_PFLS_PFB_EN_SHIFT      (0u)
#define SIM_FLASH_PFLS_PFB_EN_WIDTH      (1u)

/* UDIDH Bit Fields */
#define SIM_UDIDH_H_MASK                 (0xFFFFFFFFu)
#define SIM_UDIDH_H_SHIFT                (0u)
#define SIM_UDIDH_H_WIDTH                (32u)

/* UDIDMH Bit Fields */
#define SIM_UDIDMH_MH_MASK               (0xFFFFFFFFu)
#define SIM_UDIDMH_MH_SHIFT              (0u)
#define SIM_UDIDMH_MH_WIDTH              (32u)

/* UDIDML Bit Fields */
#define SIM_UDIDML_ML_MASK               (0xFFFFFFFFu)
#define SIM_UDIDML_ML_SHIFT              (0u)
#define SIM_UDIDML_ML_WIDTH              (32u)

/* UDIDL Bit Fields */
#define SIM_UDIDL_L_MASK                 (0xFFFFFFFFu)
#define SIM_UDIDL_L_SHIFT                (0u)
#define SIM_UDIDL_L_WIDTH                (32u)

/* SDID Bit Fields */
#define SIM_SDID_ID_MASK                 (0xFFFFFFFFu)
#define SIM_SDID_ID_SHIFT                (0u)
#define SIM_SDID_ID_WIDTH                (32u)

/* SW_TRG Bit Fields */
#define SIM_SW_TRG_SW_TRG_MASK           (0x01u)
#define SIM_SW_TRG_SW_TRG_SHIFT          (0u)
#define SIM_SW_TRG_SW_TRG_WIDTH          (1u)

/*******************************************************************************
 * the typedefs
 ******************************************************************************/

/*! \brief The definition of SIM registers
 */
typedef struct _SimRegType_
{
    uint32_t                RESERVED0[1]; /*!< Reserverd block, offset: 0x00 */
    volatile uint32_t       CHIP;         /*!< system chip register, offset: 0x04 */
    uint32_t                RESERVED1[2]; /*!< Reserverd block, offset: 0x08 */
    volatile uint32_t       PWM_CTRL0;    /*!< system PWM register 0, offset: 0x10 */
    volatile uint32_t       PWM_CTRL1;    /*!< system PWM register 1, offset: 0x14 */
    uint32_t                RESERVED2[3]; /*!< Reserverd block, offset: 0x1C */
    volatile uint32_t       MFT_CTRL0;    /*!< system MFT register 0, offset: 0x24 */
    volatile uint32_t       MFT_CTRL1;    /*!< system MFT register 1, offset: 0x28 */
    volatile uint32_t       FLASH;        /*!< system flash controller register, offset: 0x2C */
    const volatile uint32_t UDIDH;        /*!< system UD ID high register, offset: 0x30 */
    const volatile uint32_t UDIDMH;       /*!< system UD ID medium high register, offset: 0x34 */
    const volatile uint32_t UDIDML;       /*!< system UD ID medium low register, offset: 0x38 */
    const volatile uint32_t UDIDL;        /*!< system UD ID low register, offset: 0x3C */
    const volatile uint32_t SDID;         /*!< system SDID high register, offset: 0x40 */
    volatile uint32_t       SW_TRG;       /*!< system software trigger register, offset: 0x44 */
} SimRegType;

/*******************************************************************************
 * the globals
 ******************************************************************************/

/*******************************************************************************
 * the function prototypes
 ******************************************************************************/
/*! \brief Gets the SRAM Size
 *
 * This function gets the current SRAM Size.
 *
 * \param[in] obj : pointer to SIM register instance
 * \return SRAM size
 *         - 0b : 8K
 *         - 1b : 16K
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetChipSRamSize(const SimRegType *obj)
{
    return ((obj->CHIP & SIM_CHIP_SRAM_SIZE_MASK) >> SIM_CHIP_SRAM_SIZE_SHIFT);
}

/*! \brief Gets the PFlash Size
 *
 * This function gets the current  PFlash Size.
 *
 * \param[in] obj : pointer to SIM register instance
 * \return Pflash size
 *         - 0b : 128K
 *         - 1b : 224K
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetChipPFlsSize(const SimRegType *obj)
{
    return ((obj->CHIP & SIM_CHIP_PFLS_SIZE_MASK) >> SIM_CHIP_PFLS_SIZE_SHIFT);
}

/*! \brief Gets the SRAM initialization status
 *
 * This function gets the current SRAM initialization status.
 *
 * \param[in] obj : pointer to SIM register instance
 * \return SRAM initialization status
 *         - 0b : SRAM initialization is in progress
 *         - 1b : SRAM initialization is done or not started
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetChipSRamInitSt(const SimRegType *obj)
{
    return ((obj->CHIP & SIM_CHIP_SRAM_INIT_ST_MASK) >> SIM_CHIP_SRAM_INIT_ST_SHIFT);
}

/*! \brief Sets the SRAM initial command
 *
 * This function sets the SRAM initial command.
 * SRAM initialization start trigger. Invalid when SRAM_RETEN is 0
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of SRAM initial command
 *                    - 0b : not start SRAM initialization
 *                    - 1b : start SRAM initialization
 */
__attribute__((always_inline)) static inline void SimReg_SetChipSRamInit(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->CHIP;

    tmp &= ~SIM_CHIP_SRAM_INIT_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_CHIP_SRAM_INIT_SHIFT)) & SIM_CHIP_SRAM_INIT_MASK);
    obj->CHIP = tmp;
}

/*! \brief Gets the SRAM retention
 *
 * This function gets the current SRAM retention.
 * It is reseted by power up and standby exit only.
 *
 * \note If this bit is set to 0 and system reset happens, program heap operation might malfunction.
 *       Use this bit with caution.
 *
 * \param[in] obj : pointer to SIM register instance
 * \return SRAM retention
 *         - 0b : memory contents are retained across resets.
 *         - 1b : No memory contents retention.
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetChipSRamReten(const SimRegType *obj)
{
    return ((obj->CHIP & SIM_CHIP_SRAM_RETEN_MASK) >> SIM_CHIP_SRAM_RETEN_SHIFT);
}

/*! \brief Sets the SRAM retention
 *
 * This function sets the SRAM retention.
 * It is reseted by power up and standby exit only.
 *
 * \note If this bit is set to 0 and system reset happens, program heap operation might malfunction.
 *       Use this bit with caution.
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of SRAM retention
 *                    - 0b : memory contents are retained across resets.
 *                    - 1b : No memory contents retention.
 */
__attribute__((always_inline)) static inline void SimReg_SetChipSRamReten(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->CHIP;

    tmp &= ~SIM_CHIP_SRAM_RETEN_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_CHIP_SRAM_RETEN_SHIFT)) & SIM_CHIP_SRAM_RETEN_MASK);
    obj->CHIP = tmp;
}

/*! \brief Gets the PWM5 output channel select
 *
 * This function gets the current PWM5 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \return PWM5 output channel select
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetPwmCtrl0PwmFunc5(const SimRegType *obj)
{
    return ((obj->PWM_CTRL0 & SIM_PWM_CTRL0_PWM_FUNC5_MASK) >> SIM_PWM_CTRL0_PWM_FUNC5_SHIFT);
}

/*! \brief Sets the PWM5 output channel select
 *
 * This function sets the PWM5 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of PWM5 output channel select
 */
__attribute__((always_inline)) static inline void SimReg_SetPwmCtrl0PwmFunc5(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->PWM_CTRL0;

    tmp &= ~SIM_PWM_CTRL0_PWM_FUNC5_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_PWM_CTRL0_PWM_FUNC5_SHIFT)) & SIM_PWM_CTRL0_PWM_FUNC5_MASK);
    obj->PWM_CTRL0 = tmp;
}

/*! \brief Gets the PWM4 output channel select
 *
 * This function gets the current PWM4 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \return PWM4 output channel select
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetPwmCtrl0PwmFunc4(const SimRegType *obj)
{
    return ((obj->PWM_CTRL0 & SIM_PWM_CTRL0_PWM_FUNC4_MASK) >> SIM_PWM_CTRL0_PWM_FUNC4_SHIFT);
}

/*! \brief Sets the PWM4 output channel select
 *
 * This function sets the PWM4 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of PWM3 output channel select
 */
__attribute__((always_inline)) static inline void SimReg_SetPwmCtrl0PwmFunc4(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->PWM_CTRL0;

    tmp &= ~SIM_PWM_CTRL0_PWM_FUNC4_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_PWM_CTRL0_PWM_FUNC4_SHIFT)) & SIM_PWM_CTRL0_PWM_FUNC4_MASK);
    obj->PWM_CTRL0 = tmp;
}

/*! \brief Gets the PWM3 output channel select
 *
 * This function gets the current PWM3 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \return PWM3 output channel select
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetPwmCtrl0PwmFunc3(const SimRegType *obj)
{
    return ((obj->PWM_CTRL0 & SIM_PWM_CTRL0_PWM_FUNC3_MASK) >> SIM_PWM_CTRL0_PWM_FUNC3_SHIFT);
}

/*! \brief Sets the PWM3 output channel select
 *
 * This function sets the PWM3 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of PWM3 output channel select
 */
__attribute__((always_inline)) static inline void SimReg_SetPwmCtrl0PwmFunc3(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->PWM_CTRL0;

    tmp &= ~SIM_PWM_CTRL0_PWM_FUNC3_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_PWM_CTRL0_PWM_FUNC3_SHIFT)) & SIM_PWM_CTRL0_PWM_FUNC3_MASK);
    obj->PWM_CTRL0 = tmp;
}

/*! \brief Gets the PWM2 output channel select
 *
 * This function gets the current PWM2 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0
 *
 * \param[in] obj : pointer to SIM register instance
 * \return PWM2 output channel select
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetPwmCtrl0PwmFunc2(const SimRegType *obj)
{
    return ((obj->PWM_CTRL0 & SIM_PWM_CTRL0_PWM_FUNC2_MASK) >> SIM_PWM_CTRL0_PWM_FUNC2_SHIFT);
}

/*! \brief Sets the PWM2 output channel select
 *
 * This function sets the PWM2 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of PWM2 output channel select
 */
__attribute__((always_inline)) static inline void SimReg_SetPwmCtrl0PwmFunc2(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->PWM_CTRL0;

    tmp &= ~SIM_PWM_CTRL0_PWM_FUNC2_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_PWM_CTRL0_PWM_FUNC2_SHIFT)) & SIM_PWM_CTRL0_PWM_FUNC2_MASK);
    obj->PWM_CTRL0 = tmp;
}

/*! \brief Gets the PWM1 output channel select
 *
 * This function gets the current PWM1 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \return PWM1 output channel select
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetPwmCtrl0PwmFunc1(const SimRegType *obj)
{
    return ((obj->PWM_CTRL0 & SIM_PWM_CTRL0_PWM_FUNC1_MASK) >> SIM_PWM_CTRL0_PWM_FUNC1_SHIFT);
}

/*! \brief Sets the PWM1 output channel select
 *
 * This function sets the PWM1 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of PWM1 output channel select
 */
__attribute__((always_inline)) static inline void SimReg_SetPwmCtrl0PwmFunc1(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->PWM_CTRL0;

    tmp &= ~SIM_PWM_CTRL0_PWM_FUNC1_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_PWM_CTRL0_PWM_FUNC1_SHIFT)) & SIM_PWM_CTRL0_PWM_FUNC1_MASK);
    obj->PWM_CTRL0 = tmp;
}

/*! \brief Gets the PWM0 output channel select
 *
 * This function gets the current PWM0 output channel select.
 *
 * \param[in] obj : pointer to SIM register instance
 * \return PWM0 output channel select
 *         - 0d : PWM0[0]
 *         - 1d : PWM0[1]
 *         - 2d : PWM0[2]
 *         - 3d : PWM0[3]
 *         - 4d : PWM0[4]
 *         - 5d : PWM0[5]
 *         - 6d : PWM1[0]
 *         - 7d : PWM1[1]
 *         - 8d : PWM1[2]
 *         - 9d : PWM1[3]
 *         - 10d : PWM1[4]
 *         - 11d : PWM1[5]
 *         - others : reserved
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetPwmCtrl0PwmFunc0(const SimRegType *obj)
{
    return ((obj->PWM_CTRL0 & SIM_PWM_CTRL0_PWM_FUNC0_MASK) >> SIM_PWM_CTRL0_PWM_FUNC0_SHIFT);
}

/*! \brief Sets the PWM0 output channel select
 *
 * This function sets the PWM0 output channel select.
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of PWM0 output channel select
 *                    - 0d : PWM0[0]
 *                    - 1d : PWM0[1]
 *                    - 2d : PWM0[2]
 *                    - 3d : PWM0[3]
 *                    - 4d : PWM0[4]
 *                    - 5d : PWM0[5]
 *                    - 6d : PWM1[0]
 *                    - 7d : PWM1[1]
 *                    - 8d : PWM1[2]
 *                    - 9d : PWM1[3]
 *                    - 10d : PWM1[4]
 *                    - 11d : PWM1[5]
 *                    - others : reserved
 */
__attribute__((always_inline)) static inline void SimReg_SetPwmCtrl0PwmFunc0(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->PWM_CTRL0;

    tmp &= ~SIM_PWM_CTRL0_PWM_FUNC0_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_PWM_CTRL0_PWM_FUNC0_SHIFT)) & SIM_PWM_CTRL0_PWM_FUNC0_MASK);
    obj->PWM_CTRL0 = tmp;
}

/*! \brief Gets the PWM5 output channel select
 *
 * This function gets the current PWM5 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \return PWM5 output channel select
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetPwmCtrl1PwmFunc5(const SimRegType *obj)
{
    return ((obj->PWM_CTRL1 & SIM_PWM_CTRL1_PWM_FUNC5_MASK) >> SIM_PWM_CTRL1_PWM_FUNC5_SHIFT);
}

/*! \brief Sets the PWM5 output channel select
 *
 * This function sets the PWM5 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of PWM5 output channel select
 */
__attribute__((always_inline)) static inline void SimReg_SetPwmCtrl1PwmFunc5(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->PWM_CTRL1;

    tmp &= ~SIM_PWM_CTRL1_PWM_FUNC5_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_PWM_CTRL1_PWM_FUNC5_SHIFT)) & SIM_PWM_CTRL1_PWM_FUNC5_MASK);
    obj->PWM_CTRL1 = tmp;
}

/*! \brief Gets the PWM4 output channel select
 *
 * This function gets the current PWM4 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \return PWM4 output channel select
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetPwmCtrl1PwmFunc4(const SimRegType *obj)
{
    return ((obj->PWM_CTRL1 & SIM_PWM_CTRL1_PWM_FUNC4_MASK) >> SIM_PWM_CTRL1_PWM_FUNC4_SHIFT);
}

/*! \brief Sets the PWM4 output channel select
 *
 * This function sets the PWM4 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of PWM4 output channel select
 */
__attribute__((always_inline)) static inline void SimReg_SetPwmCtrl1PwmFunc4(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->PWM_CTRL1;

    tmp &= ~SIM_PWM_CTRL1_PWM_FUNC4_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_PWM_CTRL1_PWM_FUNC4_SHIFT)) & SIM_PWM_CTRL1_PWM_FUNC4_MASK);
    obj->PWM_CTRL1 = tmp;
}

/*! \brief Gets the PWM3 output channel select
 *
 * This function gets the current PWM3 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \return PWM3 output channel select
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetPwmCtrl1PwmFunc3(const SimRegType *obj)
{
    return ((obj->PWM_CTRL1 & SIM_PWM_CTRL1_PWM_FUNC3_MASK) >> SIM_PWM_CTRL1_PWM_FUNC3_SHIFT);
}

/*! \brief Sets the PWM3 output channel select
 *
 * This function sets the PWM3 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of PWM3 output channel select
 */
__attribute__((always_inline)) static inline void SimReg_SetPwmCtrl1PwmFunc3(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->PWM_CTRL1;

    tmp &= ~SIM_PWM_CTRL1_PWM_FUNC3_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_PWM_CTRL1_PWM_FUNC3_SHIFT)) & SIM_PWM_CTRL1_PWM_FUNC3_MASK);
    obj->PWM_CTRL1 = tmp;
}

/*! \brief Gets the PWM2 output channel select
 *
 * This function gets the current PWM2 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \return PWM2 output channel select
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetPwmCtrl1PwmFunc2(const SimRegType *obj)
{
    return ((obj->PWM_CTRL1 & SIM_PWM_CTRL1_PWM_FUNC2_MASK) >> SIM_PWM_CTRL1_PWM_FUNC2_SHIFT);
}

/*! \brief Sets the PWM2 output channel select
 *
 * This function sets the PWM2 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of PWM2 output channel select
 */
__attribute__((always_inline)) static inline void SimReg_SetPwmCtrl1PwmFunc2(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->PWM_CTRL1;

    tmp &= ~SIM_PWM_CTRL1_PWM_FUNC2_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_PWM_CTRL1_PWM_FUNC2_SHIFT)) & SIM_PWM_CTRL1_PWM_FUNC2_MASK);
    obj->PWM_CTRL1 = tmp;
}

/*! \brief Gets the PWM1 output channel select
 *
 * This function gets the current PWM1 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \return PWM1 output channel select
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetPwmCtrl1PwmFunc1(const SimRegType *obj)
{
    return ((obj->PWM_CTRL1 & SIM_PWM_CTRL1_PWM_FUNC1_MASK) >> SIM_PWM_CTRL1_PWM_FUNC1_SHIFT);
}

/*! \brief Sets the PWM1 output channel select
 *
 * This function sets the PWM1 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of PWM1 output channel select
 */
__attribute__((always_inline)) static inline void SimReg_SetPwmCtrl1PwmFunc1(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->PWM_CTRL1;

    tmp &= ~SIM_PWM_CTRL1_PWM_FUNC1_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_PWM_CTRL1_PWM_FUNC1_SHIFT)) & SIM_PWM_CTRL1_PWM_FUNC1_MASK);
    obj->PWM_CTRL1 = tmp;
}

/*! \brief Gets the PWM0 output channel select
 *
 * This function gets the current PWM0 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \return PWM0 output channel select
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetPwmCtrl1PwmFunc0(const SimRegType *obj)
{
    return ((obj->PWM_CTRL1 & SIM_PWM_CTRL1_PWM_FUNC0_MASK) >> SIM_PWM_CTRL1_PWM_FUNC0_SHIFT);
}

/*! \brief Sets the PWM0 output channel select
 *
 * This function sets the PWM0 output channel select.
 * channel details are same with SIM_PWM_CTRL0[PWM_FUNC0]
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of PWM0 output channel select
 */
__attribute__((always_inline)) static inline void SimReg_SetPwmCtrl1PwmFunc0(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->PWM_CTRL1;

    tmp &= ~SIM_PWM_CTRL1_PWM_FUNC0_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_PWM_CTRL1_PWM_FUNC0_SHIFT)) & SIM_PWM_CTRL1_PWM_FUNC0_MASK);
    obj->PWM_CTRL1 = tmp;
}


/*! \brief Gets the MFT1 Fault X Select
 *
 * This function gets the current MFT1 Fault X Select.
 * Selects the source of the MFT1 fault.
 * Every bit means one fault input, respectively.
 * If there is no pin assigned to the specific FAULT signal, logic zero is used as input source.
 *
 * \param[in] obj : pointer to SIM register instance
 * \return MFT1 Fault X Select
 *         - 0b : MFT1_FLTx pin
 *         - 1b : TRGMUX_MFT1 out
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetMftCtrl0Mft1FltSel(const SimRegType *obj)
{
    return ((obj->MFT_CTRL0 & SIM_MFT_CTRL0_MFT1_FLT_SEL_MASK) >> SIM_MFT_CTRL0_MFT1_FLT_SEL_SHIFT);
}

/*! \brief Sets the MFT1 Fault X Select
 *
 * This function sets the MFT1 Fault X Select.
 * Selects the source of the MFT1 fault.
 * Every bit means one fault input, respectively.
 * If there is no pin assigned to the specific FAULT signal, logic zero is used as input source.
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of MFT1 Fault X Select
 *                    - 0b : MFT1_FLTx pin
 *                    - 1b : TRGMUX_MFT1 out
 */
__attribute__((always_inline)) static inline void SimReg_SetMftCtrl0Mft1FltSel(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->MFT_CTRL0;

    tmp &= ~SIM_MFT_CTRL0_MFT1_FLT_SEL_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_MFT_CTRL0_MFT1_FLT_SEL_SHIFT)) & SIM_MFT_CTRL0_MFT1_FLT_SEL_MASK);
    obj->MFT_CTRL0 = tmp;
}

/*! \brief Gets the MFT0 Fault X Select
 *
 * This function gets the current MFT0 Fault X Select.
 * Selects the source of the MFT0 fault.
 * Every bit means one fault input, respectively.
 * If there is no pin assigned to the specific FAULT signal, logic zero is used as input source.
 *
 * \param[in] obj : pointer to SIM register instance
 * \return MFT0 Fault X Select
 *         - 0b : MFT0_FLTx pin
 *         - 1b : TRGMUX_MFT0 out
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetMftCtrl0Mft0FltSel(const SimRegType *obj)
{
    return ((obj->MFT_CTRL0 & SIM_MFT_CTRL0_MFT0_FLT_SEL_MASK) >> SIM_MFT_CTRL0_MFT0_FLT_SEL_SHIFT);
}

/*! \brief Sets the MFT0 Fault X Select
 *
 * This function sets the MFT0 Fault X Select.
 * Selects the source of the MFT0 fault.
 * Every bit means one fault input, respectively.
 * If there is no pin assigned to the specific FAULT signal, logic zero is used as input source.
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of MFT0 Fault X Select
 *                    - 0b : MFT0_FLTx pin
 *                    - 1b : TRGMUX_MFT0 out
 */
__attribute__((always_inline)) static inline void SimReg_SetMftCtrl0Mft0FltSel(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->MFT_CTRL0;

    tmp &= ~SIM_MFT_CTRL0_MFT0_FLT_SEL_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_MFT_CTRL0_MFT0_FLT_SEL_SHIFT)) & SIM_MFT_CTRL0_MFT0_FLT_SEL_MASK);
    obj->MFT_CTRL0 = tmp;
}

/*! \brief Gets the MFT global load enable
 *
 * This function gets the current MFT global load enable.
 * This bit is not self-clearing.
 * For subsequent reload operations, it should be cleared and then set.
 *
 * \param[in] obj : pointer to SIM register instance
 * \return MFT global load enable
 *         - 0b : MFT Global load mechanism disabled.
 *         - 1b : MFT Global load mechanism enabled
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetMftCtrl0GldOk(const SimRegType *obj)
{
    return ((obj->MFT_CTRL0 & SIM_MFT_CTRL0_GLDOK_MASK) >> SIM_MFT_CTRL0_GLDOK_SHIFT);
}

/*! \brief Sets the MFT global load enable
 *
 * This function sets the MFT global load enable.
 * This bit is not self-clearing.
 * For subsequent reload operations, it should be cleared and then set.
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of MFT global load enable
 *                    - 0b : MFT Global load mechanism disabled.
 *                    - 1b : MFT Global load mechanism enabled
 */
__attribute__((always_inline)) static inline void SimReg_SetMftCtrl0GldOk(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->MFT_CTRL0;

    tmp &= ~SIM_MFT_CTRL0_GLDOK_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_MFT_CTRL0_GLDOK_SHIFT)) & SIM_MFT_CTRL0_GLDOK_MASK);
    obj->MFT_CTRL0 = tmp;
}

/*! \brief Gets the MFT1 Sync Bit
 *
 * This function gets the current MFT1 Sync Bit.
 * This is used as a synchronization trigger source for MFT
 *
 * \param[in] obj : pointer to SIM register instance
 * \return MFT1 Sync Bit
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetMftCtrl1Mft1SyncBit(const SimRegType *obj)
{
    return ((obj->MFT_CTRL1 & SIM_MFT_CTRL1_MFT1SYNCBIT_MASK) >> SIM_MFT_CTRL1_MFT1SYNCBIT_SHIFT);
}

/*! \brief Sets the MFT1 Sync Bit
 *
 * This function sets the MFT1 Sync Bit.
 * This is used as a synchronization trigger source for MFT
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of MFT1 Sync Bit
 */
__attribute__((always_inline)) static inline void SimReg_SetMftCtrl1Mft1SyncBit(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->MFT_CTRL1;

    tmp &= ~SIM_MFT_CTRL1_MFT1SYNCBIT_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_MFT_CTRL1_MFT1SYNCBIT_SHIFT)) & SIM_MFT_CTRL1_MFT1SYNCBIT_MASK);
    obj->MFT_CTRL1 = tmp;
}

/*! \brief Gets the MFT0 Sync Bit
 *
 * This function gets the current MFT0 Sync Bit.
 * This is used as a synchronization trigger source for MFT
 *
 * \param[in] obj : pointer to SIM register instance
 * \return MFT0 Sync Bit
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetMftCtrl1Mft0SyncBit(const SimRegType *obj)
{
    return ((obj->MFT_CTRL1 & SIM_MFT_CTRL1_MFT0SYNCBIT_MASK) >> SIM_MFT_CTRL1_MFT0SYNCBIT_SHIFT);
}

/*! \brief Sets the MFT0 Sync Bit
 *
 * This function sets the MFT0 Sync Bit.
 * This is used as a synchronization trigger source for MFT
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of MFT0 Sync Bit
 */
__attribute__((always_inline)) static inline void SimReg_SetMftCtrl1Mft0SyncBit(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->MFT_CTRL1;

    tmp &= ~SIM_MFT_CTRL1_MFT0SYNCBIT_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_MFT_CTRL1_MFT0SYNCBIT_SHIFT)) & SIM_MFT_CTRL1_MFT0SYNCBIT_MASK);
    obj->MFT_CTRL1 = tmp;
}

/*! \brief Gets the MFT1 CH1 Select
 *
 * This function gets the current MFT1 CH0 Select.
 * Selects MFT1 Channel0's input
 *
 * \param[in] obj : pointer to SIM register instance
 * \return MFT1 CH0 Select
 *         - 0b : MFT1_CH1 input from PAD
 *         - 1b : MFT1_CH0/MFT1_CH1/MFT1_CH2 XOR
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetMftCtrl1Mft1Ch1Sel(const SimRegType *obj)
{
    return ((obj->MFT_CTRL1 & SIM_MFT_CTRL1_MFT1CH1SEL_MASK) >> SIM_MFT_CTRL1_MFT1CH1SEL_SHIFT);
}

/*! \brief Sets the MFT1 CH1 Select
 *
 * This function sets the MFT1 CH1 Select.
 * Selects MFT1 Channel0's input
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of MFT1 CH1 Select
 *                    - 0b : MFT1_CH1 input from PAD
 *                    - 1b : MFT1_CH0/MFT1_CH1/MFT1_CH2 XOR
 */
__attribute__((always_inline)) static inline void SimReg_SetMftCtrl1Mft1Ch1Sel(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->MFT_CTRL1;

    tmp &= ~SIM_MFT_CTRL1_MFT1CH1SEL_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_MFT_CTRL1_MFT1CH1SEL_SHIFT)) & SIM_MFT_CTRL1_MFT1CH1SEL_MASK);
    obj->MFT_CTRL1 = tmp;
}

/*! \brief Gets the MFT0 channel modulation select with MFT1_CH1
 *
 * This function gets the current MFT0 channel modulation select with MFT1_CH1.
 * Bits 7 to 0 of this field are for channel 7 to 0, respectively. For each channel,
 *
 * \param[in] obj : pointer to SIM register instance
 * \return MFT0 channel modulation select with MFT1_CH1
 *         - 0b : No modulation with MFT1_CH1
 *         - 1b : Modulation with MFT1_CH1
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetMftCtrl1Mft0OutSel(const SimRegType *obj)
{
    return ((obj->MFT_CTRL1 & SIM_MFT_CTRL1_MFT0_OUTSEL_MASK) >> SIM_MFT_CTRL1_MFT0_OUTSEL_SHIFT);
}

/*! \brief Sets the MFT0 channel modulation select with MFT1_CH1
 *
 * This function sets the MFT0 channel modulation select with MFT1_CH1.
 * Bits 7 to 0 of this field are for channel 7 to 0, respectively. For each channel,
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of MFT0 channel modulation select with MFT1_CH1
 *                    - 0b : No modulation with MFT1_CH1
 *                    - 1b : Modulation with MFT1_CH1
 */
__attribute__((always_inline)) static inline void SimReg_SetMftCtrl1Mft0OutSel(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->MFT_CTRL1;

    tmp &= ~SIM_MFT_CTRL1_MFT0_OUTSEL_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_MFT_CTRL1_MFT0_OUTSEL_SHIFT)) & SIM_MFT_CTRL1_MFT0_OUTSEL_MASK);
    obj->MFT_CTRL1 = tmp;
}

/*! \brief Gets the flash eee restore config status
 *
 * This function gets the current Flash eee restore config status.
 * Indicates the restore settings of emulated eeprom
 *
 * \param[in] obj : pointer to SIM register instance
 * \return flash eee restore config status.
 *         - 0b : emulated eeprom is configured as not restore after reset
 *         - 1b : emulated eeprom is configured as restore after reset
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetFlashEeeRst(const SimRegType *obj)
{
    return ((obj->FLASH & SIM_FLASH_EEERST_MASK) >> SIM_FLASH_EEERST_SHIFT);
}

/*! \brief Gets the flash eee valid
 *
 * This function gets the current flash eee valid.
 * emulated eeprom is valid
 *
 * \param[in] obj : pointer to SIM register instance
 * \return Flash eee Valid
 *         - 0b : invalid
 *         - 1b : valid
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetFlashEeeVld(const SimRegType *obj)
{
    return ((obj->FLASH & SIM_FLASH_EEEVLD_MASK) >> SIM_FLASH_EEEVLD_SHIFT);
}

/*! \brief Gets the flash load is done
 *
 * This function gets the current flash load is done.
 *
 * \param[in] obj : pointer to SIM register instance
 * \return flash load is done
 *         - 0b : during load progress
 *         - 1b : load done
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetFlashLoadDone(const SimRegType *obj)
{
    return ((obj->FLASH & SIM_FLASH_LOAD_DONE_MASK) >> SIM_FLASH_LOAD_DONE_SHIFT);
}

/*! \brief Gets the flash is blank
 *
 * This function gets the current flash is blank.
 *
 * \param[in] obj : pointer to SIM register instance
 * \return flash is blank
 *         - 0b : flash is not blank
 *         - 1b : flash is blank
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetFlashVirginFlag(const SimRegType *obj)
{
    return ((obj->FLASH & SIM_FLASH_VIRGIN_FLAG_MASK) >> SIM_FLASH_VIRGIN_FLAG_SHIFT);
}

/*! \brief Gets the dflash prefetch buffer flush
 *
 * This function gets the current dflash prefetch buffer flush.
 *
 * \param[in] obj : pointer to SIM register instance
 * \return dflash prefetch buffer flush
 *         - 0b : do not flush dflash prefetch buffer;
 *         - 1b : flush dflash prefetch buffer;
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetFlashDFlsFlushEn(const SimRegType *obj)
{
    return ((obj->FLASH & SIM_FLASH_DFLS_FLUSH_EN_MASK) >> SIM_FLASH_DFLS_FLUSH_EN_SHIFT);
}

/*! \brief Sets the dflash prefetch buffer flush
 *
 * This function sets the dflash prefetch buffer flush.
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of dflash prefetch buffer flush
 *                    - 0b : do not flush dflash prefetch buffer;
 *                    - 1b : flush dflash prefetch buffer;
 */
__attribute__((always_inline)) static inline void SimReg_SetFlashDFlsFlushEn(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->FLASH;

    tmp &= ~SIM_FLASH_DFLS_FLUSH_EN_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_FLASH_DFLS_FLUSH_EN_SHIFT)) & SIM_FLASH_DFLS_FLUSH_EN_MASK);
    obj->FLASH = tmp;
}

/*! \brief Gets the pflash prefetch buffer flush
 *
 * This function gets the current pflash prefetch buffer flush.
 *
 * \param[in] obj : pointer to SIM register instance
 * \return pflash prefetch buffer flush
 *         - 0b : do not flush pflash prefetch buffer;
 *         - 1b : flush pflash prefetch buffer;
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetFlashPFlsFlushEn(const SimRegType *obj)
{
    return ((obj->FLASH & SIM_FLASH_PFLS_FLUSH_EN_MASK) >> SIM_FLASH_PFLS_FLUSH_EN_SHIFT);
}

/*! \brief Sets the pflash prefetch buffer flush
 *
 * This function sets the pflash prefetch buffer flush.
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of pflash prefetch buffer flush
 *                    - 0b : do not flush pflash prefetch buffer;
 *                    - 1b : flush pflash prefetch buffer;
 */
__attribute__((always_inline)) static inline void SimReg_SetFlashPFlsFlushEn(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->FLASH;

    tmp &= ~SIM_FLASH_PFLS_FLUSH_EN_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_FLASH_PFLS_FLUSH_EN_SHIFT)) & SIM_FLASH_PFLS_FLUSH_EN_MASK);
    obj->FLASH = tmp;
}

/*! \brief Gets the dflash prefetch enable
 *
 * This function gets the current dflash prefetch enable.
 *
 * \param[in] obj : pointer to SIM register instance
 * \return dflash prefetch enable
 *         - 0b : disable dflash prefetch;
 *         - 1b : enable dflash prefetch;
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetFlashDFlsPfbEn(const SimRegType *obj)
{
    return ((obj->FLASH & SIM_FLASH_DFLS_PFB_EN_MASK) >> SIM_FLASH_DFLS_PFB_EN_SHIFT);
}

/*! \brief Sets the dflash prefetch enable
 *
 * This function sets the dflash prefetch enable.
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of dflash prefetch enable
 *                    - 0b : disable dflash prefetch;
 *                    - 1b : enable dflash prefetch;
 */
__attribute__((always_inline)) static inline void SimReg_SetFlashDFlsPfbEn(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->FLASH;

    tmp &= ~SIM_FLASH_DFLS_PFB_EN_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_FLASH_DFLS_PFB_EN_SHIFT)) & SIM_FLASH_DFLS_PFB_EN_MASK);
    obj->FLASH = tmp;
}

/*! \brief Gets the pflash prefetch enable
 *
 * This function gets the current pflash prefetch enable.
 *
 * \param[in] obj : pointer to SIM register instance
 * \return pflash prefetch enable
 *         - 0b : disable pflash prefetch;
 *         - 1b : enable pflash prefetch;
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetFlashPFlsPfbEn(const SimRegType *obj)
{
    return ((obj->FLASH & SIM_FLASH_PFLS_PFB_EN_MASK) >> SIM_FLASH_PFLS_PFB_EN_SHIFT);
}

/*! \brief Sets the pflash prefetch enable
 *
 * This function sets the pflash prefetch enable.
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of pflash prefetch enable
 *                    - 0b : disable pflash prefetch;
 *                    - 1b : enable pflash prefetch;
 */
__attribute__((always_inline)) static inline void SimReg_SetFlashPFlsPfbEn(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->FLASH;

    tmp &= ~SIM_FLASH_PFLS_PFB_EN_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_FLASH_PFLS_PFB_EN_SHIFT)) & SIM_FLASH_PFLS_PFB_EN_MASK);
    obj->FLASH = tmp;
}

/*! \brief Gets the Unique Identification[127:96]
 *
 * This function gets the current Unique Identification[127:96].
 *
 * \param[in] obj : pointer to SIM register instance
 * \return Unique Identification[127:96]
 */
__attribute__((always_inline)) static inline uint32_t SimReg_GetUdidH(const SimRegType *obj)
{
    return ((obj->UDIDH & SIM_UDIDH_H_MASK) >> SIM_UDIDH_H_SHIFT);
}

/*! \brief Gets the Unique Identification[95:64]
 *
 * This function gets the current Unique Identification[95:64].
 *
 * \param[in] obj : pointer to SIM register instance
 * \return Unique Identification[95:64]
 */
__attribute__((always_inline)) static inline uint32_t SimReg_GetUdidMH(const SimRegType *obj)
{
    return ((obj->UDIDMH & SIM_UDIDMH_MH_MASK) >> SIM_UDIDMH_MH_SHIFT);
}

/*! \brief Gets the Unique Identification[63:32]
 *
 * This function gets the current Unique Identification[63:32].
 *
 * \param[in] obj : pointer to SIM register instance
 * \return Unique Identification[63:32]
 */
__attribute__((always_inline)) static inline uint32_t SimReg_GetUdidML(const SimRegType *obj)
{
    return ((obj->UDIDML & SIM_UDIDML_ML_MASK) >> SIM_UDIDML_ML_SHIFT);
}

/*! \brief Gets the Unique Identification[31:0]
 *
 * This function gets the current Unique Identification[31:0].
 *
 * \param[in] obj : pointer to SIM register instance
 * \return Unique Identification[31:0]
 */
__attribute__((always_inline)) static inline uint32_t SimReg_GetUdidL(const SimRegType *obj)
{
    return ((obj->UDIDL & SIM_UDIDL_L_MASK) >> SIM_UDIDL_L_SHIFT);
}

/*! \brief Gets the System Device Identification
 *
 * This function gets the current System Device Identification.
 *
 * \param[in] obj : pointer to SIM register instance
 * \return System Device Identification
 */
__attribute__((always_inline)) static inline uint32_t SimReg_GetSdId(const SimRegType *obj)
{
    return ((obj->SDID & SIM_SDID_ID_MASK) >> SIM_SDID_ID_SHIFT);
}

/*! \brief Gets the Software trigger to TRGMUX
 *
 * This function gets the current Software trigger to TRGMUX.
 * Writing to this bit generates software trigger to peripheral
 *
 * \param[in] obj : pointer to SIM register instance
 * \return Software trigger to TRGMUX
 */
__attribute__((always_inline)) static inline uint8_t SimReg_GetSwTrg(const SimRegType *obj)
{
    return ((obj->SW_TRG & SIM_SW_TRG_SW_TRG_MASK) >> SIM_SW_TRG_SW_TRG_SHIFT);
}

/*! \brief Sets the Software trigger to TRGMUX
 *
 * This function sets the Software trigger to TRGMUX.
 * Writing to this bit generates software trigger to peripheral
 *
 * \param[in] obj : pointer to SIM register instance
 * \param[in] value : the value of Software trigger to TRGMUX
 */
__attribute__((always_inline)) static inline void SimReg_SetSwTrg(SimRegType *obj, uint8_t value)
{
    uint32_t tmp = obj->SW_TRG;

    tmp &= ~SIM_SW_TRG_SW_TRG_MASK;
    tmp |= (((uint32_t)(((uint32_t)(value)) << SIM_SW_TRG_SW_TRG_SHIFT)) & SIM_SW_TRG_SW_TRG_MASK);
    obj->SW_TRG = tmp;
}

#ifdef __cplusplus
}
#endif /* extern "C" */

#endif /* _SIM_REG_H_ */
