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

what is a good calculator for all algebra; would a Casio fx 260 work with all algebra equations? please name the cheapest, thanks.
Kevin Reply
a perfect square v²+2v+_
Dearan Reply
kkk nice
Abdirahman Reply
algebra 2 Inequalities:If equation 2 = 0 it is an open set?
Kim Reply
or infinite solutions?
Kim
y=10×
Embra Reply
if |A| not equal to 0 and order of A is n prove that adj (adj A = |A|
Nancy Reply
rolling four fair dice and getting an even number an all four dice
ramon Reply
Kristine 2*2*2=8
Bridget Reply
Differences Between Laspeyres and Paasche Indices
Emedobi Reply
No. 7x -4y is simplified from 4x + (3y + 3x) -7y
Mary Reply
is it 3×y ?
Joan Reply
J, combine like terms 7x-4y
Bridget Reply
im not good at math so would this help me
Rachael Reply
how did I we'll learn this
Noor Reply
f(x)= 2|x+5| find f(-6)
Prince Reply
Need to simplify the expresin. 3/7 (x+y)-1/7 (x-1)=
Crystal Reply
. After 3 months on a diet, Lisa had lost 12% of her original weight. She lost 21 pounds. What was Lisa's original weight?
Chris Reply
what is nanomaterials​ and their applications of sensors.
Ramkumar Reply
what is nano technology
Sravani Reply
what is system testing?
AMJAD
preparation of nanomaterial
Victor Reply
Yes, Nanotechnology has a very fast field of applications and their is always something new to do with it...
Himanshu Reply
good afternoon madam
AMJAD
what is system testing
AMJAD
what is the application of nanotechnology?
Stotaw
In this morden time nanotechnology used in many field . 1-Electronics-manufacturad IC ,RAM,MRAM,solar panel etc 2-Helth and Medical-Nanomedicine,Drug Dilivery for cancer treatment etc 3- Atomobile -MEMS, Coating on car etc. and may other field for details you can check at Google
Azam
anybody can imagine what will be happen after 100 years from now in nano tech world
Prasenjit
after 100 year this will be not nanotechnology maybe this technology name will be change . maybe aftet 100 year . we work on electron lable practically about its properties and behaviour by the different instruments
Azam
name doesn't matter , whatever it will be change... I'm taking about effect on circumstances of the microscopic world
Prasenjit
how hard could it be to apply nanotechnology against viral infections such HIV or Ebola?
Damian
silver nanoparticles could handle the job?
Damian
not now but maybe in future only AgNP maybe any other nanomaterials
Azam
can nanotechnology change the direction of the face of the world
Prasenjit Reply
At high concentrations (>0.01 M), the relation between absorptivity coefficient and absorbance is no longer linear. This is due to the electrostatic interactions between the quantum dots in close proximity. If the concentration of the solution is high, another effect that is seen is the scattering of light from the large number of quantum dots. This assumption only works at low concentrations of the analyte. Presence of stray light.
Ali Reply
the Beer law works very well for dilute solutions but fails for very high concentrations. why?
bamidele Reply
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
where are the solutions?
where are the solutions?

Get the best Algebra and trigonometry course in your pocket!





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