otsdaq_prepmodernization  v2_05_02_indev
PeakFinder_tb.vhd
1 --------------------------------------------------------------------------------
2 -- Company:
3 -- Engineer:
4 --
5 -- Create Date: 15:02:27 07/07/2016
6 -- Design Name:
7 -- Module Name: D:/cbradford/WorkingExampleCollinDebug/GPS_ADC_/GEL_CAPTAN/PeakFinder_tb.vhd
8 -- Project Name: dig_mac
9 -- Target Device:
10 -- Tool versions:
11 -- Description:
12 --
13 -- VHDL Test Bench Created by ISE for module: PeakFinder
14 --
15 -- Dependencies:
16 --
17 -- Revision:
18 -- Revision 0.01 - File Created
19 -- Additional Comments:
20 --
21 -- Notes:
22 -- This testbench has been automatically generated using types std_logic and
23 -- std_logic_vector for the ports of the unit under test. Xilinx recommends
24 -- that these types always be used for the top-level I/O of a design in order
25 -- to guarantee that the testbench will bind correctly to the post-implementation
26 -- simulation model.
27 --------------------------------------------------------------------------------
28 LIBRARY ieee;
29 USE ieee.std_logic_1164.ALL;
30 
31 -- Uncomment the following library declaration if using
32 -- arithmetic functions with Signed or Unsigned values
33 USE ieee.numeric_std.ALL;
34 
35 ENTITY PeakFinder_tb IS
36 END PeakFinder_tb;
37 
38 ARCHITECTURE behavior OF PeakFinder_tb IS
39 
40  -- Component Declaration for the Unit Under Test (UUT)
41 
42  COMPONENT PeakFinder
43  PORT(
44  clk : IN std_logic;
45  reset : IN std_logic;
46  data_in : IN std_logic_vector(127 downto 0);
47  empty : IN std_logic;
48  signal_threshold : IN std_logic_vector(7 downto 0);
49  data_out : OUT std_logic_vector(127 downto 0);
50  out_enable : OUT std_logic
51  );
52  END COMPONENT;
53 
54 
55  --Inputs
56  signal clk : std_logic := '0';
57  signal reset : std_logic := '1';
58  signal data_in : std_logic_vector(127 downto 0) := (others => '0');
59  signal signal_threshold : std_logic_vector(7 downto 0);
60  signal empty : std_logic := '0';
61 
62  --Outputs
63  signal data_out : std_logic_vector(127 downto 0);
64  signal out_enable : std_logic;
65 
66  -- Clock period definitions
67  constant clk_period : time := 10 ns;
68 
69 BEGIN
70 
71  -- Instantiate the Unit Under Test (UUT)
72  uut: PeakFinder PORT MAP (
73  clk => clk,
74  reset => reset,
75  data_in => data_in ,
76  empty => empty,
77  signal_threshold => signal_threshold,
78  data_out => data_out,
79  out_enable => out_enable
80  );
81 
82  -- Clock process definitions
83  clk_process :process
84  begin
85  clk <= '0';
86  wait for clk_period/2;
87  clk <= '1';
88  wait for clk_period/2;
89  end process;
90 
91 
92  -- Stimulus process
93  stim_proc: process
94  begin
95  -- hold reset state for 100 ns.
96  wait for 100 ns;
97  reset <= '0';
98  wait for clk_period*10;
99 
100  -- insert stimulus here
101  data_in(127 downto 7) <= (others => '0');
102  signal_threshold<= "00000100";
103  data_in(7 downto 0) <= "00001000";
104  wait for clk_period * 10;
105  data_in <= (others => '0');
106  wait for clk_period * 10;
107  data_in(7 downto 0) <= "00000010";
108  wait;
109  end process;
110 
111 END;