1. Field
The subject matter disclosed herein relates generally to telecommunications devices, and more particularly to a method and apparatus for performing digital automatic gain control.
2. Description of Related Art
Digital automatic gain control (DAGC) is required in many parts of a baseband processing system of various telecommunications devices. DAGC is required when overflow/underflow control is required. For example, overflow and underflow control is typically required for fixed-point digital signal processing. However, even for a floating-point digital signal processor (DSP) that performs signal-processing operations, DAGC is also needed because the dynamic range of the floating-point DSP is also limited for power-reduction purposes.
DAGC is also required for scaling data prior to processing by subsequent hardware accelerator (HAC). The HAC may be designed to process data in both fixed-point and floating point. In either case, to reduce hardware complexity of the HAC, the HAC requires the input data to be scaled within a desired range before processing.
Performing DAGC on data values represented in fixed point requires maximum magnitude searching of fixed-point data values. Hardware implementation to perform such DAGC is relatively costly.
In a first aspect, a method for scaling a plurality of data values includes storing a first subset of data values of the plurality of data values into a first vector register, determining a maximum data value of the first subset of data values, and storing the greater of the maximum data value and a value stored in a scalar register to the scalar register. Each data value of the subset of data values is stored in a different element of the first vector register. The method further includes determining an adjustment factor based on the value stored in the scalar register, and adjusting each data value of the plurality of data values by the adjustment factor.
In a second aspect, a method for scaling a plurality of data values includes initializing a first vector register with a first subset of data values of the plurality of data values. Each data value of the subset of data values is stored in a different element of the first vector register. The method further includes storing a second subset of data values of the plurality of data values into a second vector register, comparing the data value of each element of the first vector register with the data value for the corresponding element of the second vector register to determine which data value is greater, and storing the greater data value to the corresponding element of the first vector register. The method further includes determining a maximum data value of the data values stored in the first vector register, determining an adjustment factor based on the determined maximum data value, and adjusting each data value of the plurality of data values by the adjustment factor.
In a third aspect, an apparatus for scaling a plurality of data values includes a processor configured to execute instructions and a vector processor that includes hardware configured to implement at least some of the instructions executed by the processor. The processor is configured to store a first subset of data values of the plurality of data values into a first vector register, issue an instruction to the vector processor that causes the vector processor to return a maximum data value of the first subset of data values, and store the greater of the maximum data value and a value stored in a scalar register to the scalar register. The processor is further configured to determine an adjustment factor based on the value stored in the scalar register, and adjust each data value of the plurality of data values by the adjustment factor.
In a second aspect, an apparatus for scaling a plurality of data values includes a processor configured to execute instructions and a vector processor that includes hardware configured to implement at least some of the instructions executed by the processor. The processor is configured to initialize a first vector register with a first subset of data values of the plurality of data values. Each data value of the subset of data values is stored in a different element of the first vector register. The processor is further configured to store a second subset of data values of the plurality of data values into a second vector register, issue a first instruction to the vector processor that causes the vector processor to compare the data value of each element of the first vector register with the data value for the corresponding element of the second vector register to determine which data value is greater, and store the greater data value to the corresponding element of the first vector register. The processor is further configured to issue a second instruction to the vector processor that causes the vector processor to return a maximum data value of the data values stored in the first vector register, determine an adjustment factor based on the determined maximum data value, and adjust each data value of the plurality of data values by the adjustment factor.
The accompanying drawings are included to provide a further understanding of the claims, are incorporated in, and constitute a part of this specification. The detailed description and illustrated embodiments described serve to explain the principles defined by the claims.
The embodiments below overcome the issues discussed above in performing DAGC by providing specialized vector-processing hardware that facilitates fast determination of the maximum data value in a set of data values. Generally, the maximum data value is determined by comparing the exponent of the respective data values to identify the maximum data value. An adjustment factor is then determined based on the maximum exponent, and the exponents of the data values are adjusted by the adjustment factor. The vector processor includes hardware that facilitates determining the maximum data value within a vector register, which facilitates fast determination of the maximum data value. The vector processor also includes hardware configured to scale data values in a vector register by the same amount.
Signals processed by the DSP are represented as a sequence of binary data values stored in the memory 110. One form of digital processing that may be performed is scaling or amplitude adjustment of the signal. That is, the magnitude of the data values are scaled up or down until the magnitude of the data values match the dynamic range requirements of the DSP 100 and/or HAC 105. In one embodiment, the data values are real numbers represented in a floating-point representation of the form:
mantissa×baseexponent
The mantissa and exponent are represented by a fixed number of bits. For example, eight bits for the mantissa and eight bits for the exponent. The base is chosen ahead of time and may be 2, 10, 16, etc. In one implementation, the DSP 100 scales the data values up or down by adjusting the exponent for each data value.
At block 200, data values associated with a signal are analyzed to identify the maximum exponent of all the data values. The data value with the largest exponent generally corresponds to the data value with the largest magnitude or is one of the data values with the largest magnitude, although it is understood that the magnitude also depends to a degree on the significant digits (i.e., the mantissa) of the data value.
At block 205, an adjustment factor is determined for scaling the data values of the signal. The adjustment factor is a value that, when applied to the data values of the signal, scales the data values to better match the requirements of the DSP 100 and/or HAC 105. For example, if the largest data value of the signal is only fifty percent of the maximum data value that may be processed by the HAC 105, an adjustment factor of two may be appropriate.
At block 210, the data values of the signal may be adjusted by the adjustment factor. That is, the exponent of the data values may be scaled by the adjustment factor. The data values may be scaled and stored again to the memory 110. Alternatively, the adjustment factor may be communicated to the HAC 105, which may include hardware for scaling the exponent of the data values by the adjustment factor.
At block 300, a scalar register of the DSP 100 (i.e., a non-vector register) is initialized, for example, to a value of zero. At block 305, if there are non-evaluated data values, then at block 310 a vector of data values is retrieved from the memory 110 and stored in a vector register of the DSP. For example, eight data values may be loaded in the vector register. Each data value is stored as one element of the vector register.
At block 315, the maximum data value within the vector register is determined.
Returning to
As shown, the operations facilitate faster determination of the maximum value of the data by processing the data utilizing vector instructions that facilitate fast determination of a maximum value within a vector register. Of course, it is understood that speed may be improved by utilizing larger vector registers. That is, vector registers that store more than eight elements. Moreover, different instructions for comparing the individual elements to one another may be utilized as well. For example, while
At block 505, if the are additional data values in the memory 110 to evaluate, then at block 510, a next group of data values are stored to a second vector register.
At block 515, the data values in the elements of the first vector register are compared with the data values in the corresponding elements of the second vector register to determine the maximum value for each comparison, as illustrated in
Returning to
If at block 505, there are more data values to evaluate, then the next group of data values are loaded into the second vector register and compared with the data values stored in the first vector register.
If at block 505, there are no more data values to evaluate, the maximum data value stored in the first vector register is determined. The maximum data value may, for example, be determined in a manner similar to the operations associated with
As noted above with reference to
At block 210, the adjustment factor is applied to the exponents of all the data values. For example, the DSP 100 may scale the exponents of all the data values in the memory by the adjustment factor. Alternatively, the adjustment factor may be communicated to the HAC 105, and the HAC 105 may scale the data values prior to further processing.
At block 805, if the adjusted exponent is greater than zero, then at block 810, the adjusted exponent and the mantissa of the original data value are output from the scaling modules 715.
If at block 805, the adjusted exponent is zero or less, then at block 815, the value zero is written to both the mantissa and exponent portions of the data value. This prevents the data values from being adjusted below zero, which could prevent further processing of the data values by the DSP and/or the HAC.
Thus, the operations above enable fast scaling of the data values by an adjustment factor. This, in conjunction with fast determination of the maximum data value, facilitates fast and efficient DAGC.
While various embodiments of the embodiments have been described, it will be apparent to those of ordinary skill in the art that many more embodiments and implementations are possible that are within the scope of the claims. Accordingly, it will be apparent to those of ordinary skill in the art that many more embodiments and implementations are possible that are within the scope of the claims. Therefore, the embodiments described are only provided to aid in understanding the claims and do not limit the scope of the claims.