Quiz 3

advertisement
Quiz 3
CPE 484/584 – Spring 2003
Chapters 1-4
Name: ___________________________
Student Number: ______________________
1) Use the multiplication algorithm discussed in class to perform 7 x -1 using 4-bit representations of the
multiplier and the multiplicand. Show all the register contents at each step of the algorithm. Identify all
the results and indicate whether overflow occurred or not. (8 points)
multiplicand = 0111
product: 0
add:
0
shift rt: 0
add:
0
shift rt: 0
add:
0
shift rt: 0
subt:
1
shift rt: 1
0000
0111
0011
1010
0101
1100
0110
1111
1111
multiplier = 1111
1111
1111
1111
1111
0111
0111
0011
0011
1001
product = 1111 1001 no overflow since the upper 4 bits are sign extended from the lower 4 bits of the
product.
2) Use the division algorithm discussed in class to perform 6/4 using 4-bit representations of the divisor
and the dividend. Show all the register contents at each step of the algorithm. Identify all the results. (8
points)
dividend = 0110
remainder:
shift left:
rem – div:
restore rem:
shift left:
rem – div:
restore rem:
shift left:
rem – div:
restore rem:
shift left:
rem – div:
shift left:
shift right:
divisor = 0100
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0000
0000
1100
0000
0001
1101
0001
0011
1111
0011
0110
0010
0100
0010
0110
1100
1100
1100
1000
1000
1000
0000
0000
0000
0000
0000
0001
0001
0
0
0
0
1
quotient = 0001 and the remainder = 0010
3) Use Booth’s algorithm to perform 2 x 3 using 4-bit representations of the multiplier and the
multiplicand. Show all the register contents at each step of the algorithm. Identify all the results and
indicate whether overflow occurred or not. (8 points)
multiplicand = 0010
product: 0
subt:
1
shift rt: 1
shift rt: 1
add:
0
shift rt: 0
shift rt: 0
0000
1110
1111
1111
0001
0000
0000
0011
0011
0001
1000
1000
1100
0110
multiplier = 0011
0
1
1
0
0
product = 0000 0110 and there is no overflow since the high 4 bits of the product are sign extended from
the low 4 bits of the product.
4) Given the following data stored in IEEE 754 floating point format, what is the decimal number that is
being represented? (8 points)
1011 1101 0100 0000 0000 0000 0000 0000
sign bit = 1:  negative
exponent field = 0111 1010  122 – 127 = -5
binary representation = -( 1.1
= -0.046875 (decimal)
 2 5 ) = -(0.000011 (binary)) = - { ( 1  2 5 ) + ( 1  2 6 ) }
5) Represent the decimal number -32.75 in IEEE 754 floating point format. (8 points)
32.75 written in binary point = 0010 0000.11
normalized binary point form =
1.0000011  2 5
sign bit = 1
exponent field = 5 + 127 = 132 = 1000 0100 (as unsigned integer)
significand field = 000 0011 0000 0000 0000 0000
IEEE 754 format = 1100 0010 0000 0011 0000 0000 0000 0000
Download