Final Review CS304
Introduction to C Why C? Difference between Python and C C compiler stages Basic syntax in C
Pointers What is a pointer? declaration, &, dereference... Pointer & dynamic memory allocation Virtual memory Pointer & arrays Relationship between pointer and array name sizeof, strlen... Pointer arithmetic *(array_ptr++) and (*array_ptr)++ [] and * pointers to arrays and array of pointers
Pointers Pointer & functions passing by value & passing by reference function pointers Pointer & structures Struct declaration and definition #define and typedef access struct with pointers offsetof
Introduction to Computer Organization Three layers in computer system software/os/hardware Hardware organization Von Neumann Architecture virtual memory and cache hierarchy What will happen if we type a linux command in command line?
Information Representation Number systems Decimal, Binary, Hexadecimal, Octal, base-10 Two important limitations Overflow, accuracy Information storage and byte order interpretation is important word size byte big endian and little endian
Integers Why low level representation? B2U, B2T, B2O, B2S range & min, max Signed vs. unsigned Integer operations sign extend, truncation, addition, negation, multiplication, division overflow, multiplication by constant, division by power of 2, rounding shift and bit operations
Floating Point Numbers Binary floating point IEEE-754 format single precision: 1[31]-sign, 8[30-23]-exponent, 23[22-0]-fraction, 127-bias Normalized & special values 0, subnormal (de-normalized), +/-infinity, NaN bias, hidden bit Range and precision Rounding, casting, special operations
Bit Operations Masks Shift operation valid range, logic shift and arithmetic shift Bit operation and logic operation Boolean algebra basic property of & ~ ^ two typical use cases of ^ (swap and array check)
Assembly Programming: Y86 Introduction to assembly programming Why assembly code? Operations and visible states in assembly programming Concept of ISA and CPU cycle Introduction to Y86 Visible states in Y86, registers, memory, cc, PC, program status
Assembly Programming: Y86 Y86 instructions assembler directives status conditions and exceptions instructions (operations, branches, and moves) stack operations subroutine call/return Y86 encoding Y86 instruction execution
Assembly Programming: IA32 Introduction to IA32 RISC and CISC (Y86 R or C, IA32 R or C?) IA32 visible states IA32 operations Data movement addressing modes: absolute, indirect, base+displacement, and indexed Stack and function operations basic stack push and pop; function call and return how to maintain the stack frame for procedure calls register usage conventions recursive procedures
Assembly Programming: IA32 IA32 operations (continue) Arithmetic and logic operations LEA! Compare and jump control flow and data flow cc and how to set cc: cmp and test how to use cc: set, jmp and cmov control structures: select, loop, switch (jump table)
Assembly Programming: IA32 Array and structures allocation and access relationship/conversion between c and IA32 Data alignment issue
Exam format True or false (10 pts) Ex. IA32 belongs to CISC Multiple choice (10 pts) basic concepts Short answer (20 pts) instruction encoding and instruction execution code reading/writing Code evaluation and open questions (60 pts) code reading, explain and fill in blanks conversion between C and Y86 (or IA32) Extra bonus (20 pts) code optimizations with computer organization knowledge some open questions about cache
Suggestions Notes!!!! Labs & HWs!!!! slides!!! Practice problems on our website!!! textbook! Don t forget to prepare for a letter-size double-side cheat sheet (must contain: Y86 encoding) Please take our course evaluation whenever you have time before December 7 th.
Thanks for taking this class, and good luck with all your finals!