how to pass input values to procedure

Discussion in 'VHDL' started by JSreeniv, Aug 24, 2009.

  1. JSreeniv

    JSreeniv Guest

    Hi all,

    I wrote a package for converting binary to Manchester format with
    "wait" delays and the procedure looks like this

    procedure HDR2MANCHESTER(Hdr_Word : in std_logic_vector(4 downto
    0);
    Hdr_Manch : out
    std_logic_vector(9 downto 0));

    variable hdr_i : integer;
    variable manch_i : integer;
    begin
    hdr_i:= 5;
    manch_i:= 10;
    while(hdr_i<=0) loop
    while(manch_i<=0) loop

    --for hdr_i in 4 downto 0 loop
    -- for manch_i in 9 downto 0 loop
    if(Hdr_Word(hdr_i) = '0') then

    wait for 50 ns;
    Hdr_Manch(manch_i):= '0';
    wait for 50 ns;
    Hdr_Manch(manch_i-1):= '1';
    else
    wait for 50 ns;
    Hdr_Manch(manch_i):= '1';
    wait for 50 ns;
    Hdr_Manch(manch_i-1):= '0';

    hdr_i := hdr_i-1;
    manch_i:= manch_i-1;
    end if;
    end loop;
    end loop;
    end HDR2MANCHESTER;

    My query is if i want give input to Hdr_Word: 00001 (binary) and the
    converting that function and assign to a signal which takes final
    output.
    so how to do:
    what to put or how to pass real values
    r_out <=HDR2MANCHESTER(??????)....

    Please suggest me ....

    Thanks
    Sreeniv
     
    JSreeniv, Aug 24, 2009
    #1
    1. Advertising

  2. JSreeniv

    Tricky Guest

    On Aug 24, 7:08 am, JSreeniv <> wrote:
    > Hi all,
    >
    > I wrote  a package for converting binary to Manchester format with
    > "wait" delays and the procedure looks like this
    >
    > procedure HDR2MANCHESTER(Hdr_Word     : in std_logic_vector(4 downto
    > 0);
    >                                               Hdr_Manch    : out
    > std_logic_vector(9 downto 0));
    >
    >   variable hdr_i   : integer;
    >                        variable manch_i : integer;
    >             begin
    >               hdr_i:= 5;
    >               manch_i:= 10;
    >               while(hdr_i<=0) loop
    >                 while(manch_i<=0) loop
    >
    >               --for hdr_i in 4 downto 0 loop
    >                -- for manch_i in 9 downto 0 loop
    >                   if(Hdr_Word(hdr_i) = '0') then
    >
    >                      wait for 50 ns;
    >                      Hdr_Manch(manch_i):= '0';
    >                      wait for 50 ns;
    >                      Hdr_Manch(manch_i-1):= '1';
    >                    else
    >                      wait for 50 ns;
    >                      Hdr_Manch(manch_i):= '1';
    >                      wait for 50 ns;
    >                      Hdr_Manch(manch_i-1):= '0';
    >
    >                     hdr_i  := hdr_i-1;
    >                     manch_i:= manch_i-1;
    >                   end if;
    >                end loop;
    >             end loop;
    >       end HDR2MANCHESTER;
    >
    > My query is if i want give input to Hdr_Word: 00001 (binary) and the
    > converting that function and assign to a signal which takes final
    > output.
    > so how to do:
    >  what to put or how to pass real values
    >   r_out <=HDR2MANCHESTER(??????)....
    >
    > Please suggest me ....
    >
    > Thanks
    > Sreeniv


    A procedure is not a function call, so you dont assign anything to the
    procedure directly. all you need to do when you call it is:

    HDR2MANCHESTER( Hdr_word => input,
    Hdr_manch => r_out);

    Treat it like a port map. But remember the procedure has to be used
    inside a process.
     
    Tricky, Aug 24, 2009
    #2
    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. Replies:
    2
    Views:
    4,393
  2. Tricky
    Replies:
    0
    Views:
    591
    Tricky
    Mar 19, 2009
  3. Tricky
    Replies:
    0
    Views:
    1,028
    Tricky
    Mar 19, 2009
  4. Reuven
    Replies:
    0
    Views:
    604
    Reuven
    Mar 19, 2009
  5. Hermes
    Replies:
    1
    Views:
    178
    Bob Barrows [MVP]
    Sep 12, 2004
Loading...

Share This Page