DOC PREVIEW
U of I CS 232 - Lecture notesl

This preview shows page 1-2-22-23 out of 23 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 23 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 23 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 23 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 23 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 23 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

August 29, 2007 ©2006 Craig Zilles (adaptedfrom slides by Howard Huang)1CS232: Computer Architecture IIFall 2007August 29, 2007 Introduction to CS232 2 Computer 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 ASMAugust 29, 2007 Introduction to CS232 3 We’ll look at bit-wise logical and shifting operations in C.Do low-level programming in a high-level languageMemoryProcessorInput/OutputHLLCompilerASMAugust 29, 2007 Introduction to CS232 4 The Instruction Set Architecture (ISA) is the bridge between the hardwareand the software.— We’ll learn the MIPS ISA in detail— We’ll get a brief introduction to the x86 ISA— We’ll learn how HLL program constructs are represented to themachine— We won’t learn how compilers work, but we’ll learn what they doStudy Instruction Set ArchitecturesMemoryProcessorInput/OutputCompilerHLL ASMAugust 29, 2007 Introduction to CS232 5 We’ll learn how to performance tune programs. We’ll exploit explicit parallelism to make programs run faster— We’ll optimize a program using SSE instructionsLearn about performanceCompilerHLL ASMMemoryProcessorInput/OutputAugust 29, 2007 Introduction to CS232 6 The key technique we’ll focus on is: Pipelining— Pipelining allows processors to work on multiple instructions at thesame time.Learn about Modern Processor OrganizationProcessorMemoryInput/OutputASMCompilerHLLAugust 29, 2007 Introduction to CS232 7 We’ll learn how virtual memory makes programming easy We’ll learn how caches make memory fast We’ll learn about buses and disksLearn about Memory and I/O systemsProcessorMemoryInput/OutputCompilerHLL ASMAugust 29, 2007 Introduction to CS232 8Why should you care? It is interesting.— How do you make a processor that runs at 3Ghz? It will help you be a better programmer.— Understanding how your program is translated to assembly code letsyou 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 computerscience— Abstraction, caching, and indirection are CS staplesAugust 29, 2007 Introduction to CS232 9CS231 vs. CS232 This class expands upon the computer architecture material from the lastfew weeks of CS231, and we rely on many other ideas from CS231.— Understanding binary, hexadecimal and two’s-complement numbersis still important.— Devices like multiplexers, registers and ALUs appear frequently. Youshould 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.Z00100010WX11001100YJanuary 22, 2003 Introduction to CS232 10Low-level Programming in “High-level” LanguagesJanuary 22, 2003 Introduction to CS232 11Low-level Programming in “High-level” Languages Very often it is necessary to store a large number of very small dataitems. Example: A Social Security Number (SSN) registry— Needs to keep track of how which SSNs have already been allocated. How much space is required?January 22, 2003 Introduction to CS232 12Storing collections of bits as integers Store N bits in each N-bit integer, only need 109/N integers— Requires 109/8 bytes = 125MBs of storage (fits on a CD) Allocate array:int array_size = 1000000000/_____________unsigned int SSN_registry[array_size]; Want two operations on this array:— check_SSN: returns 1 if SSN is used, 0 otherwise— set_SSN: marks an SSN as used.01101011101001010001000000101011000010000101110011001000111101011001010100010101100101011111110110010101010101100101010010110010100101011110100101011001001000101101110101101001000101010010101101000110011111010111010100101001SSN #7SSN #68January 22, 2003 Introduction to CS232 13check_SSNint check_SSN(unsigned int SSN_registry[], int ssn) {int word_index = ssn / (8*sizeof(int));int word = SSN_registry[word_index];0110101110100101000100000010101100001000010111001100100011110101100101010001010110010101111111011001010101010110010101001011001010010101111010010101100100100010110111010110100100010101001010110100011001111101011101010010100110010101000101011001010111111101January 22, 2003 Introduction to CS232 14check_SSNint check_SSN(unsigned int SSN_registry[], int ssn) {int word_index = ssn / (8*sizeof(int));int word = SSN_registry[word_index];int bit_offset = ssn % (8*sizeof(int)) // % is the remainder operationword = word >> bit_offset; // >> shifts a value “right”(note: zeros are inserted at the left because it is an unsigned int)011010111010010100010000001010110000100001011100110010001111010110010101000101011001010111111101100101010101011001010100101100101001010111101001010110010010001011011101011010010001010100101011010001100111110101110101001010011001010100010101100101011111110100001001010100010101100101011111January 22, 2003 Introduction to CS232 15check_SSNint check_SSN(unsigned int SSN_registry[], int ssn) {int word_index = ssn / (8*sizeof(int));int word = SSN_registry[word_index];int bit_offset = ssn % (8*sizeof(int))word = word >> bit_offset;word = (word & 1); // & is the bit-wise logical AND operatorreturn word; (each bit position is considered independently)}01101011101001010001000000101011000010000101110011001000111101011001010100010101100101011111110110010101010101100101010010110010100101011110100101011001001000101101110101101001000101010010101101000110011111010111010100101001100101010001010110010101111111010000100101010001010110010101111100000000000000000000000000000001&00000000000000000000000000000001January 22, 2003 Introduction to CS232 16set_SSNvoid set_SSN(unsigned int SSN_registry[], int ssn) {int bit_offset = ssn % (8*sizeof(int))int new_bit = (1 << bit_offset) // “left” shift the 1 to the desired spot(always shifts in 0’s at the


View Full Document

U of I CS 232 - Lecture notesl

Documents in this Course
Goal

Goal

2 pages

Exam 1

Exam 1

5 pages

Exam 1

Exam 1

6 pages

Exam 2

Exam 2

6 pages

Exam 1

Exam 1

5 pages

Load more
Download Lecture notesl
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture notesl and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture notesl 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?