Homework Assignment 7 Advanced Computer Architecture CS 350c Unique Number: 51160 Spring, 2016 Given: March 1, 2016 Due: March 10, 2016 NAME: UT EID: I have not received nor given any information regarding this homework. Signature: Homework Assignment 7 Advanced Computer Architecture CS 350c Unique Number: 51160 Spring, 2016 Given: March 1, 2016 Due: March 10, 2016 Notes: Each problem (1, 2, 3, 4, and 5) is worth 20 points. Problem 6 is an extra-credit problem. Students providing an answer may receive up to 10 extra points -- the amount of credit will depend on both the clarity of the question offered and the quality of the answer provided. When specifically doing this homework, put all of your electronics away; this includes your laptop, your tablet, your cell phone, and your calculator. Mechanical computation devices are fine; for example, an abacus may be used. Warning: We have little mercy for any kind of cheating. 1a: What is the maximum memory space required to provide memory-resident tables for a 2-level page-mapping system with 20-bit addresses, where the most-significant 6 address bits are used as an index into the first-level page table, the second most significant 6 bits are used as an index into the second-level page table, and the least-significant 8 address bits are used as an offset? Note, each page table entry is 16 bits (two bytes) in size. 1b: Describe the DRAM write process. List the steps required to write a cell. 1c: This question concerns the x86-64 calling convention. Given a subroutine of eleven arguments, how many arguments could be passed to this subroutine in registers. How would the rest of the arguments be passed to this subroutine? 2: For user-level x86 programming purposes, the memory is defined to be a sequence of bytes. x86 addressing is "little" endian; that is, the lowest address references the least-significant byte when viewed as a natural number. Byte Number: 3 2 1 0 +-----------+-----------+-----------+-----------+ | | | | | | abcd efgh | ijkl mnop | | stuv wxyz | | | | | | +-----------+-----------+-----------+-----------+ Address 10 1111 1111 1111 1111 0000 0000 0000 0000 Address 1 1111 1111 0000 0000 1111 1111 0000 0000 * Address 0.1 1111 0000 1111 0000 1111 0000 1111 0000 Address 0.01 1100 1100 1100 1100 1100 1100 1100 1100 Address 0.001 1010 1010 1010 1010 1010 1010 1010 1010 - What are the contents of the bits identified by letters "mnop" (above) for a short integer (two bytes) representing the number -751 placed at byte address 1 ? - What bit pattern would be in byte 3 if the C-language string "bytes" was stored starting at byte 0 ? Identify each bit for "abcd" and "efgh". - If an 8-byte pointer was stored starting at address 24, could you determine if the value being referenced is word (2-byte) aligned? If so, how? - What does it mean for an x86 memory address to be canonical? - Can a quad-word (an 8-byte quantity) integer start on an odd address? If so, why? If not, why not? 3: a. Assuming that there are no caches and an x86 processor is configured to provide memory mapping using 4K pages, how many memory addresses and of what sizes would need to be accessed to read a quad word located at address 110590 (including the quad word to be fetched)? 3: b. Given the 64-bit, x86 address 0x79de821dc1b7, identify the entry number for each (of the four) page tables and the final offset. PML4 Entry number: Page directory pointer entry: Page directory entry: Page table entry: Offset: 4: From Laboratory 1, explain how the following statement purports that the address computed for variable "mem" will be 4K aligned. Does it? Explain your answer. #define PAGE_SIZE (4096) #define EXTRA (PAGE_SIZE) unsigned long int data[MAX_ENTRIES + EXTRA]; // Array being traversed unsigned long int *mem; // Set pointer mem to the beginning of a (4K-address-aligned) page. mem = (unsigned long int *) ((uintptr_t) data + PAGE_SIZE - ((uintptr_t) data % PAGE_SIZE)); Write a "slow" initialization program for Laboratory 1 that "jumps" from 4K page to 4K page for an array with the following declaration. For this problem, assume size is 2^24. void init_data_slow( unsigned long int mem[], unsigned long int size ) { } 5: Consider the following three C-language declarations: int i; int x[ 4 ][ 11 ]; int *y[ 4 ]; 5a: Is i = x[ 2 ][ 7 ]; a valid C-language statement? 5b: Is i = y[ 2 ][ 7 ]; a valid C-language statement? 5c: How much storage is allocated by the declaration for array x? 5d: How much storage is allocated by the declaration for array y? 5e: How many memory references (exclusive of the write to i) are required for problem 5a (just above)? 5f: How many memory references (exclusive of the write to i) are required for problem 5b (just above)? 5g: Given the declarations above, is i = x[ 5 ][ -22 ]; a valid statement? 5h: Given the declarations above, is i = y[ 3 ][ 99 ]; a valid statement? Extra Credit Question: 6: Write your own homework question (examples are above), and provide a high-quality answer for it.