The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 2 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
1. transform the following C program P1 (see page 2) into another C program P2 that contains only instructions of the form:
(a) "A = B op C", where A,B,C are simple variables or constants, and "op" is +,-,*, etc. (signifying ADD, SUB, MULT, etc.)
(b) "if(A op B)", where "op" is ==,>,>=, etc (signifying COMPARE)
(c) "goto Label" (signifying JUMP)
(d) "A = B", where A is a simple variable and B is an array variable (signifying LOAD), or A is an array variable and B is a simple variable (signifying STORE)
(e) "scanf()", "printf()" with only one argument (signifying LOAD and STORE, respectively).
to enforce the above, program P2 can contain additional variables that are to be named TMP1, TMP2, TMP3, etc. (these along with all other simple variables are assumed to be in registers) the program is allowed to contain lables.
Â
2. introduce instrumentation code into program P2 to count the number of executions ICi of each type of instruction i,as well as the total number IC of all executed instructions, (note that LOAD and STORE correspond to two C forms as given above).
Â
3. Execute program P2 for input values d=4,6,7 and print out an analytical summary with the ICi and ICi/IC values for each instruction under each input case.
Â