110 likes | 187 Views
CPEG323 Quiz 1 Review. Long Chen October, 26 th , 2005. Problem 1 (30 points) - 1. (D) MIPS is using a RISC ISA Represent 256 in its binary representation (C) 2^8 => [0, 255], so we need 9 bits Big endian vs. little endian (A) 0x44332211 (see slides) What is Addressing mode?
E N D
CPEG323 Quiz 1 Review Long Chen October, 26th, 2005
Problem 1 (30 points) - 1 • (D) MIPS is using a RISC ISA • Represent 256 in its binary representation (C)2^8=>[0, 255], so we need 9 bits • Big endian vs. little endian (A)0x44332211 (see slides) • What is Addressing mode? (C) It determinates where an operand in an instruction can be located and addressed (see slides)
5 16 18 16 5 bits 5 bits 16 bits 6 bits Problem 1 (30 points) - 2 • The range of addresses in the conditional branch instructions in MIPS (Homework #2 - 5) This number is used to identify the distance in WORDs! Conditional branch instruction: beq $s0, $s2, there The range of the distance is about 2^15 WORDs before and 2^15 WORDs after the branch. In other words, 2^17 bytes before and 2^17 bytes after the branch (D) Addresses up to about 128K before and 128K after the branch
Problem 1 (30 points) - 3 f) In a N-bit ALU, overflow can be detected by looking at (A) the carry into MSB and the carry out MSB (See Topic3b) g) -0.75ten = - 2-1-2-2 = -0.11two Normalized it into -1.1twoX2-1 Compared with the general representation (-1)s X (1+Fraction) X 2(Exponent – 127) We have, s= 1, Fraction = .1000 0000 0000 0000 0000 000two, Exponent = 126ten = 0111 1110two (A) 1011 1111 0100 0000 0000 0000 0000 0000
Problem 1 (30 points) - 4 • Compare signed and unsigned numbers (3) 1 and 0 • Represent decimal number to hexadecimal number (2) 14D • Translate IEEE 754 binary representation to decimal representation (B) -5.0
Problem 2 (30 points) - 1 • Homework #2 – 5 • Homework #3 – 3 • Caller save register: the registers that the calling procedure (caller) is responsible for saving and restoring across the call. The called procedure (callee) can then modify the registers without constraint. Callee save register: the registers that the callee is responsible for saving and restoring if it might use. The caller uses the registers without worrying about restoring them after a call. (see slides)
Problem 2 (30 points) - 2 • P + P = N; N + N = P; P – N = N; N – P = P (see slides) • i, j, temp, $fp, $ra
Problem 3 (10 points) Homework #3 – 1 (with slight change) 1100 0000 1111 0000 0000 0000 0000 0000 (a) unsigned INT 231+230+223+222+221+220 (b) 2’s comp INT -231+230+223+222+221+220 (c) IEEE 754 single precision FP -7.5
Problem 4 (15 points) - 1 Homework #3 - 6 fib(4) fib(3) fib(2) fib(2) fib(1) fib(1) fib(0) fib(1) fib(0)
$s1 8($sp) $s0 4($sp) $ra $sp 0($sp) Problem 4 (15 points) - 2 sw $s0,4($sp) sw $s1,8($sp) sw $ra,0($sp)
Problem 5 (15 points) Homework #3 – 2