CSE306 Homework 5

CSE306 Processing Systems and Structures Lockwood, Spring 2003

Homework Assignment 5

Due: Tuesday April 29, 2003, 5pm

76 Points

The answers to this homework assignment are to be submitted via the World Wide Web (WWW). You may use any Mosaic browsers (such as Netscape or Internet Explorer) to submit this assignment. No special software is needed. Your answers will be graded automatically. Your score will be immediately posted to the on-line gradebook. You will have the opportunity to resubmit the homework and improve your score.
ID Important: Use the same ID as selected in HW0
Name (First Last)

    Representing Floating Point Numbers

  1. Suppose that we wish to represent floating point numbers using a 1-bit sign, a 4-bit exponent with a bias of 7, and an 8-bit mantissa with an implict 1. Determine the floating point representation for each of the following numbers.
    • Round mantissas to the nearest digit if necessary
    • Use IEEE-754 notation to represent special numbers.
    • Enter all values in binary (1's and 0's)

    Number = 6.0

    1. Sign = (1 pt)
    2. Exponent = (2 pts)
    3. Mantissa = (2 pts)

      Number = 1.0

    4. Sign = (1 pt)
    5. Exponent = (2 pts)
    6. Mantissa = (2 pts)

      Number = -5.875

    7. Sign = (1 pt)
    8. Exponent = (2 pts)
    9. Mantissa = (2 pts)

      Number = -113.3

    10. Sign = (1 pt)
    11. Exponent = (2 pts)
    12. Mantissa = (2 pts)

      Electronic charge of an electron, measured in Coulombs.

    13. Sign = (1 pt)
    14. Exponent = (2 pts)
    15. Mantissa = (2 pts)


      Floating Point Math and the FPU

      Consider the following program which uses the floating point unit. Assume that R1..R5 have been allocated as 32-bit floating point variables. Using the values of X1..X5, calculate the values of R1..R5.

      ; Data X1 REAL4 5.0 X2 REAL4 -0.25 X3 REAL4 3.0 X4 REAL4 6.0 X5 REAL4 10.0 ; Code finit ; Initialize FPU fld X1 ; Load operands fld X2 fadd fstp R1 ; Store and pop from register stack fld X3 fld X2 fdiv fstp R2 ; Store and leave in register stack fld X5 fldPI ; Load PI fld X4 fdiv fsin fst R3 fmul fstp R4 fld1 fld X5 fdiv fstp R5

      Enter all values in hex.

    16. R1 = (5 pts)
    17. R2 = (5 pts)
    18. R3 = (5 pts)
    19. R4 = (5 pts)
    20. R5 = (5 pts)


      Multimedia Extensions (MMX)

      MultiMedia eXtensions (MMX) allow a Single Instruction to operate on Multiple Data (SIMD). Using the documentation available in the class notes, on the web, and/or the printed documents in our lab, determine the results of the following MMX instructions. For each of the instructions, enter the hex value of the result. Assume that variables R0..R6 have been defined as quad-words (64-bit entities). Enter all values as 16-digit hex numbers

      ; Data Var1 dq 00110004777701EFh Var2 dq 0123456789ABCDEFh Var3 dq 0003FFFF01000011h Var4 dq 33335555FFFFFFFFh Var5 dq 00FFFF000000FFFFh ; Code MOVQ mm0, Var2 PAND mm0, Var5 MOVQ Rst0, mm0 MOVQ mm0, Var2 PADDB mm0, Var4 MOVQ Rst1, mm0 MOVQ mm0, Var2 PADDW mm0, Var4 MOVQ Rst2, mm0 MOVQ mm0, Var2 PADDSB mm0, Var4 MOVQ Rst3, mm0 MOVQ mm0, Var2 PADDUSB mm0, Var4 MOVQ Rst4, mm0 MOVQ mm0, Var2 PMULLW mm0, Var3 MOVQ Rst5, mm0 MOVQ mm0, Var1 PACKSSWB mm0, Var3 MOVQ Rst6, mm0

    21. R0 = (4 pts)
    22. R1 = (4 pts)
    23. R2 = (4 pts)
    24. R3 = (3 pts)
    25. R4 = (3 pts)
    26. R5 = (4 pts)
    27. R6 = (4 pts)

      Once you have completed this homework assignment, press: