-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathspiking_nn_tb.vhd
103 lines (83 loc) · 2.2 KB
/
spiking_nn_tb.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
use IEEE.math_real.all;
entity spiking_nn_tb is
end entity spiking_nn_tb;
architecture tb_vhdl of spiking_nn_tb is
component spiking_nn is
port(
clk_in : in std_logic;
reset_in : in std_logic;
input : in unsigned(5 downto 0);
output : out std_logic
);
end component;
constant CLKPERIODE : time := 50 us;
constant address_in_0 : unsigned(5 downto 0) := "000001";
constant address_in_1 : unsigned(5 downto 0) := "001000";
constant address_in_2 : unsigned(5 downto 0) := "001001";
--constant address_in_3 : unsigned(5 downto 0) := "000011";
--constant address_in_4 : unsigned(5 downto 0) := "000010";
--constant address_in_5 : unsigned(5 downto 0) := "001001";
signal clk_in : std_logic := '1';
signal reset_in : std_logic := '0';
signal input : unsigned(5 downto 0) := "000000";
signal output : std_logic := '0';
--signal temp_counter : integer := 1;
begin
spiking_nn_1 : spiking_nn
port map(
clk_in => clk_in,
reset_in => reset_in,
input => input,
output => output
);
clk_gen : process
begin
wait for CLKPERIODE/2;
clk_in <= not clk_in;
end process clk_gen;
reset_gen : process
begin
reset_in <= '1';
wait for CLKPERIODE/2;
reset_in <= '0';
wait;
end process reset_gen;
spike_gen : process
begin
for I in 0 to 3 loop
input <= "000000";
wait for CLKPERIODE * 10;
input <= address_in_0;
wait for CLKPERIODE;
input <= "000000";
wait for CLKPERIODE * 7;
input <= address_in_1;
wait for CLKPERIODE;
input <= "000000";
wait for CLKPERIODE * 13;
input <= address_in_2;
wait for CLKPERIODE;
input <= "000000";
wait for CLKPERIODE * 8;
input <= address_in_1;
wait for CLKPERIODE;
input <= "000000";
wait for CLKPERIODE * 25;
input <= address_in_1;
wait for CLKPERIODE;
input <= "000000";
wait for CLKPERIODE * 17;
input <= address_in_2;
wait for CLKPERIODE;
input <= "000000";
wait for CLKPERIODE * 2;
input <= address_in_0;
wait for CLKPERIODE;
input <= "000000";
end loop;
wait;
end process spike_gen;
end architecture tb_vhdl;