Professional Documents
Culture Documents
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
component tff is
port(t,clr,pr,clk : in STD_LOGIC;
q,qb : out STD_LOGIC);
end component;
component testand is
port(a,b : in STD_LOGIC;
c : out STD_LOGIC);
end component;
component testor is
port(x,y : in STD_LOGIC;
z : out STD_LOGIC);
end component;
component testinv is
port(s : in STD_LOGIC;
t : out STD_LOGIC);
end component;
end Behavioral;
**************************************************************************
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity tff is
Port ( t : in STD_LOGIC;
clr : in STD_LOGIC;
pr : in STD_LOGIC;
clk : in STD_LOGIC;
q : out STD_LOGIC;
qb : out STD_LOGIC);
end tff;
begin
process (clk)
variable x : STD_LOGIC := '0';
begin
if(clk'event and clk='1') then
if clr ='1' then
x:='0';
elsif pr='1' then
x:='1';
elsif t='1' then
x:= not x;
else
x:=x;
end if;
end if;
q<=x;
qb<= not x;
end process;
end Behavioral;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity testand is
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : out STD_LOGIC);
end testand;
begin
c<=a and b;
end Behavioral;
**************************************************************************
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity testor is
Port ( x : in STD_LOGIC;
y : in STD_LOGIC;
z : out STD_LOGIC);
end testor;
begin
z<=x or y;
end Behavioral;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity testinv is
Port ( s : in STD_LOGIC;
t : out STD_LOGIC);
end testinv;
begin
t<= not s;
end Behavioral;