# US 2010/0169619 A1 · Efficient Encoding for Detecting Load Dependency on Store with Misalignment

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

- Number: US 2010/0169619 A1
- Document ID: US20100169619A1
- Status: Published application
- Kind: A1
- Application number: 12/721,164
- Filed: 2010-03-10
- Published: 2010-07-01
- Earliest claimed: 2007-06-05
- Assignees: Apple Inc.
- Inventors: Tse-yu Yeh; Daniel C. Murray; Po Yung Chang; Anup S. Mehta
- Web page: https://patentgrep.com/patent/US20100169619A1

## CPC

- G06F 12/0607: {Interleaved addressing}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

In one embodiment, an apparatus comprises a queue comprising a plurality of entries and a control unit coupled to the queue. The control unit is configured to allocate a first queue entry to a store memory operation, and is configured to write a first even offset, a first even mask, a first odd offset, and a first odd mask corresponding to the store memory operation to the first entry. A group of contiguous memory locations are logically divided into alternately-addressed even and odd byte ranges. A given store memory operation writes at most one even byte range and one adjacent odd byte range. The first even offset identifies a first even byte range that is potentially written by the store memory operation, and the first odd offset identifies a first odd byte range that is potentially written by the store memory operation. The first even mask identifies bytes within the first even byte range that are written by the store memory operation, and wherein the first odd mask identifies bytes within the first odd byte range that are written by the store memory operation.

## Claims

### Claim 1

An apparatus comprising:
a queue comprising a plurality of entries, wherein each entry is assignable to a respective store memory operation, and wherein each entry is configured to store a first mask, a first offset, a second mask, and a second offset, and wherein a combination of the first mask, the first offset, the second mask, and the second offset identifies which bytes within a group of contiguous bytes in memory are updated by the respective store memory operation, and wherein each entry is further configured to store a first address identifying a first byte of the group of contiguous bytes; and
a control unit coupled to the queue, wherein the control unit is configured to receive an input address, a third mask, a fourth mask, a third offset, and a fourth offset that all correspond to a load memory operation, wherein the control unit is configured to detect that the load memory operation accesses at least one byte updated by the respective store memory operation responsive to a comparison of the first address to the input address and further responsive to the first, second, third and fourth masks and the first, second, third, and fourth offsets, and wherein the control unit is configured to signal a hit of the load memory operation on the store memory operation responsive to detecting that the load memory operation accesses the at least one byte updated by the respective store memory operation.

### Claim 2 (depends on 1)

The apparatus as recited in claim 1, wherein the group of contiguous bytes is divided into a plurality of byte ranges, each byte range comprising more than one byte, and wherein the first offset locates a first byte range of the plurality of byte ranges within the group of contiguous bytes, wherein the first byte range is updated by the respective store memory operation, and wherein the first mask identifies which bytes within the first byte range are updated by the respective store memory operation, and wherein the second offset locates a second byte range of the plurality of byte ranges within the group of contiguous bytes, wherein the second byte range is updated by the respective store memory operation, and wherein the second mask identifies which bytes within the second byte range are updated by the respective store memory operation.

### Claim 3 (depends on 2)

The apparatus as recited in claim 2 wherein the third offset and the fourth offset each identify byte ranges of the plurality of byte ranges that are accessed by the load memory operation, and wherein the third mask and the fourth mask identify the bytes accessed by the load memory operation in the identified byte ranges.

### Claim 4 (depends on 3)

The apparatus as recited in claim 3 wherein the control unit is configured to: bitwise logically AND the first mask with the third mask, to bitwise logically AND the second mask and the fourth mask, to compare the first offset to the third offset, and to compare the second offset to the fourth offset; and wherein the control unit is configured to detect that the load memory operation accesses at least one byte updated by the respective store memory operation responsive to the input address matching the first address and at least one of: (i) the first offset matching the third offset and the logical AND of the first mask and the third mask having at least one set bit; or (ii) the second offset matching the fourth offset and the logical AND of the second mask and the fourth mask having at least one set bit.

### Claim 5 (depends on 2)

The apparatus as recited in claim 2 wherein the number of bytes in each byte range of the plurality of byte ranges is greater than or equal to a maximum store size of a misaligned store memory operation.

### Claim 6 (depends on 1)

The apparatus as recited in claim 1 wherein the control unit is configured to detect that the respective store memory operation updates all bytes accessed by the load memory operation, and wherein the control unit is configured to cause the store data corresponding to the respective store memory operation to be forwarded in response to the load memory operation.

### Claim 7 (depends on 6)

The apparatus as recited in claim 6 wherein the control unit is configured to detect that all bytes accessed by the load memory operation responsive to inverting the third mask and the fourth mask, bitwise logically ORing the inverted third mask with the first mask, bitwise logically ORing the inverted fourth mask with the second mask, and detecting that a result of the bitwise logical ORing operations are both all ones.

### Claim 8 (depends on 1)

The apparatus as recited in claim 1 wherein the group of contiguous bytes is a cache block.

### Claim 9

A processor comprising:
a data cache configured to store data in units of cache blocks; and
a load/store unit coupled to the data cache and comprising a store queue, wherein the load/store unit is configured to allocate a first entry in the store queue to a store memory operation, wherein the load/store unit is configured to write the first entry with a first block address, a plurality of offsets, and a plurality of masks corresponding to the store memory operation, wherein the first block address identifies a first cache block in memory, and wherein the store memory operation updates one or more bytes in the first cache block;
wherein a cache block comprises a plurality of byte ranges, and wherein each of the plurality of offsets identifies a byte range of the plurality of byte ranges in the first cache block that is updated by the store memory operation, and wherein a corresponding one of the plurality of masks identifies which bytes in the identified byte range are updated by the store memory operation; and
wherein the load/store unit is configured to detect whether or not a load memory operation reads at least one byte updated by the store memory operation responsive to the first block address, the plurality of offsets, the plurality of masks, a second block address corresponding to the load memory operation, a second plurality of offsets corresponding to the load memory operation, and a second plurality of masks corresponding to the load memory operation.

### Claim 10 (depends on 9)

The processor as recited in claim 9 wherein the load/store unit is configured to detect that the load memory operation reads the at least one byte responsive to detecting that the first block address and the second block address are equal, detecting that at least one of the plurality of offsets is equal to a corresponding one of the second plurality of offsets, and bitwise combining the plurality of masks with corresponding ones of the second plurality of masks.

### Claim 11 (depends on 10)

The processor as recited in claim 10 wherein, the load/store unit is further configured to determine that the store memory operation writes each byte read by the load memory operation, responsive to a second bitwise combining of the plurality of masks with corresponding ones of the second plurality of masks, and wherein the load/store unit is configured to forward store data for the load memory operation responsive to determining that the store memory operation writes each byte read by the load memory operation.

### Claim 12 (depends on 11)

The processor as recited in claim 11 further comprising a scheduler coupled to the load/store unit, and wherein, responsive to the load/store unit determining that the store memory operation writes at least one byte read by the load memory operation but not each byte read by the load memory operation, the load/store unit is configured to signal a replay of the load memory operation to the scheduler.

### Claim 13 (depends on 9)

The processor as recited in claim 9 further comprising an address generation unit coupled to the load/store unit and configured to generate the first block address and the second block address.

### Claim 14 (depends on 13)

The processor as recited in claim 13 wherein the address generation unit is further configured to generate the plurality of masks, the plurality of offsets, the second plurality of masks and the second plurality of offsets.

### Claim 15 (depends on 9)

The processor as recited in claim 9 wherein each of the plurality of byte ranges identified by the plurality of offsets are adjacent.

### Claim 16

A method comprising:
writing a first address, a first even offset, a first even mask, a first odd offset, and a first odd mask corresponding to a store memory operation to a first entry in a queue, wherein a cache block is logically divided into alternately-addressed even and odd byte ranges, wherein a number of bytes in each byte range is an integer greater than one, and wherein a given store memory operation writes at most one even byte range and one adjacent odd byte range; and wherein the first even offset identifies a first even byte range in the cache block that is potentially written by the store memory operation and the first odd offset identifies a first odd byte range in the cache block that is potentially written by the store memory operation; and wherein the first even mask identifies bytes within the first even byte range that are written by the store memory operation, and wherein the first odd mask identifies bytes within the first odd byte range that are written by the store memory operation;
receiving an input address, an input even offset, an input even mask, an input odd offset, and an input odd mask that each correspond to a load memory operation;
determining that the store memory operation writes at least one byte read by the load memory operation responsive, at least in part, to the first address equaling the input address and at least one of: (i) the first even offset equaling the first odd offset and the first even mask overlapping the input even mask; or (ii) the first odd offset equaling the input odd offset and the first odd mask overlapping the input odd mask.

### Claim 17 (depends on 16)

The method as recited in claim 16 wherein further comprising:
determining that the store memory operation writes each byte read by the load memory operation, wherein determining that the store memory operation writes each byte is responsive, at least in part, to the first even offset, the first even mask, the first odd offset, the first odd mask, the input even offset, the input even mask, the input odd offset, and the input odd mask; and
causing store data to be forwarded for the load memory operation responsive to determine that the store memory operation writes each byte read by the load memory operation.

### Claim 18 (depends on 16)

The method as recited in claim 16 wherein the first even mask overlaps the input even offset if at least one byte identified by the first even offset is also identified in the input even mask.

### Claim 19 (depends on 18)

The method as recited in claim 18 further comprising:
bitwise logical ANDing the first even mask with the input even mask; and
detecting at least one set bit in a result of the bitwise logical ANDing to detect that that first even mask overlaps with the input even mask.

### Claim 20 (depends on 16)

The method as recited in claim 16 wherein further comprising:
determining that the store memory operation writes at least one byte read by the load memory operation but not each byte read by the load memory operation; and
replaying the load memory operation responsive to the determining.
