M
midiwidi
Guest
Hallo
There are VHDL modules that I offen need in my designs for example a
sync module. It generates a puls with the length of one clk periode, if
there is an edge on its input.
-- syncrise.vhd
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
entity syncrise is
port( clk: in std_logic;
nres: in std_logic;
input: in std_logic;
output: out std_logic
);
end syncrise;
architecture behavioral of syncrise is
signal stage: std_logic_vector(1 downto 0);
begin
process (clk,nres,input)
begin
if (nres = '0') then
output <= '0';
stage <= "00";
elsif (clk'event and clk = '1') then
stage <= stage(0) & input;
if stage = "01" then
output <= '1';
else
output <= '0';
end if;
end if;
end process;
end behavioral;
Is there any possebility to use this module like a function or
procedure ?
like a <= syncrise(b); or syncrise(a,b);
Or is it not possible to produce sequential hardware with a function or
procedure call?
Any other ideas to do this?
There are VHDL modules that I offen need in my designs for example a
sync module. It generates a puls with the length of one clk periode, if
there is an edge on its input.
-- syncrise.vhd
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
entity syncrise is
port( clk: in std_logic;
nres: in std_logic;
input: in std_logic;
output: out std_logic
);
end syncrise;
architecture behavioral of syncrise is
signal stage: std_logic_vector(1 downto 0);
begin
process (clk,nres,input)
begin
if (nres = '0') then
output <= '0';
stage <= "00";
elsif (clk'event and clk = '1') then
stage <= stage(0) & input;
if stage = "01" then
output <= '1';
else
output <= '0';
end if;
end if;
end process;
end behavioral;
Is there any possebility to use this module like a function or
procedure ?
like a <= syncrise(b); or syncrise(a,b);
Or is it not possible to produce sequential hardware with a function or
procedure call?
Any other ideas to do this?