- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
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.Enlace copiado
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
--- 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
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
I did look at the megawizard but the divider and multiplier do not have carry, overflow, etc outputs you can specify, only the adder.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
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.- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
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.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Thats no problem. Embedded multipliers allow inputs up to 36 bits, with 72 bit output.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
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?
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
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.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
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.- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
--- 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.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Yeah, careless mistake I'm half asleep here in the us. figure it out tomorrow.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
What megawizard are you looking at to create a multiplier btw? my one allows inputs up to 256 bits, no overflow problems.
Also, you can just write behavioural VHDL and it will use the correct number of embedded multipliers. 32bit * 32bit doesnt need an overflow.- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
The LPM_Mult is what I looked at. If you are multiplying two 32 bit numbers, and the output is restricted to 32 bits, all numbers that have bits above the 32 bit limit will require an overflow detection. For example if you multiply FFFFFFFF * FFFFFFFF, the result will be FFFFFFFE00000001, which exceeds the limit and will not fit on a 32 bit output bus.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
dont use the LPM mult
Use behavioural code. What FPGA are you targetting?- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Cyclone II
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
For me, Quartus 10, The megawizard lets me create an LPM_MULT for a cyclone two that has 2x 256bit inputs and 512 bit output. So no need for any overflow.
Basically, 32 bit multiply is trivial in even the most basic of FPGAs. overflow is never needed.- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
And if you understand VHDL, why are you using the megawizard anyway for multiply. What wrong with the * function?
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Yes, I agree that you need no overflow when the output is twice the width of the inputs. That is not the case with me. I do not have a 64 bit output bus, only a 32. Are you misunderstanding something?
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
In that case, all you need for a single overflow but is to or the top 32 bits of the output of the multuplier (because you connect the least significant 32 bits of the multiplier to your output) for your unsigned ALU.
for the signed, the output becomes and overflow/underflow. first check is to see if the top 32 bit are all 1 or all 0. If this fails, there is an overflow (in the case of MSB = '1') or underflow (MSB = '0'). Then you compare MSB with bit 31. MSB = '1' and bit31 = '0' means underflow, MSB = '0' and bit31 = '1' mean overflow. You can of course combine all this for a single bit "error".- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
How are divide by zero conditions handled in the MegaWizard divider, the LPM_DIVIDER?

- Suscribirse a un feed RSS
- Marcar tema como nuevo
- Marcar tema como leído
- Flotar este Tema para el usuario actual
- Favorito
- Suscribir
- Página de impresión sencilla