<< Chapter < Page Chapter >> Page >

(Q format addition, subtraction): Perform the additions 01001101 11100100 , and 01111001 10001011 when the binary numbers are Q-7 format. Also compute 01001101 11100100 and 10001011 00110111 . In which cases, do you have overflow?

Intentionally left blank.

Multiplication

Multiplication of two 2's complement numbers is a bit complicated because of the sign bit. Similar to themultiplication of two decimal fractional numbers, the result of multiplying twoQ- N numbers is Q- 2 N , meaning that we have 2 N binary digits following the implied binary digit. However, depending on the numbers multiplied, theresult can have either 1 or 2 binary digits before the binary point. We call the digit right before the binarypoint the sign bit and the one proceeding the sign bit (if any) the extended sign bit .

The following is the two examples of binary fractional multiplications:

0.110 0.75 Q-3 X 1.110 -0.25 Q-3-------------------------- 00000110 01101010 -------------------------------1110100 -0.1875 Q-6

Above, all partial products are computed and represented in Q-6 format for summation. For example, 0.110*0.010 =0.01100 in Q-6 for the second partial product. For the 4th partial product, caremust be taken because in 0.110*1.000 , 1.000 represents -1 , so the product is -0.110 = 1.01000 (in Q-6 format) that is 2's complement of 0.11000 . As noticed in this example, it is important to represent eachpartial product in Q-6 (or in general Q- 2 N ) format before adding them together. Another example makes this point clearer:

1.110 -0.25 Q-3 X 0.110 0.75 Q-3------------------------- 0000111110 111100000 -----------------------------11110100 -0.1875 Q-6

For the second partial product, we need 1.110*0.010 in Q-6 format. This is obtained as 1111100 in Q-6 (check!). A simple way to obtain it is to first perform themultiplication in normal fashion as 1110*0010 = 11100 ignoring the binary points, then perform sign extension by putting enough 1s (if the result is negative) or 0s (if the result isnonnegative), then put the binary point to obtain a Q-6 number. Also notice that we need to remove the extra signbit to obtain the final result.

In C62x, if we multiply two Q-15 numbers using one of multiply instruction (for example MPY ), we obtain 32 bit result in Q-30 format with 2 sign bits. To obtain the result back inQ-15 format, (i) first we remove 15 trailing bits and (ii) remove the extended sign bit.

(Q format multiplication): Perform the multiplications 01001101*11100100 , and 01111001*10001011 when the binary numbers are Q-7 format.

Intentionally left blank.

Assembly language implementation

When A0 and A1 contain two 16-bit numbers in the Q-15 format, we can perform the multiplications using MPY followed by a right shift.

1 MPY .M1 A0,A1,A2 2 NOP3 SHR .S1 A2,15,A2 ;lower 16 bit contains result 4 ;in Q-15 format

Rather than throwing away the 15 LSBs of the multiplication result by shifting, you can round up the result by adding 0x4000 before shifting.

1 MPY .M1 A0,A1,A2 2 NOP3 ADDK .S1 4000h,A6 4 SHR .S1 A2,15,A2 ;lower 16 bit contains result5 ;in Q-15 format

C language implementation

Let's suppose we have two 16-bit numbers in Q-15 format, stored in variable x and y as follows:

short x = 0x0011; /* 0.000518799 in decimal */ short y = 0xfe12; /* -0.015075684 in decimal */short z; /* variable to store x*y */

The product of x and y can be computed and stored in Q-15 format as follows:

z = (x * y) >> 15;

The result of x*y is a 32-bit word with 2 sign bits. Right shifting it by 15 bits ignores the last15 bits, and storing the shifted result in z that is a short variable (16 bit) removes the extended sign bit by taking only lower 16 bits.

Questions & Answers

A golfer on a fairway is 70 m away from the green, which sits below the level of the fairway by 20 m. If the golfer hits the ball at an angle of 40° with an initial speed of 20 m/s, how close to the green does she come?
Aislinn Reply
cm
tijani
what is titration
John Reply
what is physics
Siyaka Reply
A mouse of mass 200 g falls 100 m down a vertical mine shaft and lands at the bottom with a speed of 8.0 m/s. During its fall, how much work is done on the mouse by air resistance
Jude Reply
Can you compute that for me. Ty
Jude
what is the dimension formula of energy?
David Reply
what is viscosity?
David
what is inorganic
emma Reply
what is chemistry
Youesf Reply
what is inorganic
emma
Chemistry is a branch of science that deals with the study of matter,it composition,it structure and the changes it undergoes
Adjei
please, I'm a physics student and I need help in physics
Adjanou
chemistry could also be understood like the sexual attraction/repulsion of the male and female elements. the reaction varies depending on the energy differences of each given gender. + masculine -female.
Pedro
A ball is thrown straight up.it passes a 2.0m high window 7.50 m off the ground on it path up and takes 1.30 s to go past the window.what was the ball initial velocity
Krampah Reply
2. A sled plus passenger with total mass 50 kg is pulled 20 m across the snow (0.20) at constant velocity by a force directed 25° above the horizontal. Calculate (a) the work of the applied force, (b) the work of friction, and (c) the total work.
Sahid Reply
you have been hired as an espert witness in a court case involving an automobile accident. the accident involved car A of mass 1500kg which crashed into stationary car B of mass 1100kg. the driver of car A applied his brakes 15 m before he skidded and crashed into car B. after the collision, car A s
Samuel Reply
can someone explain to me, an ignorant high school student, why the trend of the graph doesn't follow the fact that the higher frequency a sound wave is, the more power it is, hence, making me think the phons output would follow this general trend?
Joseph Reply
Nevermind i just realied that the graph is the phons output for a person with normal hearing and not just the phons output of the sound waves power, I should read the entire thing next time
Joseph
Follow up question, does anyone know where I can find a graph that accuretly depicts the actual relative "power" output of sound over its frequency instead of just humans hearing
Joseph
"Generation of electrical energy from sound energy | IEEE Conference Publication | IEEE Xplore" ***ieeexplore.ieee.org/document/7150687?reload=true
Ryan
what's motion
Maurice Reply
what are the types of wave
Maurice
answer
Magreth
progressive wave
Magreth
hello friend how are you
Muhammad Reply
fine, how about you?
Mohammed
hi
Mujahid
A string is 3.00 m long with a mass of 5.00 g. The string is held taut with a tension of 500.00 N applied to the string. A pulse is sent down the string. How long does it take the pulse to travel the 3.00 m of the string?
yasuo Reply
Who can show me the full solution in this problem?
Reofrir Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Finite impulse response. OpenStax CNX. Feb 16, 2004 Download for free at http://cnx.org/content/col10226/1.1
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Finite impulse response' conversation and receive update notifications?

Ask