MOD function

Joined
Aug 30, 2008
Messages
2
Reaction score
0
I'm intend to write a MOD function with two positive integer number.
It could be synthesized but cannot be simulated.
It would be very appreciated if anyone could tell me how to write:

library IEEE;
use IEEE.STD_LOGIC_1164.all;

package mymod_pack is

function mymod ( L, R : in integer ) return integer;

end mymod_pack;


package body mymod_pack is

function mymod ( L, R : in integer ) return integer is
variable tmp : integer;
begin
tmp := L;
if L > R then
while tmp > R loop
tmp := L - R;
end loop;
elsif L < R then
tmp := L;
elsif L = R then
tmp := 0;
else tmp := 0;
end if;
return tmp;
end function;

end mymod_pack;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top