tb_PWM.vhd


1
-------------------------------------------------------------------------------
2
--                                                                      
3
--                        Projekt
4
--  
5
-------------------------------------------------------------------------------
6
--                                                                      
7
-- ENTITY:         tb_dezcntr
8
--
9
-- FILENAME:       tb_dezcntr.vhd
10
-- 
11
-- ARCHITECTURE:   struc
12
-- 
13
-- ENGINEER:       Wolfgang Gartner
14
--
15
-- DATE:           30.03.2009
16
--
17
-- VERSION:        1.0
18
--
19
-------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.std_logic_1164.all;
22
23
entity tb_PWM is end tb_PWM;
24
25
architecture sim of tb_PWM is
26
-- Declaration of the component under test
27
28
component PWM
29
30
port (
31
      data_i: in std_logic_vector (7 downto 0);
32
      v_o: out std_logic;
33
      pause_i: in std_logic;
34
      play_i: in std_logic;
35
      stop_i: in std_logic;
36
      eof_i: in std_logic;
37
      led : out std_logic_vector(7 downto 0); -- value for LEDs
38
      clk_i: in std_logic;
39
      reset_n: in std_logic
40
     );
41
end component;
42
43
signal data_i: std_logic_vector (7 downto 0);
44
signal v_o: std_logic;
45
signal pause_i: std_logic;
46
signal play_i: std_logic;
47
signal stop_i: std_logic;
48
signal eof_i: std_logic;
49
signal led : std_logic_vector(7 downto 0); -- value for LEDs
50
signal clk_i: std_logic := '1';
51
signal reset_n: std_logic := '1';
52
53
54
begin
55
clk_i <= not clk_i after 10 ns; -- 1/2 Periodendauer = Wechsel
56
reset_n <= '0' after 10 ns;
57
58
-- Instantiate the design under test
59
i_PWM : PWM
60
port map 
61
(     data_i => data_i,
62
      v_o => v_o,
63
      pause_i => pause_i,
64
      play_i => play_i,
65
      stop_i => stop_i,
66
      eof_i => eof_i,
67
      led  => led,
68
      clk_i => clk_i,
69
      reset_n => reset_n
70
 );
71
72
-- Generate inputs for simulation
73
run : process
74
begin
75
76
data_i <= (others => '0');
77
pause_i <= '0';
78
play_i <= '0';
79
stop_i <= '0';
80
eof_i <= '0';
81
led  <= (others => '1');
82
wait for 10 ns;
83
data_i <= (others => '0');
84
play_i <= '1';
85
wait for 1000 ns;
86
data_i <= "01011100" ;
87
play_i <= '0';
88
stop_i <= '1';
89
wait for 100 ns;
90
91
92
end process run;
93
end sim;