# US 7,467,177 B2 · Mathematical circuit with dynamic rounding

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

- Number: US 7,467,177 B2
- Document ID: US7467177B2
- Status: Granted
- Kind: B2
- Application number: 11/019,853
- Filed: 2004-12-21
- Published: 2005-06-30
- Granted: 2008-12-16
- Earliest claimed: 2003-12-29
- Assignees: Xilinx, Inc.
- Inventors: James M. Simkins; Steven P. Young; Jennifer Wong; Bernard J. New; Alvin Y. Ching
- Web page: https://patentgrep.com/patent/US7467177B2

## CPC

- G06F 7/49963: {Rounding to nearest (G06F7/49957 takes precedence)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Described are mathematical circuits that perform flexible rounding schemes. The circuits require few additional resources and can be adjusted dynamically to change the number of bits involved in the rounding. In one embodiment, a DSP circuit stores a rounding constant selected from the group of binary numbers 2(M−1) and 2(M−1)−1, calculates a correction factor, and sums the rounding constant, the correction factor, and a data item to obtain a rounded data item.

## Claims

### Claim 1

A DSP slice in an array of DSP slices comprising:
a first operand input port for receiving a first signed operand, the first signed operand including a first sign bit;
a second operand input port for receiving a second signed operand, the second signed operand including a second sign bit;
wherein the first signed operand is a value selected from a group consisting of an upstream-output-cascade value from another DSP slice upstream from the DSP slice, a concatenated value of another first signed operand and another second signed operand from the other DSP slice upstream from the DSP slice, a partial product value from the other DSP slice upstream from the DSP slice, a product value from the other DSP slice upstream from the DSP slice, and an output value from the other DSP slice upstream from the DSP slice;
a third operand input port for receiving a rounding constant;
a product generator having:
a multiplier port connected to the first operand input port for receiving the first signed operand;
a multiplicand port connected to the second operand input port for receiving the second signed operand; and
a product port for producing a product of the first and second signed operands;
a correction circuit having:
first and second correction-circuit input terminals connected to the respective first and second operand input ports for receiving the first and second sign bits; and
a correction-circuit output terminal, the correction circuit configured for generating a correction factor from the first and second sign bits for providing the correction factor on the correction-circuit output terminal; and
a adder having a first addend terminal connected to the product port for receiving the product, a second addend terminal connected to the third operand input port for receiving the rounding constant, and a third addend terminal connected to the correction-circuit output terminal for receiving the correction factor;
the adder configured to sum the rounding constant, the correction factor, and the product to obtain a rounded product.

### Claim 2 (depends on 1)

The DSP slice of claim 1, wherein the correction factor is an exclusive NOR of the first sign bit and the second sign bit.

### Claim 3 (depends on 1)

The DSP slice of claim 1, further comprising a register connected to the third operand input port and storing the rounding constant.

### Claim 4 (depends on 1)

The DSP slice of claim 1, wherein the adder further includes a fourth addend terminal.

### Claim 5 (depends on 1)

The DSP slice of claim 1, wherein the rounded product is the product with N least-significant bits of the product removed, and wherein the rounding constant is selected from the group of binary numbers 2(N−1)−1 and 2(N−1).

### Claim 6 (depends on 1)

The DSP slice of claim 1, wherein the DSP slice is configured for rounding the product of a signed multiplier and a signed multiplicand to remove the N least-significant bits of the product, wherein the first signed operand is the signed multiplier, wherein the second signed operand is the signed multiplicand, the DSP slice configured for:
storing the rounding constant selected from the group of binary numbers 2(N−1)and 2(N−1)−1;
calculating the correction factor from a multiplier sign bit of the signed multiplier and a multiplicand sign bit of the signed multiplicand, the multiplier sign bit being the first sign bit and the multiplicand sign bit being the second sign bit;
summing the rounding constant, the correction factor, and the product to obtain the rounded product; and
dropping the N least significant bits of the rounded product.

### Claim 7 (depends on 6)

The DSP slice of claim 6, wherein calculating the correction factor from the multiplier sign bit of the signed multiplier and the multiplicand sign bit of the signed multiplicand comprises multiplying the multiplier and the multiplicand to calculate the product.

### Claim 8 (depends on 6)

The DSP slice of claim 6, wherein the correction factor is an exclusive NOR of the multiplier sign bit and the multiplicand sign bit.

### Claim 9 (depends on 6)

The DSP slice of claim 6, wherein the rounding constant is 2(N−1)−1.

### Claim 10

A circuit comprising:
a first operand port providing a multiplier;
a second operand port providing a multiplicand;
a third operand port providing a rounding constant;
a product generator having a multiplier port connected to the first operand port for receiving the multiplier, a multiplicand port connected to the second operand port for receiving the multiplicand, and a product port, wherein the product generator provides a signed product of the multiplier and the multiplicand on the product port; and
an adder having a first addend port connected to the product port and receiving the product, a second addend port connected to the third operand port for receiving the rounding constant, a carry-in port, and a sum port;
wherein the circuit is a DSP slice;
wherein the multiplier associated with a first signed operand, the first signed operand being a value selected from a group consisting of an upstream-output-cascade value from another DSP slice upstream from the DSP slice, a concatenated value from the other DSP slice, a partial product value from the other DSP slice, a product value from the other DSP slice, and an output value from the other DSP slice; and
wherein the adder is configured to sum the rounding constant, the correction factor, and the product to obtain a rounded product.

### Claim 11 (depends on 10)

The circuit of claim 10, further comprising carry-in logic connected to the carry-in port and generating a carry-in signal.

### Claim 12 (depends on 11)

The circuit of claim 11, wherein the carry-in signal is a function of the sign of the product.

### Claim 13 (depends on 12)

The circuit of claim 12, wherein the carry-in signal is an exclusive-NOR of the sign bit of the multiplier and the sign bit of the multiplicand.

### Claim 14 (depends on 10)

The circuit of claim 10, further comprising a first operand register for storing the first signed operand and a second operand register for storing a second signed operand.

### Claim 15 (depends on 10)

The circuit of claim 10, further comprising an operand register connected to the third operand input port for storing the rounding constant.

### Claim 16 (depends on 15)

The circuit of claim 15, wherein the operand register connects to the third operand port of DSP slices.

### Claim 17 (depends on 10)

The circuit of claim 10, wherein the product is rounded to remove N bits, and wherein the rounding constant is selected from the group of binary numbers consisting of 2(N−1) and 2(N−1)−1.

### Claim 18

A circuit comprising:
a first operand port providing a multiplier;
a second operand port providing a multiplicand;
a third operand port providing a rounding operand;
a product generator having a multiplier port connected to the first operand port for receiving the multiplier, a multiplicand port connected to the second operand port for receiving the multiplicand, and a product port, wherein the product generator provides a product of the multiplier and the multiplicand on the product port;
carry-in logic receiving a carry-in signal, a first sign bit from the multiplier, and a second sign bit from the multiplicand; and
an adder having a first addend port connected to the product port for receiving the product, a second addend port connected to the third operand port for receiving the rounding operand, a carry-in port connected to the carry-in logic, and a sum port;
wherein the circuit is a DSP slice;
wherein the multiplier is a value selected from a group consisting of an upstream-output-cascade value from another DSP slice upstream from the DSP slice, a concatenated value of another multiplier and another multiplicand from the other DSP slice upstream from the DSP slice, a partial product value from the other DSP slice upstream from the DSP slice, a product value from the other DSP slice upstream from the DSP slice, and an output value from the other DSP slice upstream from the DSP slice;
wherein the adder is configured to sum at least the rounding operand and the product to obtain a rounded product.

### Claim 19 (depends on 18)

The circuit of claim 18, wherein the carry-in logic provides a second carry-in signal to the carry-in port of the adder.

### Claim 20 (depends on 18)

The circuit of claim 18, wherein the carry-in logic conveys the first-mentioned carry-in signal as the second carry-in signal.

### Claim 21 (depends on 18)

The circuit of claim 18, wherein the second carry-in signal is a function of the first and second sign bits.

### Claim 22 (depends on 21)

The circuit of claim 21, wherein the rounding operand is a rounding constant.

### Claim 23 (depends on 21)

The circuit of claim 21, wherein the second carry-in signal is one of an exclusive OR or an exclusive NOR of the first and second sign bits.

### Claim 24 (depends on 21)

The circuit of claim 21,wherein the carry-in logic includes synchronous storage elements adapted to synchronize the second carry-in signal.

### Claim 25 (depends on 24)

The circuit of claim 24, wherein the carry-in logic selectively synchronizes the second carry-in signal.

### Claim 26

An array of DSP elements comprising:
a DSP element in the array of DSP elements having:
a first operand input port for receiving a first signed operand, the first signed operand including a first sign bit;
a second operand input port for receiving a second signed operand, the second signed operand including a second sign bit;
wherein the first signed operand is a value selected from a group consisting of an upstream-output-cascade value from another DSP element upstream from the DSP element, a concatenated value of another first signed operand and another second signed operand from the other DSP element upstream from the DSP element, a partial product value from the other DSP element upstream from the DSP element, a product value from the other DSP element upstream from the DSP element, and an output value from the other DSP element upstream from the DSP element;
a third operand input port for receiving a third signed operand from an output of an adjacent DSP element with respect to the DSP element, the third signed operand including a third sign bit;
a fourth operand input port for receiving a fourth signed operand from an output of the DSP element, the fourth signed operand including a fourth sign bit;
a fifth operand input port for receiving a rounding constant;
a correction circuit having:
first, second, third and fourth correction-circuit input terminals for receiving the first, second, third and fourth sign bits; and
a correction-circuit output terminal, the correction circuit for generating a correction factor based on a selection from a group consisting of the first sign bit, a combination of the first and second sign bits, the third sign bit, and the fourth sign bit, and the correction circuit providing the correction factor on the correction-circuit output terminal; and
a adder having a first addend terminal, a second addend terminal connected to the fifth operand input port for receiving the rounding constant, and a third addend terminal connected to the correction-circuit output terminal for receiving the correction factor;
the adder configured to sum the rounding constant, the correction factor, and an input value on the first addend terminal to obtain a rounded value.

### Claim 27 (depends on 26)

The array of DSP elements of claim 26 wherein the value selected from the group is determined responsive to a mode setting of a mode circuit.

### Claim 28

An arithmetic circuit comprising:
a first operand input port for receiving a first signed operand, the first signed operand including a first sign bit;
wherein the first signed operand is a value selected from a group consisting of an upstream-output-cascade value from another arithmetic circuit upstream from the arithmetic circuit, a concatenated value of another first signed operand and a second signed operand of the another arithmetic circuit upstream from the arithmetic circuit, a partial product value from the another arithmetic circuit upstream from the arithmetic circuit, a product value from the another arithmetic circuit upstream from the arithmetic circuit, and an output value from the another arithmetic circuit upstream from the arithmetic circuit; and wherein the value selected from the group is determined responsive to a mode setting of a mode circuit;
a correction circuit having:
an input terminal for receiving the first sign bit; and
a correction-circuit output terminal, the correction circuit for generating a correction factor based on the first sign bit, and the correction circuit providing the correction factor on the correction-circuit output terminal; and
an adder having a first addend terminal for receiving the first signed operand, a second addend terminal for receiving a rounding constant, and a third addend terminal connected to the correction-circuit output terminal for receiving the correction factor;
the adder configured to sum the rounding constant, the correction factor, and the first signed operand to obtain a rounded value.

### Claim 29 (depends on 28)

The arithmetic circuit of claim 28 wherein the third addend terminal is a carry-in terminal, wherein the adder further comprises a fourth addend terminal, and wherein the first addend terminal receives the first signed operand having a first partial product, and the fourth addend terminal receives a second partial product.

### Claim 30 (depends on 29)

The arithmetic circuit of claim 29 wherein the correction circuit generates the correction factor based on a second sign bit of a multiplicand and a third sign bit of a multiplier, the multiplicand and the multiplier multiplied together to produce the first and second partial products.
