DOC PREVIEW
U of I CS 231 - Lecture notes

This preview shows page 1 out of 4 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

11/3/2003 Random Access Memory 1Random access memory• Sequential circuits all depend upon the presence of memory.– A flip-flop can store one bit of information.– A register can store a single “word,” typically 32-64 bits.• Random access memory, or RAM, allows us to store even larger amounts of data. Today we’ll see:– The basic interface to memory.– How you can implement static RAM chips hierarchically.• This is the last piece we need to put together a computer!11/3/2003 Random Access Memory 2Introduction to RAM• Random-access memory, or RAM, provides large quantities of temporary storage in a computer system.• Remember the basic capabilities of a memory: – It should be able to store a value.– You should be able to read the value that was saved.– You should be able to change the stored value.• A RAM is similar, except that it can store many values.– An address will specify which memory value we’re interested in.– Each value can be a multiple-bit word (e.g., 32 bits).• We’ll refine the memory properties as follows:A RAM should be able to:- Store many words, one per address- Read the word that was saved at a particular address- Change the word that’s saved at a particular address11/3/2003 Random Access Memory 3Picture of memory• You can think of computer memory as being one big array of data.– The address serves as an array index.– Each address refers to one word of data.• You can read or modify the data at any given memory address, just like you can read or modify the contents of an array at any given index.• If you’ve worked with pointers in C or C++, then you’ve already worked with memory addresses. Address Data000000000000000100000002..........FFFFFFFDFFFFFFFEFFFFFFFF11/3/2003 Random Access Memory 4Block diagram of RAM• This block diagram introduces the main interface to RAM. – A Chip Select, CS, enables or disables the RAM.– ADRS specifies the address or location to read from or write to.– WR selects between reading from or writing to the memory.4To read from memory, WR should be set to 0.OUT will be the n-bit value stored at ADRS.4To write to memory, we set WR = 1.DATA is the n-bit value to save in memory.• This interface makes it easy to combine RAMs together, as we’ll see.2kx n memoryADRS OUTDATACSWRknnCS WR Memory operation0 x None1 0 Read selected word1 1 Write selected word11/3/2003 Random Access Memory 5Memory sizes• We refer to this as a 2kx n memory.– There are k address lines, which can specify one of 2kaddresses.– Each address contains an n-bit word.• For example, a 224x 16 RAM contains 224= 16M words, each 16 bits long.– The RAM would need 24 address lines.– The total storage capacity is 224x 16 = 228bits.2kx n memoryADRS OUTDATACSWRknn11/3/2003 Random Access Memory 6Size matters!• Memory sizes are usually specified in numbers of bytes (8 bits).• The 228-bit memory on the previous page translates into:228bits / 8 bits per byte = 225bytes• With the abbreviations below, this is equivalent to 32 megabytes.• To confuse you, RAM size is measured in base 2 units, while hard drive size is measured in base 10 units.– In this class, we’ll only concern ourselves with the base 2 units.Prefix Base 2 Base 10K Kilo 210 = 1,024 103 = 1,000M Mega 220 = 1,048,576 106 = 1,000,000G Giga 230 = 1,073,741,824 109 = 1,000,000,00011/3/2003 Random Access Memory 7Typical memory sizes• Some typical memory capacities:– PCs usually come with 128-256MB RAM.– PDAs have 8-64MB of memory.– Digital cameras and MP3 players can have 32MB or more of storage.• Many operating systems implement virtual memory, which makes the memory seem larger than it really is.– Most systems allow up to 32-bit addresses. This works out to 232, or about four billion, different possible addresses.– With a data size of one byte, the result is apparently a 4GB memory!– The operating system uses hard disk space as a substitute for “real” memory. Address Data000000000000000100000002..........FFFFFFFDFFFFFFFEFFFFFFFF11/3/2003 Random Access Memory 8Reading RAM• To read from this RAM, the controlling circuit must:– Enable the chip by ensuring CS = 1.– Select the read operation, by setting WR = 0.– Send the desired address to the ADRS input.– The contents of that address appear on OUT after a little while.• Notice that the DATA input is unused for read operations.2kx n memoryADRS OUTDATACSWRknn11/3/2003 Random Access Memory 9Writing RAM• To write to this RAM, you need to:– Enable the chip by setting CS = 1.– Select the write operation, by setting WR = 1.– Send the desired address to the ADRS input.– Send the word to store to the DATA input.• The output OUT is not needed for memory write operations.2kx n memoryADRS OUTDATACSWRknn11/3/2003 Random Access Memory 10Static memory• How can you implement the memory chip?• There are many different kinds of RAM.– We’ll start off discussing static memory, which is most commonly used in caches and video cards.– Later we mention a little about dynamic memory, which forms the bulk of a computer’s main memory.• Static memory is modeled using one latch for each bit of storage.• Why use latches instead of flip flops?– A latch can be made with only two NAND or two NOR gates, but a flip-flop requires at least twice that much hardware.– In general, smaller is faster, cheaper and requires less power.– The tradeoff is that getting the timing exactly right is a pain.11/3/2003 Random Access Memory 11Starting with latches• To start, we can use one latch to store each bit. A one-bit RAM cell is shown here.• Since this is just a one-bit memory, an ADRS input is not needed.• Writing to the RAM cell:– When CS = 1 and WR = 1, the latch control input will be 1.– The DATA input is thus saved in the D latch.• Reading from the RAM cell and maintaining the current contents:– When CS = 0 or when WR = 0, the latch control input is also 0, so the latch just maintains its present state.– The current latch contents will appear on OUT. 11/3/2003 Random Access Memory 12My first RAM• We can use these cells to make a 4 x 1 RAM. • Since there are four words, ADRS is two bits.• Each word is only one bit, so DATA and OUT are one bit each.• Word selection is done with a decoder attached to the CS inputs of the RAM cells. Only one cell can be read or written at a time.• Notice that the outputs are connected together with a single


View Full Document

U of I CS 231 - Lecture notes

Documents in this Course
Counters

Counters

23 pages

Latches

Latches

22 pages

Lecture

Lecture

33 pages

Lecture

Lecture

16 pages

Lecture

Lecture

4 pages

Datapaths

Datapaths

30 pages

Lecture

Lecture

6 pages

Registers

Registers

17 pages

Datapaths

Datapaths

28 pages

Decoders

Decoders

20 pages

Load more
Download Lecture notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?