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 agoSigned and Unsigned arithmatic is identical. the only difference is that signed arithmatic has the sign extended forward. This is why it is a parameter, not an input signal to select signed or unsigned.
so for example: take the following 4 bit number: 1011 = 11 or -5 if this was put into an 8 bit multiplier (or 18 bits in the case of a cyclone 2), the number becomes: 00001011 for unsigned 11111011 for signed You can do real time selection of signed or unsigned yourself, and therefor only use 1 mulitplier. What you have to do is set the signed/unsigned parameter to unsigned and then do all the sign extension yourself (or preferably, dont use the lpm library at all, just imply it). Rmember that all inputs then have to become 18 bit numbers. But it can be done quite easily.