Lectures for 2nd Edition

Download Report

Transcript Lectures for 2nd Edition

Lectures for 2nd Edition
Note: these lectures are often supplemented with other
materials and also problems from the text worked
out on the blackboard. You’ll want to customize
these lectures for your class. The student audience
for these lectures have had assembly language
programming and exposure to logic design
Text in blue is by N. Guydosh
Updated 1/22/04
1998 Morgan Kaufmann Publishers
1
Chapter 1
1998 Morgan Kaufmann Publishers
2
Introduction
•
Rapidly changing field:
– vacuum tube -> transistor -> IC -> VLSI (see section 1.4)
– doubling every 1.5 years:
memory capacity
processor speed (Due to advances in technology and organization)
•
Things you’ll be learning:
– how computers work, a basic foundation
– how to analyze their performance (or how not to!)
– issues affecting modern processors (caches, pipelines)
•
Why learn this stuff?
– you want to call yourself a “computer scientist”
– you want to build software people use (need performance)
– you need to make a purchasing decision or offer “expert” advice
1998 Morgan Kaufmann Publishers
3
What is a computer?
•
Components:
What “Joe Average” sees:
– input (mouse, keyboard)
– output (display, printer)
– memory (disk drives, DRAM, SRAM, CD)
– Network
•
Our primary focus is to look under the covers: the processor (datapath and
control)
– implemented using millions of transistors
– Impossible to understand by looking at each transistor
– We need ... Abstractions
1998 Morgan Kaufmann Publishers
4
Abstractions
•
All information in a computer is encoded in 1’s and 0’s – binary
•
Dealing directly at the bit level is a near impossibility – what was done in the
first computers.
•
We identify functional abstractions in the design of a computer
– For example the concept of an instruction which is an encoding of bits
– Identifying each instruction symbolically – need for translation
– An assembler translates from symbolic to binary – translation is 1 to 1
from symbolic to binary instructions – easier than binary, but still too
complex for writing algorithms.
– We now abstract to a high level language like C and use a compiler to
translate to assembly or true machine instructions – translation is now
one C statement to many instructions.
– Ideally a high level language will allow portability across many hardware
platforms – simply recompile. There may be exceptions in real life.
1998 Morgan Kaufmann Publishers
5
Abstraction
•
Delving into the depths
reveals more information
•
An abstraction omits unneeded detail,
helps us cope with complexity
High-level
language
program
(in C)
swap(int v[], int k)
{int temp;
temp = v[k];
v[k] = v[k+1];
v[k+1] = temp;
}
C compiler
Assembly
language
program
(for MIPS)
swap:
muli $2, $5,4
add $2, $4,$2
lw $15, 0($2)
lw $16, 4($2)
sw $16, 0($2)
sw $15, 4($2)
jr $31
What are some of the details that
appear in these familiar abstractions?
Assembler
Binary machine
language
program
(for MIPS)
00000000101000010000000000011000
00000000100011100001100000100001
10001100011000100000000000000000
10001100111100100000000000000100
10101100111100100000000000000000
10101100011000100000000000000100
00000011111000000000000000001000
1998 Morgan Kaufmann Publishers
6
Hardware/Software Interface
•
By abstraction, we identify functional entities in a computer in both
the hardware and software.
– The network of logic gates are abstracted into functional units
such as an ALU’s, registers, etc.
– The instruction set (see previous slide) is an abstraction of the
overall function of the hardware design – it actually defines
(specifies) this hardware function.
– Ideally, we my think of the instruction set as a spec for the design
of the hardware - design the hardware execute each instruction
as efficiently as possible.
– In the real world, there may be some tradeoffs between the
hardware design and the instruction set in the sense that
hardware engineers may negotiate a change in an instruction –
but in general we think as the instruction set as relatively fixed.
•
The relationship between the instruction set and the underlying
hardware is called the hardware/software interface.
1998 Morgan Kaufmann Publishers
7
What are “Machine Structures”?
Application (ex: browser)
Compiler
Software
Hardware
Assembler
Operating
System
(Mac OS X)
Processor Memory I/O system
61C
Instruction Set
Architecture
Datapath & Control
Digital Design
Circuit Design
transistors
*
Acknowledgment:
From course CS61C, Berkeley
By Dan Garcia
Coordination of many
levels (layers) of abstraction
1998 Morgan Kaufmann Publishers
8
Instruction Set Architecture
•
A very important abstraction
– interface between hardware and low-level software
– standardizes instructions, machine language bit patterns, etc.
– advantage: different implementations of the same architecture
– disadvantage: sometimes prevents using new innovations
True or False: Binary compatibility is extraordinarily important?
•
Modern instruction set architectures:
– 80x86/Pentium/K6(by AMD), PowerPC, DEC Alpha, MIPS,
SPARC, HP
1998 Morgan Kaufmann Publishers
9
Where we are headed
•
•
•
•
•
•
•
Performance issues (Chapter 2) vocabulary and motivation
A specific instruction set architecture (Chapter 3)
Arithmetic and how to build an ALU (Chapter 4)
Constructing a processor to execute our instructions (Chapter 5)
Pipelining to improve performance (Chapter 6)
Memory: caches and virtual memory (Chapter 7)
I/O (Chapter 8)
Key to a good grade: reading the book!
1998 Morgan Kaufmann Publishers
10
Anatomy: 5 components of any Computer
Personal Computer
Computer
Processor
Control
(“brain”)
Datapath
(“brawn”)
Memory
(where
programs,
data
live when
running)
Devices
Input
Output
Keyboard,
Mouse
Disk
(where
programs,
data
live when
not running)
Display,
Printer
Acknowledgment:
From course CS61C, Berkeley
By Dan Garcia
1998 Morgan Kaufmann Publishers
11