mpy32.c File Reference

`#include "driverlib/5xx_6xx/mpy32.h"`

`#include "inc/hw_types.h"`

`#include "deprecated/CCS/msp430xgeneric.h"`

`#include "driverlib/5xx_6xx/debug.h"`

## 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) |

void MPY32_setWriteDelay | ( | unsigned int | baseAddress, |

unsigned int | writeDelaySelect |
||

) |

Sets the write delay setting for the MPY32 module.

**Parameters:**-
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.

**Returns:**- NONE

References HWREG.

void MPY32_setSaturationMode | ( | unsigned int | baseAddress | ) |

Enables Saturation Mode.

**Parameters:**-
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.

**Returns:**- NONE

References HWREGB.

void MPY32_resetSaturationMode | ( | unsigned int | baseAddress | ) |

Disables Saturation Mode.

**Parameters:**-
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.

**Returns:**- NONE

References HWREGB.

void MPY32_setFractionMode | ( | unsigned int | baseAddress | ) |

Enables Fraction Mode.

**Parameters:**-
baseAddress is the Base Address of the MPY32 Module.

This function enables fraction mode.

**Returns:**- NONE

References HWREGB.

void MPY32_resetFractionMode | ( | unsigned int | baseAddress | ) |

Disables Fraction Mode.

**Parameters:**-
baseAddress is the Base Address of the MPY32 Module.

This function disables fraction mode.

**Returns:**- NONE

References HWREGB.

void MPY32_setOperandOne8Bit | ( | unsigned int | baseAddress, |

unsigned char | multiplicationType, |
||

unsigned char | operand |
||

) |

Sets an 8-bit value into operand 1.

**Parameters:**-
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.

**Returns:**- NONE

References HWREGB.

void MPY32_setOperandOne16Bit | ( | unsigned int | baseAddress, |

unsigned char | multiplicationType, |
||

unsigned int | operand |
||

) |

Sets an 16-bit value into operand 1.

**Parameters:**-
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.

**Returns:**- NONE

References HWREG.

void MPY32_setOperandOne24Bit | ( | unsigned int | baseAddress, |

unsigned char | multiplicationType, |
||

unsigned long | operand |
||

) |

Sets an 24-bit value into operand 1.

**Parameters:**-
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.

**Returns:**- NONE

void MPY32_setOperandOne32Bit | ( | unsigned int | baseAddress, |

unsigned char | multiplicationType, |
||

unsigned long | operand |
||

) |

Sets an 32-bit value into operand 1.

**Parameters:**-
baseAddress is the Base Address of the MPY32 Module. multiplicationType **MPY_MULTIPLY_UNSIGNED****MPY_MULTIPLY_SIGNED****MPY_MULTIPLYACCUMULATE_UNSIGNED****MPY_MULTIPLEACCUMULATE_SIGNED**operand is the 32-bit value to load into the 1st operand.

**Returns:**- NONE

References HWREG.

void MPY32_setOperandTwo8Bit | ( | unsigned int | baseAddress, |

unsigned char | operand |
||

) |

Sets an 8-bit value into operand 2, which starts the multiplication.

**Parameters:**-
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.

**Returns:**- NONE

References HWREGB.

void MPY32_setOperandTwo16Bit | ( | unsigned int | baseAddress, |

unsigned int | operand |
||

) |

Sets an 16-bit value into operand 2, which starts the multiplication.

**Parameters:**-
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.

**Returns:**- NONE

References HWREG.

void MPY32_setOperandTwo24Bit | ( | unsigned int | baseAddress, |

unsigned long | operand |
||

) |

Sets an 24-bit value into operand 2, which starts the multiplication.

**Parameters:**-
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.

**Returns:**- NONE

void MPY32_setOperandTwo32Bit | ( | unsigned int | baseAddress, |

unsigned long | operand |
||

) |

Sets an 32-bit value into operand 2, which starts the multiplication.

**Parameters:**-
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.

**Returns:**- NONE

References HWREG.

unsigned char MPY32_getResult8Bit | ( | unsigned int | baseAddress | ) |

Returns an 8-bit result of the last multiplication operation.

**Parameters:**-
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.

**Returns:**- The 8-bit result of the last multiplication operation.

References HWREGB.

unsigned int MPY32_getResult16Bit | ( | unsigned int | baseAddress | ) |

Returns an 16-bit result of the last multiplication operation.

**Parameters:**-
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.

**Returns:**- The 16-bit result of the last multiplication operation.

References HWREG.

unsigned long MPY32_getResult24Bit | ( | unsigned int | baseAddress | ) |

Returns an 24-bit result of the last multiplication operation.

**Parameters:**-
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.

**Returns:**- The 24-bit result of the last multiplication operation.

References HWREG.

unsigned long MPY32_getResult32Bit | ( | unsigned int | baseAddress | ) |

Returns an 32-bit result of the last multiplication operation.

**Parameters:**-
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.

**Returns:**- The 32-bit result of the last multiplication operation.

References HWREG.

uint64 MPY32_getResult64Bit | ( | unsigned int | baseAddress | ) |

Returns an 64-bit result of the last multiplication operation.

**Parameters:**-
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.

**Returns:**- The 64-bit result seperated into 4 unsigned ints in 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.

**Parameters:**-
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.

**Returns:**- The value of the MPY32 module Sum Extension.

References HWREG.

unsigned short MPY32_getCarryBitValue | ( | unsigned int | baseAddress | ) |

Returns the Carry Bitof the last multiplication operation.

**Parameters:**-
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.

**Returns:**- The value of the MPY32 module Carry Bit 0x0 or 0x1.

References HWREGB.

Copyright 2012, Texas Instruments Incorporated