Final Examination
• Final examination is take-home and open-book. You may use any printed or electronic resources to complete
this exam.
• There are 5 questions, each is worth 20 marks. Answer every question.
• This exam paper has 4 pages.
• You should not collaborate with other students in this class or ask for help from other people.
• You should upload a digital copy of your completed exam paper to OWL. If OWL fails for some reason, you
can email it to me (
• It is each student’s responsibility to ensure they can submit a complete and legible copy of their completed
exam paper within the time limit provided.
• Late submission is accepted, with a penalty of 25% per hour after the deadline.
• The exam is available on OWL from 9:00 AM on Friday, April 17th until 9:00 PM on Monday, April 20th.
• Once you access the exam paper, you have 6 hours to complete the examination.
• If you experience serious technical difficulties, you need to let me know as soon as possible, but there is no
guarantee accommodations can, or will, be made.
• If you have questions during the exam, you should send them to me by email. I will do my best to answer
them quickly, but I cannot make any guarantees (I can’t be instantly available for the entire period the
exam is open). If I do not answer your question quickly enough, just use your judgment. Always state
your assumptions in your answer.
The exam is available between
9:00 AM on Friday, April 17th until 9:00 PM on
Monday, April 20th
Submit your exam on OWL 6 hours after accessing it.
Exam must be submitted before 9:00 PM Monday
1 Short Answer Questions
Answer the following question in paragraph form.
(a). Describe the differences between a programmable logic controller (PLC), an embedded system, and a
computer. [5 marks]
(b). Explain the differences between the following lines of assembly code. [5 marks]
str r1, [r0], #4
str r1, [r0, #4]
str r1, [r0, #4]!
(c). Describe the difference between a homogeneous and a heterogeneous wireless sensor network (WSN). [5
(d). Implement the following in one rung of relay ladder logic (RLL). Assume A, B, C, and D are inputs that are
normally open. [5 marks]
(A and (B or C)) or ((A and B) or D)
2 Memory Mapping
Consider an microprocessor with 64 k of memory space and a 8 bit cell size. We need to design a memory map
with 192 kb of ROM and 128 kb of RAM. Due to a supply shortage (probably related to the pandemic?), we have
only the following chips available:
• One (1) 8 k×8 RAM chip, priced at $4.50 each.
• Two (2) 8 k×4 RAM chips, priced at $2.00 each.
• Six (3) 4 k×8 RAM chips, priced at $3.00 each.
• Two (2) 8 k×8 ROM chips, priced at $2.50 each.
• Ten (10) 4 k×8 ROM chips, priced at $1.50 each.
Note that despite the shortage, there are still significantly more chips than needed.
(a). [8 marks] Design a suitable memory map for this system. Show the boundaries (in terms of the hexadecimal
memory address) of memory covered by each individual chip. Your drawing does not need to be to
scale — if you are writing your exam on a computer it may be convenient to use a table or a spreadsheet for
drawing the memory map.
(b). [8 marks] Determine the minterms for accessing each individual memory chip required by the microcontroller’s
control logic.
(c). [4 marks] In solving this problem, you made decisions about which chips to use, and where in memory
space to arrange the RAM and ROM. Briefly explain your choices in regards to typical design considerations
like efficiency, simplicity, cost effectiveness, robustness, user friendliness, etc. (Keep it short, you can
use point form if you wish.)
3 Assembly Language
Consider an ARM Cortex®A9 on a DE1 SoC.
• Assume we have a sequence of 100 numbers already stored in memory.
• The numbers are 10 bits or less, but they are all stored as 32 bit words (i.e., with lots of leading zeros).
• The numbers are stored starting at address 0x00001000. This means that the first number is at 0x00001000,
the second is at 0x00001004, etc.
(a). Write a program in ARMv7 assembly language to read these values from memory and display them in
binary on the set of 10 LEDs memory mapped to 0xFF200000. You do not need to worry about timing how
long the numbers are displayed. [10 marks]
(b). Explain how your program works to someone who doesn’t know how to read assembly. You may do this
by adding comments to the code, using a flow chart, or writing pseudocode or a paragraph of text. Your
explanation should include a description of what is stored in the registers at various points in the program
(you may use a table for this). If you can’t figure out how to actually write the assembly language code for
part (a), then use this section to explain how your program should work. [10 marks]
4 Wireless Sensor Networks
The global pandemic has subsided, and the world breathes a sigh of relief. But Western students returning to
campus realize the nightmare is not yet over: the campus is overrun with hordes of ferocious Canada geese. A
desperate battle to reclaim the university is fought — and lost. Most students and faculty have fled, the few that
remain control only a portion of the campus around the engineering buildings.
The situation is grim, and morale is low. Students are having difficulty balancing a full load of engineering
courses with constant battles against deadly bands of Canada geese. To help the situation, you propose to build
a WSN to keep track of the geese. The sensor network area is shown in the attached map, the drawing is to scale.
Only the area inside the heavy dotted line needs to be monitored — outside the boundary the geese have full
control. It may not be possible to monitor the entire area, so the priorities are:
• A well-monitored path (or paths) between the student residences (Ontario Hall, Perth Hall, Essex Hall,
and London Hall) and the engineering buildings.
• Monitoring the bridge across the river for supply drops and reinforcements.
• A well-monitored path to nursing and health science for medical treatment.
You may assume that all areas inside buildings are always geese free.
(a). Design a WSN to monitor for geese and fulfill the above priorities. You have access to the following types of
Name Cost Sensing Radius Communication Radius Limitations
Node A $125 100 m 150 m Requires external power
Node B $75 50 m 100 m None
Node C $25 50 m 50 m Requires hub
Hub $200 none 200 m Requires external power
Because they require power, type A nodes and hubs must be mounted on the roof of a building. Type C
nodes have no storage, they only work if they can directly communicate with a hub. You have a budget of
$2000. This is a public project, so naturally you can overspend the budget if necessary.
Draw your WSN as accurately as possible on the provided map. Copies of this map in PNG, PDF, and SVG
formats are included as separate files. You may use any one of these to draw the WSN. I do recommend using a vector
graphics program to digitally draw the WSN, but it is ok to use other methods if you want, including printing it out
and drawing by hand. [5 marks]
(b). Write a paragraph (or two) justifying your design choices in the WSN. You should explain the network
topology and level of homogeneity in the WSN, and discuss reliability, ease of deployment, cost, etc. [10
(c). Use your best judgment to estimate the path of maximal breach distance that a goose might follow to go
from one side of the sensor area to the other. You do not need to make any calculations here, but draw the
path on the provided map (you may draw it on the WSN map yu completed in (a), or use an extra copy of
the map). Discuss in writing whether or not you think your WSN has a low maximal breach distance, and
whether or not the maximal breach distance is an important parameter for this type of WSN. [5 marks]
5 Relay Ladder Logic
You have been hired to program an airport X-ray baggage scanner using PLCs. Here are the design requirements:
• The baggage conveyor belt can move forwards and backwards, and can be stopped. You need to include
both the state of the conveyor belt, and the forwards, backwards, and stop buttons.
• The X-ray scanner can be on or off. Again, you need to include the state of the scanner as well as the on and
off buttons.
• The X-ray scanner can only be turned on when the belt is moving forwards.
(a). Implement this design using relay ladder logic. Either use the notation discussed in class, or provide a
description of your notation. Arbitrary nesting is supported, but vertical contacts are not. [15 marks]
(b). Discuss whether a PLC, an embedded system, or a full computer is most appropriate for operating an
airport X-ray baggage scanner. [5 marks]