22
The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Embed Size (px)

Citation preview

Page 1: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

The von Neumann Model – Chapter 4COMP 2620

Dr. James Money COMP 2620

1

Page 2: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Basic Components

•We need two things to get a task done on a computer:1. A computer program to do the task2. The computer itself to do the task

•A computer program is the set of instructions that carries out the work

•The instruction is the smallest piece of work the computer can do – it cannot carry out only a part of an instruction!

Dr. James Money COMP 2620

2

Page 3: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Basic Components

•John von Neumann proposed the model we use for computers in 1946

•There are five parts:▫Memory▫Processing Unit▫Input▫Output▫Control Unit

•Together, these are called the von Neumann model

Dr. James Money COMP 2620

3

Page 4: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Basic Components

Dr. James Money COMP 2620

4

M E M ORY

CON TR OL UN IT

M AR M D R

IR

P R OCE S S IN G UN IT

ALU TE M P

P C

OUTP UTM on ito rP rin terLE DD is k

IN P UTK eyboardM ous eS c anne rD is k

Page 5: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Memory

•Before, we constructed a simple 22 by 3 bit memory using gates and latches

•However, most memory today is 8 bits•We might have something on the order of

228 memory locations•Call say the memory has an address space

of 228 and an addressability of 8 bits

Dr. James Money COMP 2620

5

Page 6: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Memory

•We usually refer to the memory as 256 megabyte where “256 mega” refers to the 228 locations

•The “byte” refers to the fact the memory locations are 8 bit

•By definition, byte, is 8 bits

Dr. James Money COMP 2620

6

Page 7: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Memory

•Common prefixes:▫Kilo= 1024 bytes =210 bytes▫Mega = 1024 Kilo▫Giga = 1024 Mega

•How many bytes in 2GB of memory?

Dr. James Money COMP 2620

7

Page 8: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Memory

•We recall that if we have 1 bit, there are two possible values

•If there are two bits, we have 4 = 22 values

•So, for eight bits, there are 28=256 values•In general, if we have k bits, then there

are 2k

possible values

Dr. James Money COMP 2620

8

Page 9: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Memory

•Thus, if we have 228 memory locations, we need 28 bits to store an address

•On the LC-3 in chapter 5, we will see that the computer we use has a memory address space of 216

•The addressability on the LC-3 is 16 bits

Dr. James Money COMP 2620

9

Page 10: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Memory

•How to we read or write to memory?•We need to first specify the location we

want to access•On the LC-3, we place the memory location

in the memory address register(MAR)•Then, we can read or write that part of

memory•The memory data register(MDR) contains

the value that is read or the value to write

Dr. James Money COMP 2620

10

Page 11: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Memory

•How to write:1. Place the address we want to write to in

the MAR2. Place the value we wish to write in the

MDR3. We issue the memory command with the

Write Enable signal4. The value in MDR is written to address

MAR

Dr. James Money COMP 2620

11

Page 12: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Memory

•How to read:1. Place the address to read in the MAR2. Issue the memory command without

Write Enable3. Read the value from MDR

Dr. James Money COMP 2620

12

Page 13: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Memory

•Let us re-emphasize memory has two properties:▫The address of the memory location▫The value stored in that memory location

•This is like post office boxes:▫There are numbers on the boxes▫Each box has mail in it

Dr. James Money COMP 2620

13

Page 14: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Memory

Dr. James Money COMP 2620

14

000

001

010

011

100 00000110

101

110 00000100

111

Page 15: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Processing Unit

•The processing of information is carried out by the processing unit

•The processing unit in modern computer can have many complex parts each dedicated to a particular function▫Divide▫Multiply▫square root▫…

Dr. James Money COMP 2620

15

Page 16: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Processing Unit

•The simplest form is the Arithmetic and Logic Unit, denoted ALU

•It performs:▫Basic arithmetic – add, subtract▫Basic logic – bitwise AND, OR, and NOT

•The LC-3 has an ALU which can perform ADD, AND, and NOT

•(Side note, how to we do OR??)

Dr. James Money COMP 2620

16

Page 17: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Processing Unit

•The size processed by the ALU is referred to as the word length and each element is referred to as a word

•On the LC-3, the ALU works in 16 bit quantities

•Thus, the word length is 16 bits•This differs depending on the ISA•On x86 it can be 32 or 64 bits depending

on the mode of operation• It can be as little as 8 bits

Dr. James Money COMP 2620

17

Page 18: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Processing Unit

•On most processing units, there is some form of temporary storage

•This storage is typically “within” the ALU for speed

•Example: Compute (a+b)·c▫First compute a+b and store▫Then, take that value and multiply by c

Dr. James Money COMP 2620

18

Page 19: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Processing Unit•Why not just use memory?

▫Speed is slow compared to the operations•Memory access is typically many times slower

than the addition and multiply operation•Thus, by using local storage in the ALU, we

avoid the one extra memory hit•Most commonly, this storage is extra registers•The LC-3 has eight registers: R0,R1,…,R7 with

16 its each•The SPARC-V9 has 32(R0,…R31) with 64 bits

Dr. James Money COMP 2620

19

Page 20: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Input and Output

•We need to get the information into the computer somehow▫Input provides this capability

•Then we must do something with the data▫Output allows us to do that

•Together, they are generically called peripherals because they are like accessories for the computer

•However, they are no less important

Dr. James Money COMP 2620

20

Page 21: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Input and Output

•The LC-3 has two such devices▫Keyboard for input▫Monitor for output

•Other systems have many more▫Mouse▫LED display▫Scanner▫Printer▫Floppy disk▫Punch cards

Dr. James Money COMP 2620

21

Page 22: The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP 2620 1

Control Unit

•The control unit handles all the other units

•The control unit keeps track of the running program in memory

•There are two main registers for the control unit:▫Instruction register – contains the

instruction that is currently processing▫Program Counter(PC) – has the address of

the next instruction to execute

Dr. James Money COMP 2620

22