150 likes | 269 Views
CMSC311. Computer Organization and Assembly Language Read: Chapter 1,2 Fall 2006 Dr. Ju Wang. Class Objectives. Learn how high-level language (C/Java) is translated into the language of hardware How does the hardware execute the resulting program • Computer arithmetic
E N D
CMSC311 • Computer Organization and Assembly Language • Read: Chapter 1,2 • Fall 2006 • Dr. Ju Wang
Class Objectives • Learn how high-level language (C/Java) is translated into the language of hardware • How does the hardware execute the resulting program • Computer arithmetic • Machine language / assembly language • System organization/implementation • Prepare for future software/architecture/design classes
How to success in this course • check course page http://www.people.vcu.edu/~jwang3/cmsc311/index.htm • Read textbook: Computer Organization 5th edition (Hamacher and Vranesic) • Do assignments: problem exercise, assembly language programming, basic computer simulator • Independent work • Class participation and be active: • Questions, office hours
About programming projects • You will learn AVR assembly language • You will write AVR code to solve some problems • You will learn AVR studio software to debug/execute your AVR code • Lab/tutorial might be scheduled based on demand
What is a computer? • Components: • input (mouse, keyboard) • output (display, printer) • memory (disk drives, DRAM, SRAM, CD) • network • Our primary focus: the processor (datapath and control) • implemented using millions of transistors • Impossible to understand by looking at each transistor
Abstraction • Delving into the depths reveals more information • An abstraction omits unneeded detail, helps us cope with complexityWhat are some of the details that appear in these familiar abstractions?
Types of Computer and Organization • Desktop • Server • Laptop • Supercomputer • Embedded computer computer processor MEMORY I/O Dev 1 Datapath I/O Dev 2 I/O Dev 3 control I/ODev 4
PC Motherboard and CPU Pentium 4 processor 1.7GHz, $90 ASUS P4 motherboard, $120
What is ISA • Instruction Set Architecture (the “vocabulary” of a machine) • All processor has its type of ISA • interface between hardware and low-level software • Determine the compatibility/portability of software
ISA examples • Digital Alpha (v1, v3) 1992-97 • HP PA-RISC (v1.1, v2.0) 1986-96 • Sun Sparc (v8, v9) 1987-95 • SGI MIPS (MIPS I, II, III, IV, V) 1986-96 • Intel (8086,80286,80386, 1978-96 80486,Pentium, MMX, ...)
Big Picture Sys prog App prog Compiler Assembler Operating System Instruction Set Architecture CPU MEM I/O Dev Logical design, Layout, … electrical signal
Inside the CPU • A modern processor has: • Registers: r0, r1, r2, • Hold 8/16/32/64 bits of information • Like variables in C • Functional units: •given input data, produce results as data • Control unit: • Controls follow of the instructions
From Java to machine code • C Statement: • int foo; foo = 15; foo = foo + 7; • • MIPS Assembly Language: • ori $1,$0,15 # set foo to 15 • addiu $1,$1,7 # add 7 to foo • (register 1 holds the value of foo) • • MIPS Machine Instructions: • 00110100000000010000000000001111 • 00100100001000010000000000000111
How program is executed • • Basic idea: • 1. Fetch machine instruction • 2. Decode it, examine fields • 3. Execute the specified operation
Stored-Program Computer • Instructions are numbers too! • • Memory is a linear array of "registers" • • Store instructions in memory (von Neumann architecture) • • New register PC, the program counter • 1. Fetch machine instruction at PC • 2. Decode it, examine fields • 3. Update PC • 4. Execute the specified operation