SlideShare uma empresa Scribd logo
1 de 38
Baixar para ler offline
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
1
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.
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
2
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.
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
3
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.
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
4
• 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.
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
5
• 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.
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
6
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
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
7
❑ 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
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
8
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
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
9
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
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
10
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.
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
11
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:
0 1 2 3 4 5 6 7 8 9 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
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
12
◼ 0 represents zero voltage (0v) or ground
◼ 1 represents positive voltage (+5v)
Power
of 2
Calculation Value
2
0
1 1
2
1
2 2
Dec
imal
Binary
0 00
2
1
* 0 + 2
0
* 0 = 2*0 +1*0 = 0+0=0
1 01
2
1
* 0 + 2
0
* 1 = 2*0 +1*1 =0+1= 1
2 10 2
1
* 1 + 2
0
* 0 = 2*1 +1*0 = 2+0=2
3 11 2
1
* 1 + 2
0
* 1 = 2*1 +1*1 = 2+1=3
Example: 3-bit binary numbers
Decimal Binary
0 000 Power of 2 Calculation Value
1 001 2
0
1
2 010 2
1
2 2
3 011 2
2
2 * 2 4
4 100
5 101
6 110
7 111
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
13
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
Decimal
7-bit Binary
Number
5 0000101
14 0001110
26 0011010
53 0110101
What is the biggest decimal number that you can represent in binary using 8-bit ?
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
14
 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.
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
15
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
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
16
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
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
17
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
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
18
 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
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
19
Problem with arithmetic
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
20
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
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
21
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.
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
22
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
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
23
Memory Locations and Addresses
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
25
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.
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
26
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:
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
27
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).
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
28
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
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
29
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
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
30
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
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
31
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
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
32
Problems
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
33
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.
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
34
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.
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
36
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
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
37
 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.
Bahubali College of Engineering, Shravanabelagola
Computer Organisation 18EC35 K Ramamani, HOD in E&CE
38

Mais conteúdo relacionado

Mais procurados

Processor architecture
Processor architectureProcessor architecture
Processor architecture
Muuluu
 
Basic structure of computers
Basic structure of computersBasic structure of computers
Basic structure of computers
Kumar
 
Бие даалт
Бие даалтБие даалт
Бие даалт
Muuluu
 
Topic 5 Digital Technique basic computer structure
Topic 5 Digital Technique basic computer structureTopic 5 Digital Technique basic computer structure
Topic 5 Digital Technique basic computer structure
Bai Haqi
 
Computer organuzaton & architecture
Computer organuzaton & architectureComputer organuzaton & architecture
Computer organuzaton & architecture
Subhankar Bisoyi
 
03 top level view of computer function and interconnection
03 top level view of computer function and interconnection03 top level view of computer function and interconnection
03 top level view of computer function and interconnection
Sher Shah Merkhel
 
Chapter1 basic structure of computers
Chapter1  basic structure of computersChapter1  basic structure of computers
Chapter1 basic structure of computers
jismymathew
 

Mais procurados (17)

Unit 1 Computer organization and Instructions
Unit 1 Computer organization and InstructionsUnit 1 Computer organization and Instructions
Unit 1 Computer organization and Instructions
 
Processor architecture
Processor architectureProcessor architecture
Processor architecture
 
Unit iii
Unit iiiUnit iii
Unit iii
 
Basic structure of computers
Basic structure of computersBasic structure of computers
Basic structure of computers
 
Бие даалт
Бие даалтБие даалт
Бие даалт
 
Topic 5 Digital Technique basic computer structure
Topic 5 Digital Technique basic computer structureTopic 5 Digital Technique basic computer structure
Topic 5 Digital Technique basic computer structure
 
Computer organuzaton & architecture
Computer organuzaton & architectureComputer organuzaton & architecture
Computer organuzaton & architecture
 
Co notes3 sem
Co notes3 semCo notes3 sem
Co notes3 sem
 
Ch12 io systems
Ch12   io systemsCh12   io systems
Ch12 io systems
 
CS6303 - Computer Architecture
CS6303 - Computer ArchitectureCS6303 - Computer Architecture
CS6303 - Computer Architecture
 
Intro to the unit
Intro to the unitIntro to the unit
Intro to the unit
 
Advanced computer architecture
Advanced computer architectureAdvanced computer architecture
Advanced computer architecture
 
Embedded networking
Embedded networkingEmbedded networking
Embedded networking
 
Basic organization of computer
 Basic organization of computer Basic organization of computer
Basic organization of computer
 
03 top level view of computer function and interconnection
03 top level view of computer function and interconnection03 top level view of computer function and interconnection
03 top level view of computer function and interconnection
 
Module1
Module1Module1
Module1
 
Chapter1 basic structure of computers
Chapter1  basic structure of computersChapter1  basic structure of computers
Chapter1 basic structure of computers
 

Semelhante a Co module 1 2019 20-converted

Computer Organization and Architecture.pptx
Computer Organization and Architecture.pptxComputer Organization and Architecture.pptx
Computer Organization and Architecture.pptx
AshokRachapalli1
 
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
Abhishekn84
 
What is operating system
What is operating systemWhat is operating system
What is operating system
Suvithak
 
1_to_10.pdf
1_to_10.pdf1_to_10.pdf
1_to_10.pdf
SHEHABALYAMANI
 

Semelhante a Co module 1 2019 20-converted (20)

Cao u1
Cao u1Cao u1
Cao u1
 
Computer Organization and Architecture.pptx
Computer Organization and Architecture.pptxComputer Organization and Architecture.pptx
Computer Organization and Architecture.pptx
 
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
 
Computer Architecture
Computer ArchitectureComputer Architecture
Computer Architecture
 
CAO.pptx
CAO.pptxCAO.pptx
CAO.pptx
 
ch1.pptx
ch1.pptxch1.pptx
ch1.pptx
 
Computer Organization and Architechuture basics
Computer Organization and Architechuture basicsComputer Organization and Architechuture basics
Computer Organization and Architechuture basics
 
What is operating system
What is operating systemWhat is operating system
What is operating system
 
chapter 1 -Basic Structure of Computers.pptx
chapter 1 -Basic Structure of Computers.pptxchapter 1 -Basic Structure of Computers.pptx
chapter 1 -Basic Structure of Computers.pptx
 
HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS1:002
HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS1:002HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS1:002
HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS1:002
 
Co m1-1
Co m1-1Co m1-1
Co m1-1
 
computer devices and memory unit 2 notes.pdf
computer devices and memory unit 2 notes.pdfcomputer devices and memory unit 2 notes.pdf
computer devices and memory unit 2 notes.pdf
 
HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS3:005
HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS3:005HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS3:005
HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS3:005
 
HHCJ AMUMARA: COMPUTER STUDIES LECTURE NOTE FOR SS2-001
HHCJ AMUMARA: COMPUTER STUDIES LECTURE NOTE FOR SS2-001HHCJ AMUMARA: COMPUTER STUDIES LECTURE NOTE FOR SS2-001
HHCJ AMUMARA: COMPUTER STUDIES LECTURE NOTE FOR SS2-001
 
unit-i.pdf
unit-i.pdfunit-i.pdf
unit-i.pdf
 
introduction COA(M1).pptx
introduction COA(M1).pptxintroduction COA(M1).pptx
introduction COA(M1).pptx
 
BASIC STRUCTURE OF COMPUTERS.pptx
BASIC STRUCTURE OF COMPUTERS.pptxBASIC STRUCTURE OF COMPUTERS.pptx
BASIC STRUCTURE OF COMPUTERS.pptx
 
Computer organisation and architecture module 1
Computer organisation and architecture module 1Computer organisation and architecture module 1
Computer organisation and architecture module 1
 
CO&A_Modulektyukkhghhkkkkkkkjg_1 PPT.pdf
CO&A_Modulektyukkhghhkkkkkkkjg_1 PPT.pdfCO&A_Modulektyukkhghhkkkkkkkjg_1 PPT.pdf
CO&A_Modulektyukkhghhkkkkkkkjg_1 PPT.pdf
 
1_to_10.pdf
1_to_10.pdf1_to_10.pdf
1_to_10.pdf
 

Último

Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Dr.Costas Sachpazis
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
Tonystark477637
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 

Último (20)

UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSUNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spain
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 

Co module 1 2019 20-converted

  • 1. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 1 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.
  • 2. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 2 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.
  • 3. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 3 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.
  • 4. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 4 • 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.
  • 5. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 5 • 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.
  • 6. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 6 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
  • 7. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 7 ❑ 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
  • 8. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 8 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
  • 9. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 9 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
  • 10. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 10 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.
  • 11. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 11 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: 0 1 2 3 4 5 6 7 8 9 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
  • 12. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 12 ◼ 0 represents zero voltage (0v) or ground ◼ 1 represents positive voltage (+5v) Power of 2 Calculation Value 2 0 1 1 2 1 2 2 Dec imal Binary 0 00 2 1 * 0 + 2 0 * 0 = 2*0 +1*0 = 0+0=0 1 01 2 1 * 0 + 2 0 * 1 = 2*0 +1*1 =0+1= 1 2 10 2 1 * 1 + 2 0 * 0 = 2*1 +1*0 = 2+0=2 3 11 2 1 * 1 + 2 0 * 1 = 2*1 +1*1 = 2+1=3 Example: 3-bit binary numbers Decimal Binary 0 000 Power of 2 Calculation Value 1 001 2 0 1 2 010 2 1 2 2 3 011 2 2 2 * 2 4 4 100 5 101 6 110 7 111
  • 13. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 13 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 Decimal 7-bit Binary Number 5 0000101 14 0001110 26 0011010 53 0110101 What is the biggest decimal number that you can represent in binary using 8-bit ?
  • 14. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 14  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.
  • 15. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 15 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
  • 16. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 16 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
  • 17. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 17 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
  • 18. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 18  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
  • 19. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 19 Problem with arithmetic
  • 20. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 20 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
  • 21. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 21 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.
  • 22. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 22 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
  • 23. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 23 Memory Locations and Addresses
  • 24. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 24
  • 25. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 25 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.
  • 26. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 26 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:
  • 27. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 27 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).
  • 28. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 28 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
  • 29. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 29 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
  • 30. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 30 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
  • 31. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 31 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
  • 32. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 32 Problems
  • 33. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 33 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.
  • 34. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 34 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.
  • 35. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 35
  • 36. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 36 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
  • 37. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 37  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.
  • 38. Bahubali College of Engineering, Shravanabelagola Computer Organisation 18EC35 K Ramamani, HOD in E&CE 38