ECE291 Computer Engineering II Lockwood, Fall 1998

Homework Assignment 5

Due: Thursday April 22, 1999, 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. This page can accessed directly as
http://www.ece.uiuc.edu/~ece291/hw/hw5.html

ID Important: Use the same ID as selected in HW0
Name (First Last)


    Representing Floating Point Numbers

    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.

    Number = 1.0

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

    Number = -33.375

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

    Number = -113.6

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

    Number = 1/3

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

    Number = PI: 3.14159265359

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


    Calculations with the Floating Point Unit

    Determine the how the floating point variables will change for the code listed below

    
    A          Real4 5.5
    B          Real4 9.9
    C          Real4 4.4
    
    FOUR       Real4 4.0
    
    BSquared   Real4 ?
    
    FourAC     Real4 ?
    B24AC      Real4 ?
    SqrtB24AC  Real4 ?
    Num1       Real4 ?
    Num2       Real4 ?
    Denom      Real4 ?
    
    X1         Real4 ?
    X2         Real4 ?
    
      ...        
    
    	FINIT              ; Initialize the FPU
                               ; Always do this once when program begins!
    	FLD  	B
    	FCHS
    
    	FLD 	B
    	FLD 	B
    	FMUL
    	FST	BSquared
    
    	FLD	FOUR
    	FLD	A
    	FLD	C
    	FMUL
    	FMUL
    	FST	FourAC
    
    	FSUB
    	FST	B24AC
    
    	FSQRT
    	FST	SqrtB24AC
    
    	FADD
    	FST	Num1
    	FLD	A	
    	FLD	A
    	FADD
    	FST 	Denom
    
    	FDIV
    	FSTP	X1
    
    	XOR     BYTE PTR [B+3] , 80h   ; FCHS w/o a FPU!
    	FLD  	B
    	FLD	SqrtB24AC
    	FSUB
    	FST	Num2
    
    	FLD	Denom
    	FDIV
    	FSTP	X2	
    
    

  16. BSquared = (8 hex digits) (2 pts)

  17. FourAC = (8 hex digits) (2 pts)

  18. B24AC = (8 hex digits) (2 pts)

  19. SqrtB24AC = (8 hex digits) (2 pts)

  20. Num1 = (8 hex digits) (2 pts)

  21. Num2 = (8 hex digits) (2 pts)

  22. Denom = (8 hex digits) (2 pts)

  23. X1 = (8 hex digits) (2 pts)

  24. X2 = (8 hex digits) (2 pts)


    DMA and Digital Audio Sampling

    • 4 seconds of audio has been sampled with the following properties.
      • 8-bit resolution
      • 11.025 KHz Sample rate
      • Mono
    • Audio has been stored in a variable called AudioBuf
      • SEG AudioBuf = 3D00h
      • OFFSET AudioBuf = B291h
    • The Plug and Play SB-compatible card has allocated the following system resources:
      • DMA channel 1
      • Base address 220h
      • IRQ 5

  25. Determine how many bytes of memory are requried to represent this digitized sound.
    (decimal) (2 pts)

  26. Determine the value that must be written to the DMA's page register to begin playing this sound.
    (hex) (2 pts)

  27. Determine the value that must be written to the DMA's address register to begin playing this sound.
    (hex) (2 pts)

  28. What I/O port address of the DMA controller contains this DMA address register?
    (hex) (2 pts)

  29. What I/O port address of the sound card can be read to determine if the sound card is ready to accept a command?
    (hex) (2 pts)


    Multimedia Extensions (MMX)

    MultiMedia eXtensions (MMX) enable parallelism by allowing 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, analyze the following MMX-enabled application.

    
    Audio8Buf     dq 0102030405060708h ; Digitized stereo audio samples
    Right8Mask    dq 00FF00FF00FF00FFh
    
    Audio16Buffer dq 7A01C4E2F013A004h ; 16-bit audio samples
    Audio16Volume dq 0005000400030002h
    
    Xposition     dq 0A27527F9DC8DFF0h ; X-position of 8 different tanks
    Yposition     dq 6468507C6099306Fh ; Y-position of 8 different tanks
    
    AngleVector   dq 873C100A8545727Bh ; Angles of 8 different players
    PowerVector   dq 0563501560326435h ; Current Power level of 8 players
    MaxPower      dq 6450631524486035h ; Maximum allowed power for all 8 players.
    
    BestClass     dq 000E0C0E00020901h
    
    
     Rst0  dq 0     ; The results you need to determine !
     Rst1  dq 0
     Rst2  dq 0
     Rst3  dq 0
     Rst4  dq 0
     Rst5  dq 0
     Rst6  dq 0
     Rst7  dq 0
     Rst8  dq 0
     Rst9  dq 0
     Rst10 dq 0
    
    
    ; --- DSP Operations ---
    
         MOVQ     mm0, Audio8Buf
         MOVQ     mm1, Right8Mask
         PAND     mm0, mm1
         MOVQ     Rst0, mm0
    
         MOVQ     mm2, Audio16Buffer
         PSLLW    mm2, 3
         MOVQ     Rst1, mm2
    
    ; --- Arithmetic Operations ---
    
         MOVQ     mm1, Xposition
         MOVQ     mm2, Yposition
         MOVQ     mm3, mm2
         MOVQ     mm4, mm2
         PADDB    mm2, mm1
         MOVQ     Rst2, mm2
    
         PADDUSB  mm3, mm1
         MOVQ     Rst3, mm3
    
         PADDSB   mm4, mm1
         MOVQ     Rst4, mm4
    
    ; --- SIMD Logical Operations ---
    
         PSRAW    mm1, 2
         MOVQ     Rst5, mm1
    
    ; --- Multimedia Operations ---
    
         MOVQ     mm0, Audio16Buffer
         PMULLW   mm0, Audio16Volume
         MOVQ     Rst6, mm0
    
    ; -- Real-time algorithmic calculations --
    
         MOVQ     mm7, PowerVector
         PCMPGTB  mm7, MaxPower
         MOVQ     Rst7, mm7
    
    ; --- Pack/Unpack Operations ---
    
         MOVQ mm1, BestClass
         MOVQ mm2, BestClass
         MOVQ mm4, mm1
         PXOR mm3, mm3
         PUNPCKHBW mm1,mm3
         MOVQ Rst8,mm1
    
         PUNPCKLBW mm3,mm2
         MOVQ Rst9,mm3
    
         MOVQ mm3, AngleVector
         PACKSSWB mm3,mm2
         MOVQ Rst10,mm3
    
    

    Enter all values as 16-digit hex numbers

  30. R0 = (3 pts)
  31. R1 = (3 pts)
  32. R2 = (3 pts)
  33. R3 = (3 pts)
  34. R4 = (3 pts)
  35. R5 = (3 pts)
  36. R6 = (3 pts)
  37. R7 = (3 pts)
  38. R8 = (3 pts)
  39. R9 = (3 pts)
  40. R10 = (3 pts)


Once you have completed this homework assignment, press: