Final Exam Winter 2013

advertisement
EECS 373 Final Exam
Winter 2013
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
7
8
12
13
14
Total
/4
/9
/12
/16
/8
/9
/7
/10
/15
/10
/100
NOTES:






There are 14 pages including this one.
Closed book, closed notes.
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.
Page 1 of 14
1. Multiple choice. Circle the correct option. [4 points, -1 per wrong or blank answer, minimum 0]
a) Body area networks (BANs) tend to use less power to transmit the same amount of data when
compared to ZigBee or most other wireless standards. This is because:
 They can use the body as an antenna
 They tend to have considerably shorter range
 They assume a lower noise floor
 They use fuel cells
b) The Controller Area Network (CAN bus) can be difficult to work with. Perhaps the biggest
reason is that
 It uses low-voltage differential signaling so requires a special transceiver.
 It uses an extremely high-speed clock to avoid noise and thus requires expensive
equipment to observe the bus (with a scope or logic analyzer).
 Coupled fields cause interference with other devices, especially motors.
 Because CAN is commonly used in vehicles (cars, planes etc.) it is highly shielded from
outside noise and is thus difficult to observe.
c) One problem with Flash memory is that it can wear out. One helpful technique to address this
problem is called “wear leveling”. The idea of wear leveling is:
 to refresh each block of memory so that it doesn’t lose its data after too many reads.
 to write data only in large chunks so as to minimize the number of writes.
 to move commonly written data around to balance out the wear.
 to read data in large chunks so as to minimize the number of reads.
d)
An H-bridge is useful when working with DC motor for all except the following reasons
 It makes it easy to use a low-current signal to control a high-current DC motor.
 It makes it easy to have a DC motor go into reverse or break in addition to going
forward.
 It allows for flexible control of a DC motor with a single input to the H-bridge
 It makes it easy to use a low-voltage signal to control a high-voltage DC motor.
e) HDMI and VGA both typically:
 Use digital values to control the amount of Red, Green and Blue of a given pixel.
 Use analog values to control the amount of Red, Green and Blue of a given pixel.
 Provide pixel values ordered over time from left to right and then top to bottom.
 Provide a mechanism for changing monitor settings.
Page 2 of 14
2. True or false. Circle the letter in front of each statement if it is true, put an “X” through the letter if
it is false. [4 points, -1 per wrong or blank answer, minimum 0]
a. The Microsoft Kinect actively sends out a dotted pattern of IR light and uses the shift of
those dots to determine depth.
b. Compared to Wi-Fi, Zigbee has a shorter range and uses less power, but has a higher
bandwidth.
c. USB 2.0, at its highest speed, is within 50% of the bandwidth of the fastest standard
Ethernet currently on the market.
d. Ultrasonic sensors work less well with soft targets.
e. PID is a feedback control algorithm that can be used when you have a sensor and an
actuator.
f. One serious issue today is that modern computer chips tend to be more vulnerable to
radiation than older ones.
g. Parallel computers are becoming more common in part because they can achieve a desired
amount of processing power (i.e. MIPS) while using less total power.
3. Assume that memory is initialized to zero and the following code executes:
BASE_EMC = 0x0000400;
uint32_t *x = (uint32_t*)BASE_EMC;
*(x-1) = 0x89abcdef;
*x = 0x11223344;
Indicate the value found in each memory location listed below. You are to assume the processor is
in little-endian mode. You are to fill in each entry. [5 points]
Address Value
0x3FC
0x3FD
0x3FE
0x3FF
0x400
0x401
0x402
0x403
0x404
0x405
0x406
0x407
Page 3 of 14
4. Convert the following C code into ABI-compliant ARM assembly. Points will be deducted for
particularly inefficient implementations. You should assume the rest of the program is also ABI
compliant. [12 points]
#define DEV1 0x40000100
#define DEV2 0x40000000
int bob(int);
int test_and_set(int b)
{
int a;
a=*(int *)DEV1;
b=bob(a);
*(int*) DEV2=a+b;
return(a-b);
}
Page 4 of 14
5. Short answer. Each answer must be 20 words or less. [16 points]
a. Explain why it is often more beneficial to place four identical capacitors on the power
distribution network (from power to ground) than one capacitor which has four times the
capacitance. [4]
b. Describe the primary advantage of the Rate Monotonic scheduling algorithm over the
Earliest Deadline First scheduling algorithm. [4]
c. The I2C and CAN wires are “open-drain” and thus require pull-up resistors. Explain why I2C
and CAN use this scheme while SPI does not. [4]
d. It is not unusual to see processors marketed for their ability to do nothing (no computation)
with very little power utilization. Why is that such a potentially important thing? [4]
Page 5 of 14
6. Answer the following question using the above figures. Assume Vref=8V and that all converters
have an INL of ± ¼ LSB. There may be more than one possible answer (or a range or ranges of
possible answers). Provide all possible answers! [8 points]
a. If 5 V is put into the 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? [2]
b. If 4.2 V is put into the 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? [2]
c. If “01” is put into DAC#2 and Vout is placed into the ADC’s Vin, what value(s) could you find
at the ADC’s Dout? [2]
d. If “10” is put into DAC#1 and Vout is placed into the ADC’s Vin, what value(s) could you find
at the ADC’s Dout? [2]
Page 6 of 14
7. Consider an embedded application which consists of 3 tasks named A, B, and C. Each task is CPU
bound (that is, there is no I/O or memory operations which take significant time to execute) and
periodic. Each task must complete before the next instance of the task is ready to start. These tasks
have the following properties and requirements. You are to assume there is no overhead of any
type (including scheduling overhead) and that this machine runs any given instruction in exactly the
same amount of time. [9 points]
Task
A
B
C
Maximum number instructions
executed by a single instance of the task
5 Million
20 Million
20 Million
How often the
task needs to run
100ms
200ms
500ms
a) What is the lowest MIPS (millions of instructions per second) processor that would be able to
schedule these tasks using EDF? Show your work. [3]
b) You are choosing between 4 different processors. Which of these would be the lowest MIPS
processor which would be able to RM schedule these tasks? Clearly explain and show your work.
[6]
(1) 150 MIPS
(2) 200 MIPS
(3) 250 MIPS
(4) 300 MIPS
Page 7 of 14
8. Design a circuit which takes a 200 KHz clock as an input and generates a 20 KHz clock with a
duty cycle of 20%. 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. You are to do
this by drawing the elements, not using Verilog. [7]
Page 8 of 14
Thermostat Design
Your task is to upgrade an older model digital thermostat to use a SmartFusion device. You will verify
the design with an evaluation board like the one in lab. The thermostat is
used to regulate temperature in large rooms such as auditoriums.
Because the temperature may not be evenly distributed through large
rooms, this thermostat uses 4 temperature sensors distributed through
the room.
You will likely find it helpful to read the rest of the exam before solving any of the following parts.
Thermostat Analog to Digital Converter (ADC)
The thermostat uses an 8-bit ADC to measure the voltages from the temperature sensors and an analog
multiplexor to select one of the 4 analog voltages coming from the temperature sensors. The analog
multiplexor selects one of the analog inputs (A0 – A3) by selecting with S1 and S0.
The APB clock is running at 100MHz and our ADC needs a 25MHz clock.
<continued on next page>
Page 9 of 14
To start a conversion, a start signal must be applied. The ADC conversion will begin when the ADC
observes the start signal high on a clk edge when it had observed it low on the previous clk edge (see
the figure below). The ADC takes several clk cycles to complete the conversion for the analog signal
(potentially hundreds).
When the conversion is complete the ready signal will go high and stay high until another start signal is
applied.
Again, the APB clock is running at 100MHz and our ADC needs a 25MHz clock.
Page 10 of 14
Interface to the APB bus
The kit has the following APB3 bus interface. The signal names are shown in bold. The ABP3 bus signals
follow APB3 timing and protocol. Read and write cycles are provided on the next page. PSEL is
configured to be “1” when memory locations 0x40050000-0x40050007 are accessed.
SmartFusion
APB Write Data: PWDATA (32 bits)
APB Read Data: PRDATA (32 bits)
APB Peripheral Write: PWRITE
Peripheral Address: PADDR (8 bits)
Peripheral Select: PSEL
Bus Clock: PCLK
Bus Ready: PREADY
APB Timing diagram
The following diagrams are provided as a reminder of the APB timing with no wait states.
ABP3 Read Timing
ABP3 Write Timing
Page 11 of 14
Part 1: ADC APB3 Bus Interface (10 points)
Provide a hardware interface between the SmartFusion APB3 bus and the ADC to allow SmartFusion to
read the converted data and the ready signal from the ADC. Assume the read address is the word
address 0x40050000 (and only that address). You may use standard gates such as ANDs, ORs, NOTs,
TRISTATES and DFFs (as well as standard bubbles). Be sure to show all connections. You may use GND
and VCC to indicate a logical 0 and 1 respectively. You may not use Boolean or Verilog expressions. You
will lose points for having unneeded logic. Note: we have put all the APB connections on the left and all
the ADC connections on the right. This means inputs and outputs are intermixed, be sure you are driving
all outputs!
PWDATA[31:0]
adc[7:0]
PRDATA[31:0]
ready
PWRITE
PENABLE
PSEL
PADDR[7:0]
PCLK
PREADY
Page 12 of 14
Part 2: MUX APB3 Bus Interface (15 points)
Provide a hardware interface between the SmartFusion APB3 bus and the analog MUX such that the
SMART fusion can write the select lines S0 and S1 and can also read to find out which analog input is
currently selected. The ADC conversion should also be started when you write this location (but not
when you read it). Assume the write address is the word address at 0x40050004 (and only that
address). You may use standard gates such as ANDs, ORs, NOTs, TRISTATES, and DFFs (with enables), as
well as standard bubbles. Be sure to show all connections. You may use GND and VCC to indicate a
logical 0 and 1 respectively. You may not use Boolean or Verilog expressions. You will lose points for
having unneeded logic. Note: we have put all the APB connections on the left and all the ADC
connections on the right. This means inputs and outputs are intermixed, be sure you are driving all
outputs!
PWDATA[31:0]
PRDATA[31:0]
S0
S1
PWRITE
PENABLE
PSEL
start
PADDR[7:0]
clk
PCLK
PREADY
Page 13 of 14
Part 3: Thermostat Device Driver (10 points)
Write the C function get_temperature() which will read an ADC channel passed to it as an
argument and return the value scaled to degrees Centigrade. To convert from the ADC value to
Centigrade, you will call the function convert(). You do not have to write convert().
Function Prototypes:
(int temperature) get_temperature (int channel)
(int cent)convert (int voltage)
Providing comments may improve your chance for partial credit.
Page 14 of 14
Download