Professional Documents
Culture Documents
Basic Structure of
Computers
Computer system Architectur
SUPER COMPUTERS
• Computer • Software
– A device that accepts input, – A computer program that tells
processes data, stores data, and the computer how to perform
produces output, all according to particular tasks.
a series of stored instructions.
• Network
• Hardware – Two or more computers and
– Includes the electronic and other devices that are
mechanical devices that process connected, for the purpose of
the data; refers to the computer sharing data and programs.
as well as peripheral devices.
• Peripheral devices
– Used to expand the computer’s
input, output and storage
capabilities.
Basic Terminology
• Input
– Whatever is put into a computer system.
• Data
– Refers to the symbols that represent facts, objects, or ideas.
• Information
– The results of the computer storing data as bits and bytes; the words, numbers,
sounds, and graphics.
• Output
– Consists of the processing results produced by a computer.
• Processing
– Manipulation of the data in many ways.
• Memory
– Area of the computer that temporarily holds data waiting to be processed,
stored, or output.
• Storage
– Area of the computer that holds data on a permanent basis when it is not
immediately needed for processing.
Basic Terminology
Calvin College
What is a computer?
• Output Unit
• Memory
• Bus Structure
The Big Picture
Processor
Input
Control
Memory
ALU
Output
• NOTHING ELSE!
INPUT UNIT:
OUTPUT UNIT:
T1 Enable R1
T2 Enable R2
R1 R2
•Each basic step is
executed in one clock
cycle
R2
MEMORY
•Two types are RAM or R/W memory and ROM read only memory
•ROM is used to store data and program which is not going to change.
• Add LOCA, R0
• Add the operand at memory location LOCA to the
operand in a register R0 in the processor.
• Place the sum into register R0.
• The original contents of LOCA are preserved.
• The original contents of R0 is overwritten.
• Instruction is fetched from the memory into the
processor – the operand at LOCA is fetched and added to
the contents of R0 – the resulting sum is stored in
register R0.
Separate Memory Access and
ALU Operation
• Load LOCA, R1
• Add R1, R0
• Whose contents will be overwritten?
Interconnection between Processor and Memory
Registers
Registers are fast stand-alone storage locations that hold data
temporarily. Multiple registers are needed to facilitate the
operation of the CPU. Some of these registers are
0 0 0 0th Location
0 0 1 1st Location
0 1 0
W/R
0 1 1
CS RD
A0 PROCESSOR
A1 1 0 0
A2
1 0 1
ADDRESS BUS
1 1 0
D7 D0
D0 D7
1 1 1
DATA BUS
Cont:-
Example 2
A computer has 128 MB of memory. Each word in this computer
is eight bytes. How many bits are needed to address any single
word in memory?
Solution
The memory address space is 128 MB, which means 227.
However, each word is eight (23) bytes, which means that we
have 224 words. This means that we need log2 224, or 24 bits, to
address each word.
MEMORY OPERATIONS
• 8000 54
• 8001 96
• 8002
78
• 8003
• 8004 46
|
Big Endian
0 0 1 2 3 0 3 2 1 0
4 4 5 6 7 4 7 6 5 4
• •
• •
• •
k k k k k k k k k k
2 -4 2 -4 2 -3 2- 2 2 - 1 2 - 4 2- 1 2 - 2 2 -3 2 -4
• R2 [LOCN]
• R4 [R3] +[R2]
ASSEMBLY LANGUAGE
NOTATION (ALN)
• RTN is easy to understand and but cannot be
used to represent machine instructions
• Mnemonics can be converted to machine
language, which processor understands
using assembler
Eg:
1. MOVE LOCN, R2
2. ADD R3, R2, R4
TYPES OF INSTRUCTION
}
Begin execution here i
i+4 Add B,R0
3-instruction program
i+8 Move R0,C
. segment
.
.
A
.
.
.
C
• PC – Program counter: hold the address of the next
instruction to be executed
• Straight line sequencing: If fetching and executing of
instructions is carried out one by one from successive
addresses of memory, it is called straight line sequencing.
• Major two phase of instruction execution
• Instruction fetch phase: Instruction is fetched form
memory and is placed in instruction register IR
• Instruction execute phase: Contents of IR is decoded and
processor carries out the operation either by reading data
from memory or registers.
BRANCHING
A: 11110000
• Example:
– A: 1 1 1 1 0 0 0 0 +(−B): 1 1 1 0 1 1 0 0
– B: 0 0 0 1 0 1 0 0 11011100
C=1 Z=0
S=1
V=0
Overflow occurs when the magnitude of a
number exceeds the range allowed by the size of
the bit field
Status Bits
Cn-1
A B
Cn ALU
F
V Z S C
Fn-1
Zero Check
Figure Format and different instruction types
Processing the instructions
Simple computer, like most computers, uses machine cycles.
During the execute phase, the instruction is executed and the results are
placed in the appropriate memory location or the register.
Once the third phase is completed, the control unit starts the cycle again,
but now the PC is pointing to the next instruction.
The process continues until the CPU reaches a HALT instruction.
Types of Addressing Modes
The different ways in which the location of the operand is
specified in an instruction are referred to as addressing
modes
• Immediate Addressing
• Direct Addressing
• Indirect Addressing
• Register Addressing
• Register Indirect Addressing
• Relative Addressing
• Indexed Addressing
Immediate Addressing
Instruction
opcode
operand
Direct Addressing
• Address field contains address of operand
• Effective address (EA) = address field (A)
• e.g. ADD A
– Add contents of cell A to accumulator
– Look in memory at address A for operand
• Single memory reference to access data
• No additional calculations to work out effective address
• Limited address space
Direct Addressing Diagram
Instruction
Opcode Address A
Memory
Operand
Indirect Addressing (1)
Pointer to operand
Operand
Register Addressing (1)
• No memory access
Instruction
Opcode Register Address R
Registers
Operand
Register Indirect
Addressing
• C.f. indirect addressing
• EA = [R]
• Operand is in memory cell pointed to by
contents of register R
• Large address space (2n)
• One fewer memory access than indirect
addressing
Register Indirect
Addressing Diagram
Instruction
Opcode Register Address R
Memory
Registers
Instruction
Opcode Register R Constant Value
Memory
Registers
• Implied mode
– The operand is specified implicitly in the definition
of the opcode.
• Immediate mode
– The actual operand is specified in the instruction
itself.
Addressing Modes (Summary)
Mnemonics
Assembly Language
Assembler
Assembler Directives
Assembly language is mostly a thin layer above the machine
structure. An assembly language is a low-level programming
language for a computer, microcontroller, or other
programmable device, in which each statement corresponds
to a single machine code instruction. Each assembly language
is specific to a particular computer architecture, in contrast to
most high-level programming languages, which are generally
portable across multiple systems. Assembly language is
converted into executable machine code by a utility program
referred to as an assembler; the conversion process is referred
to as assembly, or assembling the code.
An assembler directive is a message to the assembler that tells the assembler something it
needs to know in order to carry out the assembly process; for example, an assemble directive
tells the assembler where a program is to be located in memory.
Examples of common assembler directives are ORG (origin), EQU (equate), and DS.B (define
space for a byte).
Equate
The EQU assembler directive simply equates a symbolic name to a numeric value. Consider:
Sunday EQU 1
Monday EQU 2
The assembler substitutes the equated value for the symbolic name; for example, if you write
the instruction ADD.B #Sunday,D2, the assembler treats it as if it were ADD.B #1,D2.
In this case, the assembler evaluates "Sunday + 1" as 1 + 1 and assigns the value 2 to the
symbolic name "Monday".
ORG
sets the current origin to a new value. This is used to
set the program or register address during assembly.
For example, ORG 0100h tells the assembler to
assemble all s
Subsequent code starting at address 0100h.
DS
Defines an amount of free space. No code is
generated. This is sometimes used for allocating
variable space.
Basic Input/Output
Operations
I/O
Bus
Processor
DATAIN DATAOUT
SIN SOUT
- Registers
- Flags Keyboard Display
- Device interface
Main Cache
memory memory Processor
Bus
N S
T
R
How to improve T?
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.
• Pipelining is an implementation technique where
multiple instructions are overlapped in execution.
The computer pipeline is divided in stages. Each stage
completes a part of an instruction in parallel.
• Add R1, R2, R3
• Superscalar operation – multiple instruction pipelines are
implemented in the processor.
• Goal – reduce S (could become <1!)
Clock Rate
• T is difficult to compute.
• Measure computer performance using benchmark programs.
• System Performance Evaluation Corporation (SPEC) selects and publishes
representative application programs for different application domains,
together with test results for many commercially available computers.
• Compile and run (no simulation)
• Reference computer
i 1
Multiprocessors and
Multicomputers
• Multiprocessor computer
Execute a number of different application tasks in parallel
Execute subtasks of a single large task in parallel
All processors have access to all of the memory – shared-memory
multiprocessor
Cost – processors, memory units, complex interconnection networks
• Multicomputers
Each computer only have access to its own memory
Exchange message via a communication network – message-passing
multicomputers
• Evolution of Computer Architecture − In last four decades,
computer architecture has gone through revolutionary
changes. We started with Von Neumann architecture and
now we have multicomputers and multiprocessors.
• Performance of a computer system − Performance of a
computer system depends both on machine capability and
program behavior. Machine capability can be improved
with better hardware technology, advanced architectural
features and efficient resource management. Program
behavior is unpredictable as it is dependent on application
and run-time conditions
• Multiprocessors and Multicomputers
• In this section, we will discuss two types of parallel computers −
• Multiprocessors
• Multicomputers
• Shared-Memory Multicomputers
• Three most common shared memory multiprocessors models are −
• Uniform Memory Access (UMA)
• In this model, all the processors share the physical memory uniformly. All the
processors have equal access time to all the memory words. Each processor may
have a private cache memory. Same rule is followed for peripheral devices.
• When all the processors have equal access to all the peripheral devices, the
system is called a symmetric multiprocessor. When only one or a few processors
can access the peripheral devices, the system is called an asymmetric
multiprocessor.
• Non-uniform Memory Access (NUMA)
• In NUMA multiprocessor model, the access
time varies with the location of the memory
word. Here, the shared memory is physically
distributed among all the processors, called
local memories. The collection of all local
memories forms a global address space which
can be accessed by all the processors.
Cache Only Memory Architecture (COMA)
The COMA model is a special case of the NUMA model. Here,
all the distributed main memories are converted to cache
memories
• Distributed - Memory Multicomputers − A
distributed memory multicomputer system consists
of multiple computers, known as nodes, inter-
connected by message passing network. Each node
acts as an autonomous computer having a
processor, a local memory and sometimes I/O
devices. In this case, all local memories are private
and are accessible only to the local processors. This
is why, the traditional machines are called no-
remote-memory-access (NORMA)machines.