EP0671684A2

Pre-fetch mechanism and method for computer systems.

Abstract

A heuristic prefetch mechanism is provided that fetches code without solicitation by the execution unit. The heuristic prefetch mechanism is configured to normally prefetch sequential code and, if a particular line of requested code is out of sequence with respect to an immediately preceeding line of requested code, is configured to "remember" and store the address of the previous instruction along with the out-of-sequence address of the subsequently requested code. If the execution unit later issues another request for the previous instruction, the heuristic prefetch mechanism uses the out-of-sequence address for prefetching the next line of code. The heuristic prefetch mechanism includes a non-sequential monitor for determining whether code fetches are sequential, and an SRAM tag unit for storing a portion of the previous address along with the out-of-sequence subsequent address. During each instruction fetch of the execution unit, a comparison operation is made to determine whether a non-sequential history of that particular instruction has been stored within the SRAM tag unit. If the SRAM memory tag unit stores a non-sequential address corresponding to the particular instruction, the non-sequential address is loaded into a prefetch address latch. If the SRAM tag unit contains no corresponding entry, the address of the next sequential line is stored within the prefetch address latch. A memory fetch state machine subsequently prefetches the line corresponding to the address within the prefetch address latch, and stores the line within a prefetch code buffer. During each instruction fetch by the CPU core, the memory fetch state machine determines whether the requested instruction resides within the prefetch code buffer and, if present, provides the code directly from the prefetch code buffer.

EP0671684A2, drawing sheet 1
Sheet 1 of 4

Term

Term ended

Projected expiry passed 3 February 2015, 11.6 years ago.

  1. Priority
  2. Filed
  3. Published
  4. Projected expiry
  5. Today

20 claims: 2 independent, 18 dependent

  1. 1
    A prefetch unit for a computer system capable of prefetching instruction code from a system memory comprising:a prefetch code buffer capable of storing prefetched code;a prefetch address latch for storing an address value of code to be prefetched;a memory fetch state machine capable of fetching from said system memory code corresponding to said address value within said prefetch code address latch and capable of providing said code to said prefetch code buffer;a non-sequential monitor capable of detecting whether an address of non-sequential code is non-sequential with respect to an address of a previous code;a memory tag unit capable of storing the address of said non-sequential code in response to said non-sequential monitor;and a comparator unit coupled to said memory tag unit and capable of determining whether an address of new code corresponds to an entry within said memory tag unit, wherein the address of said non-sequential code is provided to said prefetch address latch.
  2. 2
    The prefetch unit as recited in Claim 1 wherein said non-sequential code is provided to said prefetch address latch if said comparator unit indicates that said address of said new code corresponds to said entry within said memory tag unit.
  3. 3
    The prefetch unit as recited in Claim 1 wherein said memory tag unit stores the address of said non-sequential code in response to a write signal asserted by said non-sequential monitor.
  4. 4
    The prefetch unit as recited in Claim 3 wherein said non-sequential monitor asserts said write signal if said address of said non-sequential code is non-sequential with respect to said address of said previous code.
  5. 5
    The prefetch unit as recited in Claim 1 wherein at least a portion of said address of said new code is provided to an address input of said memory tag unit.
  6. 6
    The prefetch unit as recited in Claim 1 wherein said memory tag unit is a random access memory.
  7. 7
    The prefetch unit as recited in Claim 1 wherein said memory tag unit is further capable of storing at least a portion of said address of said previous code that corresponds to the address of said non-sequential code.
  8. 8
    The prefetch unit as recited in Claim 7 wherein said comparator unit compares said at least a portion of said address of said previous code with the address of said new code.
  9. 9
    The prefetch unit as recited in Claim 1 further comprising a sequential line adder for providing a sequential line address value to said prefetch address latch.
  10. 10
    The prefetch unit as recited in Claim 9 wherein said sequential line address value is provided to said prefect address latch if said non-sequential monitor determines that an address of sequential code is sequential with respect to an address of said previous code.
  11. 11
    The prefetch unit as recited in Claim 1 further comprising a previous address latch coupled to said non-sequential monitor for storing said address of said previous code.
  12. 12
    The prefetch unit as recited in Claim 1 wherein said prefetch code buffer is capable of storing a line of several words of prefetched code.
  13. 13
    The prefetch unit as recited in Claim 1 wherein said prefetch code buffer is capable of storing a plurality of lines of prefetched code.
  14. 14
    The prefetch unit as recited in Claim 11 further comprising a multiplexer for selectively providing either said address of sequential code to said prefetch address latch or said address of said non-sequential code to said prefetch address latch.
  15. 15
    A method for prefetching instruction code from a system memory comprising the steps of:determining whether an address of a particular code request by a CPU core is non-sequential with respect to an address of a previous code request;storing the address of said particular code if non-sequential with respect to the address of said previous code request;determining whether an address of a subsequent code request corresponds to said previous code request;and prefetching said particular code from said system memory.
  16. 16
    The method for prefetching instruction code from a system memory as recited in Claim 15 wherein said step of prefetching said address of said particular code from said system memory is performed if said address of said subsequent code request corresponds to said address of said previous code request.
  17. 17
    The method for prefetching instruction code from a system memory as recited in Claim 16 comprising the further step of prefetching an address of sequential code if said address of said subsequent code request does not correspond to said address of said previous code request.
  18. 18
    The method for prefetching instruction code from a system memory as recited in Claim 15 wherein said step of prefetching said address of said particular code from said system memory includes prefetching an entire line comprising said address of said particular code.
  19. 19
    The method for prefetching instruction code from a system memory as recited in Claim 15 further comprising the step of storing said particular code within a prefetch code buffer.
  20. 20
    The method for prefetching instruction code from a system memory as recited in Claim 15 comprising the further step of storing said address of said previous code request.
Independent claims20