Links: [Course Home] [Schedule] [Resources] [Study Guide] [Moodle]
Due Sunday, September 24 at 5:00 PM. No late submissions accepted. Solutions will be posted to Moodle by Monday at 2 PM. This assignment is worth 200 points.
Complete the following problems. In order to receive credit, you must show enough work to make it clear how you arrived at your answer. If applicable, you may write programs to solve these problems; in that case, include your source code and program output in your writeup.
You should submit your assignment as a single PDF via Moodle. It is OK to submit a PDF consisting of photos of handwritten pages, as long as your work is clearly legible and the lighting is reasonable. An app like Genius Scan can help with this. Corrupted or unreadable files will not receive any credit, and submissions in formats other than PDF may lose points.
You may work in groups of up to three students. Please refer to the course collaboration policy.
Submitting the assignment: Please have just one group member submit the assignment, and put all group members' names in the submitted document. Because Moodle has no idea who your group members are, the assignment will show up as missing/unsubmitted for the other group members until it's graded. This is annoying but harmless.
Read this article:
A PDF is also posted to Moodle.
Yes, actually read it. It is the most painless (least painful?) distillation of a lot of helpful background information about processor fabrication and the processor industry. The perspective you gain from it will pay off in this class.
Refer to (but don't read all of!) this article:
Read only the captions under the figures. Pick one figure that illustrates something about latency, and one that illustrates something about throughput. For each graph, explain:
Intel multicore processors have a feature called Turbo Boost, in which some of the cores can run faster than their rated speed if the overall processor is well below its power and thermal limits. To oversimplify a bit, some cores can run faster if other cores are inactive.
This problem concerns a hypothetical 4-core processor, based loosely on the Intel Core i7-4712HQ, a mobile processor which was first launched in 2014. This hypothetical processor has the following characteristics:
# active cores | Frequency of active cores | Total static power | Total dynamic power (max.) | Supply voltage |
---|---|---|---|---|
4 | 2.26 GHz | 18 W | 42 W | 1.00 V |
2 | 3.06 GHz | 20 W | ? | 1.25 V |
1 | 3.20 GHz | 23 W | ? | 1.52 V |
Make the following overly simplistic assumptions:
You have a CPU-bound program that takes 10 seconds to run on a single core with Turbo Boost
enabled. A single routine that can be easily parallelized over multiple cores takes up 50 5 of those seconds. Assume that you can get perfect linear speedup from parallelizing this routine; i.e. splitting it across 2 cores would result in it taking 25 2.5 seconds.
Write a sequence of LEGv8 instructions that is equivalent to the following C code,
where a, b, and c are unsigned integers.
Assume that a is in $s0 X19, b is in $s1 X20,
and c is in $s2 X21. For this problem, use only the arithmetic and logical instructions
covered in class; do not use branches, jumps, or division/mod operations.
a += b + 2 - c;
Show how the following sequence of LEGv8 instructions is represented in 32-bit binary machine code. Label the fields of each instruction.
CBZ X10, exit ADD X1, X2, X3 STUR X10, [SP, 8] exit:
Assume that a 500-element signed integer array (call it A) is currently at the top of the stack.
Write assembly code to make room on the stack for a new 2-element integer array (call it B).
The elements of B should be as follows:
int copy_alpha(char* dst_ptr, char* src_ptr) { /* Arguments: * - dst_ptr should point to the memory where the string is to be copied * (the programmer needs to have allocated enough memory before calling this function) * - src_ptr should point to a null-terminated string * * What this function does: * - Copies ONLY alphabetical characters from the source string to the destination string. * - Null-terminates the destination string * - Returns the length of the destination string */ char* dst_start = dst_ptr; // copy dst_ptr so we can track string length while (*src_ptr) { if (isalpha(*src_ptr)) { *dst_ptr = *src_ptr; // copy the character dst_ptr++; // advance the destination pointer } src_ptr++; // advance the source pointer } *dst_ptr = 0; // add the null terminator return (dst_ptr - dst_start); // length = distance from null terminator to 1st character }