Technical Field
This invention relates to the field of computer systems, and in particular to devices and techniques for facilitating communication among a central processor unit, cache memory, main memory, and various other bus masters, while maintaining cache coherency with substantially decreased bus traffic.
Background and Summary
A major goal in the design of computer systems is the development of architectures that optimize the flow of data and instructions between the forms of memory devices, coprocessors, input/output (I/O) devices and the central processor unit(s) (CPU). Buses provide the communication links among these devices, and the number of buses and their interconnections are a key factor in determining the performance of a computer system. Generally speaking, the interconnections between buses and the positioning of devices on buses should allow concurrent operations, where for example data transfers between the CPU and its cache memory proceed simultaneously with data transfers between main memory and I/O devices.
The use of cache memory, however, imposes additional bookkeeping requirements on a computer system in order to maintain coherence between the data stored in cache and main memories. This bookkeeping is reflected in increased bus traffic, as main memory addresses are broadcast to cache memories on other buses. Consequently, system architectures must balance the faster memory access provided by multiple memory devices against the additional bus operations necessary to maintain the coherence of data in these memory devices. Bus operations for maintaining data coherence have priority, forcing other bus operations to be held off and thus reducing the degree of concurrent bus operation.
FIG. 1A illustrates a conventional computer system 130 including memory 112 with cache controller 113, main memory 114. In this architecture, CPU 110 is connected to CPU bus 120 in parallel with cache memory 112, and CPU bus 120 is extended so that main memory 114 and I/O devices 116 are also coupled to CPU bus 120. A local bus 126 supporting additional devices 128 such as additional I/O devices is also shown in FIG. 1A. Local bus 126 is coupled to CPU bus 120 through bus interface 117. The look-aside architecture of FIG. 1A does not allow transfers between CPU 110 and cache memory 112 to proceed concurrently with transfers between main memory 114 and I/O devices 116, since both transfers require access to CPU bus 120. In addition, cache memory 112 must be capable of monitoring (snooping) all activity on CPU bus 120 for write and read requests to main memory 114 by I/O devices 116 and additional devices 128. Otherwise data written to main memory 114 by I/O devices 116 and additional devices 128 may invalidate data in cache memory 112. Alternatively, I/O devices 116 and additional devices 128 may request data from main memory 114 that has not been updated from cache memory 112.
FIG. 1B illustrates a conventional computer system 140 including a CPU 110, a cache memory 112 with cache controller 113, a main memory unit 114, and devices 116 arrayed in a look-through or serial cache read architecture. In this architecture, CPU 110 is coupled to cache memory 112 by CPU bus 120, and cache memory 112, main memory 114, and devices 116 are coupled by means of a separate, local bus 118. Look-through architecture allows transfers between CPU 110 and cache memory 112 to proceed concurrently with transfers between devices 116 and main memory 114, since a separate CPU bus 120 and local bus 118 is available for each transfer. However, in this architecture data transfers between CPU 110 and main memory 114 must traverse both CPU bus 120 and local bus 118, and, as in look-aside architecture, such transfers are limited by traffic on local bus 118.
The look-through architecture of FIG. 1B has other limitations as well. For example, CPU 110 initiates a bus cycle to main memory 114 only after cache memory 112 has been searched, so that whenever the data sought by CPU 110 is not in cache memory 112 (cache miss),there is a delay in retrieving the data from main memory 114. In addition, cache memory 112 must be dual ported to interface with both local bus 118 and CPU bus 120, adding additional cost and complexity to the system.
In the architecture of FIGS. 1A and 1B, cache memory 112 automatically snoops all activity on CPU bus 120 and snoops all activity on local bus 118, respectively, regardless of how recently the asserted address has been snooped. Since bus snooping requires the attention of cache controller 113, snooping can interfere with data transfers between CPU 110 and cache memory 112 and further degrade operation of computer systems 130, and 140.
An embodiment of the present invention is illustrated by computer system 200 of FIG. 2. As shown, computer system 200 includes at least one CPU 210, a system controller 260, a cache memory 212, a CPU bus 220, a main memory 214, a local bus 218, and at least one I/O device 216. An optional bus 219 coupled to local bus 218 through a transceiver 270 is also shown in FIG. 2. Bus 219 may be used, for example to couple a peripheral device 240 to computer system 200. System controller 260 enhances concurrent operations by decoupling the CPU bus 220 and local bus 218, and providing a substantially independent path to main memory 214 for each of buses 218, 219, 220.
System controller 260 may also eliminate redundant snoop cycles to CPU bus 220. For this purpose, snoop-tag registers 362 (FIG. 3) is included in system controller 260 for storing address tags 342 and status tags 344 of recently snooped addresses in main memory 214. Snoop-tag registers 362 allow system controller 260 to access the necessary information on recently snooped addresses without asserting snoop cycles on CPU bus 220. The consequent reduction in traffic on CPU bus 220 enhances the performance of the computer system 200.
These and other features and advantages of the invention will become apparent to those skilled in the art from the following detailed description in conjunction with the accompanying drawings.
Brief Description of the Drawings
FIGS. 1A, 1B are block diagrams of conventional computer systems that implement parallel and serial cache read architectures, respectively.
FIG. 2 is a block diagram of a computer system in accordance with the present invention.
FIG. 3 is a block diagram of the system controller of FIG. 2.
FIGS. 4A-4F are diagrams of sets of signals that couple the system controller to the other components of the computer system of FIG. 2.
FIGS. 5A, 5B are diagrams of state machines for implementing bus crossing operations in the computer system of FIG. 2.
FIG. 6 is a diagram of a state machine implemented by the bus arbitration controller of a system controller in accordance with the present invention.
FIG. 7 is a timing diagram for a write operation from the CPU to a bus master on the expansion bus.
FIGS. 8A, 8B are diagrams of transceivers for coupling the local and expansion buses.
FIG. 9 is a diagram of a state machine implemented by the memory arbitration unit of a system controller in accordance with the present invention.
Detailed Description
Referring to FIG. 2, there is shown an embodiment of a computer system 200 of the present invention including a CPU 210 that is coupled to a system controller 260 through a CPU bus 220, a main memory 214 that is coupled to system controller 260 through a dedicated memory bus 262, and a local bus 218 for coupling an I/O device 216 to system controller 260. I/O device 216 may be, for example, a graphics card, a network card, or a disk controller. CPU 210 is coupled to a cache memory 212 through a dedicated cache bus 264 and to an optional coprocessor through a dedicated bus 266. Coprocessor 266 may be included to handle specialized functions such as floating point mathematics or graphics functions.
System controller 260 also supports an expansion bus 219 which is coupled to local bus 218 through a transceiver 270. Expansion bus 219 provides a path between a peripheral or I/O device 240 and local bus 218 for transfers between device 240 and device 216 and for transfers between device 240 and CPU 210 or main memory 214 through system controller 260. Expansion bus 219 may also operate in conjunction with a peripheral controller 230 to provide a path for direct memory transfers (DMA) between device 240 and main memory 214 or between device 240 and a local memory 272 on local bus 218. For this purpose, address bus 217 of local bus 218 is connected to peripheral controller. Control lines and 234 couple control signals between system controller 260 and expansion bus 219 and between system controller 260 and peripheral controller 230, respectively. Expansion bus 219 also operates in conjunction with peripheral controller 230 to couple peripheral or I/O devices 242, 244 to system controller 260.
In one embodiment, I/O device 242 is a keyboard controller and device 240 is an EPROM.
In a preferred embodiment of computer systems 200 system controller 260 is a NxVL.TM. system controller of NexGen, Inc., and CPU 210 and CPU bus 220 are a processor and bus, respectively, suitable for implementing industry standard x86 architecture, such as the Nx586.TM. processor chip and 64-bit Nexbus of NexGen, Inc. In this embodiment, local bus 218 may be a 32-bit bus such as the VL-Bus.TM. and expansion bus 219 may be a 16-bit bus such as the ISA bus. Accordingly, U.S. Pat. Nos. 5,093,778, 5,226,126, 5,226,130, and 5,230 which relate to the Nx586 microprocessor, the Nx586 Microprocessor and Nx587 Numerics Processor Databook, the NxVL System Controller Databook, and references cited therein are hereby incorporated by reference.
The configuration of computer system 200 indicated in FIG. 2 allows system controller 260 to function as a controller for main memory 214, an arbiter for CPU bus 220, and an interface between CPU bus 220 and local and expansion buses 218, 219. Further, system controller 260 can arbitrate access by bus masters on any of buses 220, 218, 219 to bus slaves on any other buses 220, 218, 219 and mediate operation of peripheral controller 230.
Referring now to FIG. 3, there is shown a block diagram of system controller 260. CPU bus 220 and local bus 218 are coupled to system controller 260 through first and second bus interfaces 310, 312, respectively. Dedicated memory bus 262 for main memory 214 is coupled to system controller 260 through a memory controller 350. Expansion bus 219 and peripheral controller 230 are coupled to system controller 260 through a bus controller 316 and a peripheral interface 318, respectively.
Bus interface 310 is coupled to memory controller 350 through a write buffer 330 and a read buffer 332 to couple bus signals between CPU bus 220 and memory controller 350. Bus interface 312 is coupled to memory controller 350 through write buffer 330 and read buffer 334 for coupling bus signals between local bus 218 and memory controller 350. Bus interface 312 is also coupled to memory controller 350 through read buffer 336 for coupling bus signals between expansion bus 219 and memory controller 350. An interbus interface 314 provides a direct path between bus interfaces 310 and 312 for bus crossing operations between CPU bus 220 and local and expansion buses 218, 219.
Memory controller 350 provides signals to memory bus 262 responsive read and write requests operations initiated by bus masters on buses 220, 218, 219. For this purpose, memory controller 350 includes a memory map 352 for mapping the addresses of main memory 214 assigned to system controller 260 to DRAM chip rows, storage uses, and functions.
A memory arbitration unit 370 operates in conjunction with memory controller 350 and a snoop controller 360 to regulate access to main memory 214 by write buffer 330 and read buffers 332, 334, 336. Snoop controller 360 also governs the snooping operations necessary to maintain data coherence among the data signals in main memory 214, cache memory 212, write buffer 330, and read buffers 332, 334, 336. A bus arbitration unit 340 is coupled to bus interfaces 310, 312, bus controller 316, and peripheral interface 318 regulate control of buses 218, 219, 220. The operations of bus arbitration unit 340, memory arbitration unit 370, memory controller 350, and snoop controller 360 are discussed in further detail below.
The functions of system controller 260 fall roughly into three categories: coupling bus signals among bus masters on buses 218, 219, 220; operating in conjunction with main memory 214 to emulate a multi-ported memory; and maintaining the coherence of data in cache memory 212, main memory 214, write buffer 330, and read buffers 332, 334, 336.
Bus interfaces 310 and 312, bus controller 316, memory controller 350, and peripherals controller 318 support bus signals appropriate for CPU bus 220, local bus 218, expansion bus 219, memory bus 262, and peripheral controller 230, respectively. This allows system controller 260 to effectively and efficiently couple communication signals among bus masters on CPU bus 220, local and expansion buses 218, 219 and between these bus masters and main memory 214, local memory 272, and peripheral devices 242, 244.
Referring now to FIG. 4A, there are shown bus signals 400 supported by bus interface 310 in the preferred embodiment of system controller 260. Bus signals 400 include arbitration signals 402, cycle control signals 404, cache control signals 406, transceiver control signals 408, and address/data signals 410 for CPU bus 220. Bus signals 400 are listed in Table 1 of the Appendix along with a brief description of their functions.
Referring now to FIG. 4B, there are shown bus signals 420 supported by bus interface 312 in the preferred embodiment of system controller 260. Bus signals 420 include arbitration signals 422, cycle control signals 424, address signals 426, and data signals 428 for local bus 218. In addition, a subset of address signals 426 and data signals 428 are used for communication with expansion bus 219. Bus signals 420 are listed in Table 2 of the Appendix along with brief descriptions of their functions.
Referring now to FIG. 4C, there are shown bus signals 440 supported by bus controller 316 in the preferred embodiment of system controller 260. Bus signals 440 include cycle control signals 442, transceiver control signals 444, address signals 446, refresh signal 448, and clock signal 450 for controlling expansion bus 219. Bus signals 440 are listed in Table 3 of the Appendix along with brief descriptions of their functions.
Referring now to FIG. 4D, there are shown bus signals 460 supported by memory controller 350 in the preferred embodiment of system controller 260. Bus signals 460 include cycle control signals 462, address signals 464, row/column strobe signals 466, data signals 468, and parity signals 470 for memory bus 262. Bus signals 460 are listed in Table 4 of the Appendix along with brief descriptions of their functions.
Referring now to FIG. 4E, there are shown control signals 480 supported by peripheral interface 318 in the preferred embodiment of system controller 260. Control signals 480 include cycle control signal 482, counter control signals 484, DMA control signals 486 and interrupt acknowledge signals 488 for peripheral controller 230. Control signals 480 are listed in Table 5 of the Appendix along with brief descriptions of their functions.
In addition to coupling bus signals 400, 420 between main memory 214 and bus masters on CPU bus 220 and local bus 218, respectively, system controller 260 also supports bus crossing operations. In bus crossing operations, system controller 260 acts as a bus interface for CPU 210, coupling bus signals 400, 420 between CPU bus 220 and local bus 218 using interbus-interface 314. Interbus interface 314 couples address/data signals 410 to address signals 426 and data signals 428 on local bus 218. In the preferred embodiment, multiplexing between 64-bit signals of processor bus 220 and 32-bit signals of local bus 218 is handled by bus interface 310 using standard techniques.
Referring now to FIG. 5A, there are shown state machines 510, 520 implemented by bus interfaces 310, 312 for handling bus crossing transfers initiated by CPU 210 via interebus interface 214. Referring now to FIG. 5B, there are shown state machines 530, 540 implemented by bus interface 312 and snoop controller 362 through bus interface 310 for handling bus crossing transfers initiated by a bus master on local bus 218. Interbus interface 314 also includes signal lines 502 for coupling state machines 510, 520. State machines 510, 520, 530, 540 are discussed below in conjunction bus crossing operations.
System controller 260 also supports bus-crossing operations between local and expansion buses 218, 219, respectively, using bus controller 316 to control transceivers 270 and expansion bus 219. Where bus-crossing operations on expansion bus 219 involve devices 242, 244, system controller 260 handles these operations using bus controller 216 operating in conjunction with peripheral interface 218 and peripheral controller 230.
Bus operations are initiated when CPU 210, device 216 assert arbitration signals 402 (NREQ*, AREQ*) and 422 (LREQ<2:0>), respectively, to gain control of buses 218, 219, 220, for bus operations. A bus master on expansion bus 219 such as device 240 initiates a DMA cycle by asserting a signal (DRQ) directly to peripheral controller 230 which in turn asserts control signal 480 (HHOLD) to gain control of buses 220, 218, 219. Device 240 may also assert refresh signal 448 (REFRESH*) to gain control of buses 220, 218, 219 to refresh memory on expansion bus 219. System controller 260 grants control of buses 218, 219, 220 to one of the requesting devices, i.e. the bus master, according to a priority scheme implemented by bus arbitration unit 340. For this purpose, bus arbitration unit 340 is coupled to bus interfaces 310 and 312, bus controller 316, and peripheral interface 318, to regulate which bus request signal is acknowledged in accordance with the priority scheme.
Referring now to FIG. 6, there is shown a state machine 610 for implementing this priority scheme in the preferred embodiment of computer system 200, according to arbitration control signals 402, 422 and control signals 482. State machine 610 grants control of buses 218, 219, 220 to CPU 210 when no other device requests access (612), when computer system 200 is reset (614), or when the contents of cache memory 212 must be written back to main memory 214 to maintain coherence of the stored data (616). Alternative bus arbitration schemes which are well known in the art may also be used.
In general, when an address is asserted by a bus master on any of buses 220, 218, 219, system controller 260 compares the address with memory map 252 in memory controller 250. If the address is outside main memory 214 (FIG. 5A, step 504), system controller 260 converts the bus cycle to a bus cycle on local bus 218 (FIG. 5A, 502) using interface 512 (FIG. 5A, step 506) interbus interface 314, bus controller 316 and peripheral interface 318 as appropriate. If no response is received from a device on local bus 218 within a preselected time, the bus cycle is converted to a bus cycle on expansion bus 219 (step 508 of FIG. 5A). If the address is asserted by a bus master on local bus 218, the bus cycle is forwarded to expansion bus 219 if no response is received by a device on local bus 218 within a preselected time.
Operation of system controller 260 is illustrated by a write operation from CPU 210 to a bus slave on expansion bus 219, device 240. CPU 210 begins by asserting arbitration signal 402 (NREQ*) on CPU bus 220. System controller 260 responds with arbitration signal 402 (GNT*) on CPU bus 220 when control of buses 220, 218, 219 is granted to CPU 210 by bus arbitration unit 340, at which point CPU 210 initiates a write bus cycle on CPU bus 220.
Referring now to FIG. 7, there is shown a timing diagram for a 16-bit write to a (16-bit) device 240 on expansion bus 219 by CPU 210. CPU 210 asserts the address of device 240 using address/data signals 410 (NxAD<63:0>) and cycle control signal 404 (ALE*) of CPU bus 220. Since the address is outside the address space of main memory 214, system controller 260 triggers interbus interface 314 to convert the bus signals on CPU bus 220 to a bus cycle on local bus 218. When no device on local bus 218 responds by asserting arbitration signal 422 (LDEV<n>*) within a selected time, system controller 260 assumes the write is to expansion bus 219. System controller 260 asserts arbitration signal 402 (GXACK) to CPU 210 to indicate slave device 240 is available, and CPU 210 responds by asserting data on address/data signals 410 (NxAD<63:0>). At this point, CPU 210 and CPU bus 220 are effectively decoupled from system controller 260.
System controller 260 proceeds with the write operation by triggering transceivers 270 to convert address signal 426 (LBADR<31:2>) on local bus 218 to address signal 426' (LA<23:17>, SA<19:2>) on expansion bus 219 using bus controller 216. System controller 260 also asserts cycle control signal 442 (SBHE*) to indicate valid data is available on expansion bus 219. Bus device 240 responds with cycle control signal 442 (MEMCS16*) to indicate its data width is 16 bits. System controller 260 then triggers transceivers 270 to convert data signal 428 (LBDATA<31:0>on local bus 218 to data signal 428' (SD<15:0>) on expansion bus 219. Cycle control signals 442 (BALE, MEMW *) are asserted by system controller 260 to validate data on expansion bus 219. Device 240 asserts cycle control signal 442 (IOCHRDY) to system controller 260 to indicate that the write cycle is finished.
Referring now to FIG. 8A, there is shown a schematic diagram of transceivers 270 for coupling local and expansion buses 218, 219 in the preferred embodiment of computer system 200. Transceiver 270 includes data transceivers 800d to translate between data signals 428 (LBDATA<31:0>) of local bus 218 and data signals 428' (SD<15:0>) of expansion bus 219 in response to transceiver control signals 444 (SDOE0*, SDOE 1*:, SDOE2*, SDOE3*, SDIR 1 *, SDOE01*, SDIR2*). FIG. 8B shows a schematic diagram of address transceivers 800a for translating between address signals 426 (LBADR<23:2>) of local bus 218 and address signals 426' (SA<19:2>, LA<23: 17>) of expansion bus 219 in response to transceiver control signal 444 (VLASADIR*).
The second major function of system controller 260 is to allow emulate a m 214 to emulate a multi-ported memory. This minimizes read and write latencies and facilitates operation of CPU bus 220 and local and expansion buses 218, 219. Referring again to FIG. 3, system controller 260 includes write buffer 330 between bus interfaces 310, 312 and memory controller 350, for buffering all write operations to main memory 214 by bus masters on buses 220, 218, 219. Bus interface 310 is coupled to memory controller 350 through read buffer 332, which buffers read operations between CPU 210 and main memory 214. Similarly, bus interface 312 is coupled to memory controller 350 through read buffers 334, 336, which buffer read operations between main memory 214 and bus masters on local and expansion buses 218, 219, respectively.
Write buffer 330 operates as a first in first out (FIFO) write queue to which data from a bus master may transferred pending a write operation data to main memory 214. In a preferred embodiment of the present invention, write buffer 330 is a 64 byte FIFO queue organized as eight qword (8-byte words) data blocks 331. Each data block 331 has an associated address tag 332, status tag (qword-enable bits) 344, and decoded row-select bits 346 to facilitate snooping and transfers to main memory 214 as discussed in detail below.
Referring now to FIG. 4F, there are shown FIFO signal lines 494 supported by write buffer 330. FIFOEMPTY 495 is coupled to memory controller 350 to indicate when write buffer 330 is empty and no more data is to be written to main memory 214. FIFO4MTY 496 and FIFO2MTY 497 are coupled to processor bus 210 and local bus 218, respectively, to indicate that write buffer 330 can accept at least 4 and 2q words writes. FIFOFULL 498 (FIFOFULL) is coupled to processor, local and expansion buses 220, 218, 219, respectively, to indicate when write buffer 230 is full. In this case, data writes are blocked at bus interface 310 or 312 until write buffer 330 is emptied.
In the preferred embodiment, write buffer 330 accepts single qword writes and four-qword (burst) writes from CPU 210. System controller 260 supports data writes to write buffer 330 at a rate of one clock cycle per qword, in contrast to data writes from write buffer 330 to main memory 14 which occur at a rate of two or three clock cycles per qword. Write buffer 330 accepts single dword writes and 16 byte block (burst) writes from bus masters on local bus 218 and single byte writes or word writes from bus masters on expansion bus 219.
Read buffers 332, 334, 336 implement a replacement policy (prefetch) that allows them to function as small caches for bus masters on CPU bus 210, local bus 218, and expansion bus 219, respectively. In order to maintain the coherence of cached data, read buffers 332, 334, 336 also snoop all write operations, as discussed in the following section.
In the preferred embodiment, read buffer 332 stores two 32 byte prefetch blocks 335 of data. Read operations initiated by CPU 210 reach read buffer 332 following a cache miss in cache memory 212, in which case a read hit in read buffer 332 obviates the need to search main memory 214. When the second 32 byte block is read by CPU 210, system controller 260 triggers read buffer 332 to read two new 32 byte blocks of data from main memory 214. A read miss in read buffer 332 triggers read buffer 332 to fetch two new 32 byte blocks 335 of data from main memory 214. The first of 32-byte blocks 335 is used to satisfy the read operation and the second of 32-byte blocks 335 serves as a prefetch for subsequent read requests from CPU 210. As with write buffer 330, each data qword in read buffer 332 has an associated address tag 342, qword-valid bits 344, and decoded row-select bits 346 to facilitate snooping by snoop controller 360.
In the preferred embodiment, read buffer 334 stores two 16-byte data blocks 337 and prefetches two new 16 byte data blocks 337 in response to a read miss in read buffer 334 by a bus master on local bus 218. The first of 16 byte data blocks 337 is used to satisfy the read request and the second of 16-byte data blocks 337 serves as a prefetch. Read buffer 336 stores an eight byte data block 339 which is refilled only when a read miss occurs in read buffer 336. Data blocks 337, 339 in read buffers 334, 336, respectively, also include address tags 342 to facilitate snooping, as discussed below.
Write buffer 330 and read buffer 332 add an additional level of data storage between cache memory 212 and main memory 214 of computer system 200. Similarly, read buffers 334, 336 in conjunction with write buffer 330 provide additional levels of data storage between main memory 214 and bus masters on local buses 218, 219, respectively. Consequently, a third function of system controller 260 is maintaining data coherence in the hierarchy of storage locations comprising cache memory 212, write buffer 330, and read buffers 332, 334, 336. These operations are discussed in conjunction with continued reference to FIG. 3.
The various snooping operations are carried out by system controller 260 in conjunction with snoop controller 360, memory controller 350, memory arbitration unit 370, read buffers 332, 334, 336 and write buffer 330 by comparing addresses asserted on buses 218, 219, 220 with address tags 342 of cached or buffered data. As discussed above, address and status tags 342, 344 are maintained for each qword of data blocks 331 in write buffer 330 and for each qword of data blocks. 335, 337, 339 in read buffers 332, 334, 336, respectively, to monitor data in these queues. In addition, data blocks 281 in cache memory 212 are monitored and invalidated when necessary. In a preferred embodiment of computer system 200, cache memory 212 is organized in 32 byte cache blocks 281 that also include address tags 282 and status tags 284 characterized according to Modified, Exclusive, Shared, Invalid (MESI) protocol. This protocol is well known and is not discussed in further detail here.
Memory arbitration unit 370 of system controller 260 implements a memory arbitration protocol in which reads are executed before writes so that if a read request is received while a write is pending, the read will be executed first. In order to insure that reads are not executed at an address in main memory 214 for which a write is pending, address tags 342 in write buffer 330 are snooped when a bus master on any of buses 220, 218, 219 initiates a read operation. If an address 215 to be read matches address tag 342 of a pending write (a snoop hit), memory controller 350 executes the pending write before the read.
Referring to FIG. 9, there is shown a state machine 900 for implementing the memory arbitration protocol discussed above. In particular, state machine 900 executes read operations (READREQ) before write operations (WRITEREQ) in step 902 as long as there is no pending write operation (PENDINGWRITE) to the address in main memory 214 to which the read operation is directed, and as long as there is no pending memory refresh request (REFRESHREQ) from a device on expansion bus 219. However, where memory arbitration unit 370 detects a pending write to the same address in main memory 214 to which a read operation is directed, state machine 900 executes the write operation before the read operation at step 904.
Referring again to FIG. 3, read buffers 332, 334, 336 snoop all writes to main memory 214 to insure that invalid data provided to a bus master on buses 220, 218, 219, respectively, is identified as such. When an address tag 324 in one of read buffers 332, 334, 336 matches the address asserted in the write operation (a snoop hit), corresponding status tag 334 is modified to indicate that the data is invalid.
System controller 260 also supports snooping by CPU 210 to insure the coherence of data in cache memory 212 and main memory 214. For this purpose, system controller 260 asserts on CPU bus 220 the addresses of reads and writes to main memory 214 by bus masters on local bus 218 and expansion bus 219. CPU 210 compares the asserted address with address tags 282 in cache block 281, and when a snoop hit occurs, corresponding status tag 284 is updated to indicate that the data in cache block 281 is no longer valid.
It is not necessary to initiate snoop cycles to processor 210 for all such read/write operations to main memory 214. For example, the size of data transfers on Focal bus 218 and expansion bus 219 range from 1 to 16 bytes, which is significantly smaller than the 32 byte data blocks 281 in cache memory 212. Accordingly, repeated transfers by bus masters on local bus 218 and expansion bus 219 could result in multiple snoops to the same address tag 282 in cache memory 212. Such redundant snoops consume bus cycles on CPU 220 and unnecessarily tie up CPU 210 and cache memory 212.
In order to eliminate redundant snoops, system controller 260 includes snoop-tag registers 362 in snoop controller 360, for storing address tags 342 corresponding to address tags 382 in cache memory 212 of recently snooped addresses. In the preferred embodiment, address tags 342 corresponding to the four most recently snooped addreses are stored in snoop-tag registers 362. When an address in main memory 214 is asserted by a bus master on local bus 218 or expansion bus 219, it is compared with address tags 342 in snoop-tag registers 362, and if a match occurs, the snoop cycle to CPU 210 is aborted. When no match occurs, the snoop cycle proceeds, and snoop-tag registers 262 are updated to include address tag 342 of the snooped address.
The write policy of computer system 200 governs the timing of data transfers between cache memory 212 and main memory 214. In the preferred embodiment, computer system 200 implements a write-back policy for cache blocks 281 whereby a data block 381 modified by CPU 210 is retained in cache memory 212 and corresponding status flag 384 is set to indicate that data block 381 has been "modified". Cache data blocks 381 are written back to main memory 214 when, for example, cache memory 212 is flushed in response to a change in context of the code being run by CPU 210, when a cache block 381 containing "modified" data is replaced following a cache miss, or when a snoop cycle hits in a cache block 381 containing "modified" data. In the last case, CPU 210 asserts cache control signal 408 (DCL*) to system controller 260. System controller 260 aborts the bus cycle on local bus 218 or expansion bus 219 and grants control of CPU bus 220 to CPU 210 to write back cache block 381 containing the modified data. A signal line 372 couples bus interface 310 to read buffers 334, 336 for transfering the modified data from cache memory 212 directly to read buffers 334, 336 to satisfy the read request.
Therefore, a computer system 200 has been presented that includes system controller 260 for decoupling CPU bus 220 from local and expansion buses 218, 219 to facilitate concurrent CPU 210 -cache memory 212 and local bus master-main memory 214 operations without introducing additional bus traffic. System controller 260 includes read buffers 232, 234, 236 for main memory 214, which act effectively as additional caches for CPU 210 and bus masters on local and expansion buses 218, 219. Read buffers 332, 334, 336 and write buffer 330 also allow main memory 214 to emulate a multi-ported main memory. System controller 260 supports snoop operations for read buffers 332, 334, 336 and write buffer 330, including a read/write reordering operation to prevent reads of stale data from main memory 214. In addition, snoop-tag registers 362 in system controller 260 prevents redundant snooping, reducing traffic on the CPU bus 20.
Although the present invention has been described with respect to the specific embodiments disclosed, various changes and modifications may be suggested to persons skilled in the art, and it is intended that the present invention covers such changes and modifications as fall within the scope of the appended claims.