Go to the source code of this file.
Data Structures | |
struct | uint64 |
Defines | |
#define | __MSP430_HAS_MPY32__ |
#define | MPY32_WRITEDELAY_OFF ( !(MPYDLY32 + MPYDLYWRTEN) ) |
#define | MPY32_WRITEDELAY_32BIT (MPYDLYWRTEN) |
#define | MPY32_WRITEDELAY_64BIT (MPYDLY32 + MPYDLYWRTEN) |
#define | MPY32_MULTIPLY_UNSIGNED (0x00) |
#define | MPY32_MULTIPLY_SIGNED (0x02) |
#define | MPY32_MULTIPLYACCUMULATE_UNSIGNED (0x04) |
#define | MPY32_MULTIPLYACCUMULATE_SIGNED (0x06) |
Functions | |
void | MPY32_setWriteDelay (unsigned int baseAddress, unsigned int writeDelaySelect) |
void | MPY32_setSaturationMode (unsigned int baseAddress) |
void | MPY32_resetSaturationMode (unsigned int baseAddress) |
void | MPY32_setFractionMode (unsigned int baseAddress) |
void | MPY32_resetFractionMode (unsigned int baseAddress) |
void | MPY32_setOperandOne8Bit (unsigned int baseAddress, unsigned char multiplicationType, unsigned char operand) |
void | MPY32_setOperandOne16Bit (unsigned int baseAddress, unsigned char multiplicationType, unsigned int operand) |
void | MPY32_setOperandOne24Bit (unsigned int baseAddress, unsigned char multiplicationType, unsigned long operand) |
void | MPY32_setOperandOne32Bit (unsigned int baseAddress, unsigned char multiplicationType, unsigned long operand) |
void | MPY32_setOperandTwo8Bit (unsigned int baseAddress, unsigned char operand) |
void | MPY32_setOperandTwo16Bit (unsigned int baseAddress, unsigned int operand) |
void | MPY32_setOperandTwo24Bit (unsigned int baseAddress, unsigned long operand) |
void | MPY32_setOperandTwo32Bit (unsigned int baseAddress, unsigned long operand) |
unsigned char | MPY32_getResult8Bit (unsigned int baseAddress) |
unsigned int | MPY32_getResult16Bit (unsigned int baseAddress) |
unsigned long | MPY32_getResult24Bit (unsigned int baseAddress) |
unsigned long | MPY32_getResult32Bit (unsigned int baseAddress) |
uint64 | MPY32_getResult64Bit (unsigned int baseAddress) |
unsigned int | MPY32_getSumExtension (unsigned int baseAddress) |
unsigned short | MPY32_getCarryBitValue (unsigned int baseAddress) |
#define __MSP430_HAS_MPY32__ |
#define MPY32_WRITEDELAY_OFF ( !(MPYDLY32 + MPYDLYWRTEN) ) |
#define MPY32_WRITEDELAY_32BIT (MPYDLYWRTEN) |
#define MPY32_WRITEDELAY_64BIT (MPYDLY32 + MPYDLYWRTEN) |
#define MPY32_MULTIPLY_UNSIGNED (0x00) |
#define MPY32_MULTIPLY_SIGNED (0x02) |
#define MPY32_MULTIPLYACCUMULATE_UNSIGNED (0x04) |
#define MPY32_MULTIPLYACCUMULATE_SIGNED (0x06) |
void MPY32_setWriteDelay | ( | unsigned int | baseAddress, |
unsigned int | writeDelaySelect | ||
) |
Sets the write delay setting for the MPY32 module.
baseAddress | is the Base Address of the MPY32 Module. |
writeDelaySelect | delays the write to any MPY32 register until the selected bit size of result has been written. Valid values are MPY32_WRITEDELAY_OFF - writes are not delayed [Default] MPY32_WRITEDELAY_32BIT - writes are delayed until a 32-bit result is available in the result registers MPY32_WRITEDELAY_64BIT - writes are delayed until a 64-bit result is available in the result registers Modified bits are MPYDLY32 and MPYDLYWRTEN of MPY32CTL0 register. |
This function sets up a write delay to the MPY module's registers, which holds any writes to the registers until all calculations are complete. There are two different settings, one which waits for 32-bit results to be ready, and one which waits for 64-bit results to be ready. This prevents unpredicatble results if registers are changed before the results are ready.
References HWREG.
void MPY32_setSaturationMode | ( | unsigned int | baseAddress | ) |
Enables Saturation Mode.
baseAddress | is the Base Address of the MPY32 Module. |
This function enables saturation mode. When this is enabled, the result read out from the MPY result registers is converted to the most-positive number in the case of an overflow, or the most-negative number in the case of an underflow. Please note, that the raw value in the registers does not reflect the result returned, and if the saturation mode is disabled, then the raw value of the registers will be returned instead.
References HWREGB.
void MPY32_resetSaturationMode | ( | unsigned int | baseAddress | ) |
Disables Saturation Mode.
baseAddress | is the Base Address of the MPY32 Module. |
This function disables saturation mode, which allows the raw result of the MPY result registers to be returned.
References HWREGB.
void MPY32_setFractionMode | ( | unsigned int | baseAddress | ) |
Enables Fraction Mode.
baseAddress | is the Base Address of the MPY32 Module. |
This function enables fraction mode.
References HWREGB.
void MPY32_resetFractionMode | ( | unsigned int | baseAddress | ) |
Disables Fraction Mode.
baseAddress | is the Base Address of the MPY32 Module. |
This function disables fraction mode.
References HWREGB.
void MPY32_setOperandOne8Bit | ( | unsigned int | baseAddress, |
unsigned char | multiplicationType, | ||
unsigned char | operand | ||
) |
Sets an 8-bit value into operand 1.
baseAddress | is the Base Address of the MPY32 Module. |
multiplicationType | is the type of multiplication to perform once the second operand is set. Valid values are MPY_MULTIPLY_UNSIGNED MPY_MULTIPLY_SIGNED MPY_MULTIPLYACCUMULATE_UNSIGNED MPY_MULTIPLEACCUMULATE_SIGNED |
operand | is the 8-bit value to load into the 1st operand. |
This function sets the first operand for multiplication and determines what type of operation should be performed. Once the second operand is set, then the operation will begin.
References HWREGB.
void MPY32_setOperandOne16Bit | ( | unsigned int | baseAddress, |
unsigned char | multiplicationType, | ||
unsigned int | operand | ||
) |
Sets an 16-bit value into operand 1.
baseAddress | is the Base Address of the MPY32 Module. |
multiplicationType | is the type of multiplication to perform once the second operand is set. Valid values are MPY_MULTIPLY_UNSIGNED MPY_MULTIPLY_SIGNED MPY_MULTIPLYACCUMULATE_UNSIGNED MPY_MULTIPLEACCUMULATE_SIGNED |
operand | is the 16-bit value to load into the 1st operand. |
This function sets the first operand for multiplication and determines what type of operation should be performed. Once the second operand is set, then the operation will begin.
References HWREG.
void MPY32_setOperandOne24Bit | ( | unsigned int | baseAddress, |
unsigned char | multiplicationType, | ||
unsigned long | operand | ||
) |
Sets an 24-bit value into operand 1.
baseAddress | is the Base Address of the MPY32 Module. |
multiplicationType | is the type of multiplication to perform once the second operand is set. Valid values are MPY_MULTIPLY_UNSIGNED MPY_MULTIPLY_SIGNED MPY_MULTIPLYACCUMULATE_UNSIGNED MPY_MULTIPLEACCUMULATE_SIGNED |
operand | is the 24-bit value to load into the 1st operand. |
This function sets the first operand for multiplication and determines what type of operation should be performed. Once the second operand is set, then the operation will begin.
void MPY32_setOperandOne32Bit | ( | unsigned int | baseAddress, |
unsigned char | multiplicationType, | ||
unsigned long | operand | ||
) |
Sets an 32-bit value into operand 1.
baseAddress | is the Base Address of the MPY32 Module. |
multiplicationType | is the type of multiplication to perform once the second operand is set. Valid values are MPY_MULTIPLY_UNSIGNED MPY_MULTIPLY_SIGNED MPY_MULTIPLYACCUMULATE_UNSIGNED MPY_MULTIPLEACCUMULATE_SIGNED |
operand | is the 32-bit value to load into the 1st operand. |
This function sets the first operand for multiplication and determines what type of operation should be performed. Once the second operand is set, then the operation will begin.
References HWREG.
void MPY32_setOperandTwo8Bit | ( | unsigned int | baseAddress, |
unsigned char | operand | ||
) |
Sets an 8-bit value into operand 2, which starts the multiplication.
baseAddress | is the Base Address of the MPY32 Module. |
operand | is the 8-bit value to load into the 2nd operand. |
This function sets the second operand of the multiplication operation and starts the operation.
References HWREGB.
void MPY32_setOperandTwo16Bit | ( | unsigned int | baseAddress, |
unsigned int | operand | ||
) |
Sets an 16-bit value into operand 2, which starts the multiplication.
baseAddress | is the Base Address of the MPY32 Module. |
operand | is the 16-bit value to load into the 2nd operand. |
This function sets the second operand of the multiplication operation and starts the operation.
References HWREG.
void MPY32_setOperandTwo24Bit | ( | unsigned int | baseAddress, |
unsigned long | operand | ||
) |
Sets an 24-bit value into operand 2, which starts the multiplication.
baseAddress | is the Base Address of the MPY32 Module. |
operand | is the 24-bit value to load into the 2nd operand. |
This function sets the second operand of the multiplication operation and starts the operation.
void MPY32_setOperandTwo32Bit | ( | unsigned int | baseAddress, |
unsigned long | operand | ||
) |
Sets an 32-bit value into operand 2, which starts the multiplication.
baseAddress | is the Base Address of the MPY32 Module. |
operand | is the 32-bit value to load into the 2nd operand. |
This function sets the second operand of the multiplication operation and starts the operation.
References HWREG.
unsigned char MPY32_getResult8Bit | ( | unsigned int | baseAddress | ) |
Returns an 8-bit result of the last multiplication operation.
baseAddress | is the Base Address of the MPY32 Module. |
This function returns the 8 least significant bits of the result registers. This can improve efficiency if the operation has no more than an 8-bit result.
References HWREGB.
unsigned int MPY32_getResult16Bit | ( | unsigned int | baseAddress | ) |
Returns an 16-bit result of the last multiplication operation.
baseAddress | is the Base Address of the MPY32 Module. |
This function returns the 16 least significant bits of the result registers. This can improve efficiency if the operation has no more than a 16-bit result.
References HWREG.
unsigned long MPY32_getResult24Bit | ( | unsigned int | baseAddress | ) |
Returns an 24-bit result of the last multiplication operation.
baseAddress | is the Base Address of the MPY32 Module. |
This function returns the 24 least significant bits of the result registers. This can improve efficiency if the operation has no more than an 24-bit result.
References HWREG.
unsigned long MPY32_getResult32Bit | ( | unsigned int | baseAddress | ) |
Returns an 32-bit result of the last multiplication operation.
baseAddress | is the Base Address of the MPY32 Module. |
This function returns a 32-bit result of the last multiplication operation, which is the maximum amount of bits of a 16 x 16 operation.
References HWREG.
uint64 MPY32_getResult64Bit | ( | unsigned int | baseAddress | ) |
Returns an 64-bit result of the last multiplication operation.
baseAddress | is the Base Address of the MPY32 Module. |
This function returns all 64 bits of the result registers. The way this is passed is with 4 integers contained within a uint64 struct.
References HWREG, uint64::RES0, uint64::RES1, uint64::RES2, and uint64::RES3.
unsigned int MPY32_getSumExtension | ( | unsigned int | baseAddress | ) |
Returns the Sum Extension of the last multiplcation operation.
baseAddress | is the Base Address of the MPY32 Module. |
This function returns the Sum Extension of the MPY module, which either gives the sign after a signed operation or shows a carry after a multiply- and-accumulate operation. The Sum Extension acts as a check for overflows or underflows.
References HWREG.
unsigned short MPY32_getCarryBitValue | ( | unsigned int | baseAddress | ) |
Returns the Carry Bitof the last multiplication operation.
baseAddress | is the Base Address of the MPY32 Module. |
This function returns the Carry Bit of the MPY module, which either gives the sign after a signed operation or shows a carry after a multiply- and-accumulate operation.
References HWREGB.