2 use ieee.std_logic_1164.ALL;
3 use ieee.std_logic_arith.ALL;
5 --------------------------------------------------------------------------------
7 entity qcounter_mcu16 is
9 -- Peripheral bus interface
10 ACK_O : out std_logic;
13 DAT_O : out std_logic_vector (15 downto 0);
16 -- QCounter component interface
17 QCOUNT : in std_logic_vector (31 downto 0));
20 --------------------------------------------------------------------------------
22 architecture behavioral of qcounter_mcu16 is
24 -- When reading whole 32-bit qcount input, first QCNTL has to be loaded, because
25 -- this event causes QCNTH to latch appropriate value of QCOUNT. This procedure
26 -- ensures that correct value is read.
28 -- Register of upper 16 bits of QCOUNT input.
29 signal upper_qcount : std_logic_vector (15 downto 0);
30 signal read_en : std_logic;
32 --------------------------------------------------------------------------------
40 QCOUNT (15 downto 0) when '0',
41 upper_qcount when '1',
42 (others => 'X') when others;
44 read_en <= SEL_I and STB_I;
47 -- Upper qcounter register
48 QCNTH : process (CLK_I)
50 if rising_edge(CLK_I) then
52 upper_qcount <= QCOUNT (31 downto 16);