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 --- You have chosen an example that works. Now consider this: I want to multiply these two 3 bit values through same unsigned multiplier: 111 * 011 = ? if viewed as unsigned, implies 7 * 3 = 21 [10101 correct] if viewed as signed, implies -1 * 3 and should give -3 [ but 10101 is wrong now, means -11] I don't know what you mean by sign extension here but let us try one bit extension: 0 111 * 0 011 7 * 3 = 21 0000 0000 10101 correct 1 111 * 0 011 15* 3 = 45 i.e. 101101 i.e./= -3 Correct ?, Wooooooo --- Quote End --- Let me correct myself, I got a bit flakey with numbers let us assume the numbers are signed: 111 * 011 (as signed I expect the result to be -1 * 3 = -3 now sign extend according to tricky's trick: 111 111 * 000 011 the verdict: = 10111101 and means -128 + 61 and /= the expected -3 So what is going on Now?