The von Neumann Model – Chapter 4

Download Report

Transcript The von Neumann Model – Chapter 4

1
The von Neumann Model –
Chapter 4
COMP 2620
Dr. James Money
COMP 2620
2
Dr. James Money COMP
2620
Basic Components
• We need two things to get a task done on a
computer:
1. A computer program to do the task
2. 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!
3
Dr. James Money COMP
2620
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
4
Dr. James Money COMP
2620
Basic Components
MEMORY
MAR
MDR
INPUT
OUTPUT
Keyboard
Mouse
Scanner
Disk
Monitor
Printer
LED
Disk
PROCESSING UNIT
ALU
TEMP
CONTROL UNIT
PC
IR
5
Dr. James Money COMP
2620
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
6
Dr. James Money COMP
2620
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
7
Dr. James Money COMP
2620
Memory
• Common prefixes:
▫ Kilo= 1024 bytes =210 bytes
▫ Mega = 1024 Kilo
▫ Giga = 1024 Mega
• How many bytes in 2GB of
memory?
8
Dr. James Money COMP
2620
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
9
Dr. James Money COMP
2620
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
10
Dr. James Money COMP
2620
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
11
Dr. James Money COMP
2620
Memory
• How to write:
1. Place the address we want to write to in the
MAR
2. Place the value we wish to write in the MDR
3. We issue the memory command with the Write
Enable signal
4. The value in MDR is written to address MAR
12
Dr. James Money COMP
2620
Memory
• How to read:
1. Place the address to read in the MAR
2. Issue the memory command without Write
Enable
3. Read the value from MDR
13
Dr. James Money COMP
2620
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
14
Dr. James Money COMP
2620
Memory
000
001
010
011
100 00000110
101
110 00000100
111
15
Dr. James Money COMP
2620
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
…
16
Dr. James Money COMP
2620
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??)
17
Dr. James Money COMP
2620
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
18
Dr. James Money COMP
2620
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
19
Dr. James Money COMP
2620
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
20
Dr. James Money COMP
2620
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
21
Dr. James Money COMP
2620
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
22
Dr. James Money COMP
2620
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