



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
The instructions and problems for the final exam of the computer engineering course (ece 2030) held in fall 2003. The exam covers various topics such as assembly language, representations and arithmetic, reverse engineering, and microcode reverse engineering. Students are required to answer multiple-choice questions, write boolean expressions, and perform arithmetic operations using two's complement fixed-point representation.
Typology: Exams
1 / 7
This page cannot be seen from the preview
Don't miss anything!




5 problems, 7 pages Final Exam 11 December 2003
Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate the pages of the exam. For maximum credit, show your work. Good Luck!
Your Name ( please print ) ________________________________________________
1 2 3 4 5 total
5 problems, 7 pages Final Exam 11 December 2003
Problem 1 (2 parts, 45 points) Assembly Language Fun
Part A (25 points) An unknown program is listed below. Answer the following questions about its behavior. The MIPS ISA description is provided on the next page.
label instruction Push ($x) sw $x, ($30) addi $30, $30, 4
Pop ($x) addi $30, $30, - lw $x, ($30)
Foo: add $2, $0, $ beq $1, $0, Done push ($1) push ($31) addi $1, $1, - jal Foo pop ($31) pop ($1) add $2, $2, $ Done: jr $
If $1 = 10 when Foo is called, what will $2 be when the subroutine finally completes?
$2 after Foo completes:
How many instructions in this subroutine are executed when called with $1 = 10?
instructions executed:
What is the maximum size of the stack when this subroutine is called with $1 = 10?
maximum stack size (in words):
What is the branch offset (in bytes) for the BEQ instruction?
branch offset (in bytes):
What is the maximum number of different return addresses (non-identical addresses) that are stored in the stack when this subroutine is called?
maximum unique return addresses in stack:
5 problems, 7 pages Final Exam 11 December 2003
Problem 2 (3 parts, 32 points) Representations and Arithmetic
Part A (15 points) For the 24 bit representations below, determine the most negative value, most positive value, and step size (difference between sequential values). All answers should be expressed in decimal notation. Fractions (e.g., 3/16ths) may be used. All signed representations are two’s complement.
representation most negative value most positive value step size signed integer (24 bits). (0 bits) unsigned fixed-point (12 bits). (12 bits) unsigned fixed-point (16 bits). (8 bits) signed fixed-point (16 bits). (8 bits)
Part B (8 points) For each problem below, compute the operations using the rules of arithmetic, and indicate whether an overflow occurs assuming all numbers are expressed using a six bit two’s complement fixed-point representation.
result
signed error?
Part C (9 points) Answer the following questions for the single precision floating point representation discussed in class (1 sign bit, 23 mantissa bits, 8 exponent bits).
range of mantissa values (in decimal): to
largest represented value (power of two): 2 ________
approx. number of decimal significant figures:
5 problems, 7 pages Final Exam 11 December 2003
Problem 3 (3 parts, 30 points) Reverse Engineering
For each part below (10 points, 8 points, 12 points), determine the behavior and write as a Boolean expression. A
OUTx
OUTy
OUTx =
OUTY =
A B C
D E
A
B
D
C E
OUTz
φ 1 φ 2
hint: look for muxes
5 problems, 7 pages Final Exam 11 December 2003
Problem 5 (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 opcode dest. reg. source 1 reg. immediate value What is the maximum number of opcodes?
What is the number of registers? What is the range of the signed immediate value?
Part B (12 points) List three differences between a branch and a jump in the MIPS instruction set.
1: 2: 3:
Part C (8 points) Explain the need for byte addressing in today’s microprocessors?
Byte addressing is needed to support:
memory
register file 32 x 32
5 5 5
rwe
X Y Z
au en
-a/s arithmetic unit
sign extender
im en im va
lu en
logical unit
lf 4
addr
data
r/-w msel
st en
ld en
shift types 0 = logical 1 = arithmetic 2 = rotate
logical functions X Y out 0 0 lf (^0) 1 0 lf (^1) 0 1 lf (^2) 1 1 lf (^3)
cycle cycle number X register driven onto X bus Y register driven onto Y bus Z register written from Z bus rwe register write enable im en immediate enable on Y bus im va immediate value
au en arithmetic unit enable -a/s -add / sub (0 = add, 1 = subtract) lu en logical unit enable lf logical function su en shift unit enable st shift type ld en load enable st en store enable r/-w read/-write (0 = write, 1 = read) msel memory select description operation description
su en
shift unit
st 2
count
16
32