The invention generally relates to implantable medical devices and in particular to a memory architecture for use with a microcontroller of an implantable medical device. 
A wide range of implantable medical stimulation devices are provided for surgical implantation into humans or animals.  One common example is the cardiac pacemaker.  Another is the implantable cardioverter defibrillator (ICD). 
Current state of the art implantable medical devices typically include a microcontroller for controlling the functions of the device such as detecting medical conditions within the patient in which the device is implanted and administering appropriate therapy.  Within a pacemaker, for example, the microcontroller monitors the detection of P-waves and R-waves to determine whether an episode of bradycardia has occurred and, if so, administers a pacing pulse to the heart.  Within an ICD, for example, the microcontroller analyzes P-waves, R-waves and other electrical signals of the heart to determine if an episode of ventricular fibrillation has occurred and, if so, administers a defibrillation shock to the heart. 
In addition to performing functions directed to administering immediate therapy, the microcontroller coordinates all other functions of the implantable device, such as: monitoring the power source of the device to determine if the power source needs to be replaced; switching of the mode of operation of the device from, for example, a single-chambered pacing mode to a dual-chambered pacing mode; and recording events such as detection of P-waves and R-waves mode switching events and the administration of therapy for diagnostic purposes.  As implantable medical devices become more and more sophisticated, the number and complexity of functions that must be performed by the microprocessor increases as well.  As a result, the software for controlling the microprocessor becomes increasingly complex and the amount of time required to design, test and debug the software also becomes more significant.  Indeed, in many cases, the development of reliable software can significantly delay the overall development of a new implantable medical device.  Accordingly, it is highly desirable to expedite the development of reliable software for use in an implantable medical device and aspects of the invention are directed to that general goal. 
Typically, software is developed using random access memory (RAM) devices that can be programmed and reprogrammed many times during the development of the software.  To reliably test the device, the software should be used in conjunction with the entire implantable medical device.  Also, while testing software within the test device, it is also desirable to test various hardware components of the device, such as pulse generators, sensors and the like.  Hence, test devices are built which incorporate all of the hardware of the implantable medical device with RAM chips for storing the software to be tested.  Ideally, however, the final medical device incorporates read only memory (ROM) rather than RAM to reduce power consumption, increase processing speed, and prevent any corruption of the software, as may occur as a result of a power surge or perhaps as a result of the malfunction of some other component of the device, such as the microprocessor.  However, the use of RAM during software design and test, rather than ROM, may affect the amount of current consumed by the device, or other device characteristics, possibly resulting in invalid tests of the hardware components of the device.  For example, after the software is embodied in ROM for installation into a production device, the slight difference in current consumption caused by switching from RAM to ROM may result in sense amplifiers not operating precisely as expected.  Moreover, in many cases, while software is being developed, the amount of memory required by the software exceeds the amount of memory expected to be used in the production device.  As a result, to test intermediate versions of the software, additional RAM chips are used in the test device, further affecting the total current consumption, resulting in a still greater risk that the hardware components of the device, once RAM is replaced with ROM in the production device, will not operate precisely as expected. 
Accordingly, it would be highly desirable to provide an improved method for designing, testing and debugging software for use in an implantable medical device and an improved device for receiving the software, which overcomes the aforementioned disadvantages.  It is to this end that many aspects of the invention are specifically directed. 
Another problem associated with employing ROM memory in the production unit of an implantable medical device, is that software upgrades or software bug fixes cannot easily be performed.  Indeed, if the software to be upgraded or fixed resides within ROM, the ROM may need to be replaced, requiring explantation of the implanted device from a patient, then implantation of a new or modified device.  As can be appreciated, this is a considerable inconvenience to the patient and a significant cost to the manufacturer of the device.  Accordingly, it would also be desirable to provide a hardware memory configuration for use in the production unit of implantable medical devices, which facilitates expedient software upgrades or software bug fixes, and still other aspects of the invention are directed towards that goal. 
In accordance with the invention, a memory system is provided for use in an implantable medical device having various computing components accessing a virtual memory space corresponding to a predetermined amount of memory.  The memory system includes dynamic means for storing data, permanent means for storing data, and a memory controller means for mapping portions of the virtual memory space to either the dynamic means for storing data or the permanent means for storing data. 
In an exemplary embodiment, the implantable medical device is a pacemaker or implantable cardioverter defibrillator.  The dynamic storage means is RAM and the permanent storage means is ROM.  The memory controller means includes a zone control register that specifies, for each of a predetermined number of zones of virtual memory, whether the zone is to be mapped to RAM or ROM.  The zone control register is a binary register having one bit per memory zone with the bit set to indicate either ROM or RAM.  In one specific implementation, the predetermined amount of memory of the virtual memory space is 256 kilobytes (256 K) of memory.  The RAM and ROM each provide 256 K of memory as well, permitting the entire virtual memory space to be mapped either to RAM or ROM. 
By providing the implantable medical device with both RAM and ROM, software for use in the device can be stored in the RAM while software is being designed, tested and debugged.  Then, once the software design has been finalized, the final software design is embodied in ROM.  In this manner, the actual production unit of the device may exploit the benefits of the ROM whereas testing may be performed while obtaining the benefits of RAM, without changing power consumption requirements or other device characteristics.  Hence, both the software and hardware components of the implantable medical device can be reliably tested without risk that slight changes in current consumption caused by replacing RAM with ROM may invalidate the tests.  Also, by providing each production unit with both RAM and ROM, software upgrades may be accomplished easily by downloading new software into a portion of the RAM, then controlling the memory controller means to map portions of the virtual memory space to access the RAM rather than the ROM.  In this manner, any software bugs discovered in the software of the ROM may be easily corrected without requiring replacement of the ROM which, in the case of an implantable medical device, would likely require explantation of the device from the patient. 
Other objects and advantages of the invention are achieved as well.  Method embodiments of the invention are also provided.