MSPM0GX51X Driver Library  2.03.00.07
Modules | Data Structures | Enumerations | Functions
Math Accelerator (MATHACL)
Collaboration diagram for Math Accelerator (MATHACL):

Modules

 DL_MATHACL_STATUS
 

Data Structures

struct  DL_MathACL_operationConfig
 Configuration struct for DL_MathACL_configOperation. More...
 

Enumerations

enum  DL_MATHACL_OP_TYPE {
  DL_MATHACL_OP_TYPE_SINCOS = MATHACL_CTL_FUNC_SINCOS,
  DL_MATHACL_OP_TYPE_ARCTAN2 = MATHACL_CTL_FUNC_ATAN2,
  DL_MATHACL_OP_TYPE_DIV = MATHACL_CTL_FUNC_DIV,
  DL_MATHACL_OP_TYPE_SQRT = MATHACL_CTL_FUNC_SQRT,
  DL_MATHACL_OP_TYPE_MPY_32 = MATHACL_CTL_FUNC_MPY32,
  DL_MATHACL_OP_TYPE_SQUARE_32 = MATHACL_CTL_FUNC_SQUARE32,
  DL_MATHACL_OP_TYPE_MPY_64 = MATHACL_CTL_FUNC_MPY64,
  DL_MATHACL_OP_TYPE_SQUARE_64 = MATHACL_CTL_FUNC_SQUARE64,
  DL_MATHACL_OP_TYPE_MAC = MATHACL_CTL_FUNC_MAC,
  DL_MATHACL_OP_TYPE_SAC = MATHACL_CTL_FUNC_SAC
}
 
enum  DL_MATHACL_Q_TYPE {
  DL_MATHACL_Q_TYPE_Q0 = MATHACL_CTL_QVAL_Q0,
  DL_MATHACL_Q_TYPE_Q1 = MATHACL_CTL_QVAL_Q1,
  DL_MATHACL_Q_TYPE_Q2 = MATHACL_CTL_QVAL_Q2,
  DL_MATHACL_Q_TYPE_Q3 = MATHACL_CTL_QVAL_Q3,
  DL_MATHACL_Q_TYPE_Q4 = MATHACL_CTL_QVAL_Q4,
  DL_MATHACL_Q_TYPE_Q5 = MATHACL_CTL_QVAL_Q5,
  DL_MATHACL_Q_TYPE_Q6 = MATHACL_CTL_QVAL_Q6,
  DL_MATHACL_Q_TYPE_Q7 = MATHACL_CTL_QVAL_Q7,
  DL_MATHACL_Q_TYPE_Q8 = MATHACL_CTL_QVAL_Q8,
  DL_MATHACL_Q_TYPE_Q9 = MATHACL_CTL_QVAL_Q9,
  DL_MATHACL_Q_TYPE_Q10 = MATHACL_CTL_QVAL_Q10,
  DL_MATHACL_Q_TYPE_Q11 = MATHACL_CTL_QVAL_Q11,
  DL_MATHACL_Q_TYPE_Q12 = MATHACL_CTL_QVAL_Q12,
  DL_MATHACL_Q_TYPE_Q13 = MATHACL_CTL_QVAL_Q13,
  DL_MATHACL_Q_TYPE_Q14 = MATHACL_CTL_QVAL_Q14,
  DL_MATHACL_Q_TYPE_Q15 = MATHACL_CTL_QVAL_Q15,
  DL_MATHACL_Q_TYPE_Q16 = MATHACL_CTL_QVAL_Q16,
  DL_MATHACL_Q_TYPE_Q17 = MATHACL_CTL_QVAL_Q17,
  DL_MATHACL_Q_TYPE_Q18 = MATHACL_CTL_QVAL_Q18,
  DL_MATHACL_Q_TYPE_Q19 = MATHACL_CTL_QVAL_Q19,
  DL_MATHACL_Q_TYPE_Q20 = MATHACL_CTL_QVAL_Q20,
  DL_MATHACL_Q_TYPE_Q21 = MATHACL_CTL_QVAL_Q21,
  DL_MATHACL_Q_TYPE_Q22 = MATHACL_CTL_QVAL_Q22,
  DL_MATHACL_Q_TYPE_Q23 = MATHACL_CTL_QVAL_Q23,
  DL_MATHACL_Q_TYPE_Q24 = MATHACL_CTL_QVAL_Q24,
  DL_MATHACL_Q_TYPE_Q25 = MATHACL_CTL_QVAL_Q25,
  DL_MATHACL_Q_TYPE_Q26 = MATHACL_CTL_QVAL_Q26,
  DL_MATHACL_Q_TYPE_Q27 = MATHACL_CTL_QVAL_Q27,
  DL_MATHACL_Q_TYPE_Q28 = MATHACL_CTL_QVAL_Q28,
  DL_MATHACL_Q_TYPE_Q29 = MATHACL_CTL_QVAL_Q29,
  DL_MATHACL_Q_TYPE_Q30 = MATHACL_CTL_QVAL_Q30,
  DL_MATHACL_Q_TYPE_Q31 = MATHACL_CTL_QVAL_Q31
}
 
enum  DL_MATHACL_OPSIGN {
  DL_MATHACL_OPSIGN_UNSIGNED = MATHACL_CTL_OPTYPE_UNSIGNED,
  DL_MATHACL_OPSIGN_SIGNED = MATHACL_CTL_OPTYPE_SIGNED
}
 

Functions

__STATIC_INLINE void DL_MathACL_enablePower (MATHACL_Regs *mathacl)
 Enables power on MATHACL module. More...
 
__STATIC_INLINE void DL_MathACL_disablePower (MATHACL_Regs *mathacl)
 Disable power on MATHACL module. More...
 
__STATIC_INLINE void DL_MathACL_reset (MATHACL_Regs *mathacl)
 Resets the MATHACL module. More...
 
__STATIC_INLINE bool DL_MathACL_isReset (MATHACL_Regs *mathacl)
 Returns if MATHACL peripheral was reset. More...
 
__STATIC_INLINE void DL_MathACL_enableSaturation (MATHACL_Regs *mathacl)
 Enable saturation. More...
 
__STATIC_INLINE void DL_MathACL_disableSaturation (MATHACL_Regs *mathacl)
 Disable saturation. More...
 
__STATIC_INLINE bool DL_MathACL_isSaturationEnabled (MATHACL_Regs *mathacl)
 Returns if saturation is enabled. More...
 
__STATIC_INLINE void DL_MathACL_setOperandOne (MATHACL_Regs *mathacl, uint32_t op)
 Load Operand one into the math accelerator. More...
 
__STATIC_INLINE void DL_MathACL_setOperandTwo (MATHACL_Regs *mathacl, uint32_t op)
 Load Operand two into the math accelerator. More...
 
__STATIC_INLINE uint32_t DL_MathACL_getResultOne (MATHACL_Regs *mathacl)
 Returns MATHACL result one register. More...
 
__STATIC_INLINE uint32_t DL_MathACL_getResultTwo (MATHACL_Regs *mathacl)
 Returns MATHACL result two register. More...
 
__STATIC_INLINE uint32_t DL_MathACL_getStatus (MATHACL_Regs *mathacl)
 Returns MATHACL operation status. More...
 
__STATIC_INLINE void DL_MathACL_clearOverflowStatus (MATHACL_Regs *mathacl)
 Clear the overflow status bit. More...
 
__STATIC_INLINE void DL_MathACL_clearUnderflowStatus (MATHACL_Regs *mathacl)
 Clear the underflow status bit. More...
 
__STATIC_INLINE void DL_MathACL_clearErrorStatus (MATHACL_Regs *mathacl)
 Clear the error status bit. More...
 
__STATIC_INLINE void DL_MathACL_waitForOperation (MATHACL_Regs *mathacl)
 Block until MATHACL_STATUS_BUSY_DONE is active in MATHACL. More...
 
void DL_MathACL_configOperation (MATHACL_Regs *mathacl, const DL_MathACL_operationConfig *opConfig, uint32_t op1, uint32_t op2)
 Configure and execute a Math accelerator operation. More...
 
__STATIC_INLINE void DL_MathACL_clearResultOne (MATHACL_Regs *mathacl)
 Clears the RES1 register. More...
 
__STATIC_INLINE void DL_MathACL_clearResultTwo (MATHACL_Regs *mathacl)
 Clears the RES2 register. More...
 
__STATIC_INLINE void DL_MathACL_clearResults (MATHACL_Regs *mathacl)
 Clears the RES1 and RES2 registers. More...
 

Detailed Description

Overview

The Math Accelerator Driver Library provides software to control the onboard Math Accelerator hardware.

Enumeration Type Documentation

§ DL_MATHACL_OP_TYPE

Enumerator
DL_MATHACL_OP_TYPE_SINCOS 

Sin or cosine operation

DL_MATHACL_OP_TYPE_ARCTAN2 

Arc tangent 2 operation – takes in X, Y values

DL_MATHACL_OP_TYPE_DIV 

Divide operation – takes in numerator, denominator, division type

DL_MATHACL_OP_TYPE_SQRT 

Square root operation – requires that a scaling factor be provided as well

DL_MATHACL_OP_TYPE_MPY_32 

Multiply operation returns 32-bit result – takes in two operands

DL_MATHACL_OP_TYPE_SQUARE_32 

Square operation returns 32-bit result – takes in one operand. Supports Q and int data formats. Enable saturation with DL_MathACL_enableSaturation and check DL_MATHACL_STATUS_OVERFLOW for overflow.

DL_MATHACL_OP_TYPE_MPY_64 

Multiply operation returns 64-bit result – takes in two operands

DL_MATHACL_OP_TYPE_SQUARE_64 

Square operation returns 64-bit result – takes in one operand

DL_MATHACL_OP_TYPE_MAC 

Multiply and Accumulate operation – takes in two operands. Supports Q and int data formats. Enable saturation with DL_MathACL_enableSaturation and check DL_MATHACL_STATUS_OVERFLOW for overflow.

DL_MATHACL_OP_TYPE_SAC 

Square and Accumulate operation – takes in one operand. Supports Q and int data formats. Enable saturation with DL_MathACL_enableSaturation and check DL_MATHACL_STATUS_OVERFLOW for overflow.

§ DL_MATHACL_Q_TYPE

Enumerator
DL_MATHACL_Q_TYPE_Q0 

Q0 Operand Type

DL_MATHACL_Q_TYPE_Q1 

Q1 Operand Type

DL_MATHACL_Q_TYPE_Q2 

Q2 Operand Type

DL_MATHACL_Q_TYPE_Q3 

Q3 Operand Type

DL_MATHACL_Q_TYPE_Q4 

Q4 Operand Type

DL_MATHACL_Q_TYPE_Q5 

Q5 Operand Type

DL_MATHACL_Q_TYPE_Q6 

Q6 Operand Type

DL_MATHACL_Q_TYPE_Q7 

Q7 Operand Type

DL_MATHACL_Q_TYPE_Q8 

Q8 Operand Type

DL_MATHACL_Q_TYPE_Q9 

Q9 Operand Type

DL_MATHACL_Q_TYPE_Q10 

Q10 Operand Type

DL_MATHACL_Q_TYPE_Q11 

Q11 Operand Type

DL_MATHACL_Q_TYPE_Q12 

Q12 Operand Type

DL_MATHACL_Q_TYPE_Q13 

Q13 Operand Type

DL_MATHACL_Q_TYPE_Q14 

Q14 Operand Type

DL_MATHACL_Q_TYPE_Q15 

Q15 Operand Type

DL_MATHACL_Q_TYPE_Q16 

Q16 Operand Type

DL_MATHACL_Q_TYPE_Q17 

Q17 Operand Type

DL_MATHACL_Q_TYPE_Q18 

Q18 Operand Type

DL_MATHACL_Q_TYPE_Q19 

Q19 Operand Type

DL_MATHACL_Q_TYPE_Q20 

Q20 Operand Type

DL_MATHACL_Q_TYPE_Q21 

Q21 Operand Type

DL_MATHACL_Q_TYPE_Q22 

Q22 Operand Type

DL_MATHACL_Q_TYPE_Q23 

Q23 Operand Type

DL_MATHACL_Q_TYPE_Q24 

Q24 Operand Type

DL_MATHACL_Q_TYPE_Q25 

Q25 Operand Type

DL_MATHACL_Q_TYPE_Q26 

Q26 Operand Type

DL_MATHACL_Q_TYPE_Q27 

Q27 Operand Type

DL_MATHACL_Q_TYPE_Q28 

Q28 Operand Type

DL_MATHACL_Q_TYPE_Q29 

Q29 Operand Type

DL_MATHACL_Q_TYPE_Q30 

Q30 Operand Type

DL_MATHACL_Q_TYPE_Q31 

Q31 Operand Type

§ DL_MATHACL_OPSIGN

Enumerator
DL_MATHACL_OPSIGN_UNSIGNED 

Unsigned operation type

DL_MATHACL_OPSIGN_SIGNED 

Signed operation type

Function Documentation

§ DL_MathACL_enablePower()

__STATIC_INLINE void DL_MathACL_enablePower ( MATHACL_Regs *  mathacl)

Enables power on MATHACL module.

Parameters
mathaclPointer to the register overlay for the peripheral

§ DL_MathACL_disablePower()

__STATIC_INLINE void DL_MathACL_disablePower ( MATHACL_Regs *  mathacl)

Disable power on MATHACL module.

Parameters
mathaclPointer to the register overlay for the peripheral

§ DL_MathACL_reset()

__STATIC_INLINE void DL_MathACL_reset ( MATHACL_Regs *  mathacl)

Resets the MATHACL module.

Parameters
mathaclPointer to the register overlay for the peripheral

§ DL_MathACL_isReset()

__STATIC_INLINE bool DL_MathACL_isReset ( MATHACL_Regs *  mathacl)

Returns if MATHACL peripheral was reset.

Parameters
mathaclPointer to the register overlay for the MATHACL peripheral
Returns
true if peripheral was reset
false if peripheral wasn't reset

§ DL_MathACL_enableSaturation()

__STATIC_INLINE void DL_MathACL_enableSaturation ( MATHACL_Regs *  mathacl)

Enable saturation.

This bit is shared among DL_MATHACL_OP_TYPE_DIV, DL_MATHACL_OP_TYPE_SQUARE_32, DL_MATHACL_OP_TYPE_MPY_32, DL_MATHACL_OP_TYPE_MAC, and DL_MATHACL_OP_TYPE_SAC operations. When saturation is enabled, if there is an overflow event during an operation, then the result will saturate to the maximum value.

Parameters
mathaclPointer to the register overlay for the peripheral
See also
DL_MATHACL_STATUS_OVERFLOW

§ DL_MathACL_disableSaturation()

__STATIC_INLINE void DL_MathACL_disableSaturation ( MATHACL_Regs *  mathacl)

Disable saturation.

When saturation is disabled, if there is an overflow event during an operation, then the result will overflow to an unknown value.

Parameters
mathaclPointer to the register overlay for the peripheral

§ DL_MathACL_isSaturationEnabled()

__STATIC_INLINE bool DL_MathACL_isSaturationEnabled ( MATHACL_Regs *  mathacl)

Returns if saturation is enabled.

Parameters
mathaclPointer to the register overlay for the MATHACL peripheral
Returns
true if saturation is enabled
false if saturation is not enabled

§ DL_MathACL_setOperandOne()

__STATIC_INLINE void DL_MathACL_setOperandOne ( MATHACL_Regs *  mathacl,
uint32_t  op 
)

Load Operand one into the math accelerator.

Parameters
[in]mathaclPointer to the register overlay for the peripheral
[in]opOperand one to load into the Math Accelerator

§ DL_MathACL_setOperandTwo()

__STATIC_INLINE void DL_MathACL_setOperandTwo ( MATHACL_Regs *  mathacl,
uint32_t  op 
)

Load Operand two into the math accelerator.

Parameters
[in]mathaclPointer to the register overlay for the peripheral
[in]opOperand two to load into the Math Accelerator

§ DL_MathACL_getResultOne()

__STATIC_INLINE uint32_t DL_MathACL_getResultOne ( MATHACL_Regs *  mathacl)

Returns MATHACL result one register.

Parameters
[in]mathaclPointer to the register overlay for the peripheral
Returns
Value stored in MATHACUL Result 1 status

§ DL_MathACL_getResultTwo()

__STATIC_INLINE uint32_t DL_MathACL_getResultTwo ( MATHACL_Regs *  mathacl)

Returns MATHACL result two register.

Parameters
[in]mathaclPointer to the register overlay for the peripheral
Returns
Value stored in MATHACUL Result 2 status

§ DL_MathACL_getStatus()

__STATIC_INLINE uint32_t DL_MathACL_getStatus ( MATHACL_Regs *  mathacl)

Returns MATHACL operation status.

Parameters
[in]mathaclPointer to the register overlay for the peripheral
Returns
One of DL_MATHACL_STATUS

§ DL_MathACL_clearOverflowStatus()

__STATIC_INLINE void DL_MathACL_clearOverflowStatus ( MATHACL_Regs *  mathacl)

Clear the overflow status bit.

Calling this API clears DL_MATHACL_STATUS_OVERFLOW

Parameters
[in]mathaclPointer to the register overlay for the peripheral
See also
DL_MATHACL_STATUS_OVERFLOW

§ DL_MathACL_clearUnderflowStatus()

__STATIC_INLINE void DL_MathACL_clearUnderflowStatus ( MATHACL_Regs *  mathacl)

Clear the underflow status bit.

Calling this API clears DL_MATHACL_STATUS_UNDERFLOW

Parameters
[in]mathaclPointer to the register overlay for the peripheral
See also
DL_MATHACL_STATUS_UNDERFLOW

§ DL_MathACL_clearErrorStatus()

__STATIC_INLINE void DL_MathACL_clearErrorStatus ( MATHACL_Regs *  mathacl)

Clear the error status bit.

Calling this API clears DL_MATHACL_STATUS_ERR_MASK

Parameters
[in]mathaclPointer to the register overlay for the peripheral
See also
DL_MATHACL_STATUS_ERR_MASK

§ DL_MathACL_waitForOperation()

__STATIC_INLINE void DL_MathACL_waitForOperation ( MATHACL_Regs *  mathacl)

Block until MATHACL_STATUS_BUSY_DONE is active in MATHACL.

Parameters
[in]mathaclPointer to the register overlay for the peripheral

References DL_MathACL_configOperation().

§ DL_MathACL_configOperation()

void DL_MathACL_configOperation ( MATHACL_Regs *  mathacl,
const DL_MathACL_operationConfig opConfig,
uint32_t  op1,
uint32_t  op2 
)

Configure and execute a Math accelerator operation.

Precondition
Call DL_MathACL_clearResults when configuring the MATHACL for performing DL_MATHACL_OP_TYPE_MAC and DL_MATHACL_OP_TYPE_SAC operations.
Parameters
[in]mathaclPointer to the register overlay for the peripheral
[in]opConfigPointer to the configuration structure for the operation
[in]op1Operand one for the operation
[in]op2Operand two for the operation. May be left as 0 if unused

Referenced by DL_MathACL_waitForOperation().

§ DL_MathACL_clearResultOne()

__STATIC_INLINE void DL_MathACL_clearResultOne ( MATHACL_Regs *  mathacl)

Clears the RES1 register.

Clears the Result 1 (RES1) register

Parameters
[in]mathaclPointer to the register overlay for the peripheral

§ DL_MathACL_clearResultTwo()

__STATIC_INLINE void DL_MathACL_clearResultTwo ( MATHACL_Regs *  mathacl)

Clears the RES2 register.

Clears the Result 2 (RES2) register

Parameters
[in]mathaclPointer to the register overlay for the peripheral

§ DL_MathACL_clearResults()

__STATIC_INLINE void DL_MathACL_clearResults ( MATHACL_Regs *  mathacl)

Clears the RES1 and RES2 registers.

Clears the Result 1 (RES1) and Result 2 (RES2) registers

Parameters
[in]mathaclPointer to the register overlay for the peripheral
© Copyright 1995-2024, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale