============ Final Review ============ ---------------------- Schedule a review session for Monday 1-2 2-3 3-4 4-5 ---------------------- Logistics Items to bring ID Two sides of an 8.5x11 sheet. writing utensil (have a backup) NO CALCULATORS or phones can be out Attempt to come 5 minutes ahead of time. Priority to give material 1) Examples done during class 2) Exercises and/or questions in class notes or programming assignment writeups. 3) final example problems 4) questions done for homework All questions in exam will be the same format as a question from one of these sources. Relevant reading assignments: see all reading assignments listed in online schedule starting on 10/16/08 and ending on 12/4/08. Ch. 7-9, 11-17, 19 in Patt and Patel book Parts of Appendix A from Hennessey and Patterson book, posted online ---------------------- Example questions (Problem 3) from final example questions can be broken into 2 pieces: The following LC3 assembly code pushes the values in R7 and R5 onto the stack: ADD R6, R6, #-1 STR R7, R6, #0 ADD R6, R6, #-1 STR R5, R6, #0 1) Draw the run-time stack after the above code executes. (Just draw the part relevant to the above code). 2) Add immediate values to the following list of instructions so that their execution results in the same run-time stack. STR R7, R6, ADD R6, R6, STR R5, R6, ADD R6, R6, (Problem 5) Given a small LC3 program example such as the one shown below .ORIG x3000 AND R0, R0, #0 ;R0 = 0 AND R1, R1, #0 ;R1 = 0 AND R2, R2, #0 ;R2 = 0 ADD R0, R0, #8 ;R0 = 8 ADD R1, R1, #-2 ;R1 = -2 LOOP0 ADD R2, R2, #2 ;R2 = R2 + 2 ADD R0, R0, R1 ;R0 = R0 + R1 BRp LOOP0 ;LOOP0 x3005 HALT .END Fill in the below symbol table and determine the PC offsets for the BR, JSR, LD, LDI, ST, and/or STI instructions. Symbol Table Label Address ------------------- (Problem 7) For the following function int p = 256; void foo() { int x = p; int y = x + p; { int a = 2; x = a; int y = x + p; printf("%d\n", a); printf("%d\n", y); } printf("%d\n", x); printf("%d\n", y); } (a) draw the activation record using the LC3 convention for placing local variables, (b) what is the output for the function? ---------------------- Conceptual Overview Number representation Circuits -Combinational and Sequential circuits. -How circuits can be used to implement finite state machines. Instruction Set Architectures, Machine Architecture -LC3 machine code -Microarchitecture is how LC3 ISA is implemented using sequential and combinational circuits. Assembly LC3 and MIPS RUNTIME STACK and recursion The C programming language Basics of compilation and debugging % gcc -g -Wall main.c % gdb a.out The C memory model: RUNTIME STACK and heap How a subset of C map to assembly The interaction between C and MIPS -MIPS is a real assembly language. -Function calls between languages. -Recursion, recursion, recursion. Generally useful software engineering practices -revision control (subversion) -debugging (gdb, MARS, valgrind) -build systems (make) -unit testing