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

Lec 02

Uploaded by

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

Lec 02

Uploaded by

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

20/1/2020

‫بسم هللا الرحمن الرحيم‬

University of Khartoum
Department of Electrical and Electronic
Engineering

COMPUTER ARCHITECTURE

January 2020 Ahmed Abdelkarim

Lecture 2

 Basic Structure of Computers.

1
20/1/2020

Interrupt
 Normal execution of programs may be preempted if
some device requires urgent servicing.
 For example, a monitoring device in a computer-
controlled industrial process may detect a dangerous
condition.
 In order to deal with the situation immediately, the
normal execution of the current program must be
interrupted. To do this, the device raises an interrupt
signal.

 An interrupt is a request from an I/O device for service


by the processor. The processor provides the requested
service by executing an appropriate interrupt-service
routine. Because such diversions may alter the internal
state of the processor, its state must be saved in memory
locations before servicing the interrupt.
 Normally, the contents of the PC, the general registers,
and some control information are stored in memory. When
the interrupt-service routine is completed, the state of the
processor is restored so that the interrupted program may
continue.

2
20/1/2020

Bus structure
 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.

Speed Issue
 Different devices have different transfer/operate
speed.
 If the speed of bus is bounded by the slowest
device connected to it, the efficiency will be very
low.
 A common approach is to include buffer registers
with the devices to hold the information during
transfers.

3
20/1/2020

Software
 System software must be in the memory in order for a
user to enter and run an application program on a
computer.
 System software is a collection of programs that are
executed as needed to perform functions such as:
 Receiving and interpreting user commands
 Entering and editing application programs and storing them as
files in secondary storage device
 Managing the storage and retrieval of files in secondary
storage devices

 Running standard application programs


 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
 Application programs are usually written in a high-
level programming language.
 Compiler translates the high-level language program
into a suitable machine language program.

4
20/1/2020

Operating system (OS)


 A large program used to control the sharing of and
interaction among various computer units as they
execute application programs.
 It assign computer resources to individual application
programs
 Memory
 Diskspace
 Move data
 Handle I/O

OS Routine Example
 Example: one processor, one disk, and one printer.
 Program is stored on disk
 Transfer program into memory

 Execute program

 Need to read a data file on disk into memory

 Calculation

 Print results

5
20/1/2020

OS Routine Example

Performance
 The most important measure of a computer is how
quickly it can execute programs.
 Three factors affect performance:
 Hardware design
 Instruction set

 Compiler

6
20/1/2020

Performance
 Processor time to execute a program depends on the
hardware involved in the execution of individual machine
instructions.

The processor cache

Performance
 The processor and a relatively small cache memory
can be fabricated on a single integrated circuit
chip.
 The internal speed of performing the basic steps of
instruction processing on such chips is very high and
is considerably faster than the speed at which
instructions and data can be fetched from the main
memory.

7
20/1/2020

Processor Clock
 Processor circuits are controlled by a timing signal called
a 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.
 The length P of one clock cycle is an important parameter
that affects processor performance.
 Its inverse is the clock rate, R =1/P, which is measured in
cycles per second (Hz).

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 depend on each other
T= N*S/R

8
20/1/2020

 A useful performance indicator is the instruction


throughput, which is the number of instructions
executed per second (P).
 P= R/S

 How to improve T ?
 We must emphasize that N, S, and R are not
independent parameters; changing one may affect
another.

Pipeline and Superscalar Operation


 Instructions are not necessarily executed one after
another.
 The value of S doesn’t have to be the number of clock
cycles to execute one instruction.
 Pipelining: overlapping the execution of successive
instructions.
 Add R1, R2, R3
 Superscalar operation: multiple instruction pipelines
are implemented in the processor in the same clock
cycle, but in different execution units
 Goal: reduce S (could become <1!)

9
20/1/2020

Clock Rate
 Increase clock rate:
 Improve the integrated-circuit (IC) technology to make the
circuits faster
 Reduce the amount of processing done in one basic step
(however, this may increase the number of basic steps
needed)

 Increases in R that are entirely caused by


improvements in IC technology affect all aspects of
the processor’s operation equally except the time to
access the main memory.

 Tradeoff between N and S


 A key consideration is the use of pipelining
S is close to 1 even though the number of basic steps
per instruction may be considerably larger
 It is much easier to implement efficient pipelining in
processor with simple instruction sets

10
20/1/2020

Compiler
 A compiler translates a high-level language program
into a sequence of machine instructions.
 To reduce N, we need a suitable machine instruction
set and a compiler that makes good use of it.
 Goal –reduce N×S
 A compiler may not be designed for a specific
processor; however, a high-quality compiler is usually
designed for, and with, a specific processor.

 Input/output organization.

11
20/1/2020

Accessing I/O Devices


 A simple arrangement to connect I/O devices to a
computer is to use a single bus arrangement, as shown in
the next figure.
 The bus enables all the devices connected to it to
exchange information. Typically, it consists of three sets
of lines used to carry address, data, and control signals.
 Each I/O device is assigned a unique set of addresses.
 When the processor places a particular address on the
address lines, the device that recognizes this address
responds to the commands issued on the control lines.

 The processor requests either a read or a write operation,


and the requested data are transferred over the data
lines.
 I/O ports are addressed using either standard I/O or
memory-mapped I/O techniques.

12
20/1/2020

Single Bus

I/O ports addressing

 When I/O devices and the memory share the same


address space, the arrangement is called memory-
mapped I/O.
 In this arrangement any machine instruction that can
access memory can be used to transfer data to or from
an I/O device.
Move DATAIN, R0
Move R0, DATAOUT
 Some processors have special In and Out instructions to
perform I/O transfer.

13
20/1/2020

 In these processors I/O devices and the memory have


separate address spaces.
 A special signal on the bus indicates that the requested
read or write transfer is an I/O operation. When this
signal is asserted, the memory unit ignores the requested
transfer.

I/O Interfacing
 The next figure illustrates the hardware required to
connect an I/O device to the bus.

14
20/1/2020

I/O interface for an input device.

 The address decoder enables the device to recognize its


address when this address appears on the address lines.
 The data register holds the data being transferred to or
from the processor.
 The status register contains information relevant to the
operation of the I/O device.

I/O Mechanisms
 Program-controlled I/O
 Interrupt
 Direct Memory Access (DMA)

15
20/1/2020

Program-Controlled I/O
 I/O devices operate at speeds that are vastly different
from that of the processor.

 Keyboard, for example, is very slow.

 It needs to make sure that only after a character is


available in the input buffer of the keyboard interface;
also, this character must be read only once.

 The basic idea is to set a status flag, SIN (Signal IN), as


part of the status register.

 This example illustrates program-controlled I/O, in which


the processor repeatedly checks a status flag to achieve
the required synchronization between the processor and
an input or output device. We say that the processor polls
the device.

16
20/1/2020

Keyboard Control Example

DATAIN

DATAOUT

STATUS DIRQ KIRQ SOUT SIN

CONTROL DEN KEN

7 6 5 4 3 2 1 0

Figure 4.3. Registers in keyboard and display interf


aces.

Keyboard Control Example

A program that reads one line from the keyboard, stores it


in memory buffer, and echoes it back to the display.

17
20/1/2020

 The rest of I/O Mechanisms which are:


 Interrupts

 Direct Memory Access (DMA)


 Will be discussed in the next Lectures.

 End of Lecture 2

18

You might also like