7/28/2019 Computer Architecture & Organisation Unit-1
1/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
UNIT 1: BASIC STRUCTURE OF COMPUTERS
Functional units of a computer
Basic operational concepts
Bus structures
Software performance
Memory locations and addresses
Memory operations
Instruction and instruction sequencing
Addressing modes
Assembly language
Page 1Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
7/28/2019 Computer Architecture & Organisation Unit-1
2/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
1.1 FUNCTIONAL UNITS OF A COMPUTER
A computer has five functionally independent main parts:
Input Unit
Memory Unit
Arithmetic and logic Unit
Output Unit
Control unit
Figure 1.1: Functional units of a computer system
A) Input Unit:-
Computers accept coded information through input units, which read the data. The most well-
known input device is keyboard. Whenever a key is pressed, the corresponding letter or digit is
automatically translated into its corresponding binary code and transmitted over a cable to either
the memory or the processor.
B) Memory Unit:-
The function of the memory unit is to store programs and data.
There are two classes of storage, called Primary and Secondary.
Page 2Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
7/28/2019 Computer Architecture & Organisation Unit-1
3/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
Primary storage is a fast memory that operates at electronic speeds. Programs must be
stored in the memory while they are being executed. Memory in which any location can be
reached in a short and fixed amount of time after specifying its address is called Random
Access Memory(RAM). The time required to access one word is called the Memory Access
Time.
Although Primary Storage is essential, it tends to be expensive. Thus additional, cheaper,
secondary storage is used when large amounts of data and many programs have to be stored,
particularly for information that is accessed infrequently. Ex:- magnetic disks and tapes and
optical disks.
C) Arithmetic and Logic Unit:-
All the arithmetic or logic operation, is initiated by bringing the required operands into the
processor, where the operation is performed by the ALU.
D) Output Unit:-
The Output unit of the computer system is the unit through which the computer displays the
result of the processed data called information. To do this, it makes use of Output devices. Its
function is to send processed result to the outside world.
Examples of Output devices are: The Monitor, also called Visual Display Unit or Cathode RayTube, Printer, Speakers, Plotters etc.
E) Control Unit:-
The Control Unit is used to co-ordinate the operations of memory, ALU, input and output units.
The Control Unit can be said as the nerve center that sends control signals to other units and
senses their states. Basic functions of the control unit are
i. It directs the sequence of operations,
ii. It interprets the instructions, of a program, in storage unit and produces signals the command
circuits to execute the instructions.
iii. It directs the flow of all activities in the computer system.
Page 3Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
7/28/2019 Computer Architecture & Organisation Unit-1
4/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
1.2 BASIC OPERATIONAL CONCEPTS
The computer works based on some given instruction. Let us consider an example:
Add LOCA, R0
-> This instruction adds the operands at memory location LOCA to the operand in the register R0
and places the sum into the register R0.It seems that this instruction is done in one step, but
actually it internally performs several steps
->First, the instruction is fetched from the memory into the processor. Next, the operand at
LOCA is fetched and added to the contents of R0.
The above instruction can be written also as-
Load LOCA, R1
Add R1,R0
Let us now analyze how the memory and processor are connected:-
The Processor contains a number of registers used for several purposes.
IR: The IR(Instruction Register) holds the instruction that is currently being executed.
PC: The PC(Program Counter) is another specialized register which contains the memory
address of next instruction to be fetched.
MAR: This register facilitates communication with the memory. The MAR holds the
address of the location to be accessed.
MDR: This register facilitates communication with the memory. The MDR contains thedata to be written into or read out of the addressed location.
There are n general purpose registers R0 to Rn-1.
The Program execution starts when the PC is set to point the 1st instruction. The content
of the PC is transferred to the MAR and Read control signal is sent to memory. Then the
addressed word is read out of the memory and loaded into the MDR. Next the contents of the
Page 4Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
7/28/2019 Computer Architecture & Organisation Unit-1
5/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
MDR are transferred to the IR. Then the program is decoded, it is sent to the ALU if it has
some arithmetic or logical calculations. The n general purpose registers are used during this
calculations to store the result. Then the result is sent to the MDR, and its address of location
where result is stored is sent to MAR. And then a write cycle is initiated. Then PC is
incremented and the process continues.
Figure 1.2: Interconnection of Processor and Main Memory
1.3 BUS STRUCTURES
In computer architecture, a bus is a subsystem that transfers data between componentsinside a computer, or between computers. Early computer buses were literally parallel electricalwires with multiple connections, but Modern computer buses can use both parallel and bit serialconnections.
A bus is a collection of wires that connect several devices within a computer system. When a
word of data is transferred between units, all its bits are transferred in parallel. A computer must
have some lines for addressing and control purposes.
Page 5Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
7/28/2019 Computer Architecture & Organisation Unit-1
6/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
Three main groupings of lines:
1.Data Bus. This is for the transmission of data.
2.Address Bus. This specifies the location of data in MM.
3. Control Bus. This indicates the direction of data transfer and coordinates the timing of events
during the transfer.
Figure 1.3: Single Bus Structure
The Bus is used to connect all the individual parts of a computer in an organized manner.
The simplest way to interconnect functional units is to use a single bus. The main advantage of
the single bus structure is its low cost and its flexibility. The multiple bus achieve more
concurrency in operation by allowing two or more transfers to be carried at the same time.
Figure 1.4: I/O Memory Bus
Single Bus Structure
All units are connected to a single bus, so it provides the sole means of interconnection. Single
bus structure has advantages of simplicity and low cost.
Page 6Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
7/28/2019 Computer Architecture & Organisation Unit-1
7/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
Single bus structure has disadvantages of limited speed since usually only two units can
participate in a data transfer at any one time. This means that an arbitration system is required
and that units will be forced to wait.
Only two units can actively use the bus at any given time. Bus control lines are used to arbitrate
multiple requests for the use of the bus.
Buffer Registers are used to hold information during transfers.
Figure 1.5: Multiple Bus Configurations
Two Bus Structure
In the first configuration, the processor is placed between the I/O unit and the memory unit. The
processor is responsible for any data transfer between the I/O unit and the memory unit. The
processor acts as a messenger. In this structure, the processor performance and capability is not
Page 7Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
7/28/2019 Computer Architecture & Organisation Unit-1
8/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
being maximized. Most of the time, the processor is doing data transfer between these units
instead of performing more complex applications. Also, the processor is idle most of the time
waiting for these slow devices.
In the second configuration, I/O transfers are made directly to or from the memory. A special
purpose processor called peripheral processor or I/O channel is needed as part of the I/Oequipment to control and facilitate such transfers. This special processor is the direct memory
access (DMA) controller. It allows main memory to perform data transfer between I/O units.
The devices connected to a bus vary widely in their speed of operation. Some electromechanical
devices, such as keyboards and printers are relatively slow. Other devises like magnetic or
optical disks, are considerably faster. Memory and processor units operate at electronic speeds,
making them the fastest parts of a computer. Because all these devices must communicate with
each other over a bus, an efficient transfer mechanism that is not constrained by the slow devices
and that can be used to smooth out the differences in timing among processors, memories, and
external devices is necessary.
Figure 1.6: Traditional bus configuration
Multiprocessors and Multicomputers:-
A large computer system which contains a number of processor units is called Multiprocessor
System. This systems either execute a number of different application tasks in parallel, or they
Page 8Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
7/28/2019 Computer Architecture & Organisation Unit-1
9/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
execute subtasks of a single large task in parallel. The high performance of these systems comes
with much increased complexity and cost.
The Multicomputer System is formed by interconnecting a group of complete computers to
achieve high total computational power. They can access only their own memory. Theycommunicate data by exchanging messages over a communication network.
1.4 SOFTWARE PERFORMANCE
Computer software, or just software is a general term used to describe the role that computerprograms, procedures and documentation play in a computer system.
The term includes:
1. Application software, such as word processors which perform productive tasks for users.
2. Firmware, which is software programmed resident to electrically programmable memorydevices on board main boards or other types of integrated hardware carriers.
3. Middleware, which controls and co-ordinates distributed systems.
4. System software such as operating systems, which interface with hardware to provide the
necessary services for application software.
Software Characteristics
Software is developed and engineered.
Software doesn't "wear-out".
Most software continues to be custom built.
Types of software
The three major classified types of software are
a) System software
b) Programming software
c) Application software
Page 9Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
7/28/2019 Computer Architecture & Organisation Unit-1
10/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
Figure 1.6: Layered architecture of an OS and System Hardware and Users
System software
System software helps run the computer hardware and computer system. It includes acombination of the following:
device drivers
operating systems
servers
utilities
windowing systems
The purpose of systems software is to unburden the applications programmer from the oftencomplex details of the particular computer being used, including such accessories ascommunications devices, printers, device readers, displays and keyboards, and also to partitionthe computer's resources such as memory and processor time in a safe and stable manner.Examples are- Windows XP, Linux and Mac.
Programming software
Programming software usually provides tools to assist a programmer in writing computer
programs, and software using different programming languages in a more convenient way. Thetools include:
compilers
debuggers
interpreters
linkers
text editors
Page 10Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
7/28/2019 Computer Architecture & Organisation Unit-1
11/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
Application software
Application software allows end users to accomplish one or more specific (not directly computerdevelopment related) tasks. Typical applications include:
1. industrial automation
2. business software
3. computer games
4. quantum chemistry and solid state physics software
5. telecommunications (i.e., the internet and everything that flows on it)
6. databases
7. educational software
8. medical software
9. military software
10. molecular modeling software
11. image editing
12. spreadsheet13. simulation software
14. Word processing
15. Decision making software
Application software exists for and has impacted a wide variety of topics.
Assembler
Typically a modern assembler creates object code by translating assembly instructionmnemonics into op codes, and by resolving symbolic names for memory locations and otherentities. The use of symbolic references is a key feature of assemblers, saving tediouscalculations and manual address updates after program modifications. Most assemblers alsoinclude macro facilities for performing textual substitutione.g., to generate common shortsequences of instructions to run inline, instead of in a subroutine.
1.4.1 PERFORMANCE AND METRICS
Important measure of performance of computer how quickly it can execute programs. Elapsed
time-total time required to execute the program.-measure of performance of entire computer
system. Processor time-sum of periods in which the processor is active. Depends on hardware
involved in execution of individual instructions
Page 11Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
http://gowsalyaa24.files.wordpress.com/2011/04/processor-cache.jpg7/28/2019 Computer Architecture & Organisation Unit-1
12/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
Start of execution, all program instructions & required data are stored in main memory. As
execution proceeds-instructions are fetched one by one over bus into processor © is placed
in cache. If any data is needed by an instruction in main memory, data are fetched & copy is
placed in cache.
If the same data or instruction is needed again, the data is read directly from cache.
1) Processor clock
Clock-processor circuits are controlled by timing signals.
Clock cycles-clock defines regular time intervals.
Cycles per second-hertz
Inverse of clock cycle-clock rate R=1/P, P-length of 1 clock cycle.
2) Basic performance equation
Where T-processor time to execute a programN-no of instruction executionsS-basic number of steps to execute one instruction.R-clock rate.
3) Pipelining & super scalar operation
Over lapping the execution of successive instructions is called pipelining.
Superscalar operation-different instructions can be executed in parallel.
4) Clock rate
2 possibilities to increase clock rate.
1. Improving IC technology makes logic circuits faster.
2. Reducing the amount of processing done in one basic step.
5) Instruction set CISC & RISC
RISC-Reduced instruction set computer-smaller number of steps to execute. CISC-complex instruction set computer-larger number of steps to execute.
6) Compiler
Translates high level language into sequence of machine instructions.
7) Performance measurement
Page 12Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
http://gowsalyaa24.files.wordpress.com/2011/04/basic-eq1.jpg7/28/2019 Computer Architecture & Organisation Unit-1
13/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
SPEC-system performance Evaluation Corporation.
1.5 MEMORY LOCATIONS AND ADDRESSES
Logical structure of a computers random-access memory (RAM)
The generic term for the smallest unit of memory that the CPU can read or write is cell. In mostmodern computers, the size of a cell is 8 bits (1 byte). Hardware-accessible units of memorylarger than one cell are called words. Currently (1998) the most common word sizes are 32 bits(4 bytes) and 64 bits (8 bytes). Every memory cell has a unique integer address.
The CPU accesses a cell by giving its address. Addresses of logically adjacent cells differ by 1.
The address space of a processor is the range of possible integer addresses, typically (0 : 2n1)
Page 13Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
7/28/2019 Computer Architecture & Organisation Unit-1
14/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
In a byte-addressed memory, the addresses of successive words differ by the number of bytes in
a word:
Page 14Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
7/28/2019 Computer Architecture & Organisation Unit-1
15/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
Page 15Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
7/28/2019 Computer Architecture & Organisation Unit-1
16/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
1.6 MEMORY OPERATIONS
The MIPS ISA is a load-store architecture. This means that the only operations thatinteract with memory are load and store.
load To loada value from memory, you copy the data from memory into aregister. store Tostore a value to memory, you copy the data from a register to
memory.
CISC ISAs often have other kinds of instructions that interact with memory. Forexample, there may be an instruction that adds the contents of a register to thecontents at a memory address and store that in a register.
These kinds of instructions do not appear in MIPS ISA, nor in most RISC ISAs.
Let's define what those terms mean:
load To "load" means to copy a value from memory at some memory address,to a register. The value might be a word (32 bits), halfword (16 bits) or byte (8
bits). If the value is any shorter than a word, then it may be loaded assigned(where the value is sign-extended to 32 bits) or unsigned (where the value iszero-extended to 32 bits).
store Store is the opposite operation of load. Where load copies a value from
memory to a register, store copies a value from register to memory.
1.7 INSTRUCTION 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
Page 16Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
7/28/2019 Computer Architecture & Organisation Unit-1
17/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
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 operandsC-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 phaseinstruction 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.
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.
Page 17Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
7/28/2019 Computer Architecture & Organisation Unit-1
18/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
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.
N - (negative)-set to 1 if result is ve or else 0.
Z - (zero)-set to 1 if result is 0, or else 0 .
V - (overflow)-set to 1if arithmetic overflow occurs or else 0.
C - (carry)-set to 1 if carry out results from operation or else 0
1.8 ADDRESSING MODES
The different ways in which location of an operand is specified in an instruction are referred as
addressing modes.
TYPES OF ADDRESSING MODES.
Variable-represented by allocating a register or memory location to hold its value.
1. REGISTER MODE
The operand is the contents of processor register, name of register is given in instruction.
Mov Loc, R2.
Processor registers are used as temporary storage locations where data in a register are
accessed using register mode.
Page 18Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
7/28/2019 Computer Architecture & Organisation Unit-1
19/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
2. ABSOLUTE MODE(OR) DIRECT MODE
The operand is in a memory location, the address of this location is given explicitly in
the instruction.
Integer A, B
Absolute mode is used to access these variables.
3. IMMEDIATE MODE
Address and data constants-represented in assembly language using immediate mode.
Operand is given explicitly in the instruction.
Mov #200, R0
(#)-value is used as an immediate operand.
Mainly used to specify value of a source operand.
4. INDIRECT MODE
Memory address of an operand can be determined by instruction.
Address-called Effective Address (EA) of an operand.
EA of an operand contents of a register.
When absolute mode-not available, indirect addressing through registers use to access
global variables.
5. INDEX MODE
Deals With lists and arrays.
EA-generated by adding constant value to contents of register.
Index registers one of set of general purpose registers in a processor.
X(Ri)
X-constant value in instruction.
Ri-name of the register involved.
EA=X+[Ri]
Second register is used, index mode
(Ri, Rj).
EA = [Ri + Rj]
Second register-base register.
Page 19Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
7/28/2019 Computer Architecture & Organisation Unit-1
20/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
X(Ri,Rj)
EA=X+[Ri]+[Rj]
Gives more flexibility.
6. RELATIVE MODE
EA-for index mode is given using program counter.
This mode used to access data operands.
Common use-specify target address in branch instruction.
Branch>0 Loop.
Program execution got to branch target location identified by name loop if branch
condition is satisfied.
7. AUTO INCREMENT MODE.
Useful for accessing data items in successive locations in memory.
EA of an operand contents of register specified in instruction.
After accessing operand contents of register is automatically incremented to point to
next item in a list.
(Ri)+
Increment amount 1 for byte specified operands.
2 for 16-bit operands.
4 for 32-bit operands.
8. AUTODECREMENT MODE.
Contents of register specified in instruction are first automatically decremented & used as
a EA of the operand.
(Ri)
Minus sign indicate contents to be decremented before being used as EA.
Operands are accessed in descending address order.
1.9 ASSEMBLY LANGUAGE
Page 20Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
7/28/2019 Computer Architecture & Organisation Unit-1
21/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
Any Assembly language consists of 3 types of instruction statements which are used to definethe program operations:
Op code mnemonics
Data sections
Assembly directives
Opcode mnemonics
Instructions (statements) in assembly language are generally very simple, unlike those in high-level languages. Generally, an opcode is a symbolic name for a single executable machinelanguage instruction, and there is at least one opcode mnemonic defined for each machinelanguage instruction.
Each instruction typically consists of an operation oropcodeplus zero or more operands. Mostinstructions refer to a single value, or a pair of values.
Operands can be either immediate (typically one byte values, coded in the instruction itself) orthe addresses of data located elsewhere in storage. This is determined by the underlyingprocessor architecture: the assembler merely reflects how this architecture works.
Data sections
There are instructions used to define data elements to hold data and variables. They define whattype of data, length and alignment of data. These instructions can also define whether the data isavailable to outside programs (programs assembled separately) or only to the program in whichthe data section is defined. Einstein College of Engineering
Page 21Prepared by Mrs. B.chitra B.E., M.Tech., / AP / CSE
7/28/2019 Computer Architecture & Organisation Unit-1
22/22
12150H36- Computer Architecture and Organization / II Year / III Semester / June-Sep 2013
Assembly directives and pseudo-ops
Assembly directives are instructions that are executed by the assembler at assembly time, not bythe CPU at run time. They can make the assembly of the program dependent on parameters inputby the programmer, so that one program can be assembled different ways, perhaps for differentapplications. They also can be used to manipulate presentation of the program to make it easierfor the programmer to read and maintain.(For example, pseudo-ops would be used to reserve storage areas and optionally their initialcontents.) The names of pseudo-ops often start with a dot to distinguish them from machineinstructions.
Some assemblers also support pseudo-instructions, which generate two or more machineinstructions.
Symbolic assemblers allow programmers to associate arbitrary names (labels orsymbols) withmemory locations. Usually, every constant and variable is given a name so instructions canreference those locations by name, thus promoting self-documenting code. In executable code,
the name of each subroutine is associated with its entry point, so any calls to a subroutine can useits name. Inside subroutines, GOTO destinations are given labels. Some assemblers supportlocal symbols which are lexically distinct from normal symbols (e.g., the use of "10$" as aGOTO destination).
Most assemblers provide flexible symbol management, allowing programmers to managedifferent namespaces, automatically calculate offsets within data structures, and assign labelsthat refer to literal values or the result of simple computations performed by the assembler.Labels can also be used to initialize constants and variables with relocatable addresses.
Assembly languages, like most other computer languages, allow comments to be added to
assembly source code that are ignored by the assembler. Good use of comments is even moreimportant with assembly code than with higher-level languages, as the meaning and purpose of asequence of instructions is harder to decipher from the code itself.
Wise use of these facilities can greatly simplify the problems of coding and maintaining low-level code. Raw assembly source code as generated by compilers or dis-assemblerscodewithout any comments, meaningful symbols, or data definitionsis quite difficult to read whenchanges must be made.
----------------------------------------------------End of Unit 1-------------------------------------------------------
Top Related