University of California, Berkeley
College of Engineering
Department of Electrical Engineering and Computer Science
CS 61C, Spring 2012 HW 3
TA: Alan Christopher
Due Sunday, February 12, 2011 @ 11:59pm
Submitting Your Solution
Submit your solution by creating a directory named "hw3". In this directory, create a file named "hw3.txt" and put your answers inside. Then run
- Convert the following hex numbers into decimal.
- Convert the binary fraction .1101 to a decimal fraction. What is ⅔ as a binary fraction?
- Show how the data in 0x12345678 would be arranged in memory of a little endian machine and a big endian machine. Assume that the data is stored starting at address 0x0.
- little endian
- big endian
- What MIPS assembly code corresponds to the C code
Assume f,g,h are assigned to $s0,$s1,$s2 and that the base address of B is in $s7.
f = -g + h + B;
- What C code corresponds to the MIPS assembly code
Assume f,g,h,i are assigned to $s0,$s1,$s2,$s3.
add $s0, $s0, $s1
add $s0, $s3, $s2
add $s0, $s0, $s3
- Write a minimal sequence of MIPS assembly instructions that does the operation identical to
A = B & C
- Suppose you are given the recurrence
where T0 = 1, T1 = 1, T2 = 3. Implement a recursive function in C and MIPS that correctly computes the value of T for a given input n. Remember to follow register conventions in your MIPS code.
- Convert the following MIPS pseudo instructions into an equivalent,minimal sequence of MIPS instructions (it's acceptable for your MIPS instructions to reference LOOP instead of a numerical offset).
move $t1, $t2
beq $t1, 0x17, LOOP