


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



5 problems, 4 pages Final Exam Solutions 3 May 2002
Problem 1 (6 parts, 35 points) Microcode Reverse Engineering
The microcode fragment below is a mysterious program that runs on the provided datapath handout. All values are in hexadecimal. Unfortunately, don’t care values (X) have been converted to zeros. For full credit, be as specific and concise as you can (e.g., list shift types, amounts, and directions, logical functions, memory addresses and operations, etc.)
cycle X Y Z rwe im en im va au en -a/s lu en lf su en st ld en st en r/-w msel 1 0 0 1 1 1 3E8 0 0 1 C 0 0 0 0 0 0 2 1 0 0 1 0 0 0 0 0 0 0 0 1 0 1 1 3 0 0 3 1 1 18 0 0 0 0 1 0 0 0 0 0 4 0 0 2 1 1 10 0 0 0 0 1 0 0 0 0 0 5 2 0 2 1 1 FF 0 0 1 8 0 0 0 0 0 0 6 3 2 3 1 0 0 1 0 0 0 0 0 0 0 0 0 7 0 0 2 1 1 8 0 0 0 0 1 0 0 0 0 0 8 2 0 2 1 1 FF 0 0 1 8 0 0 0 0 0 0 9 3 2 3 1 0 0 1 0 0 0 0 0 0 0 0 0 10 0 0 2 1 1 FF 0 0 1 8 0 0 0 0 0 0 11 3 2 3 1 0 0 1 0 0 0 0 0 0 0 0 0 12 3 0 0 1 1 2 0 0 0 0 1 1 0 0 0 0 13 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
Part A (5 points) Describe the operation that occurs during cycle 2 (be specific)?
R0 <- mem[1000] For the remaining parts, assume R0 contains the value 0x12345678 (hexadecimal) following cycle 2.
Part B (5 points) What is the value (in hexadecimal) in R3 following when cycle 3 completes?
0x Part C (5 points) What is the value (in hexadecimal) in R2 following when cycle 5 completes?
0x Part D (5 points) What is the value (in hexadecimal) in R3 following when cycle 6 completes?
0x Part E (5 points) Describe the operation that occurs during cycle 12 (be specific).
R0 <- R3 / 4 Part F (10 points) Describe the operation of this microcode fragment (be specific).
Mem[1000] is replaced by the average of four packed 8-bit values in mem[1000]
5 problems, 4 pages Final Exam Solutions 3 May 2002
Problem 2 (5 parts, 35 points) Assembly Language Consider the following MIPS subroutine. All addresses are specified in decimal.
address label instruction 5000 happy: ori $1, $0, 1000 5004 lw $2, ($1) 5008 loop: lw $3, ($1) 5012 slt $4, $3, $ 5016 beq $4, $0, skip 5020 ori $2, $3, 0 5024 skip: addi $1, $1, 4 5028 slti $4, $1, 2500 5032 bne $4, $0, loop 5036 jr $ Part A (6 points) What is the branch offset (in bytes) for the bne instruction?
branch offset (in bytes): -7 x 4 = - Part B (7 points) How many times is the addi instruction executed when happy is called?
times addi is executed: 375
Part C (6 points) If this subroutine was called with a JAL instruction at address 8448, what is the contents of $31 at the jr instruction?
contents of $31: 8452 Part D (6 points) For what relationship of $2 and $3 is the ori at 5020 executed?
ori is executed when: $3 < $
Part E (10 points) Describe the function of the happy subroutine (be specific)?
It computes the minimum value in 375 element array beginning at mem[1000]
Problem 3 (3 parts, 35 points) Instruction Formats
Part A (15 points) Consider the instruction set architecture below with fields containing zeros. 00000 00000 00000 00000 00000 00000 00000 00000 00000 opcode dest. reg. source 1 reg. immediate value
What is the maximum number of opcodes? 32
What is the number of registers? 1024
What is the range of the signed immediate value? +/- 512K
Part B (12 points) List three differences between a branch and a jump in the MIPS instruction set.
1: Branch is relative to IP; jump is absolute 2: Branch is conditional; jump is unconditional 3: Branch has +/- 32K I range (16 bit offset); jump has 0-64M I range (26 bit offset) Part C (8 points) Explain the need for byte addressing in today’s microprocessors?
Byte addressing is needed to support: string pointers
5 problems, 4 pages Final Exam Solutions 3 May 2002
Problem 5 (3 parts, 30 points) Gate design
Consider the following expression:
Out = A ⋅ B ⋅ C + A ⋅ B ⋅ C + A ⋅ B ⋅ C + A ⋅ B ⋅ C Part A (10 points) Implement the expression using only NAND and NOT gates. Assume you do not have the compliments of the inputs. Use proper mixed logic notation. Do not simplify the expression.
Out
Part B (10 points) Implement the expression using N and P type switches. Assume you do have the compliments of the inputs.
A
B
C
A
B
C
A
B
C
A B C A B C
A
B
C
A
B
C
A
B
C
Out
Part C (10 points) Implement the expression using only two-input XOR gates. Assume you do not have the input complements.