Facebook
From Cream Guinea Pig, 3 Years ago, written in VHDL.
Embed
Download Paste or View Raw
Hits: 122
  1. entity ffXY is
  2.         port X, Y, Z, CLK, CLR: in std_logic;
  3.         Q: out std_logic;
  4. end ffXY;
  5.  
  6. architecture comportamento of ffXY is
  7. signal BQ, proximo: std_logic;
  8. signal XY: std_logic_vector(1 downto 0);
  9. begin
  10.         process (CLK, CLR)
  11.         begin
  12.                 if (CLR = '1') then
  13.                         BQ <= 0;
  14.                 elsif (CLK'event and CLK = '1') then
  15.                         if (X = '0' and Y = '0') then
  16.                                 BQ <= Q;
  17.                         elsif (X = '1' and Y = '0') then
  18.                                 BQ <= Z;
  19.                         elsif (X = '0' and Y = '1') then
  20.                                 BQ <= not Z;
  21.                         elsif (X = '1' and Y = '1') then
  22.                                 BQ <= not Q;
  23.                         end if;
  24.                 end if;
  25.         end process;
  26.         Q <= BQ;
  27. end comportamento;
  28.        
  29.                
  30.                
  31.                        
  32.                        
  33.                        
  34.