Professional Documents
Culture Documents
f8c00b548eae579ff4487ecf058bdb39
f8c00b548eae579ff4487ecf058bdb39
1
SR-Latch
VHDL Code for SR-Latch
library ieee;
use ieee.std_logic_1164.all;
entity srlt is
port(r,s:in std_logic;
q,qbar:buffer std_logic);
end srlt;
begin
q<= s nand qbar;
qbar<= r nand q;
end srlatch;
SR-Latch TestBench
library ieee;
use ieee.std_logic_1164.all;
entity srlt_tb is
end srlt_tb;
r1<='1';
s1<='1';
wait for 1 ns;
r1<='0';
s1<='1';
wait for 1 ns;
r1<='1';
s1<='1';
wait for 1 ns;
r1<='1';
s1<='0';
wait for 1 ns;
r1<='1';
s1<='1';
wait for 1 ns;
r1<='0';
s1<='1';
wait for 1 ns;
r1<='0';
s1<='0';
wait for 1 ns;
component dlt
port(d:in std_logic;
q,qbar:buffer std_logic);
end component;
library ieee;
use ieee.std_logic_1164.all;
entity srff is
port(r,s,clk: in std_logic;
q,qbar: buffer std_logic);
end srff;
p0 : process
begin
cl <= '1';
wait for 0.5 ns;
cl <= '0';
wait for 0.5 ns;
end process p0;
p1 : process
begin
r1<='X';
s1<='X';
wait for 1 ns;
r1<=‘0';
s1<=‘0';
wait for 1 ns;
r1<='0';
s1<='1';
wait for 1 ns;
r1<=‘0';
s1<=‘0';
wait for 1 ns;
r1<='1';
s1<='0';
wait for 1 ns;
r1<=‘0';
s1<=‘0';
wait for 1 ns;
r1<=‘1';
s1<=‘0';
wait for 1 ns;
r1<='0';
s1<='0';
wait for 1 ns;
assert false report "End of Test";
wait;