Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library IEEE;
- use IEEE.STD_LOGIC_1164.ALL;
- entity tp3_a is
- Port ( S : in STD_LOGIC;
- R : in STD_LOGIC;
- lamp : out STD_LOGIC;
- rst : in STD_LOGIC;
- clk : in STD_LOGIC);
- end tp3_a;
- architecture Behavioral of tp3_a is
- signal Tr1, Tr2 : STD_LOGIC;
- signal Q1, Q2 : STD_LOGIC;
- begin
- Tr1 <= Q1 and S and (not R);
- Tr2 <= Q2 and R and (not S);
- process (rst, clk)
- begin
- if rst = '1' then Q1 <= '1'; Q2 <= '0';
- elsif clk'event and clk = '1' then
- if Tr1 = '1' then Q1 <= '0'; Q2 <= '1'; end if;
- if Tr2 = '1' then Q2 <= '0'; Q1 <= '1'; end if;
- end if;
- end process;
- lamp <= Q2;
- end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment