File: trigger_tb.vhd

package info (click to toggle)
bladerf 0.2022.11-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 373,752 kB
  • sloc: ansic: 1,186,428; xml: 150,799; vhdl: 24,182; tcl: 15,408; python: 3,409; sh: 1,551; makefile: 1,255; asm: 158; csh: 18; cpp: 9
file content (45 lines) | stat: -rw-r--r-- 1,215 bytes parent folder | download | duplicates (6)
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
library ieee ;
    use ieee.std_logic_1164.all ;
    use ieee.numeric_std.all ;
    use ieee.math_real.all ;
   
entity trigger_test is
end entity;

architecture arch of trigger_test is
    constant CLOCK_FREQUENCY    : REAL   := 40.0e6;
    constant CLOCK_PERIOD       : time      := 1.0 / CLOCK_FREQUENCY*1 sec;
    constant CLOCK_HALF_PERIOD  : time      := CLOCK_PERIOD / 2.0;
    
    signal clk                  : std_logic := '1';
    signal arm                  : std_logic := '0';
    signal trig              : std_logic := '1';
    signal sig                  : std_logic := '0';
    signal sigout               : std_logic := '0';
    
begin
    clk <= not clk after CLOCK_HALF_PERIOD;
    sig <= clk;
    
    trigger_dut : entity work.trigger
        generic map (
            DEFAULT_OUTPUT => '0'
        ) port map (
            armed => arm,
            trigger_in => trig,
            signal_in => sig,
            signal_out => sigout
        );
        
    tb : process
    begin
        wait for 100ns;
        arm <= '1';
        wait for 100ns;
        trig <= '0';
        wait for 100ns;
        arm <= '0';
        wait for 100ns;
        trig <= '1';
    end process;
end architecture;