EECS 373 Final Exam Winter 2009 Name: ____________________________________ unique name: _______________ Sign the honor code: I have neither given nor received aid on this exam nor observed anyone else doing so. ___________________________________ Scores: Page# Points 2 3 4 5 6 /10 /12 /7 /12 /9 Design Part 1 Part 2 Part 3 Total /10 /30 /10 /100 NOTES: Open White book and EABI only. 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/13 1. Fill-in-the-blank [10 points, -1 per wrong or blank answer] a. 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. b. An ideal 8-bit analog to digital converter that has a Vref of 16V has a quantization error of ______________ volts. c. 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 “0101” is _________V to __________ V. d. When a wire is called “open collector” (as the data line is in the N64 controller) that wire can be said to be a wired OR / AND / XOR/Adder and should never be explicitly driven high (only low and high-Z as a pull-up resistor will take care of driving that wire high). e. You’d expect to pay about $5 / $50 / $500 / $5000 / $50,000 to get one 10 square inch, two-layer, PCB board manufactured (just the board and including shipping etc., 10 days from order to arrival). f. PIC processors are often called “microcontrollers” because they are used to control small things / they have a number of components beyond just the micro processor / they are small processors / the term “nanocontroller” is a trademark of Atmel. g. Delta-Sigma converters are a type of ADC / Matlab application / voltage converter / text-to-speech device. h. When using a PowerPC823 bus running at 25MHz, the fastest you could read data from memory is __________________ bytes/sec without burst transactions and __________________ bytes/sec with burst transactions. i. The decimal range of values possible for the immediate of an “oris” instruction is ____________ to _____________, The range of values for the immediate of an “addi” instruction is ____________ to _____________. 2/13 2. Error correction (NOTE: You can only get points for parts b if you get a correct answer for part a!) 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( ) b. 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] 3. Name two common embedded-system design constraints other than cost not shared with general-purpose computers. For each constraint, give an example of a system for which that constraint is likely the most critical one. [4] 3/13 4. Design a circuit which takes a 90KHz 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] 4/13 6. Consider the following C function. int add(int 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]; printit(sum); // a function which prints the value return(sum); } Rewrite the above code in PowerPC assembly while following the ABI and being reasonably efficient about your use of stack space. You can assume that printit has the following prototype: [12] void printit(int). 5/13 7. Short answer. Each question must be answered in 10 words or less. [9 points, 3 each] a. If a converter is non-monotonic, what does this imply about its integral non-linearity? b. If multiple devices generate interrupts simultaneously on a system with non-vectored interrupts, what determines which device will get serviced first? c. Define the term “DMA” 6/13 Design problem: Under Pressure [50 points] The pressure you heart asserts on your circulation system during the pumping and relaxing phases is commonly known as your blood pressure. The measurement of the pressure during these two phases is obtained indirectly by inflating a cuff around the upper arm until blood flow is essentially stopped to the lower arm. The sound of the blood flowing back into the arm is monitored as the cuff is deflated. While the sound is above a certain threshold the highest and lowest pressures detected are the pumping and relaxing pressures respectively. We wish to automate the measurement on a version of the lab kit that has two ADC0808 converters. A pressure sensor is connected one ADC and a sound sensor to other. Pressure Sensor Channel 0 ADC0 FPGA data Processor address Sound Sensor Channel 0 ADC1 control 7/13 Part 1: Sampling [10 points] Assume that the ADCs perform a conversion in 0.1ms and we wish to sample every millisecond. We will use the general purpose timer to interrupt every millisecond and read the both ADCs at that time. Assuming a system clock of 50 MHz, what values are required to provide a 1 ms interrupt for the following GPT registers? Use “DC” for don’t care or does not matter and provide answers in binary unless otherwise specified. Timer Mode Register (TMR1) PS (provide this answer in DECIMAL!!!!) CE OM ORI FRR ICLK GE Timer Reference Register (provide answer in DECIMAL!!!!) 8/13 Part 2: Measuring the High and Low Pressure Points As discussed in lab, it is possible to read the ADC and initiate a new conversion during each sample interrupt. Look at the graph and carefully consider under what conditions the high and low pressure points can be measured. Remember, since you are using 2 ADCs, both pressure and sound measurements are available on each sample interrupt. Storing the values: The high (pumping) and low (relaxed) pressure values are to be written in two global variables: high_pressure: .half,0 # half is a 16 bit value low_pressure: .half, 0 # half is a 16 bit value Sound Detection Threshold: The sound threshold is one that is above the value 10 decimal. Pressure Conversion Function: The pressure values must be converted to mmHg before storing to the global variables. To do this you will call a C function. You DO NOT have to write this C function! The function will be passed an unsigned char and return an unsigned short (16 bits). The function prototype is: unsigned short convert_pressure(unsigned char x); Assumptions: Assume there is enough space to write the entire routine at 0x500. There are no other interrupts in the system. Assume all necessary initialization has taken place. ADC0 conversion and mux select registers are at 0x2900000 and are byte addressable. ADC1 conversion and mux select registers are at 0x2900004 and are byte addressable. Assume that the PPC’s data bus D[24:31] are mapped to the ADC’s data bus. o You may ignore endian issues that you had in lab. 9/13 Part 2a: Interrupt Routine Prolog and Epilog [10 points] Write the prolog and epilog for your interrupt routine. This should include all stack frame maintenance, register storage and recovery. You will not be penalized for inefficient stack frame or register usage. Provide comments and /or diagram stack usage for improved chance at partial credit. Prolog Epilog 10/13 Part 2b: Interrupt Body or Application Specific Function [18 points] Write the function necessary to determine and store the high(pumping) and low (relaxed) pressure values in mmHG. High-level comments or descriptions will help to determine partial credit. 11/13 Part 3: Mux Select Register Timing [12 points] Complete the following timing diagram to write the MUX SELECT REG of one of the ADCs. Provide a minimum wait state solution based on the following criteria: Bus Clk: 25 MHz MUX SELECT REG setup time: 100ns MUX SELECT REG hold time: 30ns ALE/START minimum pulse width: 40ns The data path and control are provided below for your convenience. You are to assume that the data from the PowerPC is valid on the falling edge after TS is sampled asserted (as done in lab). 12/13 Complete the timing for all signals. How many wait states did you use?___________ How much analog mux select setup time did you provide?________________ 13/13