1 --**************************************
3 -- Block timer and wc load random
5 -- Dominique Gigi March 2012
7 -- To be used with Sergio vi
8 -- 16 lower
is word count
in bytes
9 -- 16 higher are before
next event
11 --**************************************
18 USE ieee.std_logic_1164.
all;
19 use ieee.numeric_std.
all;
20 use ieee.std_logic_unsigned.
all;
22 --USE lpm.lpm_components.all;
23 --USE altera_mf.altera_mf_components.all;
24 --USE altera.altera_primitives_components.all;
34 PCIe_dt : IN (31 downto 0);
35 PCIe_func : IN (15 downto 0);
41 wc : OUT (15 downto 0);
52 --component LPM_FIFO !!!!!!!!!!!! ALTERA VERSION !!!!!!!!!!
54 -- LPM_WIDTH : ; -- MUST be greater than 0
55 -- LPM_WIDTHU : := 1; -- MUST be greater than
0
56 -- LPM_NUMWORDS : ; -- MUST be greater than 0
57 -- LPM_SHOWAHEAD : := "ON";
58 -- LPM_TYPE : := L_FIFO;
59 -- LPM_HINT : := "UNUSED");
61 -- DATA : in (LPM_WIDTH-1 downto 0);
67 -- Q : out (LPM_WIDTH-1 downto 0);
68 -- USEDW : out (LPM_WIDTHU-1 downto 0);
77 din :
IN (
31 DOWNTO 0);
80 dout :
OUT (
31 DOWNTO 0);
97 signal data_mux : (31 downto 0);
99 -- signal pcie_dt_ltch : (31 downto 0);
100 signal low_wen_sync : ;
101 signal end_evt_sync : ;
102 signal fifo_dto : (31 downto 0);
103 signal timer : (15 downto 0);
106 signal soft_reset : ;
108 --******************************************************************************
109 --************************<< BEGIN >>***************************************
110 --******************************************************************************
121 output => low_wen_sync
124 process(RST_PCIClk,PCIe_clk)
126 if RST_PCIClk = '0' then
129 elsif rising_edge(PCIe_clk) then
131 if low_wen_sync = '1' or (PCIe_wen = '1' and PCIe_func(5) = '1' and PCIe_cs = '1') then
136 if (PCIe_wen = '1' and PCIe_func(0) = '1' and PCIe_cs = '1' and PCIe_dt(5) = '1' ) then
140 if (PCIe_wen = '1' and PCIe_func(5) = '1' and PCIe_cs = '1') then
143 data_mux <= fifo_dto;
150 --fifo_rnd:LPM_FIFO !!!!!!!!!!!!!!!!!!!!!ALTERA VERSION !!!!!!!!!!!!!!!!!!!!!!!!!
154 -- LPM_NUMWORDS => 1024)
157 -- CLOCK => PCIe_clk,
159 -- RDREQ => low_wen_sync,
160 -- ACLR => soft_reset,
170 rd_en => low_wen_sync,
184 output => end_evt_sync
187 process(RST_LowClk,low_clk)
189 if RST_LowClk = '0' then
190 timer <= (others => '0');
192 elsif rising_edge(low_clk) then
194 if timer_cnt = '1' and timer(15 downto 1) = "000000000000000" then -- we don't chekc the lower in case of the delay is set to 0
198 if timer_cnt = '1' and timer(15 downto 1) = "000000000000000" then
200 elsif end_evt_sync = '1' then
204 if timer_cnt = '1' then
205 timer <= timer - "1";
206 elsif end_evt_sync = '1' then
207 timer <= fifo_dto(31 downto 16);
212 trigger <= low_wen_sync;
213 wc <= fifo_dto(15 downto 0);