CS232: Computer Architecture IIWhat is computer architecture about?Study Instruction Set ArchitecturesLearn about Modern Processor OrganizationLearn about Memory and I/O systemsWhy should you care?CS231 vs. CS232Who we areInstruction set architecturesMIPSWhat you will need to learn this monthMIPS: register-to-register, three addressRegister file reviewMIPS register fileMIPS register namesBasic arithmetic and logic operationsLarger expressionsImmediate operandsWe need more space!Memory reviewMIPS memoryLoading and storing bytesByte loadsLoading and storing wordsAn array of wordsComputing with memoryMemory alignmentNext timeHow the class will be organizedMP 1 is out – due next week!!General hints to reach CS232 nirvana1CS232: Computer Architecture IIFall 20062Computer architecture is about building and analyzing computer systems.In CS232, we will take a tour of the whole machine. Specifically, we’ll…What is computer architecture about?MemoryProcessorInput/OutputCompilerHLL ASM3The Instruction Set Architecture (ISA) is the bridge between the hardware and the software. We’ll learn the MIPS ISA in detailWe’ll learn how HLL program constructs are represented to the machineWe won’t learn how compilers work, but we’ll learn what they doStudy Instruction Set ArchitecturesMemoryProcessorInput/OutputCompilerHLL ASM4What makes a processor fast?The key technique we’ll focus on is: Pipelining—Pipelining allows processors to work on multiple instructions at the same time.Learn about Modern Processor OrganizationProcessorMemoryInput/OutputASMCompilerHLL5We’ll learn how virtual memory makes programming easyWe’ll learn how caches make memory fastWe’ll learn about buses and disksLearn about Memory and I/O systemsProcessorMemoryInput/OutputCompilerHLL ASM6Why should you care?It is interesting.—How do you make a processor that runs at 4Ghz?It will help you be a better programmer.—Understanding how your program is translated to assembly code lets you reason about correctness and performance. —Demystify the seemingly arbitrary (e.g., bus errors, segmentation faults)Many cool jobs require an understanding of computer architecture.—The cutting edge is often pushing computers to their limits.—Supercomputing, games, portable devices, etc.Computer architecture illustrates many fundamental ideas in computer science—Abstraction, caching, and indirection are everywhere in CS7CS231 vs. CS232This class expands upon the computer architecture material from the last few weeks of CS231, and we rely on many other ideas from CS231.—Understanding binary, hexadecimal and two’s-complement numbers is still important.—Devices like multiplexers, registers and ALUs appear frequently. You should know what they do, but not necessarily how they work.—Finite state machines and sequential circuits will appear again.We do not spend much time with logic design topics like Karnaugh maps, Boolean algebra, latches and flip-flops.Y0 0 1 10 0 1 1XW0 1 0 00 1 0 0Z8Who we areLecturer: Viraj Kumar•I’m a graduate student interested in teachingTeaching Assistants:Abhilasha ChaudharyVijay NoriPeter YoungOffice: 0212 Siebel9In CS232, we’ll talk about several important issues that we didn’t see in the simple processor from CS231.—The instruction set in CS231 lacked many features, such as support for function calls. We’ll work with a larger, more realistic processor.—We’ll also see more ways in which the instruction set architecture affects the hardware design.Instruction set architecturesSoftwareHardwareISA10MIPSIn this class, we’ll use the MIPS instruction set architecture (ISA) to illustrate concepts in assembly language and machine organization—Of course, the concepts are not MIPS-specific—MIPS is just convenient because it is real, yet simple (unlike x86)The MIPS ISA is still used in many places today. Primarily in embedded systems, like:—Various routers from Cisco—Game machines like the Nintendo 64 and Sony Playstation 211What you will need to learn this monthYou must become “fluent” in MIPS assembly:—Translate from C to MIPS and MIPS to CExample problem a previous last mid-term 1:Question 3: Write a recursive function (30 points)Here is a function pow that takes two arguments (n and m, both 32-bit numbers) and returns nm (i.e., n raised to the mth power). intpow(int n, int m) { if (m == 1) return n; return n * pow(n, m-1);}Translate this into a MIPS assembly language function.12MIPS: register-to-register, three addressMIPS is a register-to-register, or load/store, architecture.—The destination and sources must all be registers.—Special instructions, which we’ll see later today, are needed to access main memory. MIPS uses three-address instructions for data manipulation.—Each ALU instruction contains a destination and two sources.—For example, an addition instruction (a = b + c) has the form:add a, b, coperationdestination sourcesoperands13Register file reviewHere is a block symbol for a general 2k n register file.—If Write = 1, then D data is stored into D address.—You can read from two registers at once, by supplying the A address and B address inputs. The outputs appear as A data and B data.Registers are clocked, sequential devices.—We can read from the register file at any time. —Data is written only on the positive edge of the clock.D data Write D address A address B addressA data B data 2k n Register Filekkk n n n14MIPS register fileMIPS processors have 32 registers, each of which holds a 32-bit value. —Register addresses are 5 bits long.—The data inputs and outputs are 32-bits wide.More registers might seem better, but there is a limit to the goodness.—It’s more expensive, because of both the registers themselves as well as the decoders and muxes needed to select individual registers.—Instruction lengths may be affected, as we’ll see in the future.D data Write D address A address B addressA data B data32 32 Register File555 32 32 3215MIPS register namesMIPS register names begin with a $. There are two naming conventions:—By number:$0 $1 $2 … $31—By (mostly) two-character names, such as:$a0-$a3 $s0-$s7 $t0-$t9 $sp $raNot all of the registers are equivalent:—E.g., register $0 or $zero always contains the value 0•(go ahead, try to change it)Other registers have special
View Full Document