You are on page 1of 20

Computer Science

MO DULE 1: C O M P U T E R A R C HI T EC TU R E & O R G A N I S AT I O N
TOPIC: C O M P U T E R A R C HI T EC TU R E
Objective:
 Describe the main characteristics of a processor
CPU Components
Central Processing Unit (CPU):
◦ Is a silicon chip comprising of microscopic circuits and minute electronic components whose principal
function is to act as the information processor within a computer system.

The components making up the CPU are:


◦ Arithmetic Logic Unit (ALU):

◦ Control Unit

◦ Bus

◦ CPU Clock

◦ Registers
The components making up the CPU are:

 Arithmetic Logic Unit (ALU)


This is responsible for performing arithmetic calculations and logic/conditional operations.

 Control Unit
The electronic component which controls the flow of information through the processor and
coordinates the activities of the other components within it. It is controls what happens in the
processor.

In the Instruction cycle , the CU is responsible for:


In the Instruction cycle , the CU is responsible for:
◦ Fetching the instruction

◦ Decoding the instruction

◦ Getting any data specified by the instruction

◦ Coordinating the execution of the instruction

◦ Storing the results in a specified memory location


 Bus
• System of electrical pathways used for the transfer of data between the different
components of the CPU.

• Characterized by the number of bits that they can carry at a single time and also the type
of data that they carry

• Two categories:

• Internal/system bus: connects all the components on the motherboard

• External/expansion bus: connects external devices, peripheral, expansion slot, i/o


ports and drive connections to the rest of the computer, it is usually slower than the
internal bus.
These two categories are further subdivided into separate categories to suit

specific functions:

◦ Address/Memory bus: transfers the address of data

◦ Control Bus: carries commands from the CPU to devices and returns status

signal from the devices

◦ Data Bus: transfer data


CPU clock

Controls how fast a processor makes calculations. CPU clocks are rated on how much pulse they can

produce per second; this is measured in hertz (hz).

Registers

High speed memory locations within ta microprocessor which store information temporarily. There

are several types of registers (Accumulator, Instruction Register, Memory Address Registers and

Memory Data Register)


Instruction Format
Instruction is a code that directs a computer to execute a particular task. It
contains various fields which contain information on how the instruction is
to be executed.

Op-Code Destination of Data Source or Data

Operand

The diagram above depicts a typical instruction


Instruction format: describes what an instruction is made up of. It

describes the length of an instruction, the fields present in an instruction,

the fields present in an instruction, the positions of the fields in the

instructions and the length of each field.

https://www.geeksforgeeks.org/computer-organization-instruction-

formats-zero-one-two-three-address-instruction/
Instruction Types
An instruction within a computer is comprised of an operation code (op-

code) followed by zero, one or two bytes of operands.

The op-code is the part of the instruction which recognizes the type of

operation to be performed such as ADD, MINUS or MOV

The operand is the part that identifies the source and the destination of the

data which will be operated on.


Five (5) common types of instruction are:
 Arithmetic instructions: these perform arithmetic operations such as addition,
subtraction, increment, decrement, division and multiplication

 Example:
ADD A R1
Add the content of R1 register to accumulator; leave the result in the accumulator

DEC A

Decrement the value stored in the accumulator by 1; store the result in the accumulator
 Logical instructions: these perform boolean operations such as AND, NOT,
OR, XOR on data byte on a bit-by-bit basis

Example:

ANL A 020H
Compare the content at the 20H location in RAM with the contents of the
accumulator using the AND operator; store the result in the accumulator

ORL A R2
Compare the content of the R2 register with the contents of the accumulator
using the OR operator; store the result in the accumulator.
 Data transfer instructions: these are used to transfer data between an internal
RAM location and a Special Function Register (SFR) without going through the
accumulator or between an internal RAM location and an external RAM location
by using indirect addressing.

Example:

MOV R0 R2
Transfer the contents of the 23H location in RAM to the R0

PUSH 020H

Push stack member into 20h location of RAM


 Boolean Variable Instructions: these are used to perform Boolean operations such
as set, clear, AND, OR, NOT and conditional jump operations on single bits. Direct
addressing is used.
Example:
CLR P2.7
If Port 2 has a value of DCH (11011100), this operation leaves the port set to 5ch
(01011100)

CLR C
SUBB A R0
JNC ARRAY2
MOV A #20H

Jump if value of A >= R0, else continue to MOV instruction


 Program Branching instructions: these are used to control the flow of
execution in a program. Some instructions provide decision making capabilities
before transferring control to other parts of the program.

Example: PUSH 020H


Load program counter with FAR_ADR address

Research the following: Data Processing instruction, Data Movement


instruction, Data storage instructions, Data control instructions.
How the operand byte(s) are selected is determined by the Addressing Mode used.

The most common addressing modes are:


◦ Absolute Addressing
◦ Relative addressing
◦ Direct Addressing
◦ Indirect Addressing
◦ Indexed Addressing
◦ Immediate Addressing

https://www.geeksforgeeks.org/addressing-modes/
Instruction set
An instruction set, instruction set architecture (ISA) or command set is the

basic set of commands or instructions understood by a computer’s

processor. Each processor has its own instruction set.


Instruction/Machine Cycle
The Instruction Cycle/Machine Cycle is the sequence of steps that the
processor uses to execute an instruction. The cycle is managed by the
Control Unit.
1. The CU fetches the instruction to be executed

2. The CU decodes the instruction

3. The CU coordinates the execution of the instruction

4. The results of the execution are stored


Cache Memory
Cache Memory is a high speed memory location used to store the most
frequently used data or data that will most likely be requested next by the
CPU.

Cache memory may be a reserved portion of RAM or a separate high


speed storage device.

Types of caching:
◦ Memory Caching
◦ Disk Caching

You might also like