MOD function

Discussion in 'VHDL' started by timewing, Sep 3, 2008.

  1. timewing

    timewing

    Joined:
    Aug 30, 2008
    Messages:
    2
    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;
     
    timewing, Sep 3, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. praveen

    MOD function synthesis

    praveen, Sep 23, 2003, in forum: VHDL
    Replies:
    1
    Views:
    884
    Allan Herriman
    Sep 24, 2003
  2. Kwaj

    Mod (%) Function in VHDL

    Kwaj, Jan 14, 2004, in forum: VHDL
    Replies:
    7
    Views:
    44,999
    jacky Renaux
    Jan 20, 2004
  3. Hari Sekhon
    Replies:
    0
    Views:
    556
    Hari Sekhon
    Jun 20, 2006
  4. ryles
    Replies:
    3
    Views:
    575
    Piet van Oostrum
    Jul 26, 2009
  5. T. Onoma
    Replies:
    9
    Views:
    390
    Dave Thomas
    Dec 15, 2003
Loading...

Share This Page