Professional Documents
Culture Documents
Problemas Filtros
Problemas Filtros
vhdl
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity FF_JK is
port(
j,k,p,r,clk : in bit;
q,qp : out bit
);
end FF_JK;
FF_JK_tb.vhdl
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity FF_JK_tb is
end FF_JK_tb;
j<='1';
k<='0';
p<='0';
r<='0';
clk<='0';
wait for 10 fs;
j<='1';
k<='0';
p<='0';
r<='0';
clk<='1';
wait for 10 fs;
j<='1';
k<='1';
p<='0';
r<='0';
clk<='0';
wait for 10 fs;
j<='0';
k<='0';
p<='0';
r<='0';
clk<='1';
wait for 10 fs;
clk<='0';
wait for 10 fs;
j<='1';
k<='1';
p<='0';
r<='0';
clk<='1';
wait for 10 fs;
clk<='0';
wait for 10 fs;
j<='1';
k<='0';
p<='1';
r<='0';
clk<='1';
wait for 10 fs;
j<='0';
k<='1';
p<='0';
r<='0';
clk<='0';
wait for 10 fs;
end process;
end test;
FF_D.vhdl
library ieee;
use ieee.std_logic_1164.all;
entity FF_D is
port(
clk, d,p,r : in bit;
q,nq : out bit
);
end FF_D;
end behavior;
FF_D_tb.vhdl
library ieee;
use ieee.std_logic_1164.all;
entity FF_D_tb is
end FF_D_tb;
end component;
signal clk,d,p,r,q,nq : bit;
begin
ffD: FF_D port map(clk=>clk,d=>d,p=>p,r=>r,q=>q,nq=>nq);
process
begin
for i in 0 to 30 loop
clk<='0';
wait for 10 fs;
clk<='1';
wait for 10 fs;
end loop;
assert false report "Reached end of test";
wait;
end process;
process
begin
wait for 215 fs;
d<='1';
wait for 40 fs;
d<='0';
wait;
end process;
end test;
FF_T.vhdl
library ieee;
use ieee.std_logic_1164.all;
entity FF_T is
port(
clk, t,p,r : in bit;
q,nq : out bit
);
end FF_T;
end behavior;
FF_T_tb.vhdl
library ieee;
use ieee.std_logic_1164.all;
entity FF_T_tb is
end FF_T_tb;
end component;
signal clk,t,p,r,q,nq : bit;
begin
ffD: FF_T port map(clk=>clk,t=>t,p=>p,r=>r,q=>q,nq=>nq);
process
begin
for i in 0 to 30 loop
clk<='0';
wait for 10 fs;
clk<='1';
wait for 10 fs;
end loop;
assert false report "Reached end of test";
wait;
end process;
process
begin
wait for 15 fs;
t<='1';
wait for 20 fs;
t<='0';
entity cont_a_250 is
port (
clk,res : in bit;
q: out signed(7 downto 0)
);
end cont_a_250;
begin
process (clk)
begin
if clk' event and clk='0' then
if res='1' then
qs<="00000000";
else
qs<=e;
end if;
end if;
end process;
e<="00000000" when qs="11111010" else
qs+1;
q<=qs;
end behavior;
cont_a_250_tb.vhdl
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity cont_a_250_tb is
end cont_a_250_tb;
clk<='1';
wait for 10 fs;
end loop;
end test;
Cont_d_264.vhdl
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity cont_d_264 is
port (
clk,res : in bit;
q: out signed(8 downto 0)
);
end cont_d_264;
begin
process (clk)
begin
if clk' event and clk='0' then
if res='1' then
qs<="100001000";
else
qs<=e;
end if;
end if;
end process;
e<="100001000" when qs="000000000"else
qs-1;
q<=qs;
end behavior;
cont_d_24_tb.vhdl
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity cont_d_264_tb is
end cont_d_264_tb;
clk<='1';
wait for 10 fs;
end loop;