Lecture 3
Lecture 3
Lecture 3
These slides are based on the book: David Money Harris and Sarah L. Harris, Computer Organization and Design
GENERATIONS OF COMPUTER
1. First Generation – 1940 -1956: Vacuum Tubes
➢ Uses Silicon
➢ developed in 1948
➢
John Bardeen
won a Nobel prize
➢ on-off switch
➢ Second Generation Computers used
Transistors, starting in 1956
INTEGRATED CIRCUITS
➢ 80386 (1985)
– 32-bit address bus and 32-bit data bus
– 4GB memory
– Hardware circuitry for memory management
– Additional instructions referenced 32-bit registers
and managed the memory system
1989: INTEL 486(TM) DX CPU
➢ The 486TM generation really allowed the shift from
command-level computing into point-and-click computing.
➢ The Intel 486TM processor was the first to offer a built-in
math coprocessor, which speeds up computing because it
offers complex math functions from the central processor.
➢ 80486
– Highly integrated package.
– 80386-like microprocessor.80387-like numeric
coprocessor.
– 50 MIPS
– 8K-byte cache memory system
– Half of its instructions executed in 1 clock cycle rather 2
1993: PENTIUM® PROCESSOR
➢ The Pentium® processor allowed computers to more easily incorporate
"real world" data such as speech, sound, handwriting and photographic
images.
➢ The name Pentium®, mentioned in the comics and on television talk
shows, became a household word soon after introduction.
60
WHAT IS A COMPUTER?
• Three key components
• Computation
• Communication
• Storage (memory)
61
WHAT IS A COMPUTER?
Courtesy, Intel
WHAT IS A COMPUTER?
Processing
control
Memory
(sequencing) (program and data) I/O
datapath
CLASSES OF COMPUTERS
• Desktop computers: Designed to deliver good performance to a single user at low cost
usually executing 3rd party software, usually incorporating a graphics display, a
keyboard, and a mouse
• Servers: Used to run larger programs for multiple, simultaneous users typically
accessed only via a network and that places a greater emphasis on dependability and
(often) security
• Supercomputers: A high performance, high cost class of servers with hundreds to
thousands of processors, terabytes of memory and petabytes of storage that are used for
high-end scientific and engineering applications
• Embedded computers (processors): A computer inside another device used for running
one predetermined application. Very often cost, power, and failure rate are more
important than performance.
CISC VERSUS RISC
CISC RISC
➢ Complex Instruction Set Computer ➢ Reduced Instruction Set Computer
➢ Emphasis on hardware ➢ Emphasis on software
➢ Includes multi-clock complex ➢ Single-clock,reduced instruction
instructions only
➢ Memory-to-memory: "LOAD" and ➢ Register to register: "LOAD" and
"STORE" incorporated in "STORE“ are independent
instructions instructions
➢ Small code sizes, high cycles per ➢ Low cycles per second, large code
second sizes
➢ Transistors used for storing ➢ Spends more transistors on
complex instructions memory registers
INSTRUCTION SET ARCHITECTURE
➢ A very important abstraction
➢ interface between hardware and low-level software
➢ standardizes instructions, machine language bit patterns, etc.
➢ advantage: different implementations (cost, performance, power) of the same architecture
➢ disadvantage: sometimes prevents using new innovations
➢ Common instruction set architectures:
➢ IA-32, PowerPC, MIPS, SPARC, ARM, and others
INSTRUCTION SET ARCHITECTURE
➢ ISA, or simply architecture – the abstract interface between the hardware and the lowest level
software that encompasses all the information necessary to write a machine language program,
including instructions, registers, memory access, I/O, …
➢ ISA Includes
➢ Organization of storage
➢ Data types
➢ Encoding and representing instructions
➢ Instruction Set (or opcodes)
➢ Modes of addressing data items/instructions
➢ Program visible exception handling
➢ Specifies requirements for binary compatibility across
➢ implementations.
ISA VS. MICROARCHITECTURE
➢ ISA
➢ Agreed upon interface between software and hardware
Problem
➢ SW/compiler assumes, HW promises
Algorithm
➢ What the software writer needs to know to write and debug
Program
system/user programs
ISA
➢ Microarchitecture
Microarchitecture
➢ Specific implementation of an ISA
Circuits
➢ Not visible to the software
Electrons
➢ Microprocessor
➢ ISA, uarch, circuits
➢ “Architecture” = ISA + microarchitecture
71
MIPS ISA
➢ Instruction Categories
➢ Load/Store
➢ Computational
➢ Jump and Branch R0 - R31
➢ Floating Point
➢ Memory Management
➢ Special
PC
HI
LO
3 Instruction Formats, 32 bits wide
OP rs rt rd sa funct
OP rs rt immediate
OP jump target
EXECUTION CYCLE
Instruction
Fetch
Obtain instruction from program storage
Instruction
Determine required actions and instruction size
Decode
Result
Deposit results in storage for later use
Store
Next
Instruction
Determine successor instruction
LEVELS OF REPRESENTATION
temp = v[k];
High Level Language
Program v[k] = v[k+1];
v[k+1] = temp;
Compiler
lw $15, 0($2)
Assembly Language lw $16, 4($2)
Program sw $16, 0($2)
sw $15, 4($2)
Assembler
0000 1001 1100 0110 1010 1111 0101 1000
Machine Language 1010 1111 0101 1000 0000 1001 1100 0110
1100 0110 1010 1111 0101 1000 0000 1001
Program 0101 1000 0000 1001 1100 0110 1010 1111
Machine Interpretation
Compiler Compiler
Assembler Interpreter
Executable
HW HW HW
Implementation 1 Implementation 2 Implementation N
ADVANTAGES OF HLLS
➢ Higher-level languages (HLLs)
➢ Allow the programmer to think in a more natural language and for their intended
use (Fortran for scientific computation, Cobol for business programming, Lisp for
symbol manipulation, Java for web programming, …)
➢ Improve programmer productivity – more understandable code that is easier to
debug and validate
➢ Improve program maintainability
➢ Allow programs to be independent of the computer on which they are developed
(compilers and assemblers can translate high-level language programs to the
binary instructions of any machine)
➢ Emergence of optimizing compilers that produce very efficient
➢ assembly code optimized for the target machine
➢ Compilers convert source code to object code
➢ Libraries simplify common tasks
INSTRUCTION SET DESIGN GOALS
Maximize
Performance
Minimize
Cost
WHERE TO KEEP THE OPERANDS
Processor
Memory
Devices
Processor
ALU
Registers Memory
Devices
PROGRAM: IN MEMORY
Address Memory
Reserved
0x7FFFFFFC Stack $sp = 0x7FFFFFFC
0x10010000 Heap
$gp = 0x10008000
y
g
0x10000000 f
0x03E00008
0x00851020
0x03E00008
0x23BD0004
0x8FBF0000
0xAF828008
0x0C10000B
0xAF858004
0x20050003
0xAF848000
0x20040002
0xAFBF0000
0x00400000 0x23BDFFFC PC = 0x00400000
Reserved
THE MIPS MEMORY MAP
Address Segment
0xFFFFFFFC
Reserved
0x80000000
0x7FFFFFFC Stack
Function calls,
Dynamic Data Local variable,
dynamic memory
0x10010000 Heap
0x1000FFFC
Text Instructions
0x00400000
0x003FFFFC
Reserved
0x00000000
MEMORY LAYOUT OF C PROGRAM
➢ Stack
➢ automatic (default), local STACK
➢ Initialized/uninitialized
➢ Data
➢ Global, static, extern
➢ BSS: Block Started by Symbol Heap
➢ Code
➢ program instructions BSS
➢ Heap
➢ malloc, calloc Data
Code
MEMORY LAYOUT OF C PROGRAM
int A;
STACK
int B=10;
main(){
Heap
int Alocal;
int *p;
BSS
p=(int*)malloc(10);
} Data
Code
ADDRESS SPACE
40