-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtb_SR_Latch.vhd
88 lines (72 loc) · 1.3 KB
/
tb_SR_Latch.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity tb_SR_Latch is
end tb_SR_Latch;
architecture Behavioral of tb_SR_Latch is
component SR_Latch
port(
C : IN std_logic;
S : IN std_logic;
R : IN std_logic;
Q1 : OUT std_logic;
Q2 : OUT std_logic
);
end component;
--Inputs
signal S : std_logic := '0';
signal R : std_logic := '0';
signal C : std_logic := '0';
--Outputs
signal Q1 : std_logic;
signal Q2 : std_logic;
--Testbench Related
constant period : time := 10 ns;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: SR_Latch PORT MAP (
C => C,
S => S,
R => R,
Q1 => Q1,
Q2 => Q2
);
-- Clock process definitions
process1 :process
begin
-- Initial State
C <= '1';
S <= '0';
R <= '1';
wait for period;
-- "Set"
S <= '1';
R <= '0';
wait for period;
-- "Reset"
S <= '0';
R <= '1';
wait for period;
-- "C=0"
C <= '0';
S <= '0';
R <= '1';
wait for period;
-- "Set"
S <= '1';
R <= '0';
wait for period;
-- "Reset"
S <= '0';
R <= '1';
wait for period;
end process;
-- Stimulus process
stim_proc: process
begin
-- hold reset state for 100 ns.
wait for 100 ns;
wait for period*10;
-- insert stimulus here
wait;
end process;
end Behavioral;