Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. Consider the program given below: 1 void testFn (int *x, int flag) while (flag != 1) { flag = 1; *x = flag; 6

image text in transcribed

2. Consider the program given below: 1 void testFn (int *x, int flag) while (flag != 1) { flag = 1; *x = flag; 6 if (*x > 0) *x += 2; In answering the questions below, assume that x is not NULL. (a) Draw the control-flow graph of this program. Identify the basic blocks with unique IDs starting with 1. Lee & Seshia, Introduction to Embedded Systems 455 EXERCISES Note that we have added a dummy source node, numbered 0, to represent the entry to the function. For convenience, we have also introduced a dummy sink node, although this is not strictly required (b) Is there a bound on the number of iterations of the while loop? Justify your (c) How many total paths does this program have? How many of them are feasi (d) Write down the system of flow constraints, including any logical flow con- (e) Consider running this program uninterrupted on a platform with a data cache. answer ble, and why? straints, for the control-flow graph of this program Assume that the data pointed to by x is not present in the cache at the start of this function. For each read/write access to x, argue whether it will be a cache hit or miss Now, assume that x is present in the cache at the start of this function. Iden- tify the basic blocks whose execution time will be impacted by this modified assumption

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How To Make A Database In Historical Studies

Authors: Tiago Luis Gil

1st Edition

3030782409, 978-3030782405

More Books

Students also viewed these Databases questions

Question

What are some of the possible scenes from our future?

Answered: 1 week ago

Question

1. What are your creative strengths?

Answered: 1 week ago