ECE 0142 Computer Organization Lecture 1 Introduction Professor Jun Yang Department of Electrical and Computer Engineering University of Pittsburgh 1
Logistics Course Material: http://www.pitt.edu/~juy9/142/142.html Book: Hennessy and Patterson, “Computer Organization and Design, The Hardware/Software Interface”, 5 th 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
Prerequisites Some experience with a high level language C, etc. Digital logic circuits Covered in ECE/CoE 0132 Digital Logic 3
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 (10 9 bytes) memory, few terabytes (10 12 bytes) of disk 35 gigaflops (35×10 9 “floating-point math calculations” per second for Intel Ivy Bridge)
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× 10 15 calculations per second vs. 35×10 9 for PC) Gigabytes to terabytes memory (Sequoia: 1,024,000GB [1.0 petabyte!]) Petabytes (10 15 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.)
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 (10 3 bytes) to gigabytes of memory Kilobytes to gigabytes of storage Slow speed to fast speed Widest range of design!
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 App 1 App 2 App 3 App 4 System Software (Compiler, Assembler, Linker) antique! Operating System ECE 142 Instruction Set Architecture (ISA) Subsystems, Microarchiture Circuits, Electronics, Devices
swap (int v[], int k) { int temp; High-level language, e.g. C temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; } C Compiler swap: muli $2, $5, 4 Assembly language, e.g. MIPS add $2, $4, $2 lw $15, 0($2) lw $16, 4($2) sw $16, 0($2) sw $15, 4($2) jr $31 Assembler 00000000101000010000000000011000 Binary machine language 00000000100011100001100000100001 10001100011000100000000000000000 10001100111100100000000000000100 10101100111100100000000000000000 10101100011000100000000000000100 00000011111000000000000000001000 8
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
A Day in the Life of a C (Java) Program #include <stdio.h> hello.c int main (void) usr{1} hello { Hello ECE 142! printf(“Hello ECE 142!\n”); compiler usr{2} } hello.c hello.s assembler loader crt0.o hello.o Basic runtim library linker hello
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
Assembling, Loading, Running assembly language machine code assembled loop: add $t1,$t1,$t0 01284820 21080001 addi $t0,$t0,1 slti $t2,$t0,10 290a000a bne $t2,$0,loop 01540fffc loaded ... 0 01284820 4 21080001 8 290a000a 12 01540fffc 16 ... 20 24 machine code address memory
Assembling, Loading, Running assembly language machine code assembled loop: add $t1,$t1,$t0 01284820 21080001 addi $t0,$t0,1 slti $t2,$t0,10 290a000a bne $t2,$0,loop 01540fffc loaded ... 0 01284820 4 21080001 8 290a000a 12 01540fffc 16 ... 20 24 address memory
Assembling, Loading, Running assembly language machine code loop: add $t1,$t1,$t0 01284820 21080001 addi $t0,$t0,1 slti $t2,$t0,10 290a000a bne $t2,$0,loop 01540fffc ... 0 fetch 01284820 4 21080001 8 290a000a 12 01540fffc 16 ... 20 24 address memory Processor accesses instructions only through memory
Assembling, Loading, Running assembly language machine code loop: add $t1,$t1,$t0 01284820 21080001 addi $t0,$t0,1 slti $t2,$t0,10 290a000a bne $t2,$0,loop 01540fffc ... 0 01284820 4 21080001 8 290a000a 12 01540fffc 16 execute ... 20 01284820 24 address memory Processor accesses instructions only through memory
Assembling, Loading, Running assembly language machine code loop: add $t1,$t1,$t0 01284820 21080001 addi $t0,$t0,1 slti $t2,$t0,10 290a000a bne $t2,$0,loop 01540fffc ... 0 01284820 4 fetch 21080001 8 290a000a 12 01540fffc 16 ... 20 24 address memory Processor accesses instructions only through memory
Assembling, Loading, Running assembly language machine code loop: add $t1,$t1,$t0 01284820 21080001 addi $t0,$t0,1 slti $t2,$t0,10 290a000a bne $t2,$0,loop 01540fffc ... 0 01284820 4 21080001 8 290a000a 12 01540fffc 16 execute ... 20 21080001 24 address memory Processor accesses instructions only through memory
Assembling, Loading, Running assembly language machine code loop: add $t1,$t1,$t0 01284820 21080001 addi $t0,$t0,1 slti $t2,$t0,10 290a000a bne $t2,$0,loop 01540fffc ... 0 01284820 4 21080001 8 fetch 290a000a 12 01540fffc 16 ... 20 24 address memory Processor accesses instructions only through memory
Assembling, Loading, Running assembly language machine code loop: add $t1,$t1,$t0 01284820 21080001 addi $t0,$t0,1 slti $t2,$t0,10 290a000a bne $t2,$0,loop 01540fffc ... 0 01284820 4 21080001 8 290a000a 12 01540fffc 16 execute ... 20 290a000a 24 address memory Processor accesses instructions only through memory
Assembling, Loading, Running assembly language machine code loop: add $t1,$t1,$t0 01284820 21080001 addi $t0,$t0,1 slti $t2,$t0,10 290a000a bne $t2,$0,loop 01540fffc ... 0 01284820 4 21080001 8 290a000a 12 fetch 01540fffc 16 ... 20 24 address memory Processor accesses instructions only through memory
Assembling, Loading, Running assembly language machine code loop: add $t1,$t1,$t0 01284820 21080001 addi $t0,$t0,1 slti $t2,$t0,10 290a000a bne $t2,$0,loop 01540fffc ... 0 01284820 4 21080001 8 290a000a 12 01540fffc 16 execute ... 20 01540fffc 24 address memory Processor accesses instructions only through memory
Assembling, Loading, Running assembly language machine code loop: add $t1,$t1,$t0 01284820 21080001 addi $t0,$t0,1 slti $t2,$t0,10 290a000a bne $t2,$0,loop 01540fffc ... 0 fetch 01284820 4 21080001 8 290a000a 12 01540fffc 16 ... 20 24 address memory Processor accesses instructions only through memory
Assembling, Loading, Running assembly language machine code loop: add $t1,$t1,$t0 01284820 21080001 addi $t0,$t0,1 slti $t2,$t0,10 290a000a bne $t2,$0,loop 01540fffc ... 0 01284820 4 21080001 8 290a000a 12 01540fffc 16 execute ... 20 01284820 24 address memory Processor accesses instructions only through memory
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 24
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 Application Software System Software Hardware 25
Recommend
More recommend