SURF  1.0
JesdIlasGen.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- File : JesdIlasGen.vhd
3 -- Company : SLAC National Accelerator Laboratory
4 -- Created : 2015-04-15
5 -- Last update: 2015-04-15
6 -------------------------------------------------------------------------------
7 -- Description: Initial lane alignment sequence Generator
8 -- Adds A na R characters at the LMFC borders.
9 -------------------------------------------------------------------------------
10 -- This file is part of 'SLAC Firmware Standard Library'.
11 -- It is subject to the license terms in the LICENSE.txt file found in the
12 -- top-level directory of this distribution and at:
13 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
14 -- No part of 'SLAC Firmware Standard Library', including this file,
15 -- may be copied, modified, propagated, or distributed except according to
16 -- the terms contained in the LICENSE.txt file.
17 -------------------------------------------------------------------------------
18 
19 library ieee;
20 use ieee.std_logic_1164.all;
21 use ieee.std_logic_unsigned.all;
22 use ieee.std_logic_arith.all;
23 
24 use work.StdRtlPkg.all;
25 use work.jesd204bpkg.all;
26 
27 --! @see entity
28  --! @ingroup protocols_jesd204b
29 entity JesdIlasGen is
30  generic (
31  TPD_G : time := 1 ns;
32  F_G : positive := 2);
33  port (
34  clk : in sl;
35  rst : in sl;
36 
37  -- Enable counter
38  enable_i : in sl;
39 
40  -- Increase counter
41  ilas_i : in sl;
42 
43  -- Increase counter
44  lmfc_i : in sl;
45 
46  -- Outs
47  ilasData_o : out slv(GT_WORD_SIZE_C*8-1 downto 0);
48  ilasK_o : out slv( GT_WORD_SIZE_C-1 downto 0)
49  );
50 end entity JesdIlasGen;
51 
52 architecture rtl of JesdIlasGen is
53 
54  type RegType is record
55  lmfcD1 : sl;
56  lmfcD2 : sl;
57  end record RegType;
58 
59  constant REG_INIT_C : RegType := (
60  lmfcD1 => '0',
61  lmfcD2 => '0'
62  );
63 
64  signal r : RegType := REG_INIT_C;
65  signal rin : RegType;
66 
67  --
68 begin
69 
70  comb : process (r, rst,lmfc_i,enable_i, ilas_i) is
71  variable v : RegType;
72  variable v_ilasData : slv(ilasData_o'range);
73  variable v_ilasK : slv(ilasK_o'range);
74  begin
75  v := r;
76 
77  -- Delay LMFC for 2 c-c
78  v.lmfcD1 := lmfc_i;
79  v.lmfcD2 := r.lmfcD1;
80 
81  -- Combinatorial logic
82  v_ilasData := (others => '0');
83  v_ilasK := (others => '0');
84 
85  if enable_i = '1' and ilas_i = '1' then
86  -- Send A character
87  if r.lmfcD1 = '1' then
88  v_ilasData(v_ilasData'high downto v_ilasData'high-7) := A_CHAR_C;
89  v_ilasK(v_ilasK'high) := '1';
90  end if;
91  -- Send R character
92  if r.lmfcD2 = '1' then
93  v_ilasData (7 downto 0) := R_CHAR_C;
94  v_ilasK(0) := '1';
95  end if;
96  end if;
97 
98  if (rst = '1') then
99  v := REG_INIT_C;
100  end if;
101 
102  rin <= v;
103 
104  -- Output assignment
105  ilasData_o <= v_ilasData;
106  ilasK_o <= v_ilasK;
107  end process comb;
108 
109  seq : process (clk) is
110  begin
111  if (rising_edge(clk)) then
112  r <= rin after TPD_G;
113  end if;
114  end process seq;
115 ---------------------------------------
116 end architecture rtl;
in ilas_isl
Definition: JesdIlasGen.vhd:41
out ilasK_oslv( GT_WORD_SIZE_C- 1 downto 0)
Definition: JesdIlasGen.vhd:49
std_logic sl
Definition: StdRtlPkg.vhd:28
in enable_isl
Definition: JesdIlasGen.vhd:38
_library_ ieeeieee
F_Gpositive := 2
Definition: JesdIlasGen.vhd:32
out ilasData_oslv( GT_WORD_SIZE_C* 8- 1 downto 0)
Definition: JesdIlasGen.vhd:47
in lmfc_isl
Definition: JesdIlasGen.vhd:44
TPD_Gtime := 1 ns
Definition: JesdIlasGen.vhd:31
std_logic_vector slv
Definition: StdRtlPkg.vhd:29