INSIDE THE
COMPUTER
Inside CPUs
(cont’)
ALU (arithmetic/logic unit)
Performs arithmetic functions such as add,
subtract, multiply, and divide, and logic
functions such as AND, OR, and NOT
Program counter
Points to the address of the next
instruction to be executed
As each instruction is executed, the program
counter is incremented to point to the address
of the next instruction to be executed
Instruction decoder
Interprets the instruction fetched into the
CPU
A CPU capable of understanding more
instructions requires more transistors to design
INSIDE THE
COMPUTER
Internal
Working of
Computers
Ex. A CPU has registers A, B, C, and D and it has an 8-bit
data bus and a 16-bit address bus. The CPU can access
memory from addresses 0000 to FFFFH
Assume that the code for the CPU to move a value to
register A is B0H and the code for adding a value to
register A is 04H
The action to be performed by the CPU is to put 21H into
register A, and then add to register A values 42H and 12H
...
INSIDE THE
COMPUTER
Internal
Working of
Computers
(cont’)
Ex. (cont’)
Action Code Data
Move value 21H into reg. A B0H 21H
Add value 42H to reg. A 04H 42H
Add value 12H to reg. A 04H 12H
Mem. addr. Contents of memory address
1400 (B0) code for moving a value to register A
1401 (21) value to be moved
1402 (04) code for adding a value to register A
1403 (42) value to be added
1404 (04) code for adding a value to register A
1405 (12) value to be added
1406 (F4) code for halt
...
INSIDE THE
COMPUTER
Internal
Working of
Computers
(cont’)
Ex. (cont’)
The actions performed by CPU are as follows:
1. The program counter is set to the value 1400H,
indicating the address of the first instruction code to
be executed
2.
The CPU puts 1400H on address bus and sends it
out
The memory circuitry finds the location
The CPU activates the READ signal, indicating to
memory that it wants the byte at location 1400H
This causes the contents of memory location
1400H, which is B0, to be put on the data bus and
brought into the CPU
...
INSIDE THE
COMPUTER
Internal
Working of
Computers
(cont’)
Ex. (cont’)
3.
The CPU decodes the instruction B0
The CPU commands its controller circuitry to bring
into register A of the CPU the byte in the next
memory location
The value 21H goes into register A
The program counter points to the address of the
next instruction to be executed, which is 1402H
Address 1402 is sent out on the address bus to
fetch the next instruction
...
0 Comments