Abstract:
A cache memory system having an improved area addressing scheme for rewriting is disclosed. The cache memory system comprises a cache memory having a plurality of memory areas, a first detection circuit for designating the least recently accessed area by a CPU, a second detection circuit for detecting that the least recently accessed memory area is not designated and a control circuit for forcibly selecting a predetermined one memory area for rewriting when the least recently accessed memory area is not designated.

Description:
BACKGROUND OF THE INVENTION: 
     The present invention relates to a memory system, and more particularly to an address control circuit for designating a memory block to be subjected to data exchange with a main memory. 
     Computer system includes a main memory which is connected to a central processing unit (CPU) via a bus. While operation speed of the CPU has become very fast, the operation speeds of the bus and the main memory are still low. Therefore, it is difficult to transfer data between the CPU and the main memory at the high operation speed of the CPU. A high speed memory called a cache memory has been proposed to be inserted between the CPU and the main memory, so that the CPU may directly have interface with the cache memory at a high speed. The capacity of the cache memory is limited and small. Therefore, the cache memory stores a relatively small quantity of data which are read from the main memory. In order to implement the above function of the cache memory, the storage addresses of the cache memory are divided into a plurality of areas. Namely, memory cells of the cache memory are divided into a plurality of memory cell blocks. A control circuit is provided to the cache memory for designating the memory cell block or area to be accessed by the CPU according to the history of the access or utilization of the respective memory cell blocks or the areas. Namely, the order of the utilization of the respective cell blocks are stored in a control memory and the cell block which stores the oldest information, or, which is not utilized by the CPU most recently, is subjected to rewriting contents thereof in accordance with the contents of the main memory. The control memory includes a plurality of memory cells for storing the accessed order of the respective cell blocks, and the least recently utilized cell block (storing the oldest information) is designated by the control memory. 
     However, the conventional control memory fails to designate the cell block storing the oldest information in a certain case and the effective data exchange of information is not achieved between the cache memory and the main memory. For example, when a power supply to the control memory is switched on, the states of the respective memory cells in the control memory are made uncertain and the control memory cannot designate the cell block storing the oldest information. 
     SUMMARY OF THE INVENTION 
     It is an object of the present invention to provide a cache memory provided with an improved control memory for stably designating the cell block storing the oldest information in a cache memory. 
     The memory system according to the present invention comprises a cache memory coupled between a CPU and a main memory and having a plurality of memory locations classified into a plurality of memory areas, a control memory for storing used order of the memory areas in the cache memory, a detection circuit coupled to the control memory for detecting that the used order of the memory areas stored in the control memory is uncertain, and a set circuit for forcibly setting the control memory at a predetermined state when the detection circuit detects the uncertain state. 
     According to the present invention, the control memory can always designate the least recently used memory area in the cache memory. Therefore, information of the main memory is written to the designated memory area in the cache memory so that effective utilization of the cache memory is achieved. 
    
    
     BRIEF DESCRIPTION OF DRAWINGS 
     FIG. 1 is schematic block diagram showing a data processing system using a cache memory; 
     FIGS. 2A to 2C are diagrams showing alogorithm for determining the least recently used memory area in the cache memory; and 
     FIG. 3 is schematic block diagram of a control circuit for the cache memory according to one embodiment of the present invention. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     Referring to FIG. 1, a data processing system employing a cache memory is explained. 
     A CPU 1 is connected through a CPU bus 2 to a cache memory system 3. The cache memory system 3 includes a cache memory 4 having four memory areas CM01-CM04, a control memory 6 having memory bits a-f, a control circuit for designating one of the memory areas CM01-CM04 in accordance with the contents of the control memory 6, and a read/write control circuit 7 for designating address of a main memory 9 which is coupled to the cache memory system 3 via a memory bus 8 for transferring address of the memory 9 and data derived from the memory 9. The cache memory 4 operates at a speed higher than the main memory 9 but has a smaller memory capacity than the memory 9. 
     The CPU 1 requests necessary data to the cache memory system 3. In this instance, the read/write control circuit 7 judges whether the data requested by the CPU 1 is stored in the cache memory 4 or not. When the requested data is stored in one of the memory areas in the cache memory, the data stored in the above one memory area is transferred to the CPU via the bus 2 under control of the control circuit 7. When such data is not stored in the cache memory, data stored in the main memory is transferred to the CPU 1 via the bus 8 and written into one of the memory areas in the cache memory 4 under control of the control circuit 7. In this instance, among the four memory areas, the least recently used one which is to be used first is utilized for such writing of data from the main memory 9. This designation of the least recently used memory area is made by the control circuit 5 in accordance with the contents of the control memory 6. 
     An alogrithm for determining the least recently used memory area by the control memory 6 is explained with reference to FIGS. 2A-2C. 
     In FIG. 2A,  ○1 - ○4  correspond to the memory areas CM01-CM04 in the cache memory 4, respectively, and &#34;a&#34;-&#34;f&#34; correspond to the states of the memory bits a-f of the control memory 6, respectively. 
     The order of the oldness in utilization of the memory areas is designed by the number of arrows a-f. The direction of each arrow means the oldness, and the memory area to which a larger number of arrows are directed is more recently used one. For example, three arrows &#34;a&#34;, &#34;b&#34; and &#34;d&#34; run towards the memory area (CM01) shown as  ○1  and hence the memory area (CM01) is the least recently used, i.e. oldest area, in the cache memory. While, no arrow runs towards the memory area (CM04) denoted by ○4  and therefore the memory area CM04 is the most newly used area by the CPU 1. The order of oldness in utilization in the cache memory 4 is the memory area CM01, area CM02, area CM03 and area CM04, in FIG. 2A. 
     If one of the areas is utilized by the CPU, this one area is the most recently used area and the three arrows run from this area towards other three areas. Therefore, if the area CM01 ( ○1 ) in FIG. 2A is used by the CPU 1, then the state of the algorithm becomes one shown in FIG. 2B. Namely, the three arrows &#34;a&#34;, &#34;b&#34; and &#34;d&#34; run from the area CM01 towards other three areas with other arrows &#34;c&#34;, &#34;e&#34; and &#34;f&#34; unchanged. If it is defined that the state of each arrow is assumed &#34;1&#34; when that arrow runs from the area of the less designation number e.g.  ○1  to the area of the larger designation number e.g.  ○2  and &#34;0&#34; vice versa. Then the state of FIG. 2B is represented as (a, b, c, d, e, f) =(1, 1, 1, 0, 0, 0). 
     Referring further to FIG. 3, the cache memory system includes the control memory 6 and the control circuit 5&#39; which is composed of NAND gates B1-B4. The outputs of the six memory cells a-f of the control memory 6 are inputted to inverters A1-A6, respectively, to generate their complementary signals which are then applied to the circuit 5&#39; together with their original outputs. The circuit 5&#39; is basically a decoder for determining outputs 01 to 04 in accordance with the state of the memory cells a-f. When the states of the memory cells a-f are (a, b, c, d, e, f)=(0, 0, 0, 0, 0, 0), the output &#34;01&#34; is at &#34;1&#34; level with all the other outputs &#34;02&#34; to &#34;03&#34; being at &#34;0&#34; level. This shows that the memory area CM01 is the least recently used (oldest) area. 
     While, as shown in FIG. 2C, there is no memory area to which three arrows run. Rather, two arrows &#34;b&#34; and &#34;d&#34; run towards the memory area CM01 and two arrows &#34;a&#34; and &#34;c&#34; direct to the memory area CM02. In this case, the state of the control memory 6 is (a, b, c, d, e, f)=(1, 0, 0, 0, 1, 0) and all the outputs &#34;01&#34; to &#34;04&#34; become &#34;0&#34; level. Thus, these outputs fail to designate the least recently used memory area for rewriting content thereof. 
     Also, when a power supply to the control memory 6 is switched on, the states of the memory cells a-f are uncertain. Therefore, in this instance, there is possibility that the memory area to be subjected to rewriting for usage by the CPU 1 cannot be designated. 
     For avoiding the above-mentioned problems, the cache memory system of the invention further includes a circuit 10 (FIG. 3) of NAND gates B5 to B8 which determines the memory area most recently used by the CPU 1. When the circuit 5&#39; cannot determine the least recently used memory area, the outputs of the NAND gates B1-B4 are all &#34;1&#34;. When the circuit 10 cannot determine the most recently used memory area, the outputs of the NAND gates B5-B8 are all &#34;1&#34; level. A detection circuit 11 receives the outputs of the circuits 5&#39; and 10 and detects that the outputs of the circuit 5&#39; or 10 are all &#34;1&#34;, that is, the least recently used memory area or the most recently used memory area cannot be determined. The circuit 11 includes a NAND gate B10 detecting all &#34;1&#34; outputs of the NAND gates B1 to B4, a NAND gate B9 detecting all &#34;1&#34; outputs of the NAND gates B5-B8, and a NAND gate B11. When the circuits 5&#39; or 10 fails to designate the least recently used area or the most recently used area, the gate B11 produces &#34;1&#34; output. A circuit 12 produces the outputs &#34;01&#34; to &#34;04&#34; for designating one memory area for usage by the CPU 1. The circuit 12 includes NOR gates C1-C3, an inverter A7 and a NAND gate B12. When the output of the NAND gate B11 is at &#34;0&#34; level, the gates C1- C3 and B12 simply serve as inverters for inverting the outputs of the gates B1-B4. Therefore, one of the outputs &#34;01&#34; to &#34;04&#34; has the &#34;1&#34; level to designate the least recently used memory area. When the output of the gate B11 is in the &#34;1&#34; level, the output &#34;04&#34; is forcibly set at &#34;1&#34; level with the outputs &#34;01&#34; to &#34;03&#34; taking &#34;0&#34; level. A set circuit 13 includes an AND gate D1 receiving the output of the gate B11 and a write timing signal φ WE  and an inverter A8 for generating an inverted signal of D1. When the least recently used memory area or the most recently memory area is not detected and the output of the gate B11 is at the &#34;1&#34; level, the outputs of the gate D1 and the inverter A8 are at &#34;1&#34; and &#34;0&#34; levels, respectively, thereby to set all the memory cells at &#34;0&#34; logic state. 
     Referring to the memory cell &#34;a&#34; in FIG. 3, each of the memory cells &#34;a&#34; to &#34;f&#34; is composed of a flip-flop circuit having N-channel MOS transistors Q N4  and Q N5  and load resisters R1 and R2, a pair of transfer gate MOS transistors Q N2  and Q N3  with gates connected to an access line φ WL , and a pair of the lines Da, Da. An N-channel MOS transistor Q N1  and a P-channel MOS transistor Q P1  are also provided in each memory cell, which are rendered conductive thereby to set the memory cell at &#34;0&#34; state in response to &#34;1&#34; output of the gate D1. Needless to say, the other memory cells &#34;b&#34; to &#34;f&#34; are similarly structured to the cell &#34;a&#34; and set at &#34;0&#34; state in response to the &#34;1&#34; output of the gate D1. 
     When the state of the memory 6 is (a, b, c, d, e, f)=(1, 0, 0, 0, 1, 0), neither the least recently used memory area nor the most recently used memory area is designated as is the case of FIG. 2C. Namely, the outputs of the gates B1 to B8 are all &#34;1&#34; level so that the output of the gate B11 becomes &#34;1&#34; level. Therefore, among the outputs &#34;01&#34; to &#34;04&#34;, only the output &#34;04&#34; is set at &#34;1&#34; state so that the memory area &#34;CM04&#34; is regarded as the least recently used memory area. Also, in this instance, all the memory cells &#34;a&#34;-&#34;f&#34; are forcibly set at &#34;0&#34; level. This states of the memory 6 of (a, b, c, d, e, f)=(0, 0, 0, 0, 0, 0) indicates that the memory area &#34;CM04&#34; is the least recently used area. Although not shown, the outputs &#34;01&#34; to &#34;04&#34; are sampled or latched when they are produced in a known manner, and the change in the state of the memory 6 does not affect utilization of the outputs &#34;01&#34; to &#34;04&#34;. 
     As has been described, the present invention has great advantage in determining the area of the cache memory.