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);
73 --COMPONENT lpm_fifo --!!!!!!!!!!!!!!!!!!!! XILINX ISE VERSION !!!!!!!!!!!!!!!!!!!!!
77 -- din : IN (31 DOWNTO 0);
80 -- dout : OUT (31 DOWNTO 0);
86 COMPONENT fifo_generator_0
90 din :
IN (
31 DOWNTO 0);
93 dout :
OUT (
31 DOWNTO 0);
110 signal data_mux : (31 downto 0);
112 -- signal pcie_dt_ltch : (31 downto 0);
113 signal low_wen_sync : ;
114 signal end_evt_sync : ;
115 signal fifo_dto : (31 downto 0);
116 signal timer : (15 downto 0);
119 signal soft_reset : ;
121 --******************************************************************************
122 --************************<< BEGIN >>***************************************
123 --******************************************************************************
134 output => low_wen_sync
137 process(RST_PCIClk,PCIe_clk)
139 if RST_PCIClk = '0' then
142 elsif rising_edge(PCIe_clk) then
144 if low_wen_sync = '1' or (PCIe_wen = '1' and PCIe_func(5) = '1' and PCIe_cs = '1') then
149 if (PCIe_wen = '1' and PCIe_func(0) = '1' and PCIe_cs = '1' and PCIe_dt(5) = '1' ) then
153 if (PCIe_wen = '1' and PCIe_func(5) = '1' and PCIe_cs = '1') then
156 data_mux <= fifo_dto;
163 --fifo_rnd:LPM_FIFO !!!!!!!!!!!!!!!!!!!!!ALTERA VERSION !!!!!!!!!!!!!!!!!!!!!!!!!
167 -- LPM_NUMWORDS => 1024)
170 -- CLOCK => PCIe_clk,
172 -- RDREQ => low_wen_sync,
173 -- ACLR => soft_reset,
177 --fifo_rnd : lpm_fifo --!!!!!!!!!!!!!!!!!!!! XILINX ISE VERSION !!!!!!!!!!!!!!!!!
180 -- rst => soft_reset,
183 -- rd_en => low_wen_sync,
189 fifo_rnd: fifo_generator_0 --!!!!!!!!!!!!!!!!!!!! XILINX VIVADO VERSION !!!!!!!!!!!!!!!!!
195 rd_en => low_wen_sync,
209 output => end_evt_sync
212 process(RST_LowClk,low_clk)
214 if RST_LowClk = '0' then
215 timer <= (others => '0');
217 elsif rising_edge(low_clk) then
219 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
223 if timer_cnt = '1' and timer(15 downto 1) = "000000000000000" then
225 elsif end_evt_sync = '1' then
229 if timer_cnt = '1' then
230 timer <= timer - "1";
231 elsif end_evt_sync = '1' then
232 timer <= fifo_dto(31 downto 16);
237 trigger <= low_wen_sync;
238 wc <= fifo_dto(15 downto 0);