M
Mike Shonle
Guest
Hi, I'm just starting out in VHDL, and I'm trying to make an asynchronously
triggered oneshot that gets triggered by a short positive pulse and then
sets the output high for 10 clock cycles and then resets itself. Here's
what I have so far, which never sets the output high. Any help or advice
greatly appreciated. Thanks.
entity oneshot is
port ( clock : in std_logic;
trigger : in std_logic;
pulse : out std_logic);
end oneshot;
architecture BEHAVIORAL of oneshot is
signal triggered: integer range 0 to 1;
signal count: integer range 0 to 10; -- count variable
begin
process (trigger,clock)
begin
-- wait for trigger to go high
if trigger = '1' then
triggered <= 1;
count <= 10;
pulse <= '1';
elsif clock'event and clock = '1' then
if triggered = 1 and count > 0 then
pulse <= '1';
elsif count = 0 then
triggered <=0;
pulse <= '0';
else
count <= count -1;
end if;
end if;
end process;
end BEHAVIORAL;
triggered oneshot that gets triggered by a short positive pulse and then
sets the output high for 10 clock cycles and then resets itself. Here's
what I have so far, which never sets the output high. Any help or advice
greatly appreciated. Thanks.
entity oneshot is
port ( clock : in std_logic;
trigger : in std_logic;
pulse : out std_logic);
end oneshot;
architecture BEHAVIORAL of oneshot is
signal triggered: integer range 0 to 1;
signal count: integer range 0 to 10; -- count variable
begin
process (trigger,clock)
begin
-- wait for trigger to go high
if trigger = '1' then
triggered <= 1;
count <= 10;
pulse <= '1';
elsif clock'event and clock = '1' then
if triggered = 1 and count > 0 then
pulse <= '1';
elsif count = 0 then
triggered <=0;
pulse <= '0';
else
count <= count -1;
end if;
end if;
end process;
end BEHAVIORAL;