LPM_ABS

Ports

Port Name

Type

Usage

Description Comments

Data

I

Required

Vector represents SIGNED number Vector, LPM_Width wide

Result

O

Required

Absolute Value of Data Vector, LPM_Width wide.

Overflow

O

Optional

High (1) if Data = -2LPM_Width-1 Note 1

Note 1: Two's complement allows one more negative number than positive. The overflow port detects that singular instance and goes high to indicate that no positive equivalent exists.

Properties

Property

Usage

Value Comments

LPM_Width

Required

LPM Value > 1 Width of input and output vectors

Function

           if Data = ­2LPM_Width-1, then Overflow = 1, Result = UNDEFINED
                    else if Data < 0, then Result = (0 - Data)
                            else Result = Data

Data must always represent a SIGNED number and may be positive or negative. Result will always be positive.

 

Copyright © 1998 University of Manchester