SURF  1.0
SyncTrigRateVector.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- File : SyncTrigRateVector.vhd
3 -- Company : SLAC National Accelerator Laboratory
4 -- Created : 2014-04-16
5 -- Last update: 2016-05-20
6 -------------------------------------------------------------------------------
7 -- Description: Wrapper for multiple SyncTrigRate modules
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 
21 use work.StdRtlPkg.all;
22 
23 --! @see entity
24  --! @ingroup base_sync
26  generic (
27  TPD_G : time := 1 ns; -- Simulation FF output delay
28  COMMON_CLK_G : boolean := false; -- true if locClk & refClk are the same clock
29  ONE_SHOT_G : boolean := false;
30  IN_POLARITY_G : slv := "1"; -- 0 for active LOW, 1 for active HIGH
31  REF_CLK_FREQ_G : real := 200.0E+6; -- units of Hz
32  REFRESH_RATE_G : real := 1.0E+0; -- units of Hz
33  USE_DSP48_G : string := "no"; -- "no" for no DSP48 implementation, "yes" to use DSP48 slices
34  CNT_WIDTH_G : positive := 32; -- Counters' width
35  WIDTH_G : positive := 16);
36  port (
37  -- Trigger Input (locClk domain)
38  trigIn : in slv(WIDTH_G-1 downto 0);
39  -- Trigger Rate Output (locClk domain)
41  trigRateOut : out SlVectorArray(WIDTH_G-1 downto 0, CNT_WIDTH_G-1 downto 0); -- units of REFRESH_RATE_G
42  -- Clocks
43  locClkEn : in sl := '1';
44  locClk : in sl;
45  refClk : in sl);
46 end SyncTrigRateVector;
47 
48 architecture mapping of SyncTrigRateVector is
49 
50  type MyVectorArray is array (WIDTH_G-1 downto 0) of sl;
51 
52  function FillVectorArray (INPUT : slv)
53  return MyVectorArray is
54  variable retVar : MyVectorArray := (others => '1');
55  begin
56  if INPUT = "1" then
57  retVar := (others => '1');
58  else
59  for i in WIDTH_G-1 downto 0 loop
60  retVar(i) := INPUT(i);
61  end loop;
62  end if;
63  return retVar;
64  end function FillVectorArray;
65 
66  constant IN_POLARITY_C : MyVectorArray := FillVectorArray(IN_POLARITY_G);
67 
68  type MySlvArray is array (WIDTH_G-1 downto 0) of slv(CNT_WIDTH_G-1 downto 0);
69  signal trigRate : MySlvArray;
70 
71  signal trigRateUpdate : slv(WIDTH_G-1 downto 0);
72 
73 begin
74 
75  -- Only need to propagate one of the updates because they will be identical signals.
77 
78  GEN_VEC :
79  for i in (WIDTH_G-1) downto 0 generate
80 
81  SyncTrigRate_Inst : entity work.SyncTrigRate
82  generic map (
83  TPD_G => TPD_G,
91  port map (
92  -- Trigger Input (locClk domain)
93  trigIn => trigIn(i),
94  -- Trigger Rate Output (locClk domain)
96  trigRateOut => trigRate(i),
97  -- Clocks
98  locClkEn => locClkEn,
99  locClk => locClk,
100  refClk => refClk);
101 
102  GEN_MAP :
103  for j in (CNT_WIDTH_G-1) downto 0 generate
104  trigRateOut(i, j) <= trigRate(i)(j);
105  end generate GEN_MAP;
106 
107  end generate GEN_VEC;
108 
109 end architecture mapping;
MyVectorArray FillVectorArrayINPUT,
in trigInslv( WIDTH_G- 1 downto 0)
IN_POLARITY_Gsl := '1'
out trigRateUpdatedsl
std_logic sl
Definition: StdRtlPkg.vhd:28
slv( WIDTH_G- 1 downto 0) trigRateUpdate
array(natural range <> ,natural range <> ) of sl SlVectorArray
Definition: StdRtlPkg.vhd:669
COMMON_CLK_Gboolean := false
REFRESH_RATE_Greal := 1.0E+0
( WIDTH_G- 1 downto 0) sl MyVectorArray
REFRESH_RATE_Greal := 1.0E+0
COMMON_CLK_Gboolean := false
CNT_WIDTH_Gpositive := 32
in locClkEnsl := '1'
USE_DSP48_Gstring := "no"
CNT_WIDTH_Gpositive := 32
ONE_SHOT_Gboolean := false
TPD_Gtime := 1 ns
USE_DSP48_Gstring := "no"
_library_ ieeeieee
REF_CLK_FREQ_Greal := 200.0E+6
ONE_SHOT_Gboolean := false
MyVectorArray := FillVectorArray(IN_POLARITY_G ) IN_POLARITY_C
REF_CLK_FREQ_Greal := 200.0E+6
out trigRateOutslv( CNT_WIDTH_G- 1 downto 0)
out trigRateOutSlVectorArray ( WIDTH_G- 1 downto 0, CNT_WIDTH_G- 1 downto 0)
( WIDTH_G- 1 downto 0) slv( CNT_WIDTH_G- 1 downto 0) MySlvArray
std_logic_vector slv
Definition: StdRtlPkg.vhd:29