Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   VHDL (http://www.velocityreviews.com/forums/f18-vhdl.html)
-   -   MOD operator synthesis (http://www.velocityreviews.com/forums/t22471-mod-operator-synthesis.html)

 Basel Naamna 05-08-2004 08:10 PM

MOD operator synthesis

i'v coded gcd algorithm in vhdl, and i'v used the MOD operator, but i
got problems in synthesis, synthesis is ready to accept power of two
right operand with MOD operator.
any one have idea how to get over this problem?

 Mike Treseler 05-10-2004 08:09 PM

Re: MOD operator synthesis

Basel Naamna wrote:
> i'v coded gcd algorithm in vhdl, and i'v used the MOD operator, but i
> got problems in synthesis, synthesis is ready to accept power of two
> right operand with MOD operator.

That's the way it is. Mod does work for constants.
Hmm...Maybe a counter that rolls over at your
special number will do what you want.

-- Mike Treseler

 Ken Smith 05-10-2004 09:51 PM

Re: MOD operator synthesis

In article <f3af42e6.0405081210.16435b3a@posting.google.com >,
Basel Naamna <baseln@yahoo.com> wrote:
>i'v coded gcd algorithm in vhdl, and i'v used the MOD operator, but i
>got problems in synthesis, synthesis is ready to accept power of two
>right operand with MOD operator.
>any one have idea how to get over this problem?

Divide and Mod operators take up all the gates in the world if you do them
all in one clock. If you can take several clock cycles for each, life
will be a lot easier.

For a mod, you slide the bigger number in from the LSB and compare after
each shift. If the contents of the shift register are >= the smaller
number, you subtract. It takes as many shifts as the number of bits you
can handle.

--
--
kensmith@rahul.net forging knowledge

 All times are GMT. The time now is 01:58 PM.