-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreg_16bit_tb.vhd
More file actions
70 lines (54 loc) · 1.41 KB
/
reg_16bit_tb.vhd
File metadata and controls
70 lines (54 loc) · 1.41 KB
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
library ieee;
use ieee.std_logic_1164.all;
entity reg_16bit_testbench is
end reg_16bit_testbench;
architecture behavior of reg_16bit_testbench is
-- component Declaration for the Unit Under Test (UUT)
component reg_16bit
port (
D : in std_logic_vector(15 downto 0);
load : in std_logic;
clk : in std_logic;
Q : out std_logic_vector(15 downto 0)
);
end component;
--Inputs
signal D : std_logic_vector(15 downto 0) := (others => '0');
signal load : std_logic := '0';
signal clk : std_logic := '0';
--Outputs
signal Q : std_logic_vector(15 downto 0);
-- Clock period definitions
constant clk_period : time := 50 ns;
begin
-- Instantiate the Unit Under Test (UUT)
uut : reg_16bit
port map(
D => D,
load => load,
clk => clk,
Q => Q
);
-- Clock process definitions
clk_process : process
begin
clk <= '0';
wait for clk_period/2;
clk <= '1';
wait for clk_period/2;
end process;
-- Stimulus process
stim_proc : process
begin
-- hold reset state for 100 ns.
wait for 100 ns;
D <= "0101010101010101";
load <= '1';
wait for clk_period;
D <= "1111111111111111";
load <= '0';
wait for 2 * clk_period;
load <= '1';
wait;
end process;
end;