2. Memory
A memory chip is used to store
all our data. A chip which is set
next to the CPU as it makes
direct contact with the CPU.
• Volotile - stores data temporarily, It
means that when the computer is
switched off, that particular data is
removed completely from the system.
E.g. RAM
• Non-volotile - stores data permanently,
it means that when the computer is
switched off all data remains stored in
the system. E.g. ROM
4. What is Machine Code?
Machine code is the only form of program
instructions that the computer hardware
can understand and execute directly. All
other forms of computer language must be
translated into machine code in order to be
executed by the hardware. E.g. Assembly
language
Assembly language is a symbolic
representation of machine code, which
allows programmers to write programs in
machine code without having to deal with
the long binary strings.
5.
Assembly Language is made up
of op-codes and operands
Instructions
in
assembly
language are rather simple
• An opcode is a single instruction that can be
executed by the CPU. In machine language it is
a binary or hexadecimal value such as 'b6'
loaded into the instruction register
e.g. Mov, add , jmp
•Operands are manipulated by the opcode.
MOV, AL, 34H
The operands are the register named AL and
the value 34 hex
7. THE FETCH – EXECUTE CYCLE
Both the data and the program that
acts upon that data are loaded into
main memory (RAM) by the operating
system. The CPU is now ready to do
some work.
8. Steps of the Fetch/Execute
Cycle:
• Get the next instruction
• Figure out what to do
• Gathering the data needed
to do it
• Do it
• Save the result, and
• Repeat (billions of
times/second)!
9. Fetch Cycle
• The Program Counter (PC) contains the address of
the next instruction to be fetched
• The address contained in the PC is copied to the
Memory Address Register (MAR).
• The instruction is copied from the memory location
contained in the MAR and placed in the Memory
Buffer Register (MBR).
• The entire instruction is copied from the MBR and
placed in the Current Instruction Register (CIR)
• The PC is incremented so that it points to the next
instruction to be fetched
10. Execute Cycle
• The address part of the instruction is
placed in the MAR
• The instruction
executed
is
decoded
and
• The processor checks for interrupts
(signals from devices or other sources
seeking the attention of the processor)
and either branches to the relevant
interrupt service routine or starts the
cycle again.
11. CU
100
101
100
PC
Program
Counter
IR
Multiply no.
Instruction
in 500, 501
Register
ALU
Acc Accumulator
378
Multiply no. in 500,501
101
Store result in 502
500
21
501
18
502
1.The PC contains the address of location 100
2.CU fetches instruction in location 100
3. Make a copy of the instruction into the IR
4. Increment the PC by 1
5. Activate the right circuits to execute the instruction
12. CU
PC
100
102
101
Program
Counter
Store result
Multiply no.
Instruction
IR
inin 502
500, 501
Register
ALU
Acc Accumulator
378
Multiply no. in 500,501
101
Store result in 502
500
21
501
18
502
378
1. The PC contains the address of location 101
2. CU fetches instruction in location 101
3. A copy of the instruction is saved in the IR
4. Increment the PC
5. Activate the right circuits to execute the instruction