default.txt 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * RS-trigger with assynch. reset
  3. */
  4. library ieee;
  5. use ieee.std_logic_1164.all;
  6. entity RS_trigger is
  7. generic (T: Time := 0ns);
  8. port ( R, S : in std_logic;
  9. Q, nQ : out std_logic;
  10. reset, clock : in std_logic );
  11. end RS_trigger;
  12. architecture behaviour of RS_trigger is
  13. signal QT: std_logic; -- Q(t)
  14. begin
  15. process(clock, reset) is
  16. subtype RS is std_logic_vector (1 downto 0);
  17. begin
  18. if reset = '0' then
  19. QT <= '0';
  20. else
  21. if rising_edge(C) then
  22. if not (R'stable(T) and S'stable(T)) then
  23. QT <= 'X';
  24. else
  25. case RS'(R&S) is
  26. when "01" => QT <= '1';
  27. when "10" => QT <= '0';
  28. when "11" => QT <= 'X';
  29. when others => null;
  30. end case;
  31. end if;
  32. end if;
  33. end if;
  34. end process;
  35. Q <= QT;
  36. nQ <= not QT;
  37. end architecture behaviour;