1 -------------------------------------------------------------------------------
6 -- Author(s) : stephane Domas (sdomas@univ-fcomte.fr)
8 -- Creation Date : 2017/10/16
10 -- Description : This IP does a threshold on an input
13 -- Note : The input is compared to one (or two) values and depending
14 -- on the result and the type of the comparison, the check output
15 -- is asserted to 1 or not.
16 -- The values are fixed by generic parameter.
17 -- The type of check is fixed by a generic paramter
18 -- type 1 : test if lesser or equal than X
19 -- type 2 : test if gretar or equal than X
20 -- type 3 : test if greater or equal than X and lesser or equal than Y
23 -------------------------------------------------------------------------------
26 use IEEE.std_logic_1164.all;
27 use IEEE.numeric_std.all;
31 in_width : natural := 8;
32 check_type : natural := 1;
33 inf_value : natural := 0;
34 sup_value : natural := 0
39 data_in : in std_logic_vector(in_width-1 downto 0);
40 data_in_enb : in std_logic;
41 data_out : out std_logic_vector(in_width-1 downto 0);
42 data_out_enb : out std_logic;
43 check_out : out std_logic;
44 check_out_enb : out std_logic
49 architecture rtl of checker is
53 check_process : process (clk, reset)
58 data_out <= (others => '0');
62 elsif rising_edge(clk) then
65 data_out <= (others => '0');
69 if data_in_enb = '1' then
75 if check_type = 1 then
76 if unsigned(data_in) <= inf_value then
79 elsif check_type = 2 then
80 if unsigned(data_in) >= inf_value then
83 elsif check_type = 3 then
84 if unsigned(data_in) >= inf_value and unsigned(data_in) <= sup_value then
91 end process check_process;