ITEC255-Chapter3 (Part1)
ITEC255-Chapter3 (Part1)
ITEC255
Computer Organization
ITEC255 - Computer Organization & Architecture
& Architecture
Key Points
• The major computer system components (processor, main
memory, I/O modules) need to be interconnected in order to
exchange data and control signals.
1
Key Points
• The most popular means of interconnection is the use of a
shared system bus consisting of multiple lines.
Computer Components
• Virtually all contemporary computer designs are based on
concepts referred to as von Neumann architecture.
memory.
Contents of this memory are addressable by location,
without regard to the type of data contained there.
Execution occurs in a sequential fashion from one
instruction to the next.
2
Computer Components
Computer Components
data.
3
Computer Components
• Programming is now much easier. Instead of rewiring the
hardware for each new program, all we need to do is provide
a new sequence of codes.
• Each code is an instruction and part of the hardware
interprets each instruction and generates control signals.
ITEC255 - Computer Organization & Architecture
Computer Components
4
Computer Components
Computer Components
• Figure shows top-level components and suggests the
interactions among them.
ITEC255 - Computer Organization & Architecture
10
5
Computer Components
11
Computer Components
12
6
Computer Function
13
Computer Function
• Program execution consists of repeating the process of
instruction fetch and instruction execution. The instruction
execution may involve several operations and depends on the
nature of the instruction.
• The processing required for a single instruction is called an
ITEC255 - Computer Organization & Architecture
instruction cycle.
• Program execution halts only if the machine is turned off,
some sort of unrecoverable error occurs, or a program
instruction that halts the computer is encountered.
14
7
Computer Function
• At the beginning of each instruction cycle, the processor
fetches an instruction from memory.
• In a typical processor, a register called the program counter
(PC) holds the address of the instruction to be fetched next.
• The processor always increments the PC after each
ITEC255 - Computer Organization & Architecture
15
Computer Function
16
8
Computer Function
Example:
• Consider a simple example using a hypothetical machine that
includes the characteristics shown below.
ITEC255 - Computer Organization & Architecture
17
Computer Function
Example:
• The processor contains a single data register, called an
accumulator (AC).
• Both instructions and data are 16 bits long.
• The instruction format provides 4 bits for the opcode.
ITEC255 - Computer Organization & Architecture
• To summarize:
• Step 1: Load AC from 940
• Step 2: Add contents of 941 to AC
• Step 3: Store AC to 941
18
9
Computer Function
Example:
1. PC contains 300, address of first instruction. This instruction (value 1940
in hexadecimal) is loaded into instruction register IR and PC is
incremented.
2. First instruction in IR is 1940.
ITEC255 - Computer Organization & Architecture
19
Computer Function
Example:
Solution
ITEC255 - Computer Organization & Architecture
20
10
Computer Function
• Virtually all computers provide mechanism by which other
modules (I/O, memory) may interrupt normal processing of
processor.
• Interrupts are provided primarily as a way to improve processing
efficiency.
• The most common classes of interrupts:
ITEC255 - Computer Organization & Architecture
Computer Function
22
11
Computer Function
• From the point of view of the user program, an interrupt is just an
interruption of the normal sequence of execution.
• When the interrupt processing is completed, execution resumes.
Thus, the user program does not have to contain any special code to
accommodate interrupts; the processor and the operating system
are responsible for suspending the user program and then resuming
ITEC255 - Computer Organization & Architecture
23
Computer Function
24
12
Computer Function
• If an interrupt is pending, the processor does the following:
It suspends execution of the current program being executed
and saves its context on the system stack – a special place in
memory.
It sets the program counter to the starting address of an
interrupt handler routine.
ITEC255 - Computer Organization & Architecture
25
Computer Function
• The processor now proceeds to the fetch cycle and fetches the
first instruction in the interrupt handler program, which will
service the interrupt.
ITEC255 - Computer Organization & Architecture
26
13
Computer Function
Example:
• The user program performs a series of WRITE calls
interleaved with processing.
• Code segments 1, 2, and 3 refer to sequences of
instructions that do not involve I/O.
ITEC255 - Computer Organization & Architecture
27
Computer Function
Example: WRITE WRITE
Solution
(Short I/O wait)
ITEC255 - Computer Organization & Architecture
WRITE
WRITE
28
14
Computer Function
WRITE WRITE
Example:
Solution
(Long I/O wait)
ITEC255 - Computer Organization & Architecture
WRITE
WRITE
29
15