Unit1 1.4&1.5 Neumann Instruct
Unit1 1.4&1.5 Neumann Instruct
1
Outline
2
Unit-1_1.4
VON NEUMANN ARCHITECTURE
3
The Von Neumann Architecture
• All computers more or less based on the same basic design, the Von Neumann Architecture!
4
The Von Neumann Architecture
• Model for designing and building computers, based on the following three characteristics:
Processor (CPU)
Memory Input-Output
Control Unit
ALU
Store data and program Communicate with
"outside world", e.g.
• Screen
• Keyboard
Execute • Storage devices
program • ...
Do arithmetic/logic operations
requested by program
Simplified Architecture
Source: Wikipedia
Memory Subsystem
– Program
– Data (variables)
are stored in the memory.
RAM
...
2N-1
W
Memory Size / Speed
• Memory sizes:
– Kilobyte (KB) = 210 = 1,024 bytes ~ 1 thousand
– Megabyte(MB) = 220 = 1,048,576 bytes ~ 1 million
– Gigabyte (GB) = 230 = 1,073,741,824 bytes ~ 1 billion
• RAM is
– volatile (can only store when power is on)
– relatively expensive
Operations on Memory
• Fetch (address):
– Fetch a copy of the content of memory cell with the specified address.
– Non-destructive, copies value in memory cell.
•Fetch(address)
–Load address into MAR.
–Decode the address in MAR.
–Copy the content of memory cell with specified address into
MDR.
•Store(address, value)
–Load the address into MAR.
–Load the value into MDR.
–Decode the address in MAR
–Copy the content of MDR into memory cell with the
specified address.
Input/Output Subsystem
• Solution:
– I/O Controller, a special purpose processor:
• Has a small memory buffer, and a control logic to control I/O device (e.g. move disk arm).
• Sends an interrupt signal to CPU when done read/write.
– Data transferred between RAM and memory buffer.
– Processor free to do something else while I/O controller reads/writes data from/to device into I/O
buffer.
Structure of the I/O Subsystem
The ALU Subsystem
• Registers:
– Very fast local memory cells, that store
operands of operations and
intermediate results.
– CCR (condition code register), a
special purpose register that stores the
result of <, = , > operations
• ALU circuitry:
– Contains an array of circuits to do
mathematical/logic operations.
• Bus:
– Data path interconnecting the registers
to the ALU circuitry.
The Control Unit
INTERPRETATION OF INSTRUCTION
20
Machine Language Instructions
• Example: ADD X, Y (Add content of memory locations X and Y, and store back in memory
location Y).
• PC (Program Counter):
– stores the address of next instruction to fetch
• IR (Instruction Register):
– stores the instruction fetched from memory
• Instruction Decoder:
– Decodes instruction and activates necessary circuitry
PC IR
+1
Instruction
Decoder
Instruction Set Design
• Notation:
• Arithmetic
– ADD X, Y, Z CON(Z) = CON(X) + CON(Y)
– ADD X, Y CON(Y) = CON(X) + CON(Y)
– ADD X R = CON(X) + R
– similar instructions for other operators, e.g. SUBTR,OR, ...
• Compare
– COMPARE X, Y
Compare the content of memory cell X to the content of memory cell Y and set the condition codes
(CCR) accordingly.
– E.g. If CON(X) = R then set EQ=1, GT=0, LT=0
Machine Instructions (cont.)
• Branch
– JUMP X Load next instruction from memory loc. X
– JUMPGT X Load next instruction from memory loc. X
only if GT flag in CCR is set, otherwise load statement from next sequence
loc. as usual.
• JUMPEQ, JUMPLT, JUMPGE, JUMPLE,JUMPNEQ
• Control
– HALT Stop program execution.
Example
• Pseudo-code: Set A to B + C
• Assuming variable:
– A stored in memory cell 100, B stored in memory cell 150, C stored in memory cell 151
• Pseudo-code: Set A to B + C
• Assuming variable:
– A stored in memory cell 100, B stored in memory cell 150, C stored in memory cell 151
• Program Execution:
– PC is set to the address where the first program instruction is stored in memory.
– Repeat until HALT instruction or fatal error
Fetch instruction
Decode instruction
Execute instruction
End of loop
Program Execution (cont.)
• Fetch phase
• Decode Phase
– Instruction decoder will then generate the signals to activate the circuitry to carry out the
instruction
Program Execution (cont.)
• Execute Phase
– Differs from one instruction to the next.
• Example:
– LOAD X (load value in addr. X into register)
• IR_address -> MAR
• Fetch signal
• MDR --> R
– ADD X
• left as an exercise
Instruction Set for Von Neumann Machine
Opcode Operation Meaning
0000 LOAD X CON(X) --> R
0001 STORE X R --> CON(X)
0010 CLEAR X 0 --> CON(X)
0011 ADD X R + CON(X) --> R
0100 INCREMENT X CON(X) + 1 --> CON(X)
0101 SUBTRACT X R - CON(X) --> R
0101 DECREMENT X CON(X) - 1 --> CON(X)
0111 COMPARE X If CON(X) > R then GT = 1 else 0
If CON(X) = R then EQ = 1 else 0
If CON(X) < R then LT = 1 else 0
36
Modified Harvard Architecture
37
THANK YOU
38