Advertisement
Oleguer

Untitled

Mar 4th, 2022
1,058
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.56 KB | None | 0 0
  1. library ieee;
  2. use ieee. std_logic_1164.all;
  3.  
  4. entity DRS_FF is
  5. PORT( S,R,D,CLK   : in  std_logic;
  6.       Q, QN       : out std_logic);
  7. end DRS_FF;
  8.  
  9. Architecture behavioral of DRS_FF is
  10.     signal tmp : std_logic;
  11. begin
  12.     process(S, R, D, clk)
  13.     -- variable tmp: std_logic;
  14.     begin
  15.         if (S = '0' and R = '1') then
  16.             tmp <= '0';
  17.         elsif (S = '1' and R = '0') then
  18.             tmp <= '1';
  19.         elsif (S = '1' and R = '1') then
  20.             tmp <= 'X';
  21.         elsif (clk = '1' and clk'event) then
  22.             tmp <= D;
  23.         end if;
  24.  
  25.     end process;
  26.         Q  <= tmp;
  27.         QN <= not tmp;
  28. end behavioral;
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement