Unit I
Unit I
Unit I
Lecture notes
Unit-1
Syllabus
Basic Structure of Computers: Computer Types, Functional Units, Basic Operational Concepts, Bus
Structures, Performance, Multiprocessors and Multi-computers, Historical perspective.
Input/output Organization: Accessing I/O devices Interrupts, Processor examples, Direct memory
access, Parallel interface and serial interfacing.
Course Outcome:
CO 1: Understand the functional units and architecture of a modern computer, and interconnectivity of
I/O units using Bus structures.
Lecture Notes
1. Input Unit: Computer accepts encoded information through input unit. The standard input device is a
keyboard. Whenever a key is pressed, keyboard controller sends the code to CPU/Memory. Examples
include Mouse, Joystick, Tracker ball, Light pen, Digitizer, Scanner etc.
2. Memory Unit: Memory unit stores the program instructions (Code), data and results of computations
etc. Memory unit is classified as:
• Primary /Main Memory
• Secondary
• Memory/Auxiliary
Computer Organization(PC 402 CS) 2
Primary memory is a semiconductor memory that provides access at high speed. Run time program
instructions and operands are stored in the main memory. Main memory is classified again as ROM and
RAM. ROM holds system programs and firmware routines such as BIOS, POST, I/O Drivers that are
essential to manage the hardware of a computer. RAM is termed as Read/Write memory or user memory
that holds run time program instruction and data. While primary storage is essential, it is volatile in nature
and expensive. Additional requirement of memory could be supplied as auxiliary memory at cheaper cost.
Secondary memories are non volatile in nature.
3. Arithmetic and logic unit: ALU consist of necessary logic circuits like adder, comparator etc., to
perform operations of addition, multiplication, comparison of two numbers etc.
4. Output Unit: Computer after computation returns the computed results, error messages, etc. via output
unit. The standard output device is a video monitor, LCD/TFT monitor. Other output devices are printers,
plotters etc.
5. Control Unit: Control unit co-ordinates activities of all units by issuing control signals. Control signals
issued by control unit govern the data transfers and then appropriate operations take place. Control unit
interprets or decides the operation/action to be performed.
The operations of a computer can be summarized as follows:
1. A set of instructions called a program reside in the main memory of computer.
2. The CPU fetches those instructions sequentially one-by-one from the main memory, decodes them and
performs the specified operation on associated data operands in ALU.
3. Processed data and results will be displayed on an output unit.
4. All activities pertaining to processing and data movement inside the computer machine are governed by
control unit
The above diagram shows the ALU and control circuitry. The processor contains a number of registers used
for several different purpose. The registers are:
Program Counter(PC): It contains the memory address of the next instructions to be fetched and
executed.
Memory Address Registers(MAR): It holds the address of the location to be accessed.
Memory Data Registers(MDR): It holds the data to be written into or read out of the addressed
location.
Instruction Register(IR): It holds the instruction that is currently being executed.
General purpose registers: These are the registers ranging from R0 through Rn-1 which are used
for intermediatory communication.
Let us see the typical operating steps:
1. Program resides in the memory which is brought from the input devices.
2. Execution starts by updating the PC with first instructions address.
3. Contents of PC are transferred to MAR, where MAR will locate the instruction in the memory.
4. The instruction is transferred to MDR, and from MDR to IR and then to ALU for the
processing.
5. ALU performs the desired operation and send the result to MDR and that output is either
transferred to output devices or to memory by specifying the address in MAR.
All the units are connected to the bus. The bus can be used for only one transfer at a time, only two units
can actively use the bus at any given time. The main advantage of the single bus structure is its low cost
and its flexibility for attaching peripheral devices. The devices connected to a bus widely vary in their speed
of operation. Devices like keyboard and printers are relatively slow. Devices like magnetic or optical disks
are fast. To maintain the speed difference between the devices we use buffer registers to hold the
information during transfers.
1.5 Performance
Computer Organization(PC 402 CS) 4
The performance of the computer depends on many features like clock, speed, instruction set, compiler
etc…
The most important measure of the performance of the computer is how quickly it can execute programs.
The speed with which a computer execute programs is affected by the design of its hardware and its machine
language instructions. For, best performance it is necessary to design the compiler, the machine instruction
set , and the hardware in a coordinated way. To speed up the operations cache memory is also used.
1. Processor clock: 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.
Clock rate, R=1/P cycles per second, where P is one clock cycle.
Processors used in personal computes have clock rate from a few hundreds million to over a billion
cycles per sec. cycles per second are called Hertzs.
T= Processor time
N=number of machine language instructions
S=average number of basic steps to execute a machine instruction.
R=Clock rate (cycles per second).
To achieve high performance, the computer designer must seek ways to reduce the value of T,
which means reducing N,S and increasing R.
which adds the contents of registers R1,R2 and places the sum in R3. The contents of R1 and R2
are first transferred to the inputs of the ALU. After the add operation is performed, the sum is
transferred to R3. The processor can read the next instruction from the memory while the addition
operation is being performed. Pipelining increases the rate of executing instructions significantly
and causes the effective value of S to reduce. With such an arrangement, it becomes possible to
start the execution of several instructions in every clock cycle. This mode of operation is called
superscalar execution.
4. Instruction set(RISC and CISC):
There are two types of instruction sets.They are:
1. RISC(Reduced Instruction Set Computers): The main idea behind this is to make hardware
simpler by using an instruction set composed of a few basic steps for loading, evaluating, and
storing operations just like a load command will load data, a store command will store the data.
Characteristic of RISC –
Simpler instruction, hence simple instruction decoding.
Instruction comes undersize of one word.
Instruction takes a single clock cycle to get executed.
More general-purpose registers.
Simple Addressing Modes.
Fewer Data types.
A pipeline can be achieved.
Computer Organization(PC 402 CS) 5
2. CISC(Complex Instruction Set Computers): The main idea is that a single instruction will
do all loading, evaluating, and storing operations just like a multiplication command will do
stuff like loading data, evaluating, and storing it, hence it’s complex.
Characteristic of CISC –
Complex instruction, hence complex instruction decoding.
Instructions are larger than one-word size.
Instruction may take more than a single clock cycle to get executed.
Less number of general-purpose registers as operations get performed in memory itself.
Complex Addressing Modes.
More Data types.
5. Performance Measurement:
System Performance Evaluation Corporation(SPEC) is a nonprofitable organization which
evaluates the performance of many computers. SPEC rating is computed as follows
First Generation: The key concept of stored program was introduced by John von Neumann. Programs
and their data were located in the same memory, as they are today. Assembly language was used to prepare
programs and was translated into machine language for execution. Basic arithmetic operations were
performed in a few milliseconds using vacuum tube s technology to implement logic functions.
Second Generation:
Transistors were invented in 1940 and they replaced the vacuum tubes. Magnetic core memories, magnetic
drum storage devices, compilers, I/O Processors were major contributions in this generation.
Third Generation: In this generation Integrated circuits(IC) came up where fabrication of many transistors
on a single silicon chip began. IC’s enabled lower-cost and faster processors and memory elements to be
built. Integrated-circuit memories began to replace magnetic core memories. This generation also included
introduction of of microprogramming, parallelism and pipelining. Cache and virtual memories were
developed.
Computer Organization(PC 402 CS) 6
Fourth Generation: In this generation integrated-circuit fabrication techniques had evolved to the point
where complete processors and large section of the main memory of small computers could be implemented
on single chip. Tens of thousands of transistors could be placed on a single chip, and the name Very Large
Scale Integration(VLSI) was coined to describe this technology. Portable computers, desktops personal
computers and workstations, interconnected by local area networks and the Internet have become the
dominant mode of computing.
Beyond fourth Generation: Computers featuring artificial intelligence, massively parallel machines,
extensive distributed systems are the examples of current trends. The growth of computer industry is fueled
by increasingly powerful and affordable desktop computers and widespread use of the vast information
resources on the internet.
The development in technology have been many innovations in the architecture of computers such as the
use of caches and pipelining which have had s significant impact on computer performance.
Input/Output Organization
1.2.1 Accessing I/O Devices:
Most modern computers use single bus arrangement for connecting I/O devices to CPU &
Memory
The bus enables all the devices connected to it to exchange information
Bus consists of 3 set of lines : Address, Data, Control
Processor places a particular address (unique for an I/O Dev.) on address lines
Device which recognizes this address responds to the commands issued on the Control lines
Processor requests for either Read / Write
The data will be placed on Data lines
Hardware to connect I/O devices to bus:
Interface Circuit
– Address Decoder
– Control Circuits
– Data registers
– Status registers
The Registers in I/O Interface – buffer and control
Flags in Status Registers like SIN SOUT
Data Registers, like Data-IN, Data-OUT
I/O devices and the memory share the same address space , the arrangement is called Memory-
mapped I/O.
In Memory -mapped I/O portions of address space are assigned to I/O devices and reads and
writes to those addresses are interpreted as commands to the I/O device.
“DATAIN” is the address of the input buffer associated with the keyboard.
- Move DATAIN, R0 reads the data from DATAIN and stores them into processor register R0;
Computer Organization(PC 402 CS) 7
Data transfer between the central computer to I/O devices may be handled in variety of modes.
–Programmed I/O
–Interrupt Initiated I/O
–Direct Memory Access (DMA)
Programmed I/O:
In this case, use dedicated I/O instructions in the processor. These I/O instructions can specify
both the device number and the command word.
The process of periodically checking status bits to see if it is time for the next I/O operation, is
called polling. Polling is the simplest way for an I/O device to communicate with the processor
the processor.
The I/O device simply puts the information in a Status register, and the processor must come and
get the information. The processor is totally in control and does all the work.
Interrupt Initiated I/O
Interrupt -driven I/O employs I/O interrupts to driven I/O , employs I/O interrupts to indicate to
the processor that an I/O device needs attention.
Computer Organization(PC 402 CS) 8
When a device wants to notify the processor that it has completed some operation or needs
attention, it causes the processor to be interrupted
Although a DMA controller transfers data without intervention by the processor, its operation
must be under the control of a program executed by the processor, usually an operating system
routine.
To initiate the transfer of a block of words, the processor sends to the DMA controller the starting
address, the number of words in the block, and the direction of the transfer. The DMA controller
then proceeds to perform the requested operation.
1.2.2 Interrupts:
Whenever any wait instruction is executed the the processor is not performing any task.
In the meanwhile the processor can perform many other tasks than waiting for the I/O devices to
get ready.
To do this we can arrange an alert for the I/O Device to inform processor that it is ready.
For this a bus control line called interrupt- request line is arranged.
The routine executed in the response to interrupt- request line is called Interrupt service
routine(IRS).
All the registers, flags, program counter values are saved by the processor before running ISR.
From the above fig, the processor first completes execution of instruction i and then loads the first
instruction address of the ISR .After execution of ISR the processor should return back to i+1 instruction.
INTR=INTR1+………+INTRn
Interrupt-Request line
ii. Enabling and Disabling Interrupts:
Device activates interrupt signal line and waits with this signal activated until processors
attends.
The interrupt signal line is active during execution of ISR and till the device caused interrupt
is serviced
Necessary to ensure that the active signal does not lead to successive interruptions (level -
triggered input) causing the system to fall in infinite loop.
What if the same device interrupts again, within an ISR ?
Three methods of Controlling Interrupts (single device)
– Ignoring interrupt
– Disabling interrupts
– Special Interrupt request line
Ignoring Interrupts – Processor hardware ignores the interrupt request line until the
execution of the first instruction of the ISR completed
– Using an interrupt disable instruction after the first instruction of the ISR
– no further interrupts
– A return from interrupt instruction is completed before further interruptions can occur
Disabling Interrupts – Processor automatically disables interrupts before starting the
execution of the ISR
– The processor saves the contents of PC and PS (status (status register) before performing
interrupt disabling.
– The interrupt-enable is set to 0
– no further interrupts allowed
– When return from interrupt instruction is executed the contents of the PS are restored from
the stack, and the interrupt enable is set to 1
Special Interrupt line – Special interrupt request line for which the interrupt handling circuit
responds only to the leading edge of the signal
– Edge –triggered
– Processor receives only one request regardless of how long the line is activated
– No separate interrupt disabling instructions
The sequence of events involved in handling an interrupt request from a single device.
Assuming that interrupts are enabled, the following is a typical scenario:
1. The device raises an interrupt request.
2. The processor interrupts the program currently being executed.
3. Interrupts are disabled by changing the control bits in the PS (except in the case of edge -triggered
interrupts) executed. PS (except in the case of edge -triggered interrupts).
4. The device is informed that its request has been recognized, and in response, and in response, it
deactivates the interrupt - request signal.
Computer Organization(PC 402 CS) 10
- Daisy Chaining:
The interrupt request line INTR is common to all the devices
Computer Organization(PC 402 CS) 11
Combining Daisy chaining and Interrupt nesting to form priority group. Each group has
different priority levels and within each group devices are connected in daisy chain way
1.2.3 Processor Examples:
ARM Interrupt Structure:
There are 6 modes, one mode is User mode and 5 privileged modes for each type of
exception.
Computer Organization(PC 402 CS) 12
When the processor switches to a different mode, it also switches some of the registers
accessible to the program.
The register set accessible in each mode is Registers R0 to R7,CPSR.
In privileged modes, except FIQ, registers R8 to R12 are also accessible.
When the processor accepts an interrupt, it takes the following actions:
1. It saves the returned address of the interrupted program in register 14 of the corresponding
modes. For example, in the case of FIQ, it saves in R14 fiq.
2. It saves the contents of the processor status register, CPSR, in the corresponding SPSR.
3. It changes the mode bits in CPSR according to the type of interrupt.
4. It branches to the interrupt-service routine starting at the appropriate vector address.
1.2.4 Direct Memory Access (DMA):
For I/O transfer, Processor determines the status of I/O devices, by – Polling – Waiting for
Interrupt signal
Considerable overhead is incurred in above I/O transfer processing
To transfer large blocks of data at high Speed, between EXTERNAL devices & Main
Memory, DMA approach is often used
DMA controller allows data transfer directly between I/O device an d Memory, with minimal
intervention of processor.
DMA controller acts as a Processor, but it is controlled by CPU
Computer Organization(PC 402 CS) 13
To initiate transfer of a block of words, the processor sends the following data to controller
– The starting address of the memory block
– The word count
– Control to specify the mode of transfer such as read or write
– A control to start the DMA transfer
DMA controller performs the requested I/O operation and sends a interrupt to the processor
upon completion.
Registers in DMA
In DMA interface
First register stores the starting address
Second register stores Word count
Third register contains status and control flags
Memory accesses by the processor and DMA Controller are interwoven
DMA devices have higher priority then processor over BUS control
Cycle Stealing:- DMA Controller “steals” memory cycles from processor, though processor
originates most memory access.
Block or Burst mode:- The DMA controller may given exclusive access to the main
memory to transfer a block of data without interruption
Conflicts in DMA:
- Processor and DMA,
- Two DMA controllers, try to use the Bus at the same time to access the main memory.
Bus Arbitration:
Bus master: device that initiates data transfers on the bus.
The next device can take control of the bus after the current master relinquishes control
Bus Arbitration: process by which the next device to become master is selected
Centralized and Distributed Arbitration
Computer Organization(PC 402 CS) 14
Centralized Arbitration
– Separate unit (bus arbitration circuitry) connected to the bus
– Processor is normally the bus master, unless it grants bus mastership to DMA
For the timing/control:
- DMA controller 2 requests and acquires bus mastership and later releases the bus.
- During its tenure as the bus master, it may perform one or more data transfer operations,
depending on whether it is operating in the cycle stealing or block mode.
- After it releases the bus, the processor resumes bus mastership.
Distributed Arbitration
– All devices waiting to use the bus has to carry out the arbitration process - no central arbiter
– Each device on the bus is assigned with a 4-bit identification number
– One or more devices request the bus by asserting the start-arbitration signal and place their
identification number on the four open collector lines
– ARB0 through ARB3 are the four open collector lines
– One among the four is selected using the code on the lines and one with the highest ID number
Computer Organization(PC 402 CS) 15
Assume that two devices, A and B, having ID numbers 5 and 6, respectively, are requesting the
use of the bus.
Device A transmits the pattern 0101, and device B transmits the pattern 0110. The code seen by
both devices is 0111.
Each device compares the pattern on the arbitration lines to its own ID, starting from the most
significant bit.
If it detects a difference at any bit position, it disables its drivers at that bit position and for all
lower-order bits. It does so by placing a 0 at the input of these drivers does so by placing a 0 at
the input of these drivers.
In the case of our example, device A detects a difference on line ARB I. Hence, it disables its d
rivers on lines ARB 1 and ARBO. This causes the pattern on the arbitration lines to change.