# US 8,280,941 B2 · Method and system for performing calculations using fixed point microprocessor hardware

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 8,280,941 B2
- Document ID: US8280941B2
- Status: Granted
- Kind: B2
- Application number: 12/004,250
- Filed: 2007-12-19
- Published: 2009-07-16
- Granted: 2012-10-02
- Earliest claimed: 2007-12-19
- Assignees: HGST Netherlands B.V.
- Inventors: Jeffrey J. Dobbek; Kirk Hwang
- Web page: https://patentgrep.com/patent/US8280941B2

## CPC

- H03M 7/24: Conversion to or from floating-point codes
- H03M: CODING; DECODING; CODE CONVERSION IN GENERAL (using fluidic means F15C4/00; optical analogue/digital converters G02F7/00; coding, decoding or code conversion, specially adapted for particular applications, see the relevant subclasses, e.g. G01D, G01R, G06F, G06T, G09G, G10L, G11B, G11C, H04B, H04L, H04M, H04N; ciphering or deciphering for cryptography or other purposes involving the need for secrecy G09C)

## Abstract

A method and system are described for performing an arithmetic operation such as multiplication or division of a fixed point variable measured at runtime by a floating point constant known at compile-time. The floating point constant is converted into a mantissa and a base-2 exponent at compile-time. The mantissa and exponent are preferably combined into a single unit (a word) of memory. At runtime either single multiplication and accumulation or matrix multiplication and accumulation is preferably achieved by a microprocessor or DSP instruction designed to use the mantissa-exponent pairs stored in a word of memory. The microprocessor instruction multiplies a fixed point runtime variable x by the mantissa and the result is shifted to the right or left as indicated by the exponent, which is preferably a 2's complement number. The complete instruction sequence to perform the multiplication can be made reentrant and can be pipelined.

## Claims

### Claim 1

A method of operating a digital processing system having only fixed point arithmetic hardware to multiply a fixed point number whose value is only known at runtime by a floating point constant known at compile-time comprising:
loading a first fixed point mantissa and a first fixed point exponent from memory into a fixed point processor, the first fixed point mantissa and the first fixed point exponent representing a first floating point constant that was converted at compile-time into the first fixed point mantissa and the first fixed point exponent;
multiplying the first fixed point mantissa by a first fixed point value for a runtime variable to calculate a first intermediate number using fixed point processor instructions; and
shifting bits of the first intermediate number to the left or right based on the value of the first fixed point exponent to obtain a first result.

### Claim 2 (depends on 1)

The method of claim 1 further comprising:
placing the first result in an accumulator;
loading a second mantissa and a second exponent derived from a second floating point constant from memory adjacent to the first fixed point mantissa and first fixed point exponent;
multiplying the second mantissa by a second fixed point data value to generate a second result;
shifting bits in the second result right or left based on the second exponent; and
adding the second result to the first result in the accumulator.

### Claim 3 (depends on 1)

The method of claim 1 wherein the first fixed point mantissa and first fixed point exponent are stored in a word of memory and the loading step is performed by a single instruction that loads a word of memory into a fixed point register.

### Claim 4 (depends on 1)

The method of claim 1 wherein the first fixed point exponent is stored in 2's complement form and shifting bits of the first intermediate number further comprises shifting in a first direction for positive values of the first fixed point exponent and shifting in a second direction for negative values of the first fixed point exponent.

### Claim 5 (depends on 1)

The method of claim 1 further comprising deriving the first fixed point mantissa by a process that includes scaling by dividing the floating point constant by a selected maximum value.

### Claim 6 (depends on 1)

The method of claim 1 further comprising placing the first result in an accumulator; and wherein the loading, multiplying, shifting and placing steps comprise a first instruction sequence and the method further comprises a second instruction sequence comprising loading a second mantissa and a second exponent derived from a second floating point constant from memory adjacent to the first fixed point mantissa and first fixed point exponent; multiplying the second mantissa by a second fixed point data value to generate a second result; shifting bits in the second result right or left based on the second exponent; and adding the second result to the first result in the accumulator;
and wherein at least one step in the second instruction sequence is executed simultaneously with a step in the first instruction sequence to pipeline first and second instruction sequences.

### Claim 7

A method of operating a digital processing system having only fixed point arithmetic hardware to multiply a fixed point number whose value is only known at runtime by a floating point constant known at compile-time comprising:
a) storing a set of fixed point values for a runtime variable in contiguous memory locations;
b) storing a set of mantissa-exponent values in fixed point form in contiguous memory locations, each mantissa-exponent value containing a fixed point mantissa derived from a predetermined floating point constant and an fixed point exponent derived from a predetermined floating point constant at compile-time, the fixed point mantissa and fixed point exponent together representing predetermined floating point constant; and
c) performing a matrix multiplication comprising:
1) multiplying a selected fixed point mantissa extracted from a selected mantissa-exponent value by a selected fixed point value for a runtime variable to calculate a first intermediate number; and
2) shifting bits of the first intermediate number to the left or right based on the value of the selected fixed point exponent extracted from a selected mantissa-exponent value to obtain a first result that is equal to the fixed point multiplication product of the fixed point number for the runtime variable and the floating point constant known at compile-time.

### Claim 8 (depends on 7)

The method of claim 7 further comprising:
prior to performing the matrix multiplication, placing an address of the set of fixed point values for the runtime variable in a first index register and placing an address of the set of mantissa-exponent values in a second index register, and
adjusting addresses in the first and second index registers during the matrix multiplication to point to the selected mantissa-exponent value and the selected fixed point value for the runtime variable for a current multiply operation.

### Claim 9 (depends on 7)

The method of claim 7 wherein each mantissa-exponent value is stored in a single word of memory that is read in a single cycle.

### Claim 10 (depends on 7)

The method of claim 7 wherein an exponent in a mantissa-exponent value is a 2's complement number.

### Claim 11 (depends on 7)

The method of claim 7 further comprising deriving a mantissa by a process that includes scaling by dividing a floating point constant by a selected maximum value.

### Claim 12

A system comprising:
a fixed point processor that executes stored instructions;
a set of fixed point values for a runtime variable in contiguous memory locations;
a set of mantissa-exponent values in fixed point form in contiguous memory locations, each mantissa-exponent value containing a fixed point mantissa derived from a predetermined floating point constant and an fixed point exponent derived from a predetermined floating point constant at compile-time; and
means for extracting a first fixed point mantissa and a first fixed point exponent from a word of memory containing the mantissa-exponent value; and
means for executing a first instruction that multiplies the first fixed point mantissa by a first fixed point data value to generate a first fixed point result and shift bits in the first fixed point result right or left based on the first fixed point exponent.

### Claim 13 (depends on 12)

The system of claim 12 wherein the first fixed point exponent is stored in 2's complement form and the means for executing a first instruction further comprises means for shifting in a first direction for positive values of the first fixed point exponent and shifting in a second direction for negative values of the first fixed point exponent.

### Claim 14 (depends on 12)

The system of claim 12 further comprising means for executing a second instruction for matrix multiplication comprising a first index register containing an address of one of the set of fixed point values for the runtime variable and a second index register containing an address of one of the set of mantissa-exponent values, and
means for adjusting addresses in the first and second index registers during the matrix multiplication to point to a selected mantissa-exponent value and a selected fixed point value for the runtime variable for use in a current multiply operation.

### Claim 15 (depends on 14)

The system of claim 14 wherein the means for executing a second instruction for matrix multiplication further comprises means for pipelining the execution of the second instruction with the execution of the first instruction by simultaneously executing a step in the first instruction with a step in the second instruction.
