1 -------------------------------------------------------------------------------
3 -- File : threshold _extctl.vhd
6 -- Author(s) : stephane Domas (sdomas@univ-fcomte.fr)
8 -- Creation Date : 2017/10/16
10 -- Description : This IP does a threshold based on a external signal
13 -- Note : input data is kept as is depending on the fact that
14 -- the keep_in signal is asserted to 1 or not. It it is not,
15 -- then input is replaced by the default_value given as a
16 -- generic. Note that keep_in_enb and data_in_enb must be
17 -- asserted to 1 at the same time so that the block gives an output
19 -------------------------------------------------------------------------------
22 use IEEE.std_logic_1164.all;
23 use IEEE.numeric_std.all;
25 entity threshold_extctl is
27 in_width : natural := 8;
28 default_value : natural := 0
33 data_in : in std_logic_vector(in_width-1 downto 0);
34 data_in_enb : in std_logic;
35 keep_in : in std_logic;
36 keep_in_enb : in std_logic;
37 data_out : out std_logic_vector(in_width-1 downto 0);
38 data_out_enb : out std_logic
44 architecture rtl of threshold_extctl is
47 signal def_val : unsigned(in_width-1 downto 0);
51 def_val <= to_unsigned(default_value, in_width);
53 threshold_process : process (clk, reset)
58 data_out <= (others => '0');
60 elsif rising_edge(clk) then
64 if data_in_enb = '1' and keep_in_enb = '1' then
69 data_out <= std_logic_vector(def_val);
74 end process threshold_process;