Introduction - KFUPM Faculty List

Download Report

Transcript Introduction - KFUPM Faculty List

Introduction
COE 301
Computer Organization
Prof. Muhamed Mudawar
Computer Engineering Department
King Fahd University of Petroleum and Minerals
Presentation Outline
 Welcome to COE 301
 Assembly-, Machine-, and High-Level Languages
 Classes of Computers
 Technology Improvements
 Programmer's View of a Computer System
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 2
Welcome to COE 301
 Instructor:
Dr. Muhamed F. Mudawar
 Office:
Building 22, Room 328
 Office Phone:
4642
 Schedule and Office Hours:
 http://faculty.kfupm.edu.sa/coe/mudawar/schedule/
 Course Web Page:
 http://faculty.kfupm.edu.sa/coe/mudawar/coe301/
 Email:
 [email protected]
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 3
Which Textbook will be Used?
 Computer Organization & Design:
The Hardware/Software Interface
 Fifth Edition, 2013
 David Patterson and John Hennessy
 Morgan Kaufmann
 Read the textbook in addition to slides
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 4
Grading Policy
 Laboratory
10%
 Quizzes
10%
 MIPS Programming
10%
 CPU Design Project
10%
 Exam 1
20%
 Exam 2
20%
 Final Exam
20%
 No makeup will be given for missing exam or quiz
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 5
Software Tools
 MIPS Simulators
 MARS: MIPS Assembly and Runtime Simulator
 Runs MIPS-32 assembly language programs
 Website: http://courses.missouristate.edu/KenVollmar/MARS/
 SPIM
 Also Runs MIPS-32 assembly language programs
 Website: http://www.cs.wisc.edu/~larus/spim.html
 CPU Design and Simulation Tool
 Logisim
 Educational tool for designing and simulating CPUs
 Website: http://ozark.hendrix.edu/~burch/logisim/
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 6
Course Learning Outcomes
 Towards the end of this course, you should be able to …
 Describe the instruction set architecture of a processor
 Analyze, write, and test assembly language programs
 Describe organization/operation of integer & floating-point units
 Design the datapath and control of a single-cycle CPU
 Design the datapath/control of a pipelined CPU & handle hazards
 Describe the organization/operation of memory and caches
 Analyze the performance of processors and caches
 Required Background
 Ability to program confidently in Java or C
 Ability to design a combinational and sequential circuit
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 7
Next . . .
 Welcome to COE 301
 Assembly-, Machine-, and High-Level Languages
 Classes of Computers
 Technology Improvements
 Programmer's View of a Computer System
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 8
Some Important Questions to Ask
 What is Assembly Language?
 What is Machine Language?
 How is Assembly related to a high-level language?
 Why Learn Assembly Language?
 What is an Assembler, Linker, and Debugger?
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 9
A Hierarchy of Languages
Application Programs
High-Level Languages
Machine independent
High-Level Language
Machine specific
Low-Level Language
Assembly Language
Machine Language
Hardware
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 10
Assembly and Machine Language
 Machine language
 Native to a processor: executed directly by hardware
 Instructions consist of binary code: 1s and 0s
 Assembly language
 Slightly higher-level language
 Readability of instructions is better than machine language
 One-to-one correspondence with machine language instructions
 Assemblers translate assembly to machine code
 Compilers translate high-level programs to machine code
 Either directly, or
 Indirectly via an assembler
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 11
Compiler and Assembler
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 12
Translating Languages
Program (C Language):
A statement in a high-level
language is translated
typically into several
machine-level instructions
swap(int v[], int k) {
int temp;
temp = v[k];
v[k] = v[k+1];
v[k+1] = temp;
}
Compiler
MIPS Machine Language:
MIPS Assembly Language:
sll
add
lw
lw
sw
sw
jr
Introduction
$2,$5, 2
$2,$4,$2
$15,0($2)
$16,4($2)
$16,0($2)
$15,4($2)
$31
Assembler
00051080
00821020
8C620000
8CF20004
ACF20000
AC620004
03E00008
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 13
Advantages of High-Level Languages
 Program development is faster
 High-level statements: fewer instructions to code
 Program maintenance is easier
 For the same above reasons
 Programs are portable
 Contain few machine-dependent details
 Can be used with little or no modifications on different machines
 Compiler translates to the target machine language
 However, Assembly language programs are not portable
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 14
Why Learn Assembly Language?
 Many reasons:
 Accessibility to system hardware
 Space and time efficiency
 Writing a compiler for a high-level language
 Accessibility to system hardware
 Assembly Language is useful for implementing system software
 Also useful for small embedded system applications
 Programming in Assembly Language is harder
 Requires deep understanding of the processor architecture
 However, it is very rewarding to system software designers
 Adds a new perspective on how programs run on real processors
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 15
Assembly Language Programming Tools
 Editor
 Allows you to create and edit assembly language source files
 Assembler
 Converts assembly language programs into object files
 Object files contain the machine instructions
 Linker
 Combines object files created by the assembler with link libraries
 Produces a single executable program
 Debugger
 Allows you to trace the execution of a program
 Allows you to view machine instructions, memory, and registers
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 16
Assemble and Link Process
Source
File
Source
File
Source
File
Assembler
Object
File
Assembler
Object
File
Assembler
Object
File
Linker
Executable
File
Link
Libraries
 A program may consist of multiple source files
 Assembler translates each source file into an object file
 Linker links all object files together and with link libraries
 The result executable file can run directly on the processor
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 17
MARS Assembler and Simulator Tool
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 18
MARS Assembler and Simulator Tool
 Simulates the execution of a MIPS program
 No direct execution on the underlying Intel processor
 Editor with color-coded assembly syntax
 Allows you to create and edit assembly language source files
 Assembler
 Converts MIPS assembly language programs into object files
 Console and file input/output using system calls
 Debugger
 Allows you to trace the execution of a program and set breakpoints
 Allows you to view machine instructions, edit registers and memory
 Easy to use and learn assembly language programming
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 19
Next . . .
 Welcome to COE 301
 Assembly-, Machine-, and High-Level Languages
 Classes of Computers
 Technology Improvements
 Programmer's View of a Computer System
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 20
Classes of Computers
 Personal computers
 General purpose, variety of software, subject to cost/performance
 Server computers
 Network based, high capacity, performance, and reliability
 Range from small servers to building sized
 Supercomputers
 High-end scientific and engineering calculations
 Highest capability but only a small fraction of the computer market
 Embedded computers
 Hidden as components of systems
 Stringent power/performance/cost constraints
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 21
Classes of Computers (cont'd)
 Personal Mobile Device (PMD)
 Battery operated
 Connects to the Internet
 Low price: hundreds of dollars
 Smart phones, tablets, electronic glasses
 Cloud Computing
 Warehouse Scale Computers (WSC)
 Software, Platform, and Infrastructure as a Service
 However, security concerns of storing "sensitive data" in "the cloud"
 Examples: Amazon and Google
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 22
Cell Phones and Tablets
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 23
Components of a Computer System
 Processor
Computer
 Datapath and Control
Memory
 Memory & Storage
 Main Memory
 Disk Storage
 Input / Output devices
I/O Devices
Input
Control
Processor
B
U
S
Datapath
Output
Disk
 User-interface devices
 Network adapters
Network
 For communicating with other computers
 Bus: Interconnects processor to memory and I/O
 Essentially the same components for all kinds of computers
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 24
Opening the Box
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 25
Inside the Processor (CPU)
 Datapath: part of a processor that executes instructions
 Control: generates control signals for each instruction
 Cache Memory: small and fast memory inside CPU
Clock
Instruction
Cache
Instruction
Program Counter
Next Program
Counter
Registers
A
L
U
Data
Cache
Control
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 26
CPU Components
 Program Counter (PC)
 Contains address of next instruction to be fetched
 Instruction and Data Caches
 Small and fast memory containing most recent instructions/data
 Register File
 General-purpose registers used for intermediate computations
 ALU = Arithmetic and Logic Unit
 Executes arithmetic and logic instructions
 Control: signals that control the execution of instructions
 Clock: used for timing
 Buses: wire and interconnect all components
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 27
Infinite Cycle implemented in Hardware
Fetch - Execute Cycle
Introduction
Fetch instruction
Compute address of next instruction
Instruction Fetch
Instruction Decode
Generate control signals for instruction
Read operands from registers
Execute
Compute result value
Memory Access
Read or write memory
Writeback Result
Writeback result in a register
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 28
Clock
Operation of digital hardware is governed by a clock
Clock period
Clock (cycles)
Data transfer
and computation
Update state

Clock period: duration of a clock cycle


Clock frequency (rate) = 1 / clock period

Introduction
e.g., 250 ps = 0.25 ns = 0.25 ×10–9 sec
e.g., 1/ 0.25 ×10–9 sec = 4.0×109 Hz = 4.0 GHz
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 29
Memory and Storage Devices
 Volatile Memory Devices
 RAM = Random Access Memory
 DRAM = Dynamic RAM
 Dense but must be refreshed (typical choice for main memory)
 SRAM: Static RAM
 Faster but less dense than DRAM (typical choice for cache memory)
 Non-Volatile Storage Devices
 Magnetic Disk
 Flash Memory (Solid State Disk)
 Optical Disk (CDROM, DVD)
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 30
Units for Storage and Memory
Size of disk storage
Value = 10n (base 10)
Size of memory
Value = 2n (base 2)
 The binary terms are used to avoid the confusion with the
commonly used decimal terms. The size of memory is 2n
because the memory address is an n-bit binary number.
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 31
Next . . .
 Welcome to COE 301
 Assembly-, Machine-, and High-Level Languages
 Classes of Computers
 Technology Improvements
 Programmer's View of a Computer System
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 32
Technology Trends
 Electronic Technology continues to improve
 Increased capacity
 Performance
 Reduced cost
 DRAM capacity
DRAM capacity
 4X every 3 years
 Slowed down to 2X
Year
Technology
1951
Vacuum tube
1965
Transistor
1975
Integrated circuit (IC)
1995
Very large scale IC (VLSI)
2013
Ultra large scale IC
Introduction
Relative performance/cost
1
35
900
2,400,000
250,000,000,000
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 33
Chip Manufacturing Process
20-30 cm diameter
30-60 cm long
< 1 mm thick
Cost of a wafer fab (fabrication) is estimated at over $10 billion
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 34
Wafer of Intel Core i7 Processors
 Wafer = 30 cm in diameter
 Die size = 216 mm2
 Quad-Core i7 + GPU
 1.2 billion transistors per die
 32 nm technology
 Smallest feature size = 32nm
 Size of a transistor gate
 Dies per wafer = 280
 Number is reduced after testing
 Rounded dies at boundary are useless
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 35
Example of a Quad-Core Die
Intel core i7 Die (4 processor cores), 3 levels of caches
The L1 and L2 caches are private and exist in each core
The L3 cache is shared by all cores
Introduction
Core 2
Core 3
Shared L3 Cache
COE 301 – Computer Organization - KFUPM
Core 4
Misc I/O
Core 1
QP Interconnect
QP Interconnect
Misc I/O
Memory Controller
© Muhamed Mudawar – slide 36
Effect of Die Size on the Yield
Yield = (Number of Good Dies) / (Total Number of Dies)
1
Yield 
(1 + (Defect per area  Die area / 2))2
Die Cost = (Wafer Cost) / (Dies per Wafer  Yield)
The die yield is an
empirical formula
that
depends on the
manufacturing
process. The die
yield decreases
with larger dies.
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 37
Example on the Die Yield
 Find the yield when the die area = 225 mm2 and 100 mm2
 Assume that defect density = 0.40/cm2
 Answer: Die Yield  (1 + Defect per Area × Die Area/2)-2
 Die area = 225 mm2 = 2.25 cm2
 Die yield for 225 mm2 dies  (1+0.40×2.25/2)-2  0.476
 Only 47.6% of the dies are good
 Die area = 100 mm2 = 1.00 cm2
 Die yield for 100 mm2 dies  (1+0.40×1.00/2)-2  0.694
 69.4% of the dies are good
 Smaller dies  Better die yield + more dies per wafer  less cost
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 38
Next . . .
 Welcome to COE 301
 Assembly-, Machine-, and High-Level Languages
 Classes of Computers
 Technology Improvements
 Programmer's View of a Computer System
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 39
Programmer’s View of a Computer System
Software
Application Programs
High-Level Language
Level 5
Assembly Language
Level 4
Operating System
Interface
SW & HW
Level 3
Instruction Set
Architecture
Level 2
Microarchitecture
Level 1
Hardware
Physical Design
Introduction
Increased level
of abstraction
Level 0
COE 301 – Computer Organization - KFUPM
Each level hides
the details of the
level below it
© Muhamed Mudawar – slide 40
Programmer's View (cont'd)
 Application Programs (Level 5)
 Written in high-level programming languages
 Such as Java, C++, Pascal, Visual Basic . . .
 Programs compile into assembly language level (Level 4)
 Assembly Language (Level 4)
 Instruction mnemonics (symbols) are used
 Have one-to-one correspondence to machine language
 Calls functions written at the operating system level (Level 3)
 Programs are translated into machine language (Level 2)
 Operating System (Level 3)
 Provides services to level 4 and 5 programs
 Translated to run at the machine instruction level (Level 2)
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 41
Programmer's View (cont'd)
 Instruction Set Architecture (Level 2)
 Interface between software and hardware
 Specifies how a processor functions
 Machine instructions, registers, and memory are exposed
 Machine language is executed by Level 1 (microarchitecture)
 Microarchitecture (Level 1)
 Controls the execution of machine instructions (Level 2)
 Implemented by digital logic
 Physical Design (Level 0)
 Implements the microarchitecture at the transistor-level
 Physical layout of circuits on a chip
Introduction
COE 301 – Computer Organization - KFUPM
© Muhamed Mudawar – slide 42