# US 2008/0307204 A1 · Fast Static Rotator/Shifter with Non Two's Complemented Decode and Fast Mask Generation

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

- Number: US 2008/0307204 A1
- Document ID: US20080307204A1
- Status: Published application
- Kind: A1
- Application number: 11/760,539
- Filed: 2007-06-08
- Published: 2008-12-11
- Earliest claimed: 2007-06-08
- Assignees: Apple Inc.
- Inventors: Honkai Tam
- Web page: https://patentgrep.com/patent/US20080307204A1

## CPC

- G06F 9/30032: {Movement instructions, e.g. MOVE, SHIFT, ROTATE, SHUFFLE}
- G06F 5/015: {having at least two separately controlled shifting levels, e.g. using shifting matrices (G06F5/012 takes precedence)}
- G06F 5/017: {using recirculating storage elements}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

In one embodiment, a rotator, a mask generator, and circuitry configured to mask the rotated operand output by the rotator with the output mask generated by the mask generator perform a shift operation. Coupled to receive the input operand and the shift count, the rotator is configured to rotate the input operand by the shift count. Coupled to receive the shift count and the shift direction, the mask generator is configured to generate an output mask by decoding a most significant bit (MSB) field of the shift count to generate a first mask, decoding a least significant bit (LSB) field of the shift count to generate a second mask, logically ANDing the bits of the second mask with the corresponding bit of the first mask and logically ORing the result with an adjacent bit of the first mask that is selected responsive to the shift direction. Additionally, in one embodiment, the rotator may be configured to perform a right rotate/shift operation using a left rotate and without performing a two's complement operation on the rotate/shift count.

## Claims

### Claim 1

An apparatus configured to perform a shift operation on an input operand, wherein a size of the shift operation is specified by a shift count and a direction of the shift operation is specified by a shift direction, the apparatus comprising:
a rotator coupled to receive the input operand and the shift count, wherein the rotator is configured to rotate the input operand by the shift count, outputting a rotated operand;
a mask generator coupled to receive the shift count and the shift direction and configured to generate an output mask, wherein the mask generator is configured to decode a most significant bit (MSB) field of the shift count to generate a first mask, and wherein the mask generator is configured to decode a least significant bit (LSB) field of the shift count to generate a second mask, and wherein each bit of the first mask corresponds to a different section of the output mask, and wherein the mask generator is configured to generate each section of the output mask by logically ANDing the bits of the second mask with the corresponding bit of the first mask and logically ORing the result with an adjacent bit of the first mask, wherein the mask generator is configured to select the adjacent bit responsive to the shift direction; and
circuitry configured to mask the rotated operand with the output mask.

### Claim 2 (depends on 1)

The apparatus as recited in claim 1 wherein the mask generator is configured to select the adjacent bit to the left if the shift direction is to the right, and wherein the mask generator is configured to select the adjacent bit to the right if the shift direction is to the left.

### Claim 3 (depends on 2)

The apparatus as recited in claim 2 wherein, for a most significant section of the output mask, the adjacent bit to the left is assumed to be zero.

### Claim 4 (depends on 2)

The apparatus as recited in claim 2 wherein, for a least significant section of the output mask, the adjacent bit to the right is assumed to be zero.

### Claim 5 (depends on 1)

The apparatus as recited in claim 1 wherein the circuitry is configured to override the output mask for a rotate operation, wherein the rotated operand is output as a result.

### Claim 6 (depends on 5)

The apparatus as recited in claim 5 wherein the circuitry is configured to logically OR bits of the output mask with an indication of the rotate operation, whereby the output mask is all ones for the rotate operation.

### Claim 7 (depends on 1)

The apparatus as recited in claim 1 wherein the mask generator is implemented with static logic circuitry.

### Claim 8

A mask generator comprising:
a first decoder coupled to receive a most significant bit (MSB) field of a shift count and a shift direction corresponding to a shift operation, wherein the first decoder is configured to decode the MSB field and the shift direction to generate a first mask, wherein each bit of the first mask corresponds to a different section of an output mask of the mask generator;
a second decoder coupled to receive a least significant bit (LSB) field of the shift count and the shift direction, wherein the second decoder is configured to decode the LSB field and the shift direction to generate a second mask; and
a final mask generator coupled to the first decoder and the second decoder and to receive the shift direction, wherein the final mask generator is configured to generate each section of the output mask by logically ANDing the bits of the second mask with the corresponding bit of the first mask and logically ORing the result with an adjacent bit of the first mask, wherein the final mask generator is configured to select the adjacent bit responsive to the shift direction.

### Claim 9 (depends on 8)

The mask generator as recited in claim 8 wherein the final mask generator is configured to select the adjacent bit to the left if the shift direction is to the right, and wherein the final mask generator is configured to select the adjacent bit to the right if the shift direction is to the left.

### Claim 10 (depends on 9)

The mask generator as recited in claim 9 wherein, for a most significant section of the output mask, the adjacent bit to the left is assumed to be zero.

### Claim 11 (depends on 9)

The mask generator as recited in claim 9 wherein, for a least significant section of the output mask, the adjacent bit to the right is assumed to be zero.

### Claim 12 (depends on 8)

The mask generator as recited in claim 8 wherein the first decoder, the second decoder, and the final mask generator are implemented with static logic circuitry.

### Claim 13

A method comprising:
receiving a shift count and a shift direction of a shift operation;
decoding a most significant bit (MSB) field of the shift count to generate a first mask, wherein each bit of the first mask corresponds to a different section of an output mask;
decoding a least significant bit (LSB) field of the shift count to generate a second mask; and
generating each section of the output mask by logically ANDing the bits of the second mask with the corresponding bit of the first mask and logically ORing the result with an adjacent bit of the first mask, the adjacent bit selected responsive to the shift direction.

### Claim 14 (depends on 13)

The method as recited in claim 13 further comprising:
receiving an input operand of the shift operation;
rotating the input operand by the shift count, forming a rotated operand; and
masking the rotated operand with the output mask.

### Claim 15 (depends on 14)

The method as recited in claim 14 further comprising overriding the output mask for a rotate operation, wherein the rotated operand is output as a result.

### Claim 16 (depends on 15)

The method as recited in claim 15 wherein the overriding comprises logically ORing bits of the output mask with an indication of the rotate operation, whereby the output mask is all ones for the rotate operation.

### Claim 17 (depends on 13)

The method as recited in claim 13 wherein the adjacent bit is to the left if the shift direction is to the right, and wherein the adjacent bit is to the right if the shift direction is to the left.

### Claim 18 (depends on 17)

The method as recited in claim 17 wherein, for a most significant section of the output mask, the adjacent bit to the left is assumed to be zero.

### Claim 19 (depends on 17)

The method as recited in claim 17 wherein, for a least significant section of the output mask, the adjacent bit to the right is assumed to be zero.

### Claim 20

A rotator comprising:
a rotation circuit;
a first decoder configured to decode a plurality of most significant bits of an input count;
a second decoder configured to decode a plurality of least significant bits of an input count;
a first multiplexor coupled to receive an output of the first decoder in a first order for left shift/rotate operations and in a second order for right shift operations;
a first mux select generator circuit configured to generate a first mux select for the first multiplexor responsive to the plurality of least significant bits and a direction of the rotate/shift operation; and
a second multiplexor coupled to receive an output of the second decoder in a third order for left shift/rotate operations and in a fourth order for right shift operations; and
a second mux select generator circuit configured to generate a second mux select for the second multiplexor responsive to the direction of the rotate/shift operation.
