MCUXpresso SDK API Reference Manual  Rev 2.15.000
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
MMDVSQ: Memory-Mapped Divide and Square Root

Overview

The MCUXpresso SDK provides driver for the Memory-Mapped Divide and Square Root (MMDVSQ) module of MCUXpresso SDK devices.

ARM processor cores in the Cortex-M family implementing the ARMv6-M instruction set architecture do not include hardware support for integer division operations. However, in certain deeply-embedded application spaces, hardware support for this class of arithmetic operations along with an unsigned square root function is important to maximize the system performance and minimize the device power dissipation. Accordingly, the MMDVSQ module is included to serve as a memory-mapped co-processor located in a special address space within the system memory map accessible only to the processor core. The MMDVSQ module supports execution of the integer division operations defined in the ARMv7-M instruction set architecture plus an unsigned integer square root operation. The supported integer division operations include 32/32 signed (SDIV) and unsigned (UDIV) calculations.

Function groups

MMDVSQ functional Operation

This group implements the MMDVSQ functional API.

MMDVSQ status Operation

This group implements the MMDVSQ status API.

Typical use case and example

Example: Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/mmdvsq

Typedefs

typedef enum
_mmdvsq_execution_status 
mmdvsq_execution_status_t
 MMDVSQ execution status.
 
typedef enum
_mmdvsq_fast_start_select 
mmdvsq_fast_start_select_t
 MMDVSQ divide fast start select.
 

Enumerations

enum  _mmdvsq_execution_status {
  kMMDVSQ_IdleSquareRoot = 0x01U,
  kMMDVSQ_IdleDivide = 0x02U,
  kMMDVSQ_BusySquareRoot = 0x05U,
  kMMDVSQ_BusyDivide = 0x06U
}
 MMDVSQ execution status. More...
 
enum  _mmdvsq_fast_start_select {
  kMMDVSQ_EnableFastStart = 0U,
  kMMDVSQ_DisableFastStart
}
 MMDVSQ divide fast start select. More...
 

Driver version

#define FSL_MMSVSQ_DRIVER_VERSION   (MAKE_VERSION(2, 0, 3))
 Version 2.0.3. More...
 

MMDVSQ functional Operation

int32_t MMDVSQ_GetDivideRemainder (MMDVSQ_Type *base, int32_t dividend, int32_t divisor, bool isUnsigned)
 Performs the MMDVSQ division operation and returns the remainder. More...
 
int32_t MMDVSQ_GetDivideQuotient (MMDVSQ_Type *base, int32_t dividend, int32_t divisor, bool isUnsigned)
 Performs the MMDVSQ division operation and returns the quotient. More...
 
uint16_t MMDVSQ_Sqrt (MMDVSQ_Type *base, uint32_t radicand)
 Performs the MMDVSQ square root operation. More...
 

MMDVSQ status Operation

static mmdvsq_execution_status_t MMDVSQ_GetExecutionStatus (MMDVSQ_Type *base)
 Gets the MMDVSQ execution status. More...
 
static void MMDVSQ_SetFastStartConfig (MMDVSQ_Type *base, mmdvsq_fast_start_select_t mode)
 Configures MMDVSQ fast start mode. More...
 
static void MMDVSQ_SetDivideByZeroConfig (MMDVSQ_Type *base, bool isDivByZero)
 Configures the MMDVSQ divide-by-zero mode. More...
 

Macro Definition Documentation

#define FSL_MMSVSQ_DRIVER_VERSION   (MAKE_VERSION(2, 0, 3))

Enumeration Type Documentation

Enumerator
kMMDVSQ_IdleSquareRoot 

MMDVSQ is idle; the last calculation was a square root.

kMMDVSQ_IdleDivide 

MMDVSQ is idle; the last calculation was division.

kMMDVSQ_BusySquareRoot 

MMDVSQ is busy processing a square root calculation.

kMMDVSQ_BusyDivide 

MMDVSQ is busy processing a division calculation.

Enumerator
kMMDVSQ_EnableFastStart 

Division operation is initiated by a write to the DSOR register.

kMMDVSQ_DisableFastStart 

Division operation is initiated by a write to CSR[SRT] = 1; normal start instead fast start.

Function Documentation

int32_t MMDVSQ_GetDivideRemainder ( MMDVSQ_Type *  base,
int32_t  dividend,
int32_t  divisor,
bool  isUnsigned 
)
Parameters
baseMMDVSQ peripheral address
dividendDividend value
divisorDivisor value
isUnsignedMode of unsigned divide
  • true unsigned divide
  • false signed divide
int32_t MMDVSQ_GetDivideQuotient ( MMDVSQ_Type *  base,
int32_t  dividend,
int32_t  divisor,
bool  isUnsigned 
)
Parameters
baseMMDVSQ peripheral address
dividendDividend value
divisorDivisor value
isUnsignedMode of unsigned divide
  • true unsigned divide
  • false signed divide
uint16_t MMDVSQ_Sqrt ( MMDVSQ_Type *  base,
uint32_t  radicand 
)

This function performs the MMDVSQ square root operation and returns the square root result of a given radicand value.

Parameters
baseMMDVSQ peripheral address
radicandRadicand value
static mmdvsq_execution_status_t MMDVSQ_GetExecutionStatus ( MMDVSQ_Type *  base)
inlinestatic

This function checks the current MMDVSQ execution status of the combined CSR[BUSY, DIV, SQRT] indicators.

Parameters
baseMMDVSQ peripheral address
Returns
Current MMDVSQ execution status
static void MMDVSQ_SetFastStartConfig ( MMDVSQ_Type *  base,
mmdvsq_fast_start_select_t  mode 
)
inlinestatic

This function sets the MMDVSQ division fast start. The MMDVSQ supports two mechanisms for initiating a division operation. The default mechanism is a “fast start” where a write to the DSOR register begins the division. Alternatively, the start mechanism can begin after a write to the CSR register with CSR[SRT] set.

Parameters
baseMMDVSQ peripheral address
modeMode of Divide-Fast-Start
  • kMmdvsqDivideFastStart = 0
  • kMmdvsqDivideNormalStart = 1
static void MMDVSQ_SetDivideByZeroConfig ( MMDVSQ_Type *  base,
bool  isDivByZero 
)
inlinestatic

This function configures the MMDVSQ response to divide-by-zero calculations. If both CSR[DZ] and CSR[DZE] are set, then a subsequent read of the RES register is error-terminated to signal the processor of the attempted divide-by-zero. Otherwise, the register contents are returned.

Parameters
baseMMDVSQ peripheral address
isDivByZeroMode of Divide-By-Zero
  • kMmdvsqDivideByZeroDis = 0
  • kMmdvsqDivideByZeroEn = 1