Embedded System
Embedded System
Lesson 5
Memory-I
Version 2 EE IIT, Kharagpur 2
Instructional Objectives
After going through this lesson the student would o Different kinds of Memory Processor Memory Primary Memory Memory Interfacing
Pre-Requisite
Digital Electronics, Microprocessors
5.1 Introduction
This chapter shall describe about the memory. Most of the modern computer system has been designed on the basis of an architecture called Von-Neumann Architecture1
Memory
The Memory stores the instructions as well as data. No one can distinguish an instruction and data. The CPU has to be directed to the address of the instruction codes. The memory is connected to the CPU through the following lines 1. Address 2. Data 3. Control
http://en.wikipedia.org/wiki/John_von_Neumann. The so-called von Neumann architecture is a model for a computing machine that uses a single storage structure to hold both the set of instructions on how to perform the computation and the data required or generated by the computation. Such machines are also known as storedprogram computers. The separation of storage from the processing unit is implicit in this model. By treating the instructions in the same way as the data, a stored-program machine can easily change the instructions. In other words the machine is reprogrammable. One important motivation for such a facility was the need for a program to increment or otherwise modify the address portion of instructions. This became less important when index registers and indirect addressing became customary features of machine architecture.
Data Lines
CPU
Address Lines
Control Lines
Fig. 5.2 The Memory Interface
Memory
In a memory read operation the CPU loads the address onto the address bus. Most cases these lines are fed to a decoder which selects the proper memory location. The CPU then sends a read control signal. The data is stored in that location is transferred to the processor via the data lines. In the memory write operation after the address is loaded the CPU sends the write control signal followed by the data to the requested memory location. The memory can be classified in various ways i.e. based on the location, power consumption, way of data storage etc The memory at the basic level can be classified as 1. Processor Memory (Register Array) 2. Internal on-chip Memory 3. Primary Memory 4. Cache Memory 5. Secondary Memory
Primary Memory
This is the one which sits just out side the CPU. It can also stay in the same chip as of CPU. These memories can be static or dynamic.
Cache Memory
This is situated in between the processor and the primary memory. This serves as a buffer to the immediate instructions or data which the processor anticipates. There can be more than one levels of cache memory.
Secondary Memory
These are generally treated as Input/Output devices. They are much cheaper mass storage and slower devices connected through some input/output interface circuits. They are generally magnetic or optical memories such as Hard Disk and CDROM devices. The memory can also be divided into Volatile and Non-volatile memory.
Volatile Memory
The contents are erased when the power is switched off. Semiconductor Random Access Memories fall into this category.
Non-volatile Memory
The contents are intact even of the power is switched off. Magnetic Memories (Hard Disks), Optical Disks (CDROMs), Read Only Memories (ROM) fall under this category.
CPU
Control Unit
ALU
Registers
Input
Output
Memory
Fig. 5.3 The Internal Registers
m words
n bits per word Fig. 5.4 Data Array Version 2 EE IIT, Kharagpur 6
Memory access
The memory location can be accessed by placing the address on the address lines. The control lines read/write selects read or write. Some memory devices are multi-port i.e. multiple accesses to different locations simultaneously memory external view
r/w
enable
A0 Ak-1
Q0
Memory Specifications
The specification of a typical memory is as follows The storage capacity: The number of bits/bytes or words it can store The memory access time (read access and write access): How long the memory takes to load the data on to its data lines after it has been addressed or how fast it can store the data upon supplied through its data lines. This reciprocal of the memory access time is known as Memory
Bandwidth
The Power Consumption and Voltage Levels: The power consumption is a major factor in embedded systems. The lesser is the power consumption the more is packing density. Size: Size is directly related to the power consumption and data storage capacity.
Generation 1
Generation 3
Generation 4 Fig. 5.6 Four Generations of RAM chips There are two important specifications for the Memory as far as Real Time Embedded Systems are concerned. Write Ability Storage Performance
Write ability
It is the manner and speed that a particular memory can be written
Ranges of write ability High end processor writes to memory simply and quickly e.g., RAM Middle range processor writes to memory, but slower e.g., FLASH, EEPROM (Electrically Erasable and Programmable Read Only Memory) Lower range special equipment, programmer, must be used to write to memory e.g., EPROM, OTP ROM (One Time Programmable Read Only Memory) Low end bits stored only during fabrication e.g., Mask-programmed ROM In-system programmable memory Can be written to by a processor in the embedded system using the memory Memories in high end and middle range of write ability
Storage permanence
It is the ability to hold the stored bits. Range of storage permanence High end essentially never loses bits e.g., mask-programmed ROM Version 2 EE IIT, Kharagpur 8
Middle range holds bits days, months, or years after memorys power source turned off e.g., NVRAM Lower range holds bits as long as power supplied to memory e.g., SRAM
Low end begins to lose bits almost immediately after written e.g., DRAM Nonvolatile memory Holds bits after power is no longer supplied High end and middle range of storage permanence
Store constant data needed by system Implement combinational circuit External view enable A0
2k n ROM
Ak-1
Qn-1 Example
Q0
The figure shows the structure of a ROM. Horizontal lines represents the words. The vertical lines give out data. These lines are connected only at circles. If address input is 010 the decoder sets 2nd word line to 1. The data lines Q3 and Q1 are set to 1 because there is a programmed Version 2 EE IIT, Kharagpur 9
connection with word 2s line. The word 2 is not connected with data lines Q2 and Q0. Thus the output is 1010 Internal view 8 4 ROM
word 0 enable
38 decoder
A0 A1 A2
Q3 Q2 Q1 Q0 Fig. 5.8 The example of a ROM with decoder and data storage
82 ROM
0 0 0 1 1 1 1 1 y 0 1 1 0 0 1 1 1 z
word 0 word 1
enable c b a
word 7
Mask-programmed ROM
The connections programmed at fabrication. They are a set of masks. It can be written only once (in the factory). But it stores data for ever. Thus it has the highest storage permanence. The bits never change unless damaged. These are typically used for final design of high-volume systems. Version 2 EE IIT, Kharagpur 10
0V floating
+15V
(b)
(a)
(d)
5-30 min
(c)
EEPROM
EEPROM is otherwise known as Electrically Erasable and Programmable Read Only Memory. It is erased typically by using higher than normal voltage. It can program and erase individual words unlike the EPROMs where exposure to the UV light erases everything. It has Version 2 EE IIT, Kharagpur 11
can be in-system programmable with built-in circuit to provide higher than normal voltage
built-in memory controller commonly used to hide details from memory user busy pin indicates to processor EEPROM still writing
can be erased and programmed tens of thousands of times Similar storage permanence to EPROM (about 10 years) Far more convenient than EPROMs, but more expensive
Flash Memory
It is an extension of EEPROM. It has the same floating gate principle and same write ability and storage permanence. It can be erased at a faster rate i.e. large blocks of memory erased at once, rather than one word at a time. The blocks are typically several thousand bytes large Writes to single words may be slower
Entire block must be read, word updated, then entire block written back Used with embedded systems storing large data items in nonvolatile memory e.g., digital cameras, TV set-top boxes, cell phones
bits are not held without power supply Read and written to easily by embedded system during execution Internal structure more complex than ROM a word consists of several memory cells, each storing 1 bit each input and output data line connects to each cell in its column rd/wr connected to every cell when row is enabled by decoder, each cell has logic that stores input data bit when rd/wr indicates write or outputs stored bit when rd/wr indicates read
external view
Qn-1
Q0
A0 A1
Memory cell
rd/wr
To every cell Q3 Q2 Q Q
Holds data as long as power supplied DRAM: Dynamic RAM Memory cell uses MOS transistor and capacitor to store bit More compact than SRAM Refresh required due to capacitor leak
Typical refresh rate 15.625 microsec. Slower to access than SRAM Version 2 EE IIT, Kharagpur 13
SRAM
DRAM
Data' Data
Data W
Ram variations
PSRAM: Pseudo-static RAM
Popular low-cost high-density alternative to SRAM NVRAM: Nonvolatile RAM Holds data after external power removed Battery-backed RAM
SRAM with own permanently connected battery writes as fast as reads no limit on number of writes unlike nonvolatile ROM-based memory
SRAM with EEPROM or flash stores complete RAM contents on EEPROM or flash before power
RAM: 62
11-13, 15-19
27,26,2,23,21,
24,25, 3-10 22 20
device characteristics Read operation data addr OE /CS1 CS2 data addr WE /CS1 CS2 timing diagrams Write operation
device characteristics
/WE /ADSP /OE /ADSC MODE /ADV /ADSP /ADSC /ADV CLK TC55V2325 FF-100 block diagram timing diagram addr <150> /WE /OE /CS1 and /CS2 CS3 data<310>
A0 Am-1 Am
enable
2m n ROM
Qn-1
Q0
2m 3n ROM
enable
2m n ROM
2m n ROM
2m n ROM
A0 Am
Q3n-1
Q2n-1
Q0
5.7 Conclusion
In this chapter you have learnt about the following 1. Basic Memory types 2. Basic Memory Organization 3. Definitions of RAM, ROM and Cache Memory Version 2 EE IIT, Kharagpur 17
4. Difference between Static and Dynamic RAM 5. Various Memory Control Signals 6. Memory Specifications 7. Basics of Memory Interfacing
5.8 Questions
Q1. Ans:
11-13, 15-19 2,23,21,24, 25, 3-10 22 27 20 26 data<70> addr<15...0> /OE /WE /CS1 CS2 HM6264
Discuss the various control signals in a typical RAM device (say HM626)
/OE: output enable bar: the output is enables when it is low. It is same as the read bar line /WE: write enable bar: the line has to made low while writing to this device CS1: chip select 1 bar: this line has to be made low along with CS2 bar to enable this chip Q2. Download the datasheet of TC55V2325FF chip and indicate the various signals.