CSE306 Homework 5

CSE306 Processing Systems and Structures Lockwood, Spring 2004

Homework Assignment 5

Due: Tuesday, May 4, 2004, 5pm

76 Points

The answers to this homework assignment are to be submitted via the World Wide Web (WWW). You may use any web browser to submit this assignment. 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)


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.


.MODEL SMALL  ; Do NOT use this option for Win32 code.

.586    ; Use features of Pentium (and better) processor
.MMX    ; Enable MMX instructions

..

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 AABBCCDD00030006h


 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


; --- 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

Enter all values as 16-digit hex numbers

  • R0 = (8 pts)
  • R1 = (8 pts)
  • R2 = (8 pts)
  • R3 = (8 pts)
  • R4 = (8 pts)
  • R5 = (8 pts)
  • R6 = (7 pts)
  • R7 = (7 pts)
  • R8 = (7 pts)
  • R9 = (7 pts)


    Once you have completed this homework assignment, press: