






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Exam; Professor: Ozturk; Class: COMPUTER ORGANIZATION; Subject: Computer Engineering; University: San Diego State University;
Typology: Exams
1 / 11
This page cannot be seen from the preview
Don't miss anything!







Fall 2010 - FINAL EXAM Open Books โ No Calculators โ No Notes 1- (Knowledge assessed -- Assembly language programming ) (15 points) Consider the following assembly code for a C for loop: loop: pushl %ebp movl %esp,%ebp movl 8(%ebp),%ecx movl 12(%ebp),%edx xorl %eax,%eax cmpl %edx,%ecx jle .L .L6: decl %ecx incl %edx incl %eax cmpl %edx,%ecx jg .L .L4: incl %eax movl %ebp,%esp popl %ebp ret Based on the assembly code above, fill in the blanks below in its corresponding C source code. (Note: you may only use the symbolic variables x, y, and result in your expressions below โ do not use register names. ) int loop(int x, int y) { int result; for (_____________; ___________; result++ ) { ___________________________; ___________________________; } __________; return result; }
2- (Knowledge assessed โ Memory , Performance ) (10 points ) A computer has a cache, main memory and disk used for virtual memory. If a reference word is in the cache 5 ns are required to access it. If it is in the main memory but not in the cache , 50 ns are required to load it into the cache and then reference is started again. If the word is not in the main memory , 11 ms are required to fetch from disk , followed by 50 ns to copy it into the cache and then the reference is started again. The cache hit ratio is 0.8 and the main memory his ratio is 0.6. What is the average time in nanoseconds required to access a referenced word on this system?
4. (Instruction Set Architecture โ 10 POINTS) This problem tests your understanding of how for loops in C relate to IA32 machine code Consider the following IA32 assembly code for a procedure foo(): foo: pushl %ebp movl %esp,%ebp movl 12(%ebp),%ecx xorl %eax,%eax movl 8(%ebp),%edx cmpl %ecx,%edx jle .L .align 4 .L5: addl %edx,%eax decl %edx cmpl %ecx,%edx jg .L .L3: leave ret Based on the assembly code above, fill in the blanks below in its corresponding C source code. (Note: you may only use symbolic variables x, y, i and result , from the source code in your expressions below โ do not use register names.) int foo(int x, int y) { int i, result=0; for (i=________; ____________________________; _________) { ______________; } return result; }
5. (Processor Architecture โ 10 points) Hypothetical Y86 processor has eight registers , and each register is represented by a 4 bit identification as given below. Register id 8 , indicates no register. The generic instruction has the format encoded representation as follows. b Where the first byte is the instruction type and second byte is the source and destination operands. The instruction set and the corresponding encoding for each Y86 instruction is given below as well. 6. ( Integer representation ) โ 10 points
Determine the byte encoding of the Y instruction sequence given below. Note that .pos 0x100 indicates that the starting address of the object code should be 0x100. .pos 0x irmovl $15,%ebx irmovl $15,%ecx addl %ecx,%ebx Loop: rmmovl %ecx,-3(%ebx) addl %ebx,%ecx jmp loop
7. ( Floating Point representation) โ 10 points
Bonus Question: (10 points)