Course Review

advertisement
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Preliminaries
1. Exam venue: ECSC 119 (Engineering & Computer Science Center).
Monday at 8:00am. Please be there 10 minutes early.
2. Exam will be 75 minutes as usual. Similar structure as mid-term.
3. Syllabus: ONLY Chapters 6 and beyond.
Course Review
4. Calculator allowed (likely not needed)
5. Exam will focus on joint understanding of how high-level
programming (in C) and low-level assembly (LC-3).
6. * = important
*** = very important
6-2
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Review - Chapter 7 *
Review - Chapter 8 ***
1. Know how to use TRAP codes (all of them).
2. Understand how symbol table is constructed during
assembly to machine code translation.
3. Symbol tables are used both by the C compiler and by
the LC-3 assembler. What is their purpose in each
case?
1. Understand the differences between:
1. Memory mapped vs special instructions
2. Synchronous and Asynchronous
3. Polling vs Interrupts
2. Try writing a simple I/O routine using polling.
3. Understand how I/O happens in the LC-3
1. Use of KBSR/KBDR
2. Use of DSR/DDR
4. Expect 1 problem on I/O using Keyboard/Display
6-3
6-4
1
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Review - Chapter 9 ***
Review - Chapter 10 ***
1. System Calls
1. LC-3 code for Stack
1. TRAP, System Control Block, Service Routine, …
2. Caller vs Callee Save
1. Push, Pop routines in LC-3 with overflow/underflow detection
2. Subroutines
2. Go through examples in the book
1. JSR, JSRR, RET
1. Use stack for passing parameters to subroutines
2. Evaluating arithmetic expressions using stack
3. ASCII to binary conversion/multiplication using stack
3. Try writing simple subroutines (add, mul…)
4. Can you list similarities and differences between
system calls and subroutines?
3. How is stack used for interrupt service routines vs
subroutines?
5. Expect a problem on writing an LC-3 sub-routine.
Remember how to save/restore registers.
6-5
6-6
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Review - Chapter 12 ***
Review - Chapter 14 ***
1. Memory layout
1. Run-time stack: When function is called:
1.
2.
3.
4.
1. Local variables, global variables, run-time stack…
2. Activation record
3. Frame pointer, Stack pointer, Global Data pointer
How do parameters get passed to the function?
How does the activation record get populated?
What bookkeeping variables are required?
What are the values of R5, R6, R7, PC at different operating
points?
2. Constructing symbol table
1. Pay attention to how offsets are computed for parameters, and
local variables.
2. Can you convert a simple C function to LC-3?
1. Pay attention to insertion of parameter passing and
bookkeeping code.
3. Expect a problem on symbol tables, stack, activation
records, C to LC-3 conversion, and perhaps smaller
instances of LC-3 to C conversion.
6-7
6-8
2
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Review - Chapter 16 ***
Review - Chapter 19 **
1. Understand the duality between pointers, arrays, and
strings in C
1. Structs, typedef, pointer to structs
2. Dynamic memory allocation - malloc, free
3. Understand how linked list, heap or stack can be
implemented using pointers.
2. Pass by value vs Pass by reference
1. Write down a simple function (e.g. swap) using both methods
2. Convert the function to LC-3 code.
4. Note: You will not get significant questions on dynamic
memory allocation, so no need to focus on it. Make
sure to understand how arrays, pointers and structs
work, however.
3. Know how to pass array as a parameter.
6-9
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
6-10
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Review - Pipelining**
What will not be covered?
1. Focus on data hazards
1. Focus on what was covered in class. Questions will be
strictly limited to what was covered.
2. Construct pipeline schedule
1. Draw schedule with bubbles if necessary.
2. Use forwarding and/or instruction re-ordering to improve efficiency.
2. Nothing on recursion (either in C or LC-3)
3. Use schedule to compute efficiency (instructions per cycle)
3. Joint understanding of LC-3 and C is important.
4. Note: No need to understand the internal structure of the pipelined
LC-3 CPU. A six stage pipeline will be assumed (as we did in
class). Stages will be listed in the exam paper.
4. Most questions on LC-3.
6-11
6-12
3
Download