home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / arch / 12132 < prev    next >
Encoding:
Internet Message Format  |  1993-01-07  |  3.0 KB

  1. Path: sparky!uunet!spool.mu.edu!olivea!sgigate!sgi!odin!mips!mips.com!woodacre
  2. From: woodacre@sgi.com (Michael Woodacre)
  3. Newsgroups: comp.arch
  4. Subject: Re: How does an R4000-style cache work?
  5. Keywords: Write-back Cache
  6. Message-ID: <1ii4i0INNr3s@spim.mti.sgi.com>
  7. Date: 7 Jan 93 20:41:36 GMT
  8. References: <1993Jan6.235455.25425@Princeton.EDU>
  9. Sender: woodacre@krell.mti.sgi.com (Michael Woodacre)
  10. Followup-To: comp.arch
  11. Organization: mips technolgies
  12. Lines: 63
  13. NNTP-Posting-Host: krell.mti.sgi.com
  14.  
  15. In article <1993Jan6.235455.25425@Princeton.EDU>, awolfe@moo.Princeton.EDU (Andrew Wolfe) writes:
  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. |> 
  32. |> I can conceive of several possible solutions:
  33. |> 
  34. |> 1)  Always save a copy of the overwritten line (for writeback).
  35. |> 
  36. |> 2)  Delay the write - then simultaneously read and write the cache.
  37. |>     (write from instruction in TC, read from instruction in MS)
  38. |> 
  39. |> 3)  Delay the write - then stall the pipeline on a hit or miss if the next 
  40. |>     instruction is a load.
  41. |> 
  42. |> The first two require a heavy-duty dual-ported cache.  The third requires
  43. |> stalls that I cannot find documented.
  44. |> 
  45. |> What method is really used to solve this problem in the R4000 and similar
  46. |> write-back caches?
  47. |> 
  48. |> 
  49. |> -- 
  50. |> --------------------------------------
  51. |> Andrew Wolfe
  52. |> Assistant Professor
  53. |> Department of Electrical Engineering
  54. |> Princeton University
  55.  
  56. The cache is accessed during the df/ds stages to read the tag, but the
  57. write is not done at this time. The data to be stored is placed in a store
  58. buffer and written into the cache at a later stage. The data cache has
  59. seperately indexed data and tag arrays to allow this to work without 
  60. adding additional stalls into the pipeline. Data in the store buffer is
  61. written into the cache when there is spare bandwidth to the cache (when
  62. there is a cycle when we are not accessing the cache for a load).
  63.  
  64. The store buffer obviously has logic to allow the data in it to be bypassed
  65. to any other operations that need the data before it has been retired into
  66. the cache.
  67.  
  68. Hope this helps,
  69.  
  70. Cheers,
  71. Mike
  72.  
  73. -- 
  74.    Michael S. Woodacre | Phone: (415) 390 4175
  75. UUCP: {ames,pyramid,decwrl}!sgi!woodacre OR woodacre@sgi.com
  76. USPS: MIPS Technologies Inc, M/S 10U-178,
  77.       2011 N. Shoreline Blvd, Mountain View, CA 94039
  78.