The disclosed embodiments relate generally to memory systems and methods, and in particular to non-homogeneous memory systems and methods.
Computer program code and data needed for execution of a process on a computer system typically reside in the computer system's physical memory. Sometimes referred to as “primary storage,” “internal memory,” or “main memory,” physical memory is accessible to the computer's central processing unit (CPU) without the use of the computer's input/output (I/O) channels. Physical memory typically affords very fast access and is therefore frequently used to store information that is or is likely to be in active use by the CPU.
Because physical memory is typically volatile and relatively expensive, many computer systems utilize secondary storage. This secondary storage is usually accessible to the CPU via the computer's I/O channels and is normally used for persistent storage of relatively large amounts of data. Since the physical memory in many computer systems is more limited than what would be required to store all the program code and data that a user may want to access, many computer systems have what is called “virtual memory.”
In a computer system with virtual memory, some of the program code and/or data in the physical memory may be removed from physical memory and stored in the secondary storage, such as the computer's hard disk, until space becomes available on the physical memory or until such code or data is needed by the CPU. Because access to the code and data in secondary storage is typically slower access than from physical memory, it is desirable to swap code or data in the physical memory that is unlikely to be used soon by the CPU with code or data in the secondary storage.
Many computer systems employing virtual memory have automatic storage allocation schemes to manage the transfer of code and storage between physical memory and secondary storage. Pages of data and program code are transferred from secondary storage to physical memory as the data and program code is needed by an executing process, and pages of data and program code are evicted from physical memory and written to secondary storage when room is needed in physical memory to store other pages of data and program code. The process of moving pages of data and program code back and forth between physical memory and secondary storage is called by a variety of names, including swapping, paging, and virtual memory management.
The location in the physical memory where a particular piece of data or code is stored is referred to as the physical address. A logical address or virtual address is a memory location accessed by an application program in a system with virtual memory such that intervening computer hardware and/or software maps the virtual address to physical memory. During the course of execution of the application, the same virtual address may be mapped to many different physical addresses as data and programs are paged out and paged in to other locations. The virtual address (which may also be referred to as the logical address) typically includes a virtual (or logical) page number plus the location within that page and is typically interpreted or mapped onto a physical memory address by the operating system using an address translation function. If the page is present in physical memory, the address translation function substitutes the physical page frame number for the logical number. If the address translation function detects that the page requested is not present in physical memory, a fault occurs and the page is read into a physical memory page frame from secondary storage. This address translation function can be accomplished using a directly indexed table, commonly referred to as a “page table,” which identifies the location of the program's pages in physical memory. If the page table indicates that a page is not resident in physical memory, the address translation function issues a page fault to the operating system. This causes execution of the program which required the page to be suspended until the desired page can be read from secondary storage and placed in physical memory.
Portable computing devices typically use a single type of memory device at each level in their memory hierarchy. Higher levels in the memory hierarchy typically operate at higher speeds and lower latency than lower levels. For example, portable computers (e.g., notebook computers) typically have three or more hierarchical levels of memory, including cache memory, secondary storage, and physical memory. Cache memory is typically implemented using Static Random-Access Memory (SRAM). Often there are two or more levels of cache memory. Secondary storage is typically implemented with magnetic disk storage (often called hard disk storage). Physical memory is typically implemented with Dynamic Random-Access Memory (DRAM). In some portable computers, such as personal digital assistants (PDAs), the secondary storage is implemented using flash memory instead of magnetic disk storage.
DRAM has a near-optimal combination of operational attributes for implementing physical memory. These attributes include, without limitation, low cost (only magnetic disk storage has a lower per-bit cost), low read time (the read access time is within an order of magnitude of that of the highest speed SRAM), low write time that is the same or similar to the read access time, and essentially unlimited endurance (i.e., the storage cell can be rewritten an unlimited number of times). Unfortunately, DRAM is volatile, which is to say that DRAM cannot maintain stored data in the absence of applied power. This means that computers relying upon DRAM for physical memory must maintain applied power even when not in use—a problem of particular significance for battery-powered devices—or require slow boot processes during which information is moved from secondary memory into physical memory. There is therefore a need for memory systems that include nonvolatile physical memory.
The subject matter disclosed is illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which like reference numerals refer to similar elements and in which:
Memory controller 104 is connected to a physical memory 108 via a communication channel 110 and to an IO controller 112 via system bus 106, though the memory and IO controllers may connect to different buses in other embodiments. IO controller 112 interfaces to peripheral devices, including e.g. a hard disk drive 114. Disk drive 114 serves as secondary storage in the present example. System bus 106 and channel 110 may include one or more signal lines, such as, for example signal lines to carry address, data, control, strobe, or clock signals. These details are readily understood by those of skill in the art and are omitted here for brevity.
Memory controller 104 may translate physical addresses P from CPU 102 to an addressing scheme suitable for physical memory 108. Such translation allows memory controller 104 to support different physical-memory configurations. In the instant example, however, physical addresses P from CPU 102 are assumed to be suitable for use with physical memory 108 without translation. Memory controller 104 additionally includes a pair of registers NxtFP and NxtEU, the purposes of which are detailed below.
Physical memory 108 includes volatile and nonvolatile portions 116 and 118, DRAM and flash memory in this embodiment. Volatile and nonvolatile portions 116 and 118 each store data in terms of “access units,” which may be defined as the smallest memory areas handled as a single chunk of data. In the instant example, volatile memory 116 supports volatile access units that store two-kilobyte pages, and nonvolatile memory 118 supports nonvolatile access units that store pages of the same size. The volatile and nonvolatile access units may be sized differently in other embodiments.
Reads and writes to nonvolatile memory 118 may be performed one access unit at a time, in a random-access fashion, but erasures are carried out on collections of access units. Flash memory 118 is therefore divided into erase units 130, sometimes called “erase blocks,” each of which is divided into nonvolatile access units 132. Each nonvolatile access unit 132 within an erased erase unit 130 can be written to or read from. Once written to, however, a nonvolatile access unit 132 cannot be written to again until the entire erase unit 130 is erased.
DRAM 116, at the direction of memory controller 104, provides a cache 120 for instructions and data and tag and dirty tables 124. CPU 102 employs tables 124 to keep track of which virtual pages reside in physical memory 108 and whether those pages have been written to without the changes having yet been saved to a lower level in the memory hierarchy (i.e., are dirty). Virtual-to-physical and physical-to-virtual address translation tables (not shown) may be held in secondary memory and may be moved to physical memory by paging software (also not shown) executing on CPU 102. These and other details that relate to the use of virtual memory are well understood by those of skill in the art and are therefore omitted for brevity.
Controller 104 tracks dirty pages in DRAM 116, which are those pages that include changes not reflected in corresponding memory locations within flash memory 118. In accordance with the depicted embodiment, controller 104 also uses DRAM 116 to store maps 126 and 127 of physical-to-flash (P->F) and flash-to-physical (F->P) address translations identifying where data and instructions in cache 120 have corresponding pages in flash memory 118 and vice versa, and to store a valid table 128 identifying which pages in flash memory 118 include valid data. Flash memory 118 will typically include considerably more address locations than will DRAM 116. For example, volatile portion 116 may include eight 256 Mb DRAM ICs and nonvolatile portion 118 may include ten 2 Gb flash memory ICs in one embodiment.
In the example of
Returning to decision 215, if the requested page is not in cache 120, then memory controller 104 copies the requested page from flash memory 118 into cache 120 in preparation for the requested memory access. To do this, memory controller 104, using the contents of map 126, translates the requested physical address P into the corresponding flash address F (step 240). Before copying the selected flash page into the DRAM cache, memory controller 104 determines whether the page to be overwritten in cache 120 (the target page) represents a “dirty” page by referencing tables 124 in DRAM 116 that memory controller 104 maintains for this purpose.
If that target page is not dirty, per decision 245, then the contents of the requested page is loaded from flash memory 118 into the clean page in cache 120 (step 247). If the target page is dirty, however, before loading the requested page from flash memory 118 to cache 120, memory controller 104 copies the target page to flash memory 118 to retain whatever changes were made to the target page since the target page was loaded from flash memory 118. Memory controller 104 (1) loads the dirty target page from cache 120 into an address in flash memory 118 identified as the next flash page by register NxtFP (step 250), (2) marks the prior flash address associated with the dirty page as invalid in table 128 (step 255), and (3) changes the physical-to-flash mapping associated with the dirty page so that subsequent requests for the newly saved page will access the updated flash page (step 260). With the contents of the target page in cache 120 thus preserved, the contents of the requested page is loaded from flash memory 118 into the formerly dirty page in cache 120 and the corresponding dirty bit in table 124 is reset (step 265). The next-flash page address NxtFP is then changed to point to an erased page 132 in flash memory 118 in preparation for the next write to flash memory (step 270). The process then returns to decision 220 for completion of the memory access.
Some embodiments favor overwrites to clean pages over dirty ones to reduce the overhead and lifespan reduction associated with a write. Using a multi-set DRAM cache, for example, the selection of a page to overwrite could factor in the clean or dirty state of the target page. The process might also take other factors into account when selecting a target page. Some embodiments, for example, favor writes to the least-recently used clean location.
The number of flash pages (e.g., access units 132 of
Memory controller 305 includes two registers that keep track of the amount of available erased pages in flash memory 320: a head register HeadF contains the address of the next empty one of flash pages 340 to receive data writes, and a tail register TailF contains the address of the one of erase units 345 storing the eldest data. The erase unit with the eldest data is likely to be among the erase units with the highest number of invalid page entries. Erasing the erase unit with the eldest data is therefore likely to free up a relatively large number of nonvolatile access units for future writes. Memory controller 305 communicates with the other components of memory system 300 over a number of ports, descriptions of some of those ports are provided below in connection with
In the example of
In one embodiment, the twenty-five most significant bits of physical byte address P 410 represent a physical line address (PH:PM:PL), which may be logically divided into the three most-significant bits PH, the middle seventeen bits PM, and the least-significant five bits PL. The tag portion of tables 325 includes columns of three-bit tags (aligned to the PH field) each associated with a 17-bit physical tag address (aligned to the PM field). Flash byte addresses 425 are expressed as a 21b flash page address and an 11b page offset. The flash page address is divided into a 15b field FH and a 5b field FM.
Flowchart 500 of
In the case of a cache hit, memory controller 305 either reads from or writes to the location in DRAM cache 310 identified by the mid- and low-order bit fields PM:PL of physical byte address 410 (decision 515). For a read, memory controller 305 causes DRAM cache 310 to present the contents of the addressed cache line on data signals DQ (step 520) and sends the read data to the CPU. For a write, memory controller 305 causes DRAM cache 310 to accept data provided from the CPU onto data signals DQ into the addressed cache line (step 525). Memory controller 305 then alters the contents of tables 325 to mark the altered page in cache 310 as dirty (step 530).
In the case of a cache miss, memory controller 305 will move the requested page from flash memory 320 into an address location in DRAM cache 310. This “target” address location in cache 310 will typically be the least-recently used (accessed) page. Memory controller 305 considers tables 325 to determine whether the target page is dirty (decision 535). If the target page is clean, an identical copy of the target page resides in flash memory 345; if dirty, then the corresponding copy in flash memory 345 is stale, so the dirty page is written to flash memory 345 to preserve the information in the target page.
If controller 305 determines that the target page is dirty, then the target page at DRAM cache address PM is loaded into flash memory 345 at the address of the erased page specified by register HeadF (step 555). Table 330 is then updated to reflect the new physical-to-flash mapping between the target page in cache 310 and the flash-head address HeadF (step 560) using the PH:PM fields of the physical address. The flash page address formerly associated with the target page in cache 310 is marked invalid in tables 335 (step 565) using the PH:PM fields of the physical address. The flash head page address HeadF is loaded into table 330 to update the flash-to-physical mapping for the target page (step 570) using the PH//PM fields of the physical address, and address HeadF is marked as valid (step 571). Controller 305 then increments head address HeadF (step 575). The process then moves to step 540.
For clean target pages, memory controller 305, using physical-to-flash mapping tables 330, converts the requested physical page address PH:PM into a flash page address FH:FM and loads the contents of that flash page into the target page location PM in cache 310 (step 540). The tag location at PM is loaded with the upper physical address field PH (step 545), and the dirty location at PM is cleared to zero (step 580). The process then moves to decision 515 and the requested memory access, either a read or a write, is completed.
The process of flowchart 500 is repeated for each access to physical memory. Each cache miss to a dirty page produces an invalid page 340 in a page in flash memory 345. If allowed to accumulate, the invalid page entries would prevent memory controller 305 from writing new pages into flash memory 320. Memory controller 305 therefore supports a garbage-collection process that recycles invalid pages.
If the tail page contains valid information, the contents of flash memory 345 at address TailF is loaded into address HeadF (step 615) and the flash-to-physical and physical-to-flash mappings in tables 335 and 330 are updated accordingly (steps 620 and 625). Controller 305 then accesses tables 335 to set the valid bit associated with the head address (step 630) and to reset the valid bit associated with the tail address (step 635). The head pointer is then updated by incrementing register HeadF (step 640). Per decision 650, if bits of field FM of TailF are all logic ones, then the tail address corresponds to the last page entry in the selected erase unit. If so, then the erase unit specified by address TailF is erased (step 660), the tail pointer is incremented to the first page address in the next erase block (step 665), and the process returns to decision 605. If bits of field FM are not all logic ones, then the tail pointer is incremented (step 655) and the process returns to decision 610. There is no reason to save the contents of invalid flash pages, so memory controller skips from decision 610 to decision 650 when it encounters an invalid page.
The embodiment of
Some embodiments can use more than one data structure and/or different kinds of structures. For example, two data structures can work their way through flash memory simultaneously, one for read-only or read-mostly pages and the other for write-often pages. The write-often data structure would be smaller and faster moving, and could jump through and around the other data structure.
In the above-described examples the access units in physical memory are of the same size as the pages addressed by the CPUs. In other embodiments the life of the nonvolatile memory can be extended by reducing the size of the access units relative to the pages addressed by the CPU. The use of relatively smaller nonvolatile access units reduces the speed at which erase units are filled, and consequently reduces the frequency of erase operations. The tables employed to map requested physical addresses to the relatively small nonvolatile access units would be more complex than in the foregoing embodiments, but the operation of such a memory system would be conceptually similar. The resulting larger tables could be stored in flash memory and cached in DRAM. Increasing the amount of flash memory for implementing a given quantity of physical memory similarly extends the life expectancy of the flash memory.
In some embodiments the memory controller can support error detection and correction for memory reads. In detecting errors, such embodiments can identify defective flash pages and substitute defective flash pages with spare pages reserved for this purpose. A table distinguishing good and bad flash pages can be maintained in e.g. flash memory for this purpose.
Flash memory devices are rated based upon a number of performance criteria, including read, write, and erase times, a maximum number of write cycles (endurance count), and the minimum time the memory can be expected to retain stored data (retention time). Flash memory used in the foregoing embodiments might be adapted to favor access times and/or write-cycle endurance over data retention. Depending upon the optimization, the flash memory might require periodic refreshing (e.g., each flash access unit is written to at least once a month), a process that could be supported by the flash device or in an associated memory controller.
An output of a process for designing an integrated circuit, or a portion of an integrated circuit, comprising one or more of the circuits described herein may be a computer-readable medium such as, for example, a magnetic tape or an optical or magnetic disk. The computer-readable medium may be encoded with data structures or other information describing circuitry that may be physically instantiated as an integrated circuit or portion of an integrated circuit. Although various formats may be used for such encoding, these data structures are commonly written in Caltech Intermediate Format (CIF), Calma GDS II Stream Format (GDSII), or Electronic Design Interchange Format (EDIF). Those of skill in the art of integrated circuit design can develop such data structures from schematic diagrams of the type detailed above and the corresponding descriptions and encode the data structures on computer readable medium. Those of skill in the art of integrated circuit fabrication can use such encoded data to fabricate integrated circuits comprising one or more of the circuits described herein.
While the present invention has been described in connection with specific embodiments, variations of these embodiments will be obvious to those of ordinary skill in the art. For example:
The examples provided above employ a direct-map DRAM cache, but other embodiments can employ different cache management schemes (e.g., an N-way associative cache management scheme) for improved performance.
The volatile memory can be implemented using technologies other than DRAM.
The nonvolatile memory can be implemented using technologies other than flash memory. In general, the memory access methods and circuits are particularly important for memory systems with nonvolatile physical memory that suffers a wear mechanism asymmetrically associated with write operations but may be employed in other systems as well.
The memory controller, two or more of the RAM, the CPU, the memory, and a graphics controller can be instantiated together on the same integrated circuit device or on various combinations of devices.
The flowcharts described above are intended to convey an operational sense of some embodiments; in practice, the process flow need not proceed as specified. Moreover, some components are shown directly connected to one another while others are shown connected via intermediate components. In each instance the method of interconnection, or “coupling,” establishes some desired electrical communication between two or more circuit nodes, or terminals. Such coupling may often be accomplished using a number of circuit configurations, as will be understood by those of skill in the art. Therefore, the spirit and scope of the appended claims should not be limited to the foregoing description. Only those claims specifically reciting “means for” or “step for” should be construed in the manner required under the sixth paragraph of 35 U.S.C. § 112.
Number | Date | Country | |
---|---|---|---|
60857408 | Nov 2006 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 17065082 | Oct 2020 | US |
Child | 18422073 | US | |
Parent | 16245749 | Jan 2019 | US |
Child | 17065082 | US | |
Parent | 15050246 | Feb 2016 | US |
Child | 16245749 | US | |
Parent | 14280437 | May 2014 | US |
Child | 15050246 | US | |
Parent | 12513848 | Dec 2009 | US |
Child | 14280437 | US |