-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtb_popcount_32.vhd
53 lines (41 loc) · 1.08 KB
/
tb_popcount_32.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
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity tb_popcount_32 is
end tb_popcount_32;
architecture Behavioral of tb_popcount_32 is
component Popcount_32
port ( input_vector : in STD_LOGIC_VECTOR(31 downto 0);
count : out STD_LOGIC_VECTOR(7 downto 0)
);
end component;
--Inputs
signal CLK : std_logic := '0';
signal input_vector : STD_LOGIC_VECTOR(31 downto 0);
--Outputs
signal count : STD_LOGIC_VECTOR(7 downto 0);
--Testbench Related
constant period : time := 10 ns;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: Popcount_32 PORT MAP (
input_vector => input_vector,
count => count
);
-- Clock process definitions
process1 :process
variable i : integer := 0;
begin
input_vector <= x"00000000";
for i in 0 to 2000 loop
wait for period;
input_vector <= std_logic_vector(unsigned(input_vector) + 1);
end loop;
end process;
-- Stimulus process
stim_proc: process
begin
wait for period/2;
CLK <= not CLK;
end process;
end Behavioral;