SLIDE 1
1
ECE 0142 Computer Organization
Lecture 1 Introduction
Professor Jun Yang Department of Electrical and Computer Engineering University of Pittsburgh
SLIDE 2 Logistics
Course Material:
http://www.pitt.edu/~juy9/142/142.html
Book:
Hennessy and Patterson, “Computer Organization and Design, The Hardware/Software Interface”, 5th Ed, MK.
Requirements:
Homework 20%
Quizzes 20% (weekly during recitations)
Midterm 1 15% (2/4, in class)
Midterm 2 15% (3/17, in class)
Final 30% (comprehensive, time TBD)
Office Hours:
Jun Tu 2:30-4 1111 Ben
Amr Mo 12-2 1142 Ben
Chang Th 2-4 1109 Ben
2
SLIDE 3 3
Prerequisites
Some experience with a high level language
C, etc.
Digital logic circuits
Covered in ECE/CoE 0132 Digital Logic
SLIDE 4 Computer systems
Three general classes of “computer”
“Desktop computers”
Examples include PC, Mac, Chrome, Linux…
Notebooks, netbooks, tablets (smart phones), …
Interact with a user – applications
Handful of central processing units (4-12?), gigabytes (109 bytes) memory, few terabytes (1012 bytes) of disk
35 gigaflops (35×109 “floating-point math calculations” per second for Intel Ivy Bridge)
SLIDE 5 Computer systems
Three general classes of “computer”
“Desktop computers”
“Servers”
Web servers, Computational servers, Supercomputers
Interact with other computers to “solve a problem” or “provide services”
Dozens to thousands of CPUs (Tianhe-2: 3,120,000 CPUs, 33.9 petaflops, or 33.9×1015 calculations per second vs. 35×109 for PC)
Gigabytes to terabytes memory (Sequoia: 1,024,000GB [1.0 petabyte!])
Petabytes (1015 bytes) of storage
Connected (network) to work together
Power hungry but efficient (Tianhe-2: 17.8 MW vs. Three Mile Island ~800 MW output). Data centers: 1.7% to 2.2% of total electricity in US.)
SLIDE 6 Computer systems
Three general classes of “computer”
“Desktop computers”
“Servers”
“Embedded computers”
Hidden inside something not computer
Applications that run on these computers interact with the “real world”
Multiple different processors for different functions
Kilobytes (103 bytes) to gigabytes of memory
Kilobytes to gigabytes of storage
Slow speed to fast speed
Widest range of design!
SLIDE 7 Layers or views
Our view of a computer system in this course is centered around the interface between the lowest level in software and the hardware
antique! ECE 142
App 1 App 2 App 3 App 4 System Software (Compiler, Assembler, Linker) Operating System Instruction Set Architecture (ISA) Subsystems, Microarchiture Circuits, Electronics, Devices
SLIDE 8 8
High-level language, e.g. C
swap (int v[], int k) { int temp; temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; }
Assembly language, e.g. 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
Binary machine language
00000000101000010000000000011000 00000000100011100001100000100001 10001100011000100000000000000000 10001100111100100000000000000100 10101100111100100000000000000000 10101100011000100000000000000100 00000011111000000000000000001000
C Compiler Assembler
SLIDE 9 Assembly Language, Machine Code
High-level programming languages are a convenience
CPU does not “understand” the high-level language! CPU understands “binary numbers”
Binary number represents a command
A command makes CPU take some action (e.g., addition)
Commands known as “machine instructions” (code) Who wants to program in binary numbers???
Assembly language is convenience
Programming in machine instructions
SLIDE 10 A Day in the Life of a C (Java) Program
hello.c compiler hello.s assembler hello.o linker crt0.o hello loader
#include <stdio.h> int main (void) { printf(“Hello ECE 142!\n”); }
hello.c
Basic runtim library
usr{1} hello
Hello ECE 142!
usr{2}
SLIDE 11 Assembling, Loading, Running
Assembly language program is assembled
Assembler is tool to create machine code from assembly language
Assembled program placed in main memory
Loader is tool to put the machine instructions into memory
Loader is automatically used when you run the program
CPU gets access to machine instructions in memory
CPU does the command for each instruction
SLIDE 12
Assembling, Loading, Running
loop: add $t1,$t1,$t0 addi $t0,$t0,1 slti $t2,$t0,10 bne $t2,$0,loop 01284820 21080001 290a000a 01540fffc ... 01284820 21080001 290a000a 01540fffc ... assembly language machine code memory assembled loaded 4 8 12 16 20 24 machine code address
SLIDE 13
Assembling, Loading, Running
loop: add $t1,$t1,$t0 addi $t0,$t0,1 slti $t2,$t0,10 bne $t2,$0,loop 01284820 21080001 290a000a 01540fffc ... 01284820 21080001 290a000a 01540fffc ... assembly language machine code memory assembled loaded 4 8 12 16 20 24 address
SLIDE 14
Assembling, Loading, Running
loop: add $t1,$t1,$t0 addi $t0,$t0,1 slti $t2,$t0,10 bne $t2,$0,loop 01284820 21080001 290a000a 01540fffc ... 01284820 21080001 290a000a 01540fffc ... assembly language machine code memory fetch 4 8 12 16 20 24 address Processor accesses instructions only through memory
SLIDE 15
Processor accesses instructions only through memory
Assembling, Loading, Running
loop: add $t1,$t1,$t0 addi $t0,$t0,1 slti $t2,$t0,10 bne $t2,$0,loop 01284820 21080001 290a000a 01540fffc ... 01284820 21080001 290a000a 01540fffc ... assembly language machine code memory execute 01284820 4 8 12 16 20 24 address
SLIDE 16
Processor accesses instructions only through memory
Assembling, Loading, Running
loop: add $t1,$t1,$t0 addi $t0,$t0,1 slti $t2,$t0,10 bne $t2,$0,loop 01284820 21080001 290a000a 01540fffc ... 01284820 21080001 290a000a 01540fffc ... assembly language machine code memory fetch 4 8 12 16 20 24 address
SLIDE 17
Processor accesses instructions only through memory
Assembling, Loading, Running
loop: add $t1,$t1,$t0 addi $t0,$t0,1 slti $t2,$t0,10 bne $t2,$0,loop 01284820 21080001 290a000a 01540fffc ... 01284820 21080001 290a000a 01540fffc ... assembly language machine code memory execute 21080001 4 8 12 16 20 24 address
SLIDE 18
Processor accesses instructions only through memory
Assembling, Loading, Running
loop: add $t1,$t1,$t0 addi $t0,$t0,1 slti $t2,$t0,10 bne $t2,$0,loop 01284820 21080001 290a000a 01540fffc ... 01284820 21080001 290a000a 01540fffc ... assembly language machine code memory fetch 4 8 12 16 20 24 address
SLIDE 19
Processor accesses instructions only through memory
Assembling, Loading, Running
loop: add $t1,$t1,$t0 addi $t0,$t0,1 slti $t2,$t0,10 bne $t2,$0,loop 01284820 21080001 290a000a 01540fffc ... 01284820 21080001 290a000a 01540fffc ... assembly language machine code memory execute 290a000a 4 8 12 16 20 24 address
SLIDE 20
Processor accesses instructions only through memory
Assembling, Loading, Running
loop: add $t1,$t1,$t0 addi $t0,$t0,1 slti $t2,$t0,10 bne $t2,$0,loop 01284820 21080001 290a000a 01540fffc ... 01284820 21080001 290a000a 01540fffc ... assembly language machine code memory fetch 4 8 12 16 20 24 address
SLIDE 21
Processor accesses instructions only through memory
Assembling, Loading, Running
loop: add $t1,$t1,$t0 addi $t0,$t0,1 slti $t2,$t0,10 bne $t2,$0,loop 01284820 21080001 290a000a 01540fffc ... 01284820 21080001 290a000a 01540fffc ... assembly language machine code memory execute 01540fffc 4 8 12 16 20 24 address
SLIDE 22
Processor accesses instructions only through memory
Assembling, Loading, Running
loop: add $t1,$t1,$t0 addi $t0,$t0,1 slti $t2,$t0,10 bne $t2,$0,loop 01284820 21080001 290a000a 01540fffc ... 01284820 21080001 290a000a 01540fffc ... assembly language machine code memory fetch 4 8 12 16 20 24 address
SLIDE 23
Processor accesses instructions only through memory
Assembling, Loading, Running
loop: add $t1,$t1,$t0 addi $t0,$t0,1 slti $t2,$t0,10 bne $t2,$0,loop 01284820 21080001 290a000a 01540fffc ... 01284820 21080001 290a000a 01540fffc ... assembly language machine code memory execute 01284820 4 8 12 16 20 24 address
SLIDE 24 24
Who Uses Assembly Language
The compiler writer
must generate machine language from a HLL
The writer of time or space critical code
Performance goals may force program specific optimizations of the assembly language
Special purpose or embedded processor programmers
Special functions and heavy dependence on unique I/O devices can make HLL’s useless
The processor designer
must implement and trade-off instruction functionality
SLIDE 25 25
An Assembly Language Uses an Instruction Set Architecture (ISA)
Instruction set: the collection of all machine operations.
ISA is a programmer interface to the hardware
Programmer sees set of instructions, along with the machine resources manipulated by them.
ISA includes
instruction set,
programmer accessible registers of the system, and
Memory
“Architecture” == ISA, “Microarchitecture” == Implementation
System Software Application Software Hardware
SLIDE 26 Layers or views
Our view of a computer system in this course is centered around the interface between the lowest level in software and the hardware
antique! ECE 142
App 1 App 2 App 3 App 4 System Software (Compiler, Assembler, Linker) Operating System Instruction Set Architecture (ISA) Subsystems, Microarchiture Circuits, Electronics, Devices
SLIDE 27
27
Sample System Architecture
SLIDE 28 28
The Memory Hierarchy
Modern computers have a hierarchy of memories
Allows tradeoffs of speed/cost/volatility/size, etc.
CPU sees common view of levels of the hierarchy.
CPU Cache Memory Main Memory Disk Memory Tape Memory
SLIDE 29
29
Some Basics before We Move on Scales, Units, and Conventions
Term K (kilo-) M (mega-) G (giga-) T (tera-) 10 3 10 6 10 9 10 12 2 10 = 1024 2 20 = 1,048,576 2 30 = 1,073,741,824 2 40 = 1,099,511,627,776 Normal Usage As a power of 2 Term Usage m (milli-) µ (micro-) n (nano-) p (pico-) 10 -3 10 -6 10 -9 10 -12 Units: Bit (b), Byte (B), Nibble, Word (w), Double Word, Long Word Second (s), Hertz (Hz)
Powers of 2 are used to describe sizes in a computer, e.g. memory sizes.