CMX
CMX firmware code in-line documentation
 All Classes Namespaces Files Functions Variables
mult_cnt.vhd
Go to the documentation of this file.
1 
14 
15 library ieee;
16 use ieee.std_logic_1164.all;
17 use IEEE.NUMERIC_STD.ALL;
18 library unisim;
19 use unisim.vcomponents.all;
20 LIBRARY work;
22 
23 
24 entity mult_cnt is
25  generic(
26  width : integer := 3
27  );
28  port(
29  clk : in T_SL; -- clock
30  reset : in T_SL; -- reset
31  inhibit : in T_SL; -- inhibit
32  data : in std_logic_vector(width-1 downto 0); -- data
33  cnt_out : out T_SLV32 -- mult
34  );
35 
36 end mult_cnt;
37 
38 architecture Behavioral of mult_cnt is
39 
40  signal cnt : std_logic_vector(32 downto 0);
41 
42  signal inhibit_r_local, reset_r_local : std_logic;
43 
44 begin
45 
46  process(clk)
47  begin
48  if rising_edge(clk) then
51  end if;
52  end process;
53 
54  process(clk)
55  begin
56  if clk'event and clk = '1' then -- raising clock edge
57 
58  if reset_r_local = '1' then
59  cnt <= (others=>'0');
60  else
61  if inhibit_r_local = '0' then
62  if cnt(32) = '1' then
63  cnt <= (others=>'1');
64  else
65  cnt <= std_logic_vector(unsigned(cnt) + unsigned(data));
66  end if;
67  end if;
68  end if;
69 
70  cnt_out <= cnt(31 downto 0);
71 
72  end if;
73  end process;
74 
75 end Behavioral;
76 
std_logic reset_r_local
Definition: mult_cnt.vhd:42
in resetT_SL
Definition: mult_cnt.vhd:30
in inhibitT_SL
Definition: mult_cnt.vhd:31
in datastd_logic_vector (width - 1 downto 0)
Definition: mult_cnt.vhd:32
out cnt_outT_SLV32
Definition: mult_cnt.vhd:33
std_logic inhibit_r_local
Definition: mult_cnt.vhd:42
std_logic_vector (32 downto 0) cnt
Definition: mult_cnt.vhd:40
widthinteger :=3
Definition: mult_cnt.vhd:26
in clkT_SL
Definition: mult_cnt.vhd:29