aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/issue1850/pulse.vhdl
blob: 97f4dd89356320a92abeccf28e7742dfb00bdbc1 (plain)
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
-- Created on    : 11/08/2021
-- Author        : Fabien Marteau <fabien.marteau@armadeus.com>
-- Copyright (c) ARMadeus systems 2015

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.numeric_std.all;


Entity rising_pulse_detector is
generic( WAITPRETRIGG_CNT: natural := 1000);
port
(
    clk : in std_logic;
    rst : in std_logic;

    inputvec : in std_logic_vector(15 downto 0);

    output_pulse : out std_logic_vector(15 downto 0)

);
end entity;

Architecture rising_pulse_detector_1 of rising_pulse_detector is

    signal inputvec_old, inputvec_pulse : std_logic_vector(15 downto 0);

begin

    output_pulse <= inputvec_pulse;

    process(clk, rst)
    begin
        if(rst = '1') then
            inputvec_old <= (others => '0');
            inputvec_pulse <= (others => '0');
        elsif(rising_edge(clk)) then
            inputvec_pulse <= (not inputvec_old) and inputvec;
            inputvec_old <= inputvec;
        end if;
    end process;

end architecture rising_pulse_detector_1;