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

Bahubali College of Engineering, Shravanabelagola

Computer Organisation 18EC35 K Ramamani, HOD in E&CE

MODULE 1
Basic Structure of Computers: Computer Types, Functional Units, Basic Operational
Concepts, Bus Structures, Software, Performance – Processor Clock, Basic Performance
Equation (upto 1.6.2 of Chap 1 of Text).
Machine Instructions and Programs: Numbers, Arithmetic Operations and Characters, IEEE
standard for Floating point Numbers, Memory Location and Addresses, Memory Operations,
Instructions and Instruction Sequencing (upto 2.4.6 of Chap 2 and 6.7.1 of Chap 6 of Text).

TYPES OF COMPUTERS
Desktop Computers
• These are most commonly used computers in home, schools and offices.
• This has
→ processing- & storage-units

→ video & audio output-units

→ Keyboard & mouse input-units.

Notebook Computers (Laptops)


• This is a compact version of a personal-computer (PC) made as a portable-unit.

Workstations
• These have more computational-power than PC.

Enterprise Systems (Mainframes)


• These are used for business data-processing.
• These have large computational-power and larger storage-capacity than workstations.

• These are referred to as


→ server at low-end and

→ Super-computers at high end.

Servers
• These have large database storage-units and can also execute requests from other computers.
• These are used in banks & educational institutions.

Super Computers
• These are used for very complex numerical-calculations.
• These are used in weather forecasting, aircraft design and military applications.

1
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

FUNCTIONAL UNITS
• A computer consists of 5 functionally independent main parts: 1)input, 2)memory,3)arithmetic &
logic, 4)output and 5)control units.

Input Unit
• The computer accepts the information in the form of program & data through an input-device.

Eg: keyboard
• Whenever a key is pressed, the corresponding letter/digit is automatically translated into its
corresponding binary-code and transmitted over a cable to either the memory or the processor.

Memory Unit
• This unit is used to store programs & data.
• There are 2 classes of storage:

1) Primary-storage is a fast-memory that operates at electronic-speed. Programs must be stored in the


memory while they are being executed.

2) Secondary-storage is used when large amounts of data & many programs have to be stored. Eg:
magnetic disks and optical disks(CD-ROMs).

• The memory contains a large number of semiconductor storage cells(i.e. flip-flops), each capable of
storing one bit of information.

• The memory is organized so that the contents of one word can be stored or retrieved in one basic
operation

• Memory in which any location can be reached in a short and fixed amount of time after specifying
its address is called RAM (Random Access Memory).

ALU (Arithmetic & Logic Unit)


• This unit is used for performing arithmetic & logical operations.

• Any arithmetic operation is initiated by bringing the required operand into the processor (i.e.
registers), where the operation is performed by the ALU.

Output Unit
• This unit is used to send processed-results to the outside world.

Eg: printer, graphic displays etc.


Control Unit
• This unit is used for controlling the activities of the other units (such as memory, I/O device).
• This unit sends control-signals (read/write) to other units and senses their states.
• Data transfers between processor and memory are also controlled by the control-unit through
timing-signals.

• Timing-signals are signals that determine when a given action is to take place.

2
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

Basic functional units of a computer

BASIC OPERATIONAL CONCEPTS


• The processor contains ALU, control-circuitry and many registers.
• The instruction-register(IR) holds the instruction that is currently being executed.

• The instruction is then passed to the control-unit, which generates the timing-signals that determine
when a given action is to take place
• The PC(Program Counter) contains the memory-address of the next-instruction to be fetched &
executed.
• During the execution of an instruction, the contents of PC are updated to point to next instruction.
• The processor also contains „n‟ general-purpose registers R0 through Rn-1.
• The MAR (Memory Address Register) holds the address of the memory-location to be accessed.
• The MDR (Memory Data Register) contains the data to be written into or read out of the addressed
location.

Following are the steps that take place to execute an instruction


• The address of first instruction(to be executed) gets loaded into PC.
• The contents of PC(i.e. address) are transferred to the MAR & control-unit issues Read signal to
memory.
• After certain amount of elapsed time, the first instruction is read out of memory and placed into
MDR.
• Next, the contents of MDR are transferred to IR. At this point, the instruction can be decoded &
executed.

• To fetch an operand, it's address is placed into MAR & control-unit issues Read signal. As a result,
the operand is transferred from memory into MDR, and then it is transferred from MDR to ALU.

3
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

• Likewise required number of operands is fetched into processor.


• Finally, ALU performs the desired operation.
• If the result of this operation is to be stored in the memory, then the result is sent to the MDR.
• The address of the location where the result is to be stored is sent to the MAR and a Write cycle is
initiated.

• At some point during execution, contents of PC are incremented to point to next instruction in the
program. [The instruction is a combination of opcode and operand].

Connection Between the Processor and the Memory

BUS STRUCTURE
• A bus is a group of lines that serves as a connecting path for several devices.
 There are many ways to connect different parts inside a computer together.
 A group of lines that serves as a connecting path for several devices is called a bus.
 Address/data/control
• Bus must have lines for data transfer, address & control purposes.

4
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

• Because the bus can be used for only one transfer at a time, only 2 units can actively use the bus at
any given time.
• Bus control lines are used to arbitrate multiple requests for use of the bus.
• Main advantage of single bus: Low cost and flexibility for attaching peripheral devices.

• Systems that contain multiple buses achieve more concurrency in operations by allowing 2 or more
transfers to be carried out at the same time. Advantage: better performance. Disadvantage: increased
cost.

• The devices connected to a bus vary widely in their speed of operation. To synchronize their
operational speed, the approach is to include buffer registers with the devices to hold the information
during transfers.

Buffer registers prevent a high-speed processor from being locked to a slow I/O device during a
sequence of data transfers.

5
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

Illustration of the steps taken by the CPU to execute an instruction that adds two numbers. The
instruction is: R = X + Y.

Software

❑ In order for a user to enter and run an application program, the computer must already contain
some system software in its memory

6
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

❑ System software is a collection of programs that are executed as needed to perform functions
such as

◆ Receiving and interpreting user commands

◆ Running standard application programs such as word processors, etc, or games

◆ Managing the storage and retrieval of files in secondary storage devices

◆ Controlling I/O units to receive input information and produce output results

❑ Translating programs from source form prepared by the user into object form consisting of
machine instructions

❑ Linking and running user-written application programs with existing standard library routines,
such as numerical computation packages

❑ System software is thus responsible for the coordination of all activities in a computing system

Operating system
❑ system (OS)Operating

◆ This is a large program, or actually a collection of routines, that is used to control the sharing of
and interaction among various computer units as they perform application programs

❑ The OS routines perform the tasks required to assign computer resource to individual application
programs

◆ These tasks include assigning memory and magnetic disk space to program and data files,
moving data between memory and disk units, and handling I/O operations

❑ In the following, a system with one processor, one disk, and one printer is given to explain the
basics of OS

◆ Assume that part of the program’s task involves reading a data file from the disk into the
memory, performing some computation on the data, and printing the results

7
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

User Program and OS Routine Sharing

Multiprogramming or Multitasking

Performance

❑ The speed with which a computer executes programs is affected by the design of its hardware
and its machine language instructions

❑ Because programs are usually written in a high-level language, performance is also affected by
the compiler that translates programs into machine languages

❑ For best performance, the following factors must be considered

Compiler, Instruction set, Hardware design

8
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

Processor Clock

The clock speed or operating frequency usually measured in hertz is the fundamental rate in
cycles per second, at which a computer performs its most basic operations.

Processor circuits are controlled by a timing signal called a clock

Every computer has the “clock generator” to generate clock signals used

throughout the system. Timing in a computer system is critical, particularly

to synchronize the activities within the various chips. To do this, a crystal is used.

The clock defines regular time intervals, called clock cycles

To execute a machine instruction, the processor divides the action to be performed into a
sequence of basic steps, such that each step can be completed in one clock cycle

❑ Let the length P of one clock cycle, its inverse is the clock rate, R=1/P

❑ Basic performance equation

T – processor time required to execute a program that has been prepared in high-level language

N – number of actual machine language instructions needed to complete the execution (note:
loop)

S – average number of basic steps needed to execute one machine instruction. Each step
completes in one clock cycle

R – clock rate

Note: these are not independent to each other

9
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

T=(NxS)/R

where T is the processor time required to execute a program, N is the number of instruction
executions, and S is the average number of basic steps needed to execute one machine instruction

1.

2. A program contains 1000 instructions. Out of that 25% instructions requires 4 clock
cycles,40% instructions requires 5 clock cycles and remaining require 3 clock cycles for
execution. Find the total time required to execute the program running in a 1 GHz machine.

10
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

Machine Instructions and Programs


Three major representations of Signed Integer

1. Sign and magnitude

2. One’s complement

3. Two’s complement

Decimal Number Representation or Base 10

In Decimal or Base 10 System, digits used are:

0123456789 Representing 537 (Five hindered and thirty Seven)

Binary Number Representation or Base 2

 Binary Digit or Bit is the smallest unit of computation on most digital computers

 Bit has two states

11
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

◼ 0 represents zero voltage (0v) or ground

◼ 1 represents positive voltage (+5v)

Power
Calculation Value
of 2
0
2 1 1

1
2 2 2

Dec
Binary
imal

0 00 1 0
2 * 0 + 2 * 0 = 2*0 +1*0 = 0+0=0

1 01 1 0
2 * 0 + 2 * 1 = 2*0 +1*1 =0+1= 1
1 0
2 10 2 * 1 + 2 * 0 = 2*1 +1*0 = 2+0=2
1 0
3 11 2 * 1 + 2 * 1 = 2*1 +1*1 = 2+1=3

Example: 3-bit binary numbers

Decimal Binary
0 000 Power of 2 Calculation Value
0
1 001 2 1
1
2 010 2 2 2
2
3 011 2 2*2 4
4 100
5 101
6 110
7 111

12
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

Representation of a Binary Number

Converting from decimal to binary (base 10 to base 2) will also produce a weighted binary
number with the right-hand most bit being the Least Significant Bit or LSB, and the left-hand
most bit being the Most Significant Bitor MSB, and we can represent this as

Convert binary to decimal by finding the decimal equivalent of the binary array of
digits 1011001012 and expanding the binary digits into a series with a base of 2giving an
equivalent of 35710 in decimal or denary.

(256) + (64) + (32) + (4) + (1) = 35710

Question: Represent the following Decimal number in 7-bit binary numbers

7-bit Binary
Decimal
Number
5 0000101
14 0001110
26 0011010
53 0110101

What is the biggest decimal number that you can represent in binary using 8-bit ?

13
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

 255 (i.e., 28 -1=256-1=255)

How many different decimal number that you can represent in binary using 8-bit ?

 0 to 255 i.e., 256 decimal numbers

Signed Binary Number Representation

 We can use a single bit to identify the sign of a signed binary number as being positive or
negative in value. So to represent a positive binary number (+n) and a negative (-n)
binary number, we can use them with the addition of a sign.

 For signed binary numbers the most significant bit (MSB) is used as the sign bit. If the
sign bit is “0”, this means the number is positive in value. If the sign bit is “1”, then the
number is negative in value. The remaining bits in the number are used to represent the
magnitude of the binary number in the usual unsigned binary number format way.

 Then we can see that the Sign-and-Magnitude (SM) notation stores positive and negative
values by dividing the “n” total bits into two parts: 1 bit for the sign and n–1 bits for the
value which is a pure binary number. For example, the decimal number 53 can be
expressed as an 8-bit signed binary number as follows:

1’s (One’s) complement


number representation

 If all bits in a
byte are inverted by
changing each 1 to 0 and
each 0 to 1, we have
formed the one’s complement of the number.

14
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

Two’s Complement

The two’s complement is a method for representing positive and negative integer values in
binary. The useful part of two’s complement is that it automatically includes the sign bit.

Rule: To form the two’s complement, add 1 to the one’s complement.

Step 1: Begin with the original binary value

10011001 Original binary number

Step 2: Find the one's complement

01100110 One's complement

Step 3: Add 1 to the one's complement

01100110 One's complement

+ 1 Add 1

-----------

01100111 <--- Two's complement

15
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

The two’s complement is a method for representing positive and negative integer values in
binary. The useful part of two’s complement is that it automatically includes the sign bit.

Rule: To form the two’s complement, add 1 to the one’s complement

Binary Sign-Magnitude, One’s Complement representation and Two’s Complement

16
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

Conversion of Negative Numbers to Two’s Complement

 These examples show conversion of a decimal number to 4-bit twos complement.

 The bit size is always important with twos complement, since you must be able to tell
where the sign bit is.

 The steps are simple.

◼ First, you convert the magnitude of the number to binary, and pad to the word size
(4 bits).

◼ If the original number was positive, you are done.

◼ Otherwise, you must negate the binary number by inverting the bits and adding 1.

 These examples show conversion of a decimal number to 4-bit twos complement.

 The bit size is always important with twos complement, since you must be able to tell
where the sign bit is.

 The steps are simple.

◼ First, you convert the magnitude of the number to binary, and pad to the word size
(4 bits).

◼ If the original number was positive, you are done.

◼ Otherwise, you must negate the binary number by inverting the bits and adding 1.

 Convert -6 to an 4-bit, twos complement binary number.

◼ Convert the magnitude, 6 to binary. So 610 = 1102.

◼ Pad to 8 bits: 0110

◼ Negate the number by inverting the bits and adding 1.

0110

Negate 1001

Add 1 1

--------

1010 Two’s complement of -6

17
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

 These examples show conversion of a decimal number to 8-bit twos complement.

 The bit size is always important with twos complement, since you must be able to tell
where the sign bit is.

 The steps are simple.

◼ First, you convert the magnitude of the number to binary, and pad to the word size
(8 bits).

◼ If the original number was positive, you are done.

◼ Otherwise, you must negate the binary number by inverting the bits and adding 1.

 Convert -72 to an 8-bit, twos complement binary number.

◼ Convert the magnitude, 72 to binary. So 7210 = 10010002.

◼ Pad to 8 bits: 01001000

◼ Negate the number by inverting the bits and adding 1.

Using 7 bits to represent each number, write the representations of 23 and -23 in signed
magnitude and 2's complement integers

 Under Signed Number Representation: Number of bits used for representation is


important because

18
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

Problem with arithmetic

19
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

Arithmetic under Two’s Complement

Subtraction by 2’s Complement

The operation is carried out by means of the following steps: (i) At first, 2’s complement of the
subtrahend is found.(ii) Then it is added to the minuend.(iii) If the final carry over of the sum is
1, it is dropped and the result is positive.(iv) If there is no carry over, the two’s complement of
the sum will be the result and it is negative

Convert the following pairs of decimal numbers to 5-bit 2’s-complement numbers, then add
them.

a. -5 and 7 b. -3 and -8

20
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

Arithmetic Overflow:

 In 2's complement number representation system, n bits can represent values in the range
(-2n-1) to (+2n-1 – 1).

 When the result of an arithmetic operation is outside the representable range, an


arithmetic overflow has occurred.

21
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

Repeat for subtraction operation, where the second number of each pair to be
subtracted from first number. State whether or not overflow occurs in each case

22
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

Memory Locations and Addresses

23
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

24
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

Two ways of Byte address assignment across words


 Big-endian and little-endian are terms that describe the order in which a sequence
of bytes are stored in computer memory.

 Big-endian is an order in which the "big end" (most significant value in the sequence) is
stored first (at the lowest storage address).

 Little-endian is an order in which the "little end" (least significant value in the sequence)
is stored first.

25
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

B
ig-
Endia
n and
Little-
Endia
n
Assign
ments

Hexadecimal numbers: A group of 4 bits can take any value between 0 (0000 binary) and 15
(1111 binary). In hexadecimal, we replace each group of 4 bits with a single digit to represent
the value 0 to 15. Since we only have digits 0 to 9, we use letters A to E to represent values 10 to
15. Here is a table of binary, denary and hex values:

26
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

Memory Word Alignment


 Words are said to be Aligned in memory if they begin at a byte-address that is a multiple
of number of bytes in a word.

 For example,

◼ If the word length is 16 (2 Bytes), aligned words begin at byte addresses 0, 2, 4,....

◼ If the word length is 32 (4 Bytes), aligned words begin at byte addresses 0, 4, 8,....

 Words are said to have Unaligned Addresses, if they begin at an arbitrary byte-address

Memory Operations

INSTRUCTIONS and INSTRUCTION SEQUENCING

Instruction: A computer must have instruction capable of performing the following


operations. They are:

 Data transfer between memory and processor register (Ex.: MOV, LOAD, STOREPUSH,
POP )

 Arithmetic and logical operations on data (Ex.: ABB, SUB, DIV, MUL)

 Program sequencing and control (Ex.: LOOP, CALL,RET)

 I/O transfer (Ex. IN, OUT).

27
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

Register Transfer Notation:


The possible locations that may be involved during data transfer are

1. Memory Location

2. Processor register

3. Registers in I/O sub-system.

Assembly Language Notation


 To represent machine instructions and programs, assembly language format is used

Instruction Set Categories


Instruction Set Categories based on the Operands explicitly specified in the instruction

1. Three-address or 3-Operand instructions

2. Two-address or 2-Operand instructions

3. One-address or 1-Operand instructions

4. Zero-address or 0-Operand instructions

28
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

Three-address or 3-Operand instructions

Two-address or 2-Operand instructions

Two-address or 2-Operand instructions


Using Two-address instructions, write complete set of instructions to perform

 C=A+B

i.e., C <- [A]+[B] Meaning: Add the contents of the memory location A and B ; And Store the
result in memory location C

29
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

ANSWER

We will use MOVE instruction

MOVE B, C //C <- [B] Move the contents of memory location B to Memory

//Location C

ADD A, C //Add the contents of Memory location A with C. And store the result

//in the memory location C

One-address or 1-Operand instructions


 Only one Operand will be specified in the instructions.

 Accumulator Register will be used as second Operand

 General Format:

Operation Source/Destination Operand

 Example: ADD A

 Acc <- [Acc]+[A] Meaning : Add the contents of accumulator with the memory location
A ; And Store the result in the accumulator register

30
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

Write a program to evaluate the arithmetic expression


RESULT=A*B + C*D in a single accumulator processor. Assume the processor has load, store,
multiply and add instructions and that all values fit in the accumulator. Do not modify the values
of A, B, C, D, E, F or G.

Use a temporary location RESULT to store the intermediate results if necessary.

Note:

Load A ;will load accumulator with the contents of the memory location A

Store A ;will store the contents of the accumulator into memory location A

Add A ;will add contents of accumulator with memory location A and

; store the result into accumulator

Zero-address or 0-Operand instructions

31
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

Problems

32
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

INSTRUCTIONS AND INSTRUCTION SEQUENCING

Four types of operations

1. Data transfer between memory and processor registers.


2. Arithmetic & logic operations on data
3. Program sequencing & control
4. I/O transfers.
1) Register transfer notations(RTN)

R3<–[R1]+[R2]

• Right hand side of RTN-denotes a value.


• Left hand side of RTN-name of a location.
2) Assembly language notations(ALN)

Add R1, R2, R3

• Adding contents of R1, R2 & place sum in R3.


3) Basic instruction types-4 types
• Three address instructions– Add A,B,C

A, B-source operands

C-destination operands

• Two address instructions-Add A,B

B <–[A] + [B]

• One address instructions –Add A

Add contents of A to accumulator & store sum back to accumulator.

• Zero address instructions

Instruction store operands in a structure called push down stack.

4) Instruction execution & straight line sequencing


• The processor control circuits use information in PC to fetch & execute instructions one at
a time in order of increasing address.
• This is called straight line sequencing.
• Executing an instruction-2 phase procedures.
• 1st phase–“instruction fetch”-instruction is fetched from memory location whose address
is in PC.
• This instruction is placed in instruction register in processor
• 2nd phase-“instruction execute”-instruction in IR is examined to determine which
operation to be performed.

33
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

5) Branching
• Branch-type of instruction loads a new value into program counter.
• So processor fetches & executes instruction at this new address called “branch target”
• Conditional branch-causes a branch if a specified condition is satisfied.
• E.g. Branch>0 LOOP –conditional branch instruction .it executes only if it satisfies
condition.
6) Condition codes
• Recording required information in individual bits called “condition code flags”.
• These flags are grouped together in a special processor register called “condition code
register” or “status register”
• Individual condition code flags-1 or 0.
• 4 commonly used flags.

1) N (negative)-set to 1 if result is –ve or else 0.

2) Z (zero)-set to 1 if result is 0, or else 0 .

3) V (overflow)-set to 1if arithmetic overflow occurs or else 0.

4) C(carry)-set to 1 if carry out results from operation or else 0

Instruction Execution: There are 2 phases for executing an instruction. They are, • Instruction Fetch •
Instruction Execution Instruction Fetch: The instruction is fetched from the memory location whose
address is in PC. This is then placed in IR. Instruction Execution: Instruction in IR is examined and
decoded to determine which operation is to be performed. Program execution Steps: To begin executing a
program, the address of first instruction must be placed in PC. The processor control circuits use the
information in the PC to fetch & execute instructions one at a time in the order of increasing order. This is
called Straight line sequencing. During the execution of each instruction, the PC is incremented by 4 to
point to the address of next instruction.

34
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

35
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

Using loop to add ‘n’ numbers:


• Number of entries in the list „nıis stored in memory location M. Register R1 is used as a
counter to determine the number of times the loop is executed. • Content location M are loaded
into register R1 at the beginning of the program. • It starts at location Loop and ends at the
instruction, Branch>0.During each pass, the address of the next list entry is determined and the
entry is fetched and added to R0. • Decrement R1; It reduces the contents of R1 by 1 each time
through the loop. • Branch >0 Loop; A conditional branch instruction causes a branch only if a
specified condition is satisfied.

Floating-Point Representation

Floating-point representation is similar in concept to scientific notation. Logically, afloating-


point number consists of: A signed (meaning positive or negative) digit string of a given length
in a given base (or radix). This digit string is referred to as the significand, mantissa, or
coefficient.

 for floating-point representation

 Numbers written in scientific notation have three components: Floating-point numbers


allow an arbitrary number of decimal places to the right of the decimal point.

◼ For example: 0.5  0.25 = 0.125

 They are often expressed in scientific notation.

◼ For example:

0.125 = 1.25  10-1

5,000,000 = 5.0  106

 Computers use a form of scientific notation

36
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

 Computer representation of a floating-point number consists of three fixed-size fields:

This is the standard arrangement of these fields

Single Precision

Single-precision floating-point format is a computer number format, usually occupying 32 bits


in computer memory; it represents a wide dynamic range of numeric values by using
a floating radix point. ... One of the first programming languages to provide single- and double-
precision floating-point data types was Fortran.

Double Precision

Double-precision floating-point format is a computer number format, usually occupying 64 bits in


computer memory; it represents a wide dynamic range of numeric values by using a floating radix point.

37
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE

38

You might also like