Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
Sample ECE 568 Exam
Q1. Warm up Questions (10 points) Q1(a). (1 point) Weak pull-up resistors in GPIO ports are used when the GPIO port is configured as an output. True or False? Q1(b). (1 point) For an 8-bit timer that is driven by a 4 MHz input clock, the maximum time that can be measured is 64 microseconds, assuming no scaling is done. True or False? Q1(c). (2 points) Assume that bit 0 of a GPIO port (say, port C) is already configured as an output pin. The purpose of the following C code is to clear bit 0 (i.e., set it to logic low) without affecting any of the other bits of port C. PORTC &= ???; What numerical value should you use in the ??? position in the above line of code? Give your answer as an unsigned 8-bit decimal integer between 0 and 255. Q1(d). (2 points) Assume that bit 7 of a GPIO port (say, port C) is already configured as an output pin. The purpose of the following C code is to set bit 7 to logic high without affecting any of the other bits of port C. PORTC ??? 128; Which Python operator should you use in the ??? position in the above program? Q1(e). (2 points) In at most 2 sentences, describe what an interrupt vector is? Q1(f). (2 points) In at most 2 sentences, describe the main difference between the von Neumann architecture and the Harvard architecture? Q2. Serial Communication (6 points) Q2(a). (2 points) State two disadvantages of synchronous serial communication compared to asynchronous communication. Q2(c). (4 points) In an asynchronous serial communication mechanism, explain how a receiver can synchronize with an incoming data signal? Q3. Simple Real-time Scheduling (10 points) Q3(a). (5 points): Are the following tasks schedulable (i.e., all task deadlines are met) using a static-priority based preemptive scheduling algorithm? Assume that there are no overheads for context switching and no shared resources that can cause blocking. If so, indicate the relative priorities that you would use for each task. Justify your answer. Task Time Period (ms) Worst-case Execution Time (ms) Deadline (ms) A 50 12 50 B 40 10 40 C 30 10 30 Q3(b). (5 points): Are the above tasks schedulable (i.e., all task deadlines are met) using a dynamic-priority based preemptive scheduling algorithm? Assume that there are no overheads for context switching and no shared resources that can cause blocking. If so, indicate your priority assignment policy. Justify your answer. Q5. Real-Time Scheduling with Complex Considerations (14 points): A real-time operating system that uses preemptive fixed-priority scheduling, has to contend with the following task-set as its workload. Each task is specified as the 3-tuple (time period, worst-case execution time, deadline). Task set: {(100, 20, 100), (150, 30, 150), (210, 105, 210), (400, 25, 400)} In addition to the above tasks, there is an interrupt that occurs occasionally in the system. Every time the interrupt occurs, the corresponding ISR has to be executed and this takes 5 time units. Interrupts can occur at anytime with the constraint that the minimum inter-arrival time between successive interrupts is 150 time units (i.e., once an interrupt occurs, the next one will not occur within the next 150 time units). Q5(a). Is the above task-set schedulable? Rigorously justify your answer. Q5(b). Now assume that you also have the ability to speed up the CPU or slow it down. However, you can only set the CPU speed once when the system starts (i.e., you cannot change it while the system runs). Also assume that as the speed of the CPU scales, the execution time of a task scales down by the same factor (for example, if the speed doubles, the execution time is halved). If you found (in part (a) above) that the task set was schedulable, calculate the largest factor by which we can slow down the CPU while maintaining the schedulability of the task set. Likewise, if the task set was not schedulable, calculate by what minimum factor we must speed up the CPU so that the task set becomes schedulable. Q6. (10 points): You are part of the design team of a battery-powered embedded system that consists only of a CPU chip and a memory (RAM) chip. The system has some power management features to help extend battery life. First, it supports a zero-power shutdown mode into which the entire system can be placed. Assume that the overheads of shutting down and waking up the system are negligible. Second, the CPU also provides a choice of two different clock frequency and supply voltage settings that it can be set to. Setting 1 uses a clock frequency of 1 MHz and a supply voltage of 2 Volts. Setting 2 uses a clock frequency of 0.5 MHz and a supply voltage of 1 Volt. The power consumption of the CPU as a function of the clock frequency and supply voltage is given by the following equations: When the system is in active mode When the system is in shutdown mode PCPU = (50 × V2 × f) + (100 × V) PCPU = 0 PMEM = 200 PMEM = 0 where PCPU is the power consumed by the CPU (expressed in mW), V is the supply voltage (expressed in Volts), f is the CPU clock frequency (expressed in MHz) and PMEM is the power consumed by the memory chip (expressed in mW). Note that the memory chip requires a supply voltage of 2 Volts and cannot operate at any other voltage. Every 60 seconds, the system wakes up from shutdown mode into active mode and executes an application, say A. After the application finishes executing, the system goes back into shutdown mode. Application A takes 10 seconds to execute if the CPU runs at a frequency of 1 MHz and 20 seconds to execute if the CPU runs at a frequency of 0.5 MHz, both of which are acceptable from a performance perspective. Your team is debating how to minimize the total energy consumed by the embedded system. One of your colleagues remembers his embedded systems professor telling him that using a lower clock frequency and a lower supply voltage leads to lower power consumption. Therefore, he proposes that the CPU should be operated at a frequency of 0.5 MHz and supply voltage of 1 Volt in order to minimize the energy consumed by the system. Do you agree with his proposal? If so, why? If you do not agree, why not? Clearly justify your answer.