Forum Discussion
Altera_Forum
Honored Contributor
17 years agosigned/unsigned multipliers
I can't seem to find a way to instantiate a multiplier that will dynamically select between signed and unsigned multiplication. This is on a Cyclone II, but applies to other parts as well. Read...
Altera_Forum
Honored Contributor
17 years ago --- Quote Start --- Hi tricky, I am afraid they are not. not only MSB meaning is different, addition/subtraction are similar(taking into account carry bit difference). multiplication/div are different. --- Quote End --- Yes they are..... take the following example: 0111 x 1011 Lets assume it is unsigned (7 x 11). Add 0's forward 00000111 x 00001011 result =
00000111
+ 111
+
+ 111
----------------
01001101 (77)Now do the same but assume its signed (7x-5) sign extend both inputs to 8 bits 00000111 x 11111011
00000111
+ 111
+
+ 111
+ 111
+ 111
.... etc
--------------------
= (..111)11011101 (= -35)
now if you had treated this as unsigned (251 x 7) the result would be 11011011101 (1757) see the resemblence yet? --- Quote Start --- I still don't understand why signa and signb aren't available though. --- Quote End --- That is because the LPM library applies accross ALL technology, and some may not have specific signa/signb inputs. You will have to instantiate the specific multiplier for the technology you are using to get full access to internal signals.