-
Notifications
You must be signed in to change notification settings - Fork 0
/
one-shot.vhd
executable file
·39 lines (33 loc) · 1 KB
/
one-shot.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity One_Shot_Timer is
port (CLK, PB: in STD_LOGIC;
EN: out STD_LOGIC);
end One_Shot_Timer;
architecture three_stage of One_Shot_Timer is
signal X,Y,Z: STD_LOGIC;
begin
-- First D flip-flop of the one-shot circuit
ONESHOTFF1 : process (CLK)
begin
if rising_edge(CLK) then -- trigger on rising clock edge
X <= PB; -- PB = D-input, X = Q-output
end if;
end process;
-- Second D flip-flop of the one-shot circuit
ONESHOTFF2 : process (CLK)
begin
if rising_edge(CLK) then -- trigger on rising clock edge
Y <= X; -- X = D-input, Y = Q-output
end if;
end process;
-- Third D flip-flop of the one-shot circuit
ONESHOTFF3 : process (CLK)
begin
if rising_edge(CLK) then -- trigger on rising clock edge
Z <= Y; -- Y = D-input, Z = Q-output
end if;
end process;
--Create enable signal with the output of the oneshot
EN <= Y and not Z;
end three_stage;