# The Computer Memory Model - PowerPoint PPT Presentation  Download Presentation The Computer Memory Model

The Computer Memory Model
Download Presentation ## The Computer Memory Model

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### Presentation Transcript

1. The Computer Memory Model Everything derives from this

2. Address Data Memory J/K J/K J/K J/K J/K J/K J/K J/K r/w info stored in digital logic (J/K latches) therefore, only 1s and 0s

3. What if? • You were a computer designer and... • You needed to store information • and retrieve it? • info would be stored as numbers (numbers can “represent” anything) • numbers would be placed at addressable locations (addresses are numbered from 0 to some maximum)

4. why 1s and 0s • remember CSE241 • memory banks are J/K latches, capable of “remembering” a binary state • latches are grouped into banks merely to store more information than is possible in 1s and 0s • 1or 0 is a bit, 8 bits are a byte

5. store something in memory • there are 16 banks of 8 latches each • rules: r/w = 0 reads latches, = 1 sets latches • memory addresses 0 to 15 banks, or • 0000 to 1111 in binary • data size is 8 bits (number of latches in each bank) e.g. store the value 22 at location 10 • r=0 (passive) • address = 10102 (10 decimal) • data = 0001 01102 (22 decimal) • r/w=1, then r/w=0 (write strobe)

6. Address Data 15 Memory 0 1111 1111 r/w

7. How much memory is there, if the address bus is 8 bits? • How much memory if the address bus is 32 bits? • Does the size of the data bus matter? • This is a bigger deal than you might imagine • Should all memory behave the same?

8. A Byte • Eight bits • Can represent a number from 0 to 25510 • Reflect computer memory as a huge bank of 8-bit switches

9. Extending bytes • Use 7 bits 111 1111 - represent 0 to 12710 • Use the highest bit for “sign” 0 111 1111 127 1 111 1111 ( -127 )

10. 2’s Compliment Replaces the redundancy of 0000 0000 1000 0000 To get negative: take the positive number, “complement” all the bits, add 1 To get positive: take the negative number, “complement” all the bits, add 1

11. For example, Positive Integer 4 0000 0100 Compliment of 4 1111 1011 + 1 0000 0001 Negative Integer 4 1111 1100 ----------------------------------- 3 0000 0011 2 0000 0010 1 0000 0001 0 0000 0000 -1 1111 1111 -2 1111 1110 -3 1111 1101

12. Size of storable numbers? 4 bits: 0000 to 1111 16 different numbers, maximum number is 15, or 24- 1 for unsigned -8 to +7 for signed two’s compliment 8 bits? 28=256 different numbers maximum number is 28 -1 = 255 for unsigned -27 to +(27-1) = -128 to 127 for signed

13. Difference between address and data • Address : number of different locations is important: 32 bit means 232 different locations • Data : range is important: 32 bit means -231 to+(231 - 1) for signed numbers 0 to +(232 - 1) for unsigned numbers

14. 0000 - 0 0001 - 1 0010 - 2 0011 - 3 0100 - 4 0101 - 5 0110 - 6 0111 - 7 1000 - 8 1001 - 9 1010 -10 - A 1011 -11 - B 1100 -12 - C 1101 -13 - D 1110 -14 - E 1111 -15 - F Start Thinking Binary Nibbles and Hex Digits

15. Converting Binary to Hex 1010011110011110101100110100 step 1: break into “nibbles” 1010 0111 1001 1110 1011 0011 0100 step 2: convert each to Hex number 1010 0111 1001 1110 1011 0011 0100 A 7 9 E B 3 4

16. Converting Hex to Binary 26D47FE16 2 6 D 4 7 F E 0010 0110 1101 0100 0111 1111 1110

17. “Literals” • Hard numbers • 0, 15, 121, 78716 etc.

18. Java Support for Binary / Hex From the Java Reference Manual: Integer literals are written in three formats: decimal (base 10), hexadecimal (base 16), and octal (base 8). Decimal literals are written as ordinary numbers, hexadecimal literals always begin with 0X or 0x, and octal literals begin with 0. For example, the decimal number 10 is 0xA or 0XA in hexadecimal format, and 012 in octal format.

19. what does that mean? 0x1234 means 123416, which means 466010 0xAEF4 means 4478810

20. why? 0 x 1AF4 can be converted easily into binary 1 A F 4 0001 1010 1111 0100 So hex shows up in programming all the time, because binary is the computer’s interface to the world

22. Address Data Memory J/K J/K J/K J/K J/K J/K J/K J/K r/w info stored in digital logic (J/K latches) therefore, only 1s and 0s

23. store something in memory • there are 16 banks of 8 latches each • rules: r/w = 0 reads latches, = 1 sets latches • memory addresses 0 to 15 banks, or • 0000 to 1111 in binary • data size is 8 bits (number of latches in each bank) e.g. store the value 22 at location 10 • r=0 (passive) • address = 10102 (10 decimal) • data = 0001 01102 (22 decimal) • r/w=1, then r/w=0 (write strobe)

24. Address bus size determines how many separately addressable banks Data bus size determines how many bits in a bank J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K select J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K decoder J/K J/K J/K J/K J/K J/K J/K J/K binary r/w

25. Address bus size determines how many separately addressable banks Data bus size determines how many bits in a bank J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K rw = 0 out J/K J/K J/K J/K J/K J/K J/K J/K in rw = 1 r/w

26. I/0 Memory Data Memory Program Memory Fast Specialty Memory

27. What goes in Program Memory? • What goes in Data Memory? • What’s the difference between address and data? • Why “Specialty” Memory? • What goes “in” Memory-Mapped I/O?

28. Address bus size determines how many separately addressable banks Data bus size determines how many bits in a bank Memory J/K J/K J/K J/K J/K J/K J/K J/K r/w

29. Design dilemma #1 Should the number of bits in a bank, be greater than the data bus size? 16 bit memory, but only 8 bit data 2 write cycles to fill up each address No. That just wastes time.

30. Design dilemma #2 What if the “computer” uses and needs numbers that are larger than the data bus? Now... this one is real. 8 bit data bus can only pass around numbers, like, -128 to 127. Virtually useless.

31. Data Storage • Address size is usually 32 bits 232 different locations 0 to 232-1 • Data bus and memory banks that store data are usually 8 bits wide Numbers limited to 0 to 255 (or -128 to 127) • How then, do you store bigger numbers? say, 32 bits = 4 bytes = 8 hex digits = 1 word - 429497296 to + 429497295. Now that’s reasonable.

32. So “numbers” in the computer are ALWAYS stored as 4 bytes, or 8 hex digits

33. Address bus size determines how many separately addressable banks Data bus size determines how many bits in a bank J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K J/K 4 bytes (4 address locations), always regarded as one computer “word” r/w

34. 4 bytes (4 address locations), always regarded as one computer “word” e.g 0x A2 01 C4 FF Data Memory 4 FF 5 C4 01 6 A2 7 0 A2 1 01 2 C4 FF 3

35. which end of the Word goes in the lower address? • does the big end of the number go in address 0? (big endian) • does the little end of the number go in address 0? (little endian) • Big Endian: words are stored with Big byte low • Little Endian: words are stored with Little byte low

36. the “representation” • constructs are designed and stored and routed and presented for simplest, fastest, easiest manufacturing • what they represent may be complicated

37. Fast Specialty Memory dependable, 32-bit memory blocks: called “registers” a counter for tracking where in data memory you currently are: called a “stack pointer” a counter for tracking where your program is: program counter (means that program memory can be within data memory)

38. The Architecture Golden Rules • Account for memory volatility - dependable storage and retrieval • Maximize throughput - reduce the time it takes to perform an operation, especially storage and retrieval • Separate encoding of information from hardware - data is stored fast and dependably (see above), but what it means is up to the user.

39. Assignment 3 – due in two weeks Part 1: • Build a Java (or any language) based memory simulator • memory: 00 thru ff (8 bit addressing) • data is 8 bits • stores data on Write function • takes data in Base 10 Integer • limit data to -128 to +127, 2’s complement • takes address in Hex • memory dump - show contents of 00-ff in Hex

40. Assignment 3 Part 2: Take in 32 bit word storage as big Base 10 integer Limit input to numbers possible using 32 bits Ask for storage address in Hex, use the next highest 4-byte boundary. Store data words in big endian format Display on memory dump