ECEn 424 Homework Set #3

Upload a pdf file containing your solutions to the problems below to Learning Suite before 11:00pm on the assigned date.

  1. Problem 3.62
  2. Problem 3.63
  3. Problem 3.65
    Add this as part D of problem 3.65: Write a C code version of transpose() that makes use of the optimizations that are found in the compiler-generated loop. Use the parameter M in your code rather than numeric constants.
  4. Problem 3.70

Clarifications

Problem 3.62: You should compile the C code you come up with for switch3() and try to match the assembly code in the book using various optimization flags for the compiler. Your submission should include your C source file for the function, the resulting assembly code, the compiler options you used for gcc, and the machine/OS you ran it on. (As previously noted, gcc can create quite different code for different machines, even if both use x86 processors.)

Problem 3.63: You should compile the C code for switch_prob() and include the assembly code that resulted. Try a number of compiler options to come as close as you can to the assembly language in the book. Your submission should include your C source file for the function, the resulting assembly code, the compiler options you used for gcc, and the machine you ran it on. (One sees very different code generated by gcc under linux vs. gcc under MacOS X for this code. Keep this in mind if you are thinking about completing the assignment using a Mac.) You can get the assembly code to annotate here if desired.

Problem 3.65: The C code you are asked to write should embody the optimizations you see in the assembly code in the book. As in the previous problems, you should compile the C code you create (with various compiler options) and try to match the assembly code in the book for the inner loop. (There is no guarantee that you can match that code exactly, since gcc changes over time, but see how close you can come.) In your submission, include your C file, the resulting assembly, and the compiler options you used to produce the assembly code. You can get skeleton code to test your optimized solution here. You can also get the assembly code to annotate here if desired.

Problem 3.70: No programming is required; no source code is required in your submission.


Last updated 16 January 2018