home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / arch / 12131 < prev    next >
Encoding:
Text File  |  1993-01-07  |  3.7 KB  |  96 lines

  1. Newsgroups: comp.arch
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!sdd.hp.com!ux1.cso.uiuc.edu!csrd.uiuc.edu!sp90.csrd.uiuc.edu!grout
  3. From: grout@sp90.csrd.uiuc.edu (John R. Grout)
  4. Subject: Re: How does an R4000-style cache work?
  5. Message-ID: <1993Jan7.201733.16338@csrd.uiuc.edu>
  6. Keywords: Write-back Cache
  7. Sender: news@csrd.uiuc.edu
  8. Reply-To: j-grout@uiuc.edu
  9. Organization: UIUC Center for Supercomputing Research and Development
  10. References: <1993Jan6.235455.25425@Princeton.EDU>
  11. Date: Thu, 7 Jan 93 20:17:33 GMT
  12. Lines: 82
  13.  
  14. awolfe@moo.Princeton.EDU (Andrew Wolfe) writes:
  15.  
  16. >I am unclear on the timing involved when write misses occur on a write-back
  17. >cache (like in the R4000).  Perhaps someone can clarify.
  18.  
  19. >When a write is attempted - a virtual index is used to select a cache line
  20. >and a virtual offset selects bytes within that line.  This happens during
  21. >the DF stage in the R4000.  The memory can then be accessed during the DS
  22. >stage.  I assume that the tag is read at this time.  If a write is allowed
  23. >to occur at this time - it may destroy data in the cache.
  24.  
  25. >The tag is checked at the next stage (TC).  If the tags match - all is OK -
  26. >but if the tags do not match, then I have written over the previous data in
  27. >the cache.  If I delay stores until after the tag check - then the memory is
  28. >busy with another instruction in the pipeline.
  29.  
  30.  
  31. >I can conceive of several possible solutions:
  32.  
  33. >1)  Always save a copy of the overwritten line (for writeback).
  34.  
  35. >2)  Delay the write - then simultaneously read and write the cache.
  36. >    (write from instruction in TC, read from instruction in MS)
  37.  
  38. >3)  Delay the write - then stall the pipeline on a hit or miss if the next 
  39. >    instruction is a load.
  40.  
  41. >The first two require a heavy-duty dual-ported cache.  The third requires
  42. >stalls that I cannot find documented.
  43.  
  44. >What method is really used to solve this problem in the R4000 and similar
  45. >write-back caches?
  46.  
  47. From "The MIPS R4000 Processor", by Mirapuri, Woodacre and Vasseghi, IEEE
  48. Micro, IEEE Micro (April 1992), pp. 10-22.
  49.  
  50. Figure 1 (p. 11) is the "R4000 internal block diagram" which illustrates a
  51.     "write buffer" and a "store buffer/aligner".
  52.  
  53. From the "CPU pipeline" paragraph (pp. 11-12):
  54.  
  55.     "In the data first (DF) and data second (DS) stages, the R4000
  56.     accesses the data cache, with a new access starting every cycle.
  57.     The MMU translates the data virtual address into a physical address
  58.     during these stages.  In the tag check (TC) stage, the R4000 compares
  59.     the data tags from the cache tag array with the translated address to
  60.     determine if the data cache access was a hit.  For stores, if the tag
  61.     check passes in TC, the data travel to the store buffer and enter the
  62.     data cache the next time cache bandwidth is available."
  63.  
  64. From the "Stalls, slips and exceptions" paragraph (pp. 14-17):
  65.  
  66.     "The different stall types include:
  67.  
  68.     Data cache miss, detected by the data tag check
  69.  
  70.     Data first stage stalls, which can occur for
  71.     three mutually exclusive groups of
  72.     instructions...
  73.  
  74.         3) The pipeline stalls to let the store buffer entries retire
  75.            to memory because control logic has detected a load to the
  76.            same memory location."
  77.  
  78. So, the indicated solution is:
  79.  
  80. 4)   Put the data in a write buffer until tag check.
  81.  
  82.      On a cache miss, stall the pipeline and write the data to cache as part
  83.       of miss processing.
  84.  
  85.      On a cache hit, put the data to the store buffer and unload it when:
  86.  
  87.     a) The cache bandwidth is available: no pipeline effects.
  88.     b) A load which wants to use the results of the store is
  89.         detected: stall the pipeline and empty the store buffer.
  90.     c) The store buffer is full: not clear (is this handled like case "b"?)
  91.  
  92. --
  93. John R. Grout                        j-grout@uiuc.edu
  94. University of Illinois, Urbana-Champaign
  95. Center for Supercomputing Research and Development
  96.