Академический Документы
Профессиональный Документы
Культура Документы
UNIT 2 MEMORIES
Chapter Objectives
Stored Program Concept Addressing
Commodity Memories
Timing
Chapter Objectives
Reality of Memory Decoding Filling the Memory Map
Chapter Objectives
Caches
Read Only Memory (ROM) Punch Cards Harvard Architecture Current Memory Technology ROM / PROM
Chapter Objectives
More Electrostatic Memories
More Magnetic Memories Full Address Decoding
Magnetic Memories
Chapter Objectives
Designing Address Decoders
Address Decoding with Random Logic Address Decoding with m-line-to-nline Decoders
SECTION 1:
MEMORY
Thus a bit pattern 01000001 could either represent the number 65 or a JUMP instruction.
Commodity Memories
All von Neumann computers need memory (some small others large) Small memories (a few Kbytes) are often on-chip with processors, etc. Large memories could be in one or more modules Several types of memory exist (cost trade-offs vary according to the system requirement)
Memory Chips
The memory device shown is a 628512. This is a 4Mbit SRAM chip organized as 512 Kwords of 8 bits each. It therefore requires nineteen address lines and eight data lines.
Points to note:
All the control signals are active low
If the chip is not selected (/CS = H), nothing happens Write enable overrides read operations The data bus is bidirectional (either read or write saves pins)
Timing Issues
When writing to memory it is important that the correct data is written to the correct location; it is also important to ensure that no other memory locations are corrupted. It is important that the address is stable during the write operation; if it is not, other locations may also be affected. (see timing diagram)
Timing (contd)
Timing cont(2)
Different processors (& different implementations) encode timing differently. This is okay, as long as timing is included somewhere.
Addressing
Some definitions: Byte now standardized as eight bits. Word the natural size of operands, which varies from processor to processor (16 bits in MU0, 32 bits in ARM). Usually the width of the data bus. Nibble four bits or half a byte
Definitions cont
Width the number of bits in a bus or a register Address range the number of elements which can be addressed.
Type what the data represents. This is really a software concept in that the hardware (usually) does not care whether a word is to be interpreted as an instruction, an integer, a float, an address . This may, however, influence the size of the transfer.
Addressing
Within the CPU it is common for several things to happen in parallel; The memory only performs one operation at once. This operation requires the answers to the questions:
Do what? Control (read or write) With what? Data Where? Address
Addressing cont
Because only one operation is happening at a time the control signals and the data bus can be shared over the whole memory. The address bus provides a code to specify which location is being used (addressed).
Commodity Memories
D-type flip-flops
Convenient for synchronous logic (e.g. FSMs) Very large area per bit
Transparent latches
Okay for logic but not as convenient
Smaller than D-types, but still large
DRAM
Very small area per bit
Memory Decoding
In reality a memory address may not always refer to one memory location. For example an ARM processor can address memory in 32-bit words or 8-bit bytes (or 16bit halfwords) and the memory system must be able to support all access sizes.
Thus the least significant bit used by the address decoder is A[2];
A[1] and A[0] act as byte selects, which will be ignored when performing word-wide operations.
produces a 32-bit byte address. can perform read and write operations with 32-, 16- and 8-bit data.
Cleaner address space left just for true memory I/O space referenced with different instructions (e.g. IN and OUT )
limited addressing modes and, possibly, a smaller address range
Endianness
Refers to the way sub-elements are numbered within an element, for example the way bytes are numbered in a word. Two types Little endian and Big endian By convention the bytes-in-a-word definition tends to dominate, thus a big-endian processor will typically still number its bits in a little-endian fashion .
If a byte load was performed on the same address the result would be: 00000012 NB: Choice of endianness in a given processor is arbitrary.
Memory Hierarchy
For a given price
big memory = slow memory small memory = fast memory
If a programme has to run from main memory it will only run at the speed at which its instructions can be read.
Caches
Two observations:
Large memories (at an economical price) tend to be slower than small ones. A program spends 90% of its time using 10% of the available address space.
Caches cont
If you can organize things so that the most used address space is in fast memory, then you can get startling improvements at relatively small cost. This is sometimes manually possible. Eg. Embedded controllers where software is fixed.
Caches cont(2)
In general purpose machines (e.g. PCs) the code is dynamic . A cache memory adapts itself to prevailing conditions by allowing the addresses it occupies to change as the program runs. It relies on
Spatial Locality guessing that if an address is used others nearby are likely to be wanted. Temporal Locality guessing that if an address has been used it is likely to be used again in the near future.
Cache Hierarchies
Caches work so well that it is now common practice to have a cache of the cache. This introduces several levels of cache or a cache hierarchy. The first level (or L1) cache will be integrated with the processor silicon (onchip).
Harvard Architecture
Normally refers to stored program computers with separate instruction and data buses. This separation may apply to the entire memory architecture or may be limited to the cache architecture . (see next two slide)
The Harvard architecture logically separates the fetching of instructions from data reads and writes.
You might like to identify and label the buses here. Where should the I/O be in each?
Memories
RAM Random Access Memory (by convention used for memory which is readable and writeable)
RAM forgets when the power is turned off
The address space of a computer will normally contain RAM ROM Read Only Memory (cannot be written to)
Used to hold fixed programs
Its big advantage is that it gives very dense storage Typical application: main memory of a PC (large, costeffective)
Require much more time to alter a location (writes take >100x the read time) than RAM
SECTION 2
Address Decoding
Although memory space is said to be flat, it does not mean the physical implementation is homogenous
Different portions of memory are used for different purposes: RAM, ROM, I/O Even if all the memory was of one type, we still have to implement it using multiple ICs
Address Decoding
This means that for a given valid address, one and only one memory-mapped component must be accessed Address decoding is the process of generating chip select (CS*) signals from the address bus for each device in the system
The address bus lines are split into two sections the N most significant bits are used to generate the CS* signals for the different devices the M least significant signals are passed to the devices as addresses to the different memory cells or internal registers
Recall
Solution
We will need 8 memory chips (8x128=1024) We will need 3 address lines to select each one of the 8 chips Each chip will need 7 address lines to address its internal memory cells With this example, all the address space was implemented. However this might not always be the case.
0 1 X X X
ROM2
PERI1 PERI2
0 0 0 0
0 0 0 0 0 0 0 0
0
0 0
0 0 0 0 0
0 0 0 0 1 0 0 0 0 1
1 X X
0 0 0 0 0 0
X X X X
0 0 0 0 0 0 0 0
X X
0 0 0 0
X X
0 0 0 0
X X
0 0 0 1
X
X X
Example
Lets assume the same microprocessor with 10 address lines (1KB memory) However, this time we wish to implement only 512 bytes of memory We still must use 128-byte memory chips Physical memory must be placed on the upper half of the memory map
Solution
Memory Map
X X X X
0 0 0 0 1
0 0 1 1
0 1 0 1
Also, recall
DEVICE
ADDRESS RANGE
ROM1
ROM2
4K
4K
000000 000FFF
001000 001FFF
ROM3
RAM
4K
2K
002000 002FFF
00C000 00C7FF
PERI1
PERI2 PERI3
256
256 256
00E000 00E0FF
00E100 00E1FF 00E200 00E2FF
System Address Lines Address range of A15 A14 A13 A12 A11 CPU PROM Address Input A4 A3 A2 A1 A0
System Device Enables PROM1 PROM2 PROM3 RAM1 PERIs PROM Data Output D7 D6 D5 D4 D3 D2 D1 D0
000000-0007FF 0
000800-000FFF 0 001000-0017FF 0 001800-001FFF 0 002000-0027FF 0 002800-002FFF 0 003000-0037FF 0 003800-003FFF 0 ----------
0
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
0
0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1
0
0 1 1 0 0 1 1 1 0 0 1 1 0 0 1 1
0
1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1
0
0 1 1 1 1 1 1 -do1 1 1 1 1 1 1 1 1
1
1 0 0 1 1 1 1 -do1 1 1 1 1 1 1 1 1
1
1 1 1 0 0 1 1 -do1 1 1 1 1 1 1 1 1
1
1 1 1 1 1 1 1 -do1 0 1 1 1 1 1 1 1
1
1 1 1 1 1 1 1 -do1 1 1 1 1 0 1 1 1
1
1 1 1 1 1 1 1
1
1 1 1 1 1 1 1
1
1 1 1 1 1 1 1