forked from alessandro-montanari/vhdl-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestRangeSensor.vhd
More file actions
75 lines (60 loc) · 1.62 KB
/
TestRangeSensor.vhd
File metadata and controls
75 lines (60 loc) · 1.62 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
71
72
73
74
75
-- Alessandro Montanari 880606-Y555
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY TestRangeSensor IS
END TestRangeSensor;
ARCHITECTURE behavior OF TestRangeSensor IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT range_sensor
PORT(
fpgaclk : IN std_logic;
triggerOut : OUT std_logic;
pulse : IN std_logic;
meters : OUT std_logic_vector(3 downto 0);
decimeters : OUT std_logic_vector(3 downto 0);
centimeters : OUT std_logic_vector(3 downto 0)
);
END COMPONENT;
--Inputs
signal fpgaclk : std_logic := '0';
signal pulse : std_logic := '0';
--Outputs
signal triggerOut : std_logic;
signal meters : std_logic_vector(3 downto 0);
signal decimeters : std_logic_vector(3 downto 0);
signal centimeters : std_logic_vector(3 downto 0);
-- Clock period definitions
constant fpgaclk_period : time := 20 ns;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: range_sensor PORT MAP (
fpgaclk => fpgaclk,
triggerOut => triggerOut,
pulse => pulse,
meters => meters,
decimeters => decimeters,
centimeters => centimeters
);
-- Clock process definitions
fpgaclk_process :process
begin
fpgaclk <= '0';
wait for fpgaclk_period/2;
fpgaclk <= '1';
wait for fpgaclk_period/2;
end process;
-- Stimulus process
stim_proc: process
begin
pulse <= '0';
wait for 251ms;
pulse <= '1';
wait for 10ms;
pulse <='0';
wait for 250ms;
pulse <= '1';
wait for 25ms;
pulse <= '0';
wait;
end process;
END;