1 / 40

# Computer Memory Model and assignment 3 - PowerPoint PPT Presentation

The Computer Memory Model. Everything derives from this. 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. What if?. You were a computer designer and... You needed to store information

Related searches for Computer Memory Model and assignment 3

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about 'Computer Memory Model and assignment 3' - Audrey

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

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

### The Computer Memory Model

Everything derives from this

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

• 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)

• 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

• 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)

Data

15

Memory

0

1111 1111

r/w

• Eight bits

• Can represent a number from 0 to 25510

• Reflect computer memory as a huge bank of 8-bit switches

• Use 7 bits

111 1111 - represent 0 to 12710

• Use the highest bit for “sign”

0 111 1111 127

1 111 1111 ( -127 )

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

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

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

• 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

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

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

26D47FE16

2 6 D 4 7 F E

0010 0110 1101 0100 0111 1111 1110

• Hard numbers

• 0, 15, 121, 78716 etc.

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.

0x1234 means 123416, which means 466010

0xAEF4 means 4478810

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

Data

Memory

r/w

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

• 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)

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

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

I/0 Memory banks

Data Memory

Program Memory

Fast Specialty Memory

• What goes in Program Memory? banks

• What goes in Data Memory?

• What’s the difference between address and data?

• Why “Specialty” Memory?

• What goes “in” Memory-Mapped I/O?

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

Design dilemma #1 banks

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.

Design dilemma #2 banks

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.

Data Storage banks

• 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.

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

4 bytes (4 address locations), always banksregarded 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

• 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

the “representation” banks

• constructs are designed and stored and routed and presented for simplest, fastest, easiest manufacturing

• what they represent may be complicated

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)

• 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.

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

• memory dump - show contents of 00-ff in Hex

Assignment 3 banks

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