Forum Discussion
Multiplier and Divider
I am new to the forum, but not VHDL. I am a student at RIT and have taken classes and am very familiar with the language. The questions I have are more of what should my hardware multiplier and divider include?
I am designing an 32-bit arithmetic logic unit that can add, subtract, multiply and divide twos compliment signed numbers and one that does unsigned (two separate units). This is part of a larger system that includes a status word. I do know that for an adder/subtractor there is an overflow and carry bit for a status register. What do you need for a multiplier and divider, or better yet, what is typically found? I know there are conditions specified by the IEEE for floating point.19 Replies
- Altera_Forum
Honored Contributor
--- Quote Start --- I suppose could make an overflow like this (syntax not guaranteed): product <= a * b; -- product is 64 bits. overflow <= NOT product(63 downto 32) AND x"0"; --No overflow when zeros. --- Quote End --- overflow will always be zero. A and 0 = 0. - Altera_Forum
Honored Contributor
I suppose could make an overflow like this (syntax not guaranteed):
product <= a * b; -- product is 64 bits. overflow <= NOT product(63 downto 32) AND x"0"; --No overflow when zeros. - Altera_Forum
Honored Contributor
I agree, that depending on the multiplier/divider usage, overflow detection and/or handling (saturation logic) may be reasonable. But it's not provided by the Altera MegaFunctions, you have to add the feature by writing behavioral code.
- Altera_Forum
Honored Contributor
The output of the ALU goes to a 32 bit bus. The wizard has no overflow, even if the output is restricted to 32 bits. So if you multiply FFFFFFFF * FFFFFFFF what happens?
- Altera_Forum
Honored Contributor
Thats no problem. Embedded multipliers allow inputs up to 36 bits, with 72 bit output.
- Altera_Forum
Honored Contributor
The alu output is 32 bits. The multiplier, if it is to have no overflow would require 64 bits. The inputs are 32 bits as well. The wizard has no overflow, even if the output is restricted to 32 bits.
- Altera_Forum
Honored Contributor
building a multiplier is as simple as writing:
output <= a * b; a divider has to be pipelined to run at any useful speed, but if you dont mind a slow clock rate, you can write: output <= a / b; I dont know why you are looking for carry on multiplier and divider, they have no meaning. - Altera_Forum
Honored Contributor
I did look at the megawizard but the divider and multiplier do not have carry, overflow, etc outputs you can specify, only the adder.
- Altera_Forum
Honored Contributor
--- Quote Start --- I am new to the forum, but not VHDL. I am a student at RIT and have taken classes and am very familiar with the language. The questions I have are more of what should my hardware multiplier and divider include? I am designing an 32-bit arithmetic logic unit that can add, subtract, multiply and divide twos compliment signed numbers and one that does unsigned (two separate units). This is part of a larger system that includes a status word. I do know that for an adder/subtractor there is an overflow and carry bit for a status register. What do you need for a multiplier and divider, or better yet, what is typically found? I know there are conditions specified by the IEEE for floating point. --- Quote End --- Hi, it is not necessary to develop your own divider or multiplier. Have a look to the Quartus build-in Megawizard. I'm pretty sure you will find most of the things you need. Kind regards GPK