-
Notifications
You must be signed in to change notification settings - Fork 4
/
tb_xnor_popcount_8.vhd
67 lines (53 loc) · 1.62 KB
/
tb_xnor_popcount_8.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
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
-- currently hardcoded for "batch size" of 8
--package Common is
-- type vector_fixed_point_type is array (7 downto 0) of std_logic_vector(31 downto 0);
-- --type vector_bin_type is array (7 downto 0) of std_logic;
-- type matrix_fixed_point_type is array (7 downto 0) of vector_fixed_point_type;
-- type matrix_bin_type is array (7 downto 0) of std_logic_vector(7 downto 0);
--end Common;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
use work.Common.all;
entity tb_xnor_popcount_8 is
end tb_xnor_popcount_8;
architecture Behavioral of tb_xnor_popcount_8 is
component xnor_popcount_8
Port ( weights : in matrix_bin_type;
nn_in : in std_logic_vector(7 downto 0);
nn_out : out vector_fixed_point_type);
end component;
--Inputs
signal weights : matrix_bin_type;
signal nn_in : std_logic_vector(7 downto 0);
--Outputs
signal nn_out : vector_fixed_point_type;
--Testbench Related
constant period : time := 10 ns;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: xnor_popcount_8 PORT MAP (
weights => weights,
nn_in => nn_in,
nn_out => nn_out
);
-- process definitions
process1 :process
variable i : integer := 0;
begin
-- assign 8x8 weight matrix (binary)
weights <= (x"01",x"33",x"45",x"67",x"89",x"AB",x"CD",x"EF");
-- assign 1x8 input matrix (binary)
nn_in <= x"63";
wait for period;
end process;
-- Stimulus process
-- stim_proc: process
-- begin
-- wait for period/2;
-- CLK <= not CLK;
-- end process;
end Behavioral;