0% found this document useful (0 votes)
11 views

Chapter 3

Uploaded by

abduwasi ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Chapter 3

Uploaded by

abduwasi ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 34

1

Chapter Three

Assembly level machine organization


2 Basic organization of the von Neumann machine

Historically there have been 2 types of Computers:

1. Fixed Program Computers – Their function is very specific and


they couldn’t be programmed, e.g., Calculators.
2. Stored Program Computers – These can be programmed to
carry out many different tasks, applications are stored on them.
 The modern computers are based on a stored-program concept
introduced by John Von Neumann.
3
Cont.…
It is also known as Instruction set architecture computer
and is having three basic units:
The Central Processing Unit (CPU)
The Main Memory Unit
The Input/Output Device.
4
Central Processing Unit
5
 The part of the Computer that performs the bulk of data processing
operations is called the Central Processing Unit and is referred to
as the CPU.
 The Central Processing Unit can also be defined as an electric
circuit responsible for executing the instructions of a computer
program.
 It has following major components:
 1.Control Unit(CU)
 2.Arithmetic and Logic Unit(ALU)
 3.variety of Registers
 Control unit
6 handles all processor control signals.
controls the operations of components.
It directs all input and output flow, fetches code for
instructions, and controls how data moves around the
system.
 Arithmetic and Logic Unit (ALU)
The arithmetic logic unit is that part of the CPU that
handles all the calculations the CPU may need.
e.g. Addition, Subtraction, Comparisons. It performs
Logical Operations, Bit Shifting Operations, and
Arithmetic operations.
7  Registers
 Registers refer to high-speed storage areas in the CPU.
 The data processed by the CPU are fetched from the registers.
 Accumulator:- Stores the results of calculations made by ALU.
 Program Counter (PC):- Keeps track of the memory location of the next
instructions to be dealt with.
 Memory Address Register (MAR):- It stores the memory locations of
instructions that need to be fetched from memory
 Memory Data Register (MDR):-It stores instructions fetched from memory
 Current Instruction Register (CIR):-It stores the most recently fetched
instructions
 Instruction Buffer Register (IBR):- Stores the instruction that is not to be
executed immediately
8 Memory Unit
 A memory unit is a collection of storage cells together
with associated circuits needed to transfer information
in and out of the storage.
 The memory stores binary information in groups of bits
called words.
 The internal structure of a memory unit is specified by
the number of words it contains and the number of bits
in each word.
Primary memory
9

primary memory also known as main memory, is the part of


the computer’s memory that the CPU can access directly.
It is used to store data that is currently being processed by the
CPU.
There are two types of primary memory
1. RAM
2. ROM
10
Secondary memory
 refers to storage devices like hard drives, solid-state drives, or flash
drives.
 It provides non-volatile storage, meaning the data remains even
when the computer is turned off.
 Secondary memory is used for storing data long-term, and is not
directly accessible by the CPU.
 It has a much larger storage capacity compared to primary memory,
but is slower to access.
 This type of memory is essential for storing large amounts of data
and programs when they are not in use.
11 Input/output Devices

 Program or data is read into main memory from the input


device or secondary storage under the control of CPU
input instruction.
 Output devices are used to output the information from a
computer.
12 Buses
 Data is transmitted from one part of a computer to another,
connecting all major internal components to the CPU and memory,
by the means of Buses.
 Types:
Data Bus: It carries data among the memory unit, the I/O
devices, and the processor.
Address Bus: It carries the address of data (not the actual data)
between memory and processor.
Control Bus: It carries control commands from the CPU (and
status signals from other devices) in order to control and
coordinate all the activities within the computer.
Control Unit
13
The Control Unit is the part of the computer’s central
processing unit (CPU), which directs the operation of the
processor.
It is the responsibility of the control unit to tell the
computer’s memory, arithmetic/logic unit, and input and
output devices how to respond to the instructions that have
been sent to the processor.
14
It fetches internal instructions of the programs from the
main memory to the processor instruction register, and
based on this register contents,
 The control unit generates a control signal that
supervises the execution of these instructions.
A control unit works by receiving input information
which it converts into control signals, which are then
sent to the central processor.
There are two types of control units:
15 Hardwired Control Unit
 This type of control unit uses specially designed hardware logic
circuits to generate the control signals that are important for
instruction execution control.
 The operation code of an instruction contains the basic data for
control signal generation.
Microprogrammed Control Unit
 This type of control unit generates control signals using
microinstructions which are stored in the control memory.
 In Microprogrammed Control, the micro-operations are
performed by executing a program consisting of micro-
instructions.
Instruction cycle
16 The primary task of the CPU is to execute programs using the fetch – decode – execute
cycle.
 This is also called the instruction cycle.
 The cycle begins as soon as the computer is turned on and ends when the computer is shut
down.
 The fetch – decode –execute cycle:
1. The processor reviews the program counter to see which command to execute next.
2. The program counter gives an address value in the memory of where the next command is.
3. The processor fetches the command value from the memory location.
4. Once the command has been fetched, it needs to be decoded and executed. For example,
this could include taking one value, putting it into the Arithmetic Logic Unit (ALU), then
taking a different value from a register and adding the two together.
5. Once this has been completed, the processor returns to the program counter to find the next
command.
6. This cycle is replicated until the program stops.
Assembly/machine language programming
17 Machine Language:
 This is the lowest level of programming language, which can only be
represented by 0s and 1s.
 It’s difficult to learn and understand because it involves working directly with
binary digits.
Assembly Language:
 This is an intermediary language, more than low level but less than high level.
 It uses numbers, symbols, and abbreviations instead of 0s and 1s.
 For example, it uses symbols like Add, Sub, and Mul for addition, subtraction,
and multiplication.
 Assembly language is easier to understand and memorize because it uses
alphabets and mnemonics
18
Instruction sets and types
 Based on the operations there are three types of instruction
types
Data Transfer Instructions
Data manipulation Instructions
Program Control Instructions
19 1. Data Transfer Instructions
 Data transfer instructions cause transfer of data
from one location to another without changing the
binary information. The most common transfer is
between the
1.Memory and Processor registers
2.Processor registers and input output devices
3.Processor registers themselves
20
2. Data manipulation Instructions
21

 Data manipulation instructions perform operations on data and provide the


computational capabilities for the computer.
 These instructions perform arithmetic, logic and shift operations.
Program Control Instructions
22
 The program control instructions provide decision making capabilities and change the path taken
by the program when executed in computer.
 These instructions specify conditions for altering the content of the program counter.
23 Instruction sets and types

 Based operand there are four types of instruction


1. Three address Instruction
2. Two address instruction
3. One address Instruction
4. Zero address Instruction
1. Three address Instruction
24

 Each instruction specifies two operand location and a result location.


 A temporary location T is used to store some intermediate result so as
not to alter any of the operand location. The three-address instruction
format requires a very complex design to hold the three address
references.
 Format: Op X, Y, Z; X Y Op Z
 Example: ADD X, Y, Z; X Y + Z
2. Two address instruction
25
 Each address field can specify either a processor register, or a memory word.
 The two-address instruction format reduces the space requirement. To avoid altering
the value of an operand, a MOV instruction is used to move one of the values to a
result or temporary location T, before performing the operation.
 Format: Op X, Y; X X Op Y
 Example: SUB X, Y; X X - Y
3. One address Instruction
26
 The accumulator contains one of the operands and is used to store the result. One
address instruction uses an implied accumulator (Ac) register for all data
manipulation.
 All operations are done between the AC register and a memory operand. We use
LOAD and STORE instruction for transfer to and from memory and Ac register.
 Format: Op X; Ac Ac Op X
 Example: MUL X; Ac Ac * X
27 4. Zero address Instruction
 It does not use address field for the instruction like ADD, SUB, MUL, DIV etc.
The PUSH and POP instructions, however, need an address field to specify the
operand that communicates with the stack.
 Format: Op; TOSTOS Op (TOS – 1)
 Example: DIV; TOS TOS DIV (TOS – 1)
 evaluate the arithmetic statement X=(A+B) *(C+D) using Zero, one, two, or
28
three address instructions.
 1. Three-Address Instructions:
ADD R1, A, B; R1M[A] + M[B]
ADD R2, C, D; R2M[C] + M[D]
MUL X, R1, R2; M[X]R1 * R2
29
Instruction Formats
 Computer instructions are stored in central memory locations and are
executed sequentially one at a time.
 A computer usually has a variety of Instruction Code Formats.
 The most common fields in instruction formats are:
An operation code field that specifies the operation to be
performed.
An Address field that designates a memory address or a processor
register.
A Mode field that specifies the way the operand or the effective
address is determined.
30

 The operation code field (Opcode) of an instruction is a group of


bits that define various processor operations such as add,
subtract, complement, shift.
 The bits that define the mode field of an instruction code specify
a variety of alternatives for choosing the operands from the given
address.
 Operation specified by an instruction is executed on some data
stored in the processor register or in the memory location.
31
Types of Instruction formats
 Most computers fall into one of 3 types of CPU organizations:
1. Single accumulator organization: - All the operations are
performed with an accumulator register.
2. General register organization: - The instruction format in
this type of computer needs three register address fields.
3. Stack organization: - The instruction in a stack computer
consists of an operation code with no address field.
32 Effective address (EA):
The effective address is defined to be the memory address
obtained from the computation dictated by the given
addressing mode.
The effective address is the address of the operand in a
computational-type instruction.
33
The most well-known addressing mode are:
1. Implied Addressing Mode.
2. Immediate Addressing Mode
3. Register Addressing Mode
4. Register Indirect Addressing Mode
5. Auto-increment or Auto-decrement Addressing Mode
6. Direct Addressing Mode
7. Indirect Addressing Mode
8. Relative Addressing Mode
9. Index Addressing Mode
10.Base Register Addressing mode
34

The End!

You might also like