how to pass input values to procedure

J

JSreeniv

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
 
T

Tricky

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.
 

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,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top