Motion FPGA
Motion FPGA for the MachX02-7000HE Breakout Board
delay_line.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 --! @file
3 --! @brief Delay-line module
4 -------------------------------------------------------------------------------
5 
6 --! Using IEEE library
7 LIBRARY ieee;
8 
9 --! Using IEEE standard logic components
10 USE ieee.std_logic_1164.ALL;
11 
12 --! @brief Delay-line entity
13 --!
14 --! This entity acts as a delay-line for signals
15 ENTITY delay_line IS
16  GENERIC (
17  count : natural RANGE 1 TO natural'high := 2 --! Delay length
18  );
19  PORT (
20  clk_in : IN std_logic; --! Clock
21  rst_in : IN std_logic; --! Asynchronous reset
22  sig_in : IN std_logic; --! Input signal
23  sig_out : OUT std_logic --! Output signal
24  );
25 END ENTITY delay_line;
26 
27 --! Architecture rtl of delay_line entity
28 ARCHITECTURE rtl OF delay_line IS
29 
30  --! Input history shift register
31  SIGNAL history : std_logic_vector(count - 1 DOWNTO 0);
32 
33  --! Current state
34  SIGNAL state : std_logic;
35 
36 BEGIN
37 
38  --! @brief Shift process
39  pr_shift : PROCESS (clk_in, rst_in) IS
40  BEGIN
41 
42  IF (rst_in = '1') THEN
43  -- Reset
44  history <= (OTHERS => '0');
45  state <= '0';
46  ELSIF (rising_edge(clk_in)) THEN
47  -- Update history
48  history <= sig_in & history(history'high DOWNTO 1);
49  state <= history(0);
50  END IF;
51 
52  END PROCESS pr_shift;
53 
54  -- Drive sig_out from current state
55  sig_out <= state;
56 
57 END ARCHITECTURE rtl;
Delay-line entity.
Definition: delay_line.vhd:15
in sig_instd_logic
Input signal.
Definition: delay_line.vhd:22
std_logic state
Current state.
Definition: delay_line.vhd:34
_library_ ieeeieee
Using IEEE library.
Definition: clk_div_n.vhd:7
countnatural range 1 TO natural'high:= 2
Delay length.
Definition: delay_line.vhd:18
out sig_outstd_logic
Output signal.
Definition: delay_line.vhd:24
in clk_instd_logic
Clock.
Definition: delay_line.vhd:20
std_logic_vector( count- 1 DOWNTO 0) history
Input history shift register.
Definition: delay_line.vhd:31
in rst_instd_logic
Asynchronous reset.
Definition: delay_line.vhd:21