SURF  1.0
SsiCmdMasterPulser.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- File : SsiCmdMasterPulser.vhd
3 -- Company : SLAC National Accelerator Laboratory
4 -- Created : 2014-01-30
5 -- Last update: 2014-05-15
6 -------------------------------------------------------------------------------
7 -- Description: SSI Command Master Pulser Module
8 -------------------------------------------------------------------------------
9 -- This file is part of 'SLAC Firmware Standard Library'.
10 -- It is subject to the license terms in the LICENSE.txt file found in the
11 -- top-level directory of this distribution and at:
12 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
13 -- No part of 'SLAC Firmware Standard Library', including this file,
14 -- may be copied, modified, propagated, or distributed except according to
15 -- the terms contained in the LICENSE.txt file.
16 -------------------------------------------------------------------------------
17 
18 library ieee;
19 use ieee.std_logic_1164.all;
20 use ieee.numeric_std.all;
21 
22 use work.StdRtlPkg.all;
23 use work.SsiCmdMasterPkg.all;
24 
25 --! @see entity
26  --! @ingroup protocols_ssi
27 entity SsiCmdMasterPulser is
28  generic (
29  TPD_G : time := 1 ns; -- Simulation FF output delay
30  OUT_POLARITY_G : sl := '1';
31  PULSE_WIDTH_G : positive := 1);
32  port (
33  -- Local command signal
34  cmdSlaveOut : in SsiCmdMasterType;
35  --addressed cmdOpCode
36  opCode : in slv(7 downto 0);
37  -- output pulse to sync module
38  syncPulse : out sl;
39  -- Local clock and reset
40  locClk : in sl;
41  locRst : in sl);
42 end SsiCmdMasterPulser;
43 
44 architecture rtl of SsiCmdMasterPulser is
45 
46  signal pulse : sl := '0';
47  signal cnt : positive range 1 to (PULSE_WIDTH_G+1) := 1;
48 
49 begin
50 
51  syncPulse <= pulse;
52 
53  process(locClk)
54  begin
55  if rising_edge(locClk) then
56  if locRst = '1' then
57  pulse <= not(OUT_POLARITY_G) after TPD_G;
58  cnt <= 1 after TPD_G;
59  else
60  if pulse = OUT_POLARITY_G then
61  cnt <= cnt + 1 after TPD_G;
62  if cnt = PULSE_WIDTH_G then
63  pulse <= not(OUT_POLARITY_G) after TPD_G;
64  cnt <= 1 after TPD_G;
65  end if;
66  elsif cmdSlaveOut.valid = '1' then
67  if cmdSlaveOut.opCode = opCode then
68  pulse <= OUT_POLARITY_G after TPD_G;
69  end if;
70  end if;
71  end if;
72  end if;
73  end process;
74 
75 end rtl;