Basic Operational Concepts

Download as pdf or txt
Download as pdf or txt
You are on page 1of 34

BASIC OPERATIONAL

CONCEPTS
How to Fetch/Read Data or Instruction
from MM
➢In order to fetch/read an instruction or data
from main memory:
1. The CPU first sends the address of the
memory location to be read.
2. The CPU then issues or sends the read signal
to the memory.
3. The word is then read out of memory and is
loaded into a CPU internal register.
How to Write/Store Data into MM
➢In order to store/write data into main memory:

1. The CPU first sends the address of the memory


location to be written.
2. The CPU then sends the write signal together with
the data or word to be written to memory.
Example 1
➢Example of a typical assembly language instruction:

MOV R0, LOCA

Copy the contents at memory location LOCA into a


register in the processor, R0.
Example 2
➢Take a look at another example of a typical
assembly language instruction:

ADD R0, LOCA

Add the operand at memory location LOCA to the


operand in a register in the processor, R0 and place
the result into register R0.
Connections Between the Processor and
the MM
Operating Steps
1. PC is set to point to the first instruction of the
program.

2. The contents of the PC are transferred to the MAR


and a Read signal is sent to the MM.
Operating Steps
3. The addressed word is read out of MM and
loaded into the MDR.
4. The contents of MDR are transferred to the IR.
The instruction is ready to be decoded and
executed.
5. During execution, the contents of the PC are
incremented or updated to point to the next
instruction.
Exercise
Enumerate the different steps needed to execute the
machine instruction

ADD LOCA, R0

Assume that the instruction itself is stored in the main


memory at location INSTR, and that this address is initially
in register PC.
CPU Instruction Execution Steps
Instruction execution in a CPU can now be
summarized by the following steps:
1. Fetching the instruction.
2. Incrementing the PC.
3. Decoding the instruction
4. Determining the location of data in the memory, if
necessary.
CPU Instruction Execution Steps
5. Fetching the required data into internal CPU
registers.
6. Executing the instruction.
7. Storing the results.
8. Return to Step 1.
Bus Structure
➢A bus is a collection of wires that connect several
devices within a computer system.
Three main groupings of lines:

1. Data Bus
2. Address Bus
3. Control Bus
Single Bus Structure

All units are connected to a single bus, so it


provides the sole means of interconnection.
Two - Bus Structure
Two - Bus Structure
Memory Locations and Addresses

➢MM is organized so that a group of n bits can be


stored or retrieved in a single basic operation.
Memory Locations and Addresses
Parts of an Instruction
➢An instruction usually contains two parts:

1. the part that specifies the operation to be


performed (op-code field).

2. the part that may be used to specify operand


addresses.
Parts of an Instruction
➢An instruction usually contains two parts:

1. the part that specifies the operation to be


performed (op-code field).
2. the part that may be used to specify operand
addresses.
Parts of an Instruction
Main Memory Operations
➢Fetch or Read. This transfers the contents of a
specific MM location to the CPU. The word in the MM
remains unchanged.

➢Store or Write. This transfers a word of information


from the CPU to a specific MM location. This destroys
the former contents of that location.
Instructions and Instructions Sequencing
Types of Instructions

1. Data transfers between MM and CPU registers.


2. Arithmetic and logic operations on data.
3. Program sequencing and control.
4. I/O operations or transfers.
Notations

R1 [LOC]

The contents of memory location LOC are transferred


into register R1.
Notations

C [A] + [B]

The operands in memory locations A and B are fetched


from MM and transferred into the CPU, where they will be
added in the ALU. Then the resulting sum is to be stored
into memory location C in MM.
Address Notations
➢Two-Address Instructions
ADD A, B A [A] + [B]
➢Three-Address Instructions
ADD A, B, C A [B] + [C]
B and C = source operands
A = destination operands
One-Address Notation
A general purpose CPU register, usually called the
accumulator, may be used for this purpose.
Examples:

ADD A ACC [A] + [ACC]


One-Address Notation

Add the contents of memory location A to the


contents of the accumulator and place the sum into
the accumulator
Examples

➢ LOAD A ACC [A]


➢ ADD B ACC [B] + [ACC]
➢ STORE C C [ACC]
Zero-Address Instructions
Instructions where the locations of all operands are
defined implicitly.
Example:
▪Inc (increment the accumulator by 1)
▪ Dec (decrement the accumulator by 1)
Two-Phase Procedure in Instruction
Execution

➢Instruction Fetch

▪ Instruction is fetched from MM location whose


address is in the program counter.
Two-Phase Procedure in Instruction
Execution

➢Instruction Execute

▪ The instruction in the instruction register is


examined to determine which operation is to be
performed.
Instruction Execution and Straight-Line
Sequencing
Branching
NEXT TOPIC:

8088 – 8086 COMPUTER


ARCHITECTURE

You might also like