ECE 109-001
Fall 2020 R.J. Evans
Rules for ECE109 Exams
This exam is Open Note, Open Book, Open Calculator, Open Computer for notes.
No correspondence is allowed with anyone other than the instructor/proctor.
You absolutely may NOT access online resources (Google, Yahoo, Chegg, etc.) to obtain any problem solutions or previous class work from ANY organization! This applies before and during the exam.
You may NOT have any materials printed/downloaded which were received from Anyone other than the instructor or TAs.
Absolutely NO IMs, E-Mails, Verbal Messages, or other communications during the exam!
If you do not have a printer available you may complete your exam on plain/lined paper and
upload it at the end.
You MUST have a camera turned on you during the entire exam. If your computer does not have an exam use a cell phone. Be sure to have your charger cable ready to cover the entire exam period.
This is a 150 minute exam. Students who arrive late will NOT be given extra time on the exam. You are allotted 5 minutes to print the exam, 130 minutes to complete the exam, and then a final 15 minutes to scan and upload the exam. If you are still working on the exam past the minute time, this will be considered cheating.
You WILL be required to show your work for full credit! Partial Credit will be Generous!
Please turn in your exam when asked! I consider it cheating to continue to work on an exam
when told to stop and will count this as an Honor Offence!!
Failure to abide by these rules and the NCSU Honor Policy will result in a zero on the exam and will be treated as a violation of the NCSU Code of Student Conduct.
Read and sign the following statement. Failure to sign the statement will result in a zero on the exam.
I have neither given nor received unauthorized assistance on this test. I have notified the proctor of any violations of the above policies.
Signature: __________________________________________________
1 of 6
ECE 109-001
Fall 2020 R.J. Evans
Topics for the Final Exam
The material for the first exam comes from all chapters in the text. In order to demonstrate mastery of the material, you must be able to do the following.
Chapter 2
1. Discuss why a binary representation (using 1 and 0) is particularly appropriate for a digital computer.
2. Compute the number of values that can be represented with n bits. Compute how many bits are required to
number/represent k items.
3. Convert a decimal integer into the following binary representations: unsigned, sign-magnitude, two’s
complement.
4. Convert a binary integer to decimal, using the following representations: unsigned, sign-magnitude, two’s complement.
5. Explain and demonstrate the following concepts: sign extension, overflow.
6. Convert between binary and hexadecimal representations.
7. Perform two’s complement binary addition, and tell whether overflow occurs. Give two methods for detecting overflow for a two’s complement operation. (The operands may be given in hexadecimal representation.)
8. Perform the following logic operations on binary numbers: AND, OR, NOT.
9. Convert a character string to its ASCII code equivalent, and vice versa, given a copy of the ASCII code table.
10. Convert a fixed-point binary representation into IEEE floating-point representation. (For floating-point problems, realize that you will have no calculator and limited time, so exam problems will not be overly complicated.)
11. Convert a decimal number into an IEEE floating-point binary representation.
12. Given an IEEE floating-point representation, show the equivalent decimal number.
Chapter 3
13. Describe the role of the n-type and p-type transistors in a CMOS logic gate.
14. Draw the CMOS implementation of the following gates: NOT, NAND, NOR, AND, OR. (For all except NOT, the number of inputs can be two or more.)
15. Distinguish between a legal and illegal CMOS logic gate.
16. Derive the truth table implemented by a given CMOS logic gate.
17. Draw the logical symbols used for the following gates: NOT, NAND, NOR, AND, OR.
18. Design a logic circuit that implements a given truth table. Use the methods described in class – Product of Sums and Sum of Products. Use one AND/OR gate for every “1/0” output in the truth table, followed by an OR/AND gate. (Please do not try to simplify the circuit. It will take more time for you, and it will be harder to grade.)
19. Create a truth table that solves a specified problem. In other words, design a logic function that transforms input values to output values in a specified way. (Example: Design a logic function with a 6-bit input and a 3- bit output, where the output represents the number of ones in the input.) Word Problem.
20. Derive the truth table implemented by a given logic circuit. Working backwards.
21. Describe DeMorgan’s Law, and show its application.
2 of 6
ECE 109-001 Fall 2020 R.J. Evans
22. Describe and show the implementation of the following combinational logic circuits: n-to-1 multiplexer, n-bit full adder.
23. Use adders and multiplexers (along with other logic) to design a logic circuit to solve a specified problem.
24. Describe and show the implementation of the following storage circuits: RS latch, D latch, D flip-flop.
25. Describe and show the implementation of an n-bit register, built out of D latches.
26. Describe and show the design of a 2n×m memory, built out of D latches. Describe the function of the decoder, address, write enable signal, and word select signal.
27. Describe and utilize the relationship between address bits, address space (number of locations, number of words), addressability (number of bits per word, number of bits per location, word size), and the total size of a memory.
28. Discuss the difference between combinational and sequential logic.
29. Given one of the following descriptions of a state machine, derive the other two: state diagram, truth tables, logic circuit.
30. Describe why flip-flops are used, rather than latches, when implementing a clock-driven state machine.
31. Design a controller state machine for a datapath, given a description of what the datapath is meant to compute. (E.g., given the datapath shown on slide 3-63 of the notes, design a system that adds every third value of the input stream.)
32. Be able to draw a simple timing diagram for the progression through a state diagram, with proper vertical alignment.
Chapter 4
33. Name and describe the three main and two interface (five total) components of the von Neumann model.
34. Describe the interface between the CPU and the memory in the LC-3 (i.e., the use of the MAR and MDR registers).
35. Define the following terms: opcode, register, word size, ALU, program counter, instruction register. Tell how each is used in the von Neumann model.
36. Describe the difference between registers and memory.
37. Describe and discuss the sequence of operations required to execute an instruction (fetch, decode, execute). What happens during each phase? (You must be able to answer this in general, as well as for each individual instruction type (opcode) that we have discussed in class.)
38. Explain the difference between instruction cycles and machine cycles.
Chapter 5
39. List the components of a machine’s Instruction Set Architecture (ISA). Provide a concise but complete description of the LC-3 ISA. Memory Organization, Register Set, Instruction Set.
40. Given an LC-3 instruction and its location in memory, describe the operation performed by that instruction, including any changes to registers and/or specific memory locations.
41. Describe the operation of the LC-3 load and store instructions: LD, LDR, LDI, ST, STR, STI.
42. Name the three addressing modes for Load/Store. PC-relative, Base + offset, and Indirect.
43. Given an instruction location and a memory address, compose a load/store instruction that reads/writes that memory location. For LDR/STR, you may also be given information about the content of registers and/or specific memory locations.
44. Describe the operation of the LC-3 compute instructions: ADD, AND, NOT, and LEA. 3 of 6
ECE 109-001 Fall 2020 R.J. Evans
45. Know how to use these to subtract, OR, copy, and clear registers.
46. Identify which Opcodes affect the status bits n, z, and p.
47. Describe the operation of the BR instruction in the LC-3. Given an instruction location, a set of conditions, and a target address, compose a BR instruction that accomplishes the desired branch. Given a BR instruction and its location, describe the effects of the branch.
48. Identify the differences between a Branch and a Jump instruction.
49. Identify the datapath components used during the execution of all LC-3 instructions. (The LC-3 datapath is shown in Figure 5.18. You don’t have to memorize this picture, or the names of all the different multiplexors, etc., but you should be able to describe how data flows among major datapath components: registers, ALU, MAR, etc.). You should be able to draw the arrows, numbers, and explain in words.
50. Using machine instructions, write a program to perform a given task. Explain the use of each instruction in the program.
51. You should be able to translate an Assembly Language instruction to/from a Machine Language instruction.
52. Given a machine language program, give a brief description of its function. You may be asked to give a description in English, or as a high-level flow chart. For this type of question, you should not give an instruction-by-instruction description of what happens — we would be looking for a higher-level description, such as: “counts the number of zeroes in the value currently in R0.”
53. Given an assembly language program, you should be able to identify and correct errors which prevent the code from achieving its desired task.
54. Perform transformations and processing of ASCII characters. Examples: Change a letter from lower-case to upper-case, or vice versa. Change a digit to its corresponding numerical value (e.g., ‘4’ to 4), or vice versa. Compare two characters to see which is alphabetically first. Determine whether a given character is a decimal/hexadecimal digit. (These examples are not exhaustive — they just represent the kinds of processing that you might be asked to do.)
55. Using the character I/O routines (GET, OUT), transfer data (e.g., strings, characters, or numbers) between a program and a user.
56. Using the string output routine (PUTS), print a desired text string to the display.
57. Demonstrate understanding of how a text string is stored in memory for the LC-3.
58. Write LC-3 assembly language code to manipulate string data.
Chapter 6
59. Describe the following phases of software development: design, programming, debugging.
60. Discuss and demonstrate how to solve a programming problem through systematic decomposition.
61. Name and give examples of the three basic programming constructs. Show how these constructs are implemented using LC-3 instructions.
62. Discuss and demonstrate techniques for finding and correcting bugs in a program.
Chapter 7
63. Describe the differences between an assembly language program and a machine language program.
64. Show the syntax of an LC-3 assembly language program statement. Be able to identify syntax errors in assembly language statements.
4 of 6
ECE 109-001 Fall 2020 R.J. Evans
65. Describe the use of labels and comments in an assembly language program.
66. Describe and demonstrate the use of the following LC-3 assembler directives: .ORIG, .END, .FILL, .BLKW, .STRINGZ.
67. Describe the two-pass assembly process.
68. Describe the contents of a symbol table, and explain its use during the assembly process.
69. Given an assembly language program, construct its symbol table.
70. Translate from assembly language to machine language, and vice versa.
71. Given an assembly language program, give a brief description of its function and/or determine the values computed by the program.
72. Using assembly language, write a program to perform a given task. Explain the use of each instruction in the program.
73. Demonstrate the proper use of the following LC-3 service routines: GETC, OUT, PUTS, HALT.
Chapter 8 I/O and Interrupts
74. Define the following: device register, control register, data register, memory-mapped register.
75. Compare and contrast the two modes of interaction between the CPU and an I/O device: polling and interrupts. Describe scenarios in which you might choose one approach over the other.
76. Demonstrate the use of the LC-3 keyboard device.
77. Demonstrate the use of the LC-3 display device.
78. Given the description of a device and its registers, write an assembly language program that uses polling to perform a specified input/output operation.
79. Describe how the CPU and an I/O device interact using interrupts.
80. Discuss how interrupts impact the CPU’s instruction processing cycle (fetch, decode, execute).
81. Describe the priority levels at which an instruction operates. Which are higher/lower.
82. Describe what occurs in the LC-3 when an interrupt signal is detected. (The specific details in the text are not required, but the process is important: What state is saved? Where is it saved? Who saves it? How and when is it restored?)
Chapter 9 TRAPs and Subroutines
83. Discuss the reasons for providing system calls for I/O and other functions.
84. Discuss the reasons for providing a mechanism for user-level subroutine calls.
85. Describe the ISA features of the LC-3 that support system calls and subroutines.
86. List and describe the four components of the LC-3 TRAP mechanism. (Section 9.1.2)
87. Write a service routine to perform a specified function. Explain the steps needed to make this service routine available to a user program via a system call, and show an example of how the service routine may be used by a user program.
88. Discuss the need for saving and restoring registers in service routines and subroutines. Describe the “callee- save” convention.
89. Explain the differences between JSRR and JMP in the LC-3.
90. Explain the differences between JSR and BRnzp in the LC-3.
91. Explain the differences in the JSR and JSRR instructions.
5 of 6
ECE 109-001 Fall 2020 R.J. Evans
92. Write a subroutine to perform a specified function. Explain the interface for your subroutine: how arguments and return values are communicated, which registers and memory locations are affected.
93. Write a program that uses system calls and/or subroutines to accomplish a specified task.
94. Understand how to reference labels in other xx.obj modules (assembly code modules) with the .EXTERNAL directive.
95. Identify the datapath components used during the execution of the TRAP, JSR, JSRR instructions. (The LC-3 datapath is shown in Figure 5.18. You don’t have to memorize this picture, or the names of all the different multiplexors, etc., but you should be able to describe how data flows among major datapath components: registers, ALU, MAR, etc.). You should be able to draw the arrows, numbers, and explain in words.
Chapter 10 Stacks and Interrupts
96. Describe what occurs in the LC-3 when an interrupt signal is detected. (The specific details in the text are not required, but the process is important: What state is saved? Where is it saved? Who saves it? How and when is it restored?)
97. Describe the operation of the RTI instruction. How is it different than RET?
98. Define the following: top of stack, push, pop , overflow, underflow.
99. Show LC-3 assembly language code that performs push and pop operations on a stack, with or without underflow/overflow prevention.
100. Describe scenarios in which a stack should be used as the interface to a subroutine: too many input/output arguments, a variable number of input/output arguments.
101. Write a subroutine that uses the stack to pass arguments and/or return values.
102. Show how a stack can be used as a subroutine interface – i.e., how the stack can be used to pass
information to and from a subroutine. (This is a general question, not the specific “standard” stack-based calling convention discussed in class.)
103. Name the three items needed to fully capture the state of a running process. Processor Status Register, Program Counter, Registers.
104. Explain the difference between a User Stack and a Supervisor Stack.
105. Explain the basic idea of Priority Level
106. Define an Exception. List 3 examples of an Exception. Explain how it is handled by the system.
107. Draw a flow chart to describe adding two integers passed in on the stack and returning the answer on the
stack.
6 of 6