EECS 373 Practice Final Exam Name: ____________________________________ unique name: _______________ Sign the honor code: I have neither given nor received aid on this exam nor observed anyone else doing so. ___________________________________ Scores: Problem # Points 1 /15 2 /12 3 /12 4 /8 5 /7 6 /9 7 /10 8 /7 9 /10 10 10 Total /100 NOTES: There are 13 pages including this one. Calculators are allowed, but no PDAs, Portables, Cell phones, etc. Don’t spend too much time on any one problem and be sure you get to the design problem with plenty of time to spare. You have about 120 minutes for the exam. Be sure to show work and explain what you’ve done when asked to do so. Getting partial credit without showing work will be rare. 1. Fill-in-the-blank [10, -1 per wrong or blank answer, minimum 0] If a given message scheme allows for three bits of error detection, the Hamming distance of the underlying code must be at least 4/5/6/7/8/9. If the scheme could correct any two-bit error and simultaneously detect any two-bit error, the Hamming distance of the underlying code must be at least 4/5/6/7/8/9. An ideal 8-bit analog to digital converter that has a Vref of 16V has a quantization error of ______________ volts, while one with a Vref of 8V has a quantization error of _____________ volts. Consider a 4-bit digital to analog converter that has an INL of no more than ±¼ LSB and a Vref of 4V. Say an input of “0000” should (ideally) generate an output of ⅛V. The range of possible values for an input of “0111” is _________V to __________ V. The AHB uses a MUX / wired-ors / tri-state devices to get data from the slave back to the master. The lowest frequency it is generally safe to assume people can’t hear is 10 KHz / 20 KHz / 35KHz / 40 KHz. This generally means the highest data rate we generally need on our DAC is around 10 KHz / 20 KHz / 35KHz / 40 KHz. When working with PCBs, a “thou” is a thousandth of an inch / a millimeter / about 1000 angstroms. A “mill” is a thousandth of an inch / a millimeter / about 1000 angstroms. When you “neck down” a trace you are taking it though a via / narrowing the trace for a short distance / routing the trace in a rat’s nest. A ____ is a conductive hole used to connect two layers on a PCB. In Verilog an @* block is used to create combinational logic / sequential logic / a flip-flop. A DAC can be too large / too slow / non-monotonic if the absolute value of the INL is greater than ½. Randomized search / Dithering / QCA is a common technique used with DACs to reduce the impact of quantization error. 2. Consider the following C function. int add(short w[], int z) // compute the sum of the first z elements of the array w. // print that sum and return the value. { int i,sum=0; for(i=0;i<z;i++) sum+=w[i]; i=printit(sum); // a function which prints the value return(sum+i); } Rewrite the above code in ARM assembly while following the ABI and being reasonably efficient about your use of stack space. You are to assume the short data type is 16-bits printit has the following prototype: [12] int printit(int); 3. Short answer—lab stuff Say you want to build a first-order low-pass RC filter where the half power point or 3db down point is at 100Hz. If the only capacitor you have is 1µF, what value should you use for R? Show your work. [3] What is a virtual timer? When might you wish to use one? [3] List at least two differences between the SPI bus and the I2C bus. [3] List two advantages of using surface mount parts rather than though hole parts. [3] Define the term “DMA”. [3] 4. Error correction (NOTE: You can only get points for parts b if you get a correct answer for part a!) Say that we have 6-bit data packets where the data bits are A, B, C, D, E, F. It has been decided to use 4 parity bits, labeled W, X, Y, Z to allow single-bit correction of the data. The parity bits W-Y are to be encoded as: W=P(A,B,C,F) X=P(A,B,C,D) Y=P(A,C,D,E) Where the function “P()” is a 1 if there are an odd number of 1’s as arguments (so P(0,1,0)=1, while P(1,1)=0). What data bits should be used as arguments to the function P to allow for one bit of correction? Use as few data bits as possible as arguments to P. [4] Z=P( ) Say two bits are corrupted in transmission. Is it possible that all four parity bits will be correct? If so, provide an example, if not explain why not. [4] 5. Design a circuit which takes a 120KHz clock as an input and generates a 10KHz clock with a duty cycle of 1/3rd. You may only use D flip-flops, standard gates (AND, OR, NOT), and a counter. Be sure to carefully label all wires including the inputs and outputs. [7] 6. Answer the following questions using the above figures. Assume Vref=16V and that all converters have a INL of ± ¼ LSB. There may be more than one possible answer (or a range or ranges of possible answers). Provide all possible answers! If 3.4V is put into he ADC and Dout is connected to Din of of DAC#1, what is/are the value(s) that could be found on Vout of the DAC? [3] If 3.6V is put into he ADC and Dout is connected to Din of of DAC#2, what is/are the value(s) that could be found on Vout of the DAC? [3] If you used the same ADC design as a above, an ADC capable of providing 10 bits of output, how many opamps would be required? [3] 7. Using the Viterbi algorithm as described in class, consider the following data being received: Data 0 0 1 1 0 0 1 Parity 0 0 0 0 0 1 0 Show a table/chart similar to the one drawn in class and indicate what data the algorithm indicates was sent. Clearly show your work. [10] 8. Say we have an 8-bit register which controls the status of an array of 8 LEDs. LED[0] connected to the LSB of that register LED[1] to the next least-significant bit etc. such that the LED is on if the corresponding bit in the register is a one. This 8-bit register has been memory mapped to location 0x20040020. Write a C function which takes one integer as an argument and returns an integer. It’s prototype would be: int lights(int num) If the value num is between 0 and 7 the function should toggle (that is change from on to off or off to on) the LED specified by the value num and return a 1. If the value num is out of range, you shouldn’t change the LEDs at all but instead should just return a 0. [7] 9. Say you are designing hardware so that a programmer can use a memory-mapped I/O device at location 0x20040020. If the user writes a value to that location the bottom eight bits that are /written should be placed in a register and driven out to LEDs. If the user reads from that location, the hardware should supply the current value of the register. It doesn’t matter what the device does with other addresses. Complete the following Verilog code so that it achieves the desired task. [10] module ledregwrp(PCLK,PENABLE,PSEL,PRESERN,PWRITE,PREADY,PSLVERR, PWDATA,PRDATA,LEDOUT); input PCLK, PENABLE, PSEL, PRESERN, PWRITE; input [7:0] PWDATA; output [7:0] PRDATA, LEDOUT; output PREADY, PSLVERR; 10. You are working on a design for our SmartFusion which has 5 interrupt sources: A, B, C, D, and E. Recall that the SmartFusion only implements the 5 highest priority bits, the other 3 are ignored. You want the following to be true: A, B and C should be able to preempt all the other interrupts other than each other. A should have the highest priority, B the second highest and C the lowest of the three. D should be able to preempt E. E should have the lowest priority. List all PRIGROUP setting or settings you could use in this case. Assume no two interrupts can be assigned the same priority. Provide your answer in 3-digit binary and explain. [5] Indicate, in 8-bit binary, what priorities you will assign to each interrupt. Let us know which PRIGROUP setting you are using (mainly if you have more than one PRIGROUP listed above). Again, no two interrupts may be assigned the same priority. [5] PRIGROUP=________________________ (3-digit binary) A priority= ________________________ (8-digit binary) B priority= ________________________ (8-digit binary) C priority= ________________________ (8-digit binary) D priority= ________________________ (8-digit binary) E priority= ________________________ (8-digit binary)