This repository has been archived by the owner on Apr 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
captouch_tb.vhd
64 lines (53 loc) · 1.84 KB
/
captouch_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
-- This testbench is just for controller-internal tests!
-- The capacitive touch pads are not simulated here (yet).
library ieee;
use ieee.std_logic_1164.all;
entity captouch_tb is
end captouch_tb;
architecture captouch_tb_rtl of captouch_tb is
-- dut --
component captouch
generic (
F_CLOCK : integer; -- frequency of clk_i in Hz
NUM_PADS : integer; -- number of touch pads
SENSITIVITY : integer -- 1=high, 2=medium, 3=low
);
port (
-- global control --
clk_i : in std_ulogic; -- clock
rstn_i : in std_ulogic; -- async reset, low-active
rstn_sync_i : in std_ulogic; -- sync reset, low-active
-- status --
ready_o : out std_ulogic; -- system calibration done when high
touch_o : out std_ulogic_vector(NUM_PADS-1 downto 0); -- touch pads state
-- touch pads --
pad_io : inout std_logic_vector(NUM_PADS-1 downto 0) -- capacitive touch pads
);
end component;
-- generators --
signal clk_gen, rstn_gen : std_logic := '0';
-- touch pads --
signal pads : std_logic_vector(3 downto 0);
begin
-- generators --
clk_gen <= not clk_gen after 10 ns;
rstn_gen <= '0', '1' after 60 ns;
-- dut --
captouch_inst: captouch
generic map (
F_CLOCK => 100000000, -- frequency of clk_i in Hz
NUM_PADS => 4, -- number of touch pads
SENSITIVITY => 2 -- 1=high, 2=medium, 3=low
)
port map (
-- global control --
clk_i => clk_gen, -- clock
rstn_i => rstn_gen, -- async reset, low-active
rstn_sync_i => '1', -- sync reset, low-active
-- status --
ready_o => open, -- system calibration done when high
touch_o => open, -- touch pads state
-- touch pads --
pad_io => pads -- capacitive touch pads
);
end captouch_tb_rtl;