0% found this document useful (0 votes)
51 views12 pages

Midterm Exam: ECE 423 W20 Embedded Computer Systems

The document is a 12-page midterm exam for an Embedded Computer Systems course. It contains instructions for the exam, which lasts 75 minutes and is worth 35 marks. The exam consists of 5 questions with multiple parts on topics like periodic scheduling, synchronous dataflows, task graph scheduling, Kahn process networks, and SystemC. It provides spaces for students to write their answers and includes tables, diagrams, and code snippets to aid in answering the questions.

Uploaded by

Jenny
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views12 pages

Midterm Exam: ECE 423 W20 Embedded Computer Systems

The document is a 12-page midterm exam for an Embedded Computer Systems course. It contains instructions for the exam, which lasts 75 minutes and is worth 35 marks. The exam consists of 5 questions with multiple parts on topics like periodic scheduling, synchronous dataflows, task graph scheduling, Kahn process networks, and SystemC. It provides spaces for students to write their answers and includes tables, diagrams, and code snippets to aid in answering the questions.

Uploaded by

Jenny
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Instructor: Rodolfo Pellizzoni Midterm: ECE 423 Winter 2020

ECE 423 W20


Embedded Computer Systems

Midterm Exam
Instructions:

• You can use a calculator. No other aids are permitted.


• Turn off all communication devices. Place all knapsacks, backpacks, and bags at the front
of the examination room or beneath your table.
• There are 5 questions with multiple parts + 1 bonus part.
• The exam period lasts 75 minutes and there are 35 marks (+2 bonus question marks).
Some marks are easier to earn than others. Read the paper carefully and use your time
wisely.
• Print your name and student ID number on the cover page.
• Write your answers directly on the question sheets. You may use either pen or pencil to
answer questions. Answers that are too light to read or smudged will be assigned a
grade of zero.
• If you feel that a question requires clarification, proceed by clearly stating any
reasonable assumptions necessary to complete the question. If your assumptions are
reasonable, they will be taken into account during grading.

First Name: ____________________

Last Name: ____________________

ID Number: ____________________

Signature: ____________________

Date: February 27, 2020 EXAM HAS 12 PAGES Page 1 of 12


Instructor: Rodolfo Pellizzoni Midterm: ECE 423 Winter 2020

DO NOT WRITE ON THIS PAGE. THIS PAGE IS USED TO COMPUTE YOUR MARK.

Question Mark Weight


1a 2
1b 2
2a 4
2b 2
3a 3
3b 3
3c 3
3d 3
3d 2
4a 5
4b 2
5 4
TOTAL 35
Bonus: 4c 2

Date: February 27, 2020 EXAM HAS 12 PAGES Page 2 of 12


Instructor: Rodolfo Pellizzoni Midterm: ECE 423 Winter 2020

1. Periodic Scheduling: consider the following periodic repeating schedule for a task graph. The
schedule contains 5 periods and repeats every 50 time units. The table below shows start and
finish time for each of the 5 periods (the start time of the first task in each period, and the finish
time of the last task in each period).

Period 1 2 3 4 5
Start time 0 10 15 24 42
Finish time 18 30 41 49 62

a. Determine the worst-case makespan for the task graph. [2p]

b. Under the assumption that inputs are periodic, compute again the worst-case makespan
for the task graph. [2p]

Date: February 27, 2020 EXAM HAS 12 PAGES Page 3 of 12


Instructor: Rodolfo Pellizzoni Midterm: ECE 423 Winter 2020

2. Synchronous Dataflows:

a. Prove that the dataflow shown below is consistent, and compute the number of firings in the
minimal periodic schedule. [4p]

Date: February 27, 2020 EXAM HAS 12 PAGES Page 4 of 12


Instructor: Rodolfo Pellizzoni Midterm: ECE 423 Winter 2020

b. Determine the minimal delays on the c -> d edge required to execute the dataflow without
deadlock. Note: there is no need to simulate the dataflow execution; instead, think about the
structure of the dataflow and number of firings. [2p]

Date: February 27, 2020 EXAM HAS 12 PAGES Page 5 of 12


Instructor: Rodolfo Pellizzoni Midterm: ECE 423 Winter 2020

3. Task Graph Scheduling: Consider the following task graph, to be scheduled on two
homogeneous processors. The number in each node denotes the execution time of the task.

a. Compute the Static Levels for the task graph under both forward and backward
scheduling. [3p]

Task A B C D E F G
Forward SL

Backward SL

b. Schedule the task graph using forward static list scheduling. Specify the order in which
tasks are scheduled. Use the timing lines and table below to help you. [3p]

Task Scheduling Order (first to last):

Date: February 27, 2020 EXAM HAS 12 PAGES Page 6 of 12


Instructor: Rodolfo Pellizzoni Midterm: ECE 423 Winter 2020

c. Do the same using backward static list scheduling. [3p]

Task Scheduling Order (first to last):

d. And finally, using backward dynamic. [3p]

Task Scheduling Order (first to last):

e. Is the schedule obtained at either step b), c) or d) optimal (in the sense of minimizing
the makespan for one execution of the task graph)? If yes, prove why. If no, draw an
optimal schedule below. [2p]

Date: February 27, 2020 EXAM HAS 12 PAGES Page 7 of 12


Instructor: Rodolfo Pellizzoni Midterm: ECE 423 Winter 2020

4. Kahn Process Networks: Consider the following operation (convolution of a 2-dimensional


image with a 2x2 filter):

const unsigned int rows = …, cols = …; //number of rows, columns


double inImg[rows][cols];
double outImg[rows-1][cols-1];
double f[2][2];
for (int y = 0; y < rows - 1; y++)
for(int x = 0; x < cols - 1; x++)
outImg[y][x] = inImg[y][x]*f[0][0] + inImg[y+1][x]*f[1][0]
+ inImg[y][x+1]*f[0][1] + inImg[y+1][x+1]*f[1][1];

a. Draw a Kahn process network to efficiently compute the convolution. You can only use the
processes below, but each process that you instantiate can have different values of input
parameters (R, C, k, v, div, M, or none, depending on the process). Note that the Input and
Output processes expect pixels to be provided one row at a time; furthermore, images are
processed one after the other (i.e., after one image is completed, the processes immediately
obtain another one). [5p]

Process Input(R, C): //produce input image


for (;;) {
*img = …; //get new input image Process +: //add two numbers
for (int y = 0; y < R; y++) for (;;) {
for(int x = 0; x < C; x++) send(wait(in1) + wait(in2), out);
send(img[y*C+x], out); }
}
Process *(k): //multiply by constant
Process Output(R, C): //consume output image for (;;) {
for (;;) {
send(wait(in)*k, out);
*img = …; //get new output image
for (int y = 0; y < R; y++) }
for(int x = 0; x < C; x++)
img[y*C+x] = wait(in); Process Drop(v, div, M): //drop
} count = 0;
for (;;) {
Process D: //duplicate a = wait(in);
for (;;) { if (floor(count/div) != v) send(a, out);
a = wait(in); count = (count+1) % M;
send(a, out1); }
send(a, out2);
}

Date: February 27, 2020 EXAM HAS 12 PAGES Page 8 of 12


Instructor: Rodolfo Pellizzoni Midterm: ECE 423 Winter 2020

Date: February 27, 2020 EXAM HAS 12 PAGES Page 9 of 12


Instructor: Rodolfo Pellizzoni Midterm: ECE 423 Winter 2020

b. Assuming the same way to provide inputs and outputs, could you implement the same
computation using a synchronous dataflow instead? Explain why. [2p]

c. Bonus Question: Assume that instead of a 2-dimensional image, you need to convolve a 3-
dimensional image (with dimension sizes R, C, W) by a 2x2x2 filter. Briefly explain how you
would modify the Kahn process network (you don’t need to draw the whole network) and
specify the parameters of the Drop processes you would need to use. [2p]

Date: February 27, 2020 EXAM HAS 12 PAGES Page 10 of 12


Instructor: Rodolfo Pellizzoni Midterm: ECE 423 Winter 2020

5. SystemC: Consider the implementation of a TDMA arbiter in SystemC. Remember that a


TDMA arbiter periodically assigns each requestor a slot of equal size (for example, for a slot of
size 5 with 10 requestors, requestor#0 is assigned time 0 to 5; requestor#1 time 5 to 10; and so
on until requestor#0 is again assigned time 50 to 55). The arbiter is implemented by the
following class:

class TDMA_arbiter
{
private:
int number; //number of requestors
sc_time size; //size of the slot; sc_time is SystemC’s time type

public:
TDMA_arbiter(int n, sc_time s) : number(n), size(s) {}

sc_time request(int id);


};

and invoked by calling time = request(id); within a SystemC thread, where id is the
numeric id of the requestor (between 0 and number – 1) making the request. If the request is
made during a slot assigned to that requestor, the function should return the amount of time
(greater than zero) left in the slot; otherwise, it should block the requestor until its next slot,
and return the slot size. Write the code of the request function. Note: the sc_time_stamp()
function can be used to obtain the current simulation time. [4p]

int request(int id)


{

Date: February 27, 2020 EXAM HAS 12 PAGES Page 11 of 12


Instructor: Rodolfo Pellizzoni Midterm: ECE 423 Winter 2020

Date: February 27, 2020 EXAM HAS 12 PAGES Page 12 of 12

You might also like