SURF  1.0
JesdTxLane.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- File : JesdTxLane.vhd
3 -- Company : SLAC National Accelerator Laboratory
4 -- Created : 2015-04-14
5 -- Last update: 2015-04-24
6 -------------------------------------------------------------------------------
7 -- Description: JesdTx transmit single lane module
8 -- Transmitter for JESD204b standard.
9 -- Supports sub-class 1 deterministic latency.
10 -- Supports sub-class 0 non deterministic latency
11 -- Features:
12 -- - Synchronization FSM
13 -- - Comma transmission
14 -- - ILA Sequence generation
15 -- - Control character generation:
16 -- - A(K28.3) - x"7C" - End of multi-frame
17 -- - F(K28.7) - x"FC" - Inserted at the end of the frame
18 -- Status register encoding:
19 -- bit 0: GT Reset done
20 -- bit 1: Transmuting valid data
21 -- bit 2: Transmitting ILA sequence
22 -- bit 3: Synchronization input status
23 -- bit 4: TX module enabled status
24 -- bit 5: SysRef detected (active only when the lane is enabled)
25 --
26 -- Note: sampleData_i should be big endian and not byte swapped
27 -- First sample in time: sampleData_i(31 downto 16)
28 -- Second sample in time: sampleData_i(15 downto 0)
29 -------------------------------------------------------------------------------
30 -- This file is part of 'SLAC Firmware Standard Library'.
31 -- It is subject to the license terms in the LICENSE.txt file found in the
32 -- top-level directory of this distribution and at:
33 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
34 -- No part of 'SLAC Firmware Standard Library', including this file,
35 -- may be copied, modified, propagated, or distributed except according to
36 -- the terms contained in the LICENSE.txt file.
37 -------------------------------------------------------------------------------
38 
39 library ieee;
40 use ieee.std_logic_1164.all;
41 use ieee.std_logic_arith.all;
42 use ieee.std_logic_unsigned.all;
43 
44 use work.StdRtlPkg.all;
45 use work.Jesd204bPkg.all;
46 
47 --! @see entity
48  --! @ingroup protocols_jesd204b
49 entity JesdTxLane is
50  generic (
51  TPD_G : time := 1 ns;
52  F_G : positive := 2;
53  K_G : positive := 32
54  );
55  port (
56 
57  -- JESD
58  -- Clocks and Resets
59  devClk_i : in sl;
60  devRst_i : in sl;
61 
62  -- JESD subclass selection: '0' or '1'(default)
63  subClass_i : in sl;
64 
65  -- Control register
66  enable_i : in sl;
68  scrEnable_i : in sl;
69  inv_i : in sl;
70 
71  -- Local multi frame clock
72  lmfc_i : in sl;
73 
74  -- Synchronization request input
75  nSync_i : in sl;
76 
77  -- GT is ready to transmit data after reset
79 
80  -- SYSREF for subclass 1 fixed latency
81  sysRef_i : in sl;
82 
83  -- Status of the transmitter
84  status_o : out slv(TX_STAT_WIDTH_C-1 downto 0);
85 
86  -- Sample data input
87  sampleData_i : in slv((GT_WORD_SIZE_C*8)-1 downto 0);
88 
89  -- Data and character output and GT signals
91  );
92 end JesdTxLane;
93 
94 architecture rtl of JesdTxLane is
95 
96  -- Internal signals
97 
98  -- Control signals from FSM
99  signal s_dataValid : sl;
100  signal s_ila : sl;
101  signal s_refDetected: sl;
102 
103  -- Data-path
104  signal s_sampleDataMux : slv(r_jesdGtTx.data'range);
105  signal s_sampleKMux : slv(r_jesdGtTx.dataK'range);
106  signal s_ilaDataMux : slv(r_jesdGtTx.data'range);
107  signal s_ilaKMux : slv(r_jesdGtTx.dataK'range);
108  signal s_commaDataMux : slv(r_jesdGtTx.data'range);
109  signal s_commaKMux : slv(r_jesdGtTx.dataK'range);
110 
111  signal s_data_sel : slv(1 downto 0);
112 
113 begin
114 
115  -- Synchronization FSM
116  syncFSM_INST : entity work.JesdSyncFsmTx
117  generic map (
118  TPD_G => TPD_G,
119  NUM_ILAS_MF_G => 4)
120  port map (
121  clk => devClk_i,
122  rst => devRst_i,
124  enable_i => enable_i,
126  lmfc_i => lmfc_i,
127  nSync_i => nSync_i,
128  sysRef_i => sysRef_i,
129  dataValid_o => s_dataValid,
130  sysref_o => s_refDetected,
131  ila_o => s_ila
132  );
133 
134  ----------------------------------------------------
135  -- Comma character generation
136  COMMA_GEN : for I in GT_WORD_SIZE_C-1 downto 0 generate
137  s_commaDataMux(I*8+7 downto I*8) <= K_CHAR_C;
138  s_commaKMux(I) <= '1';
139  end generate COMMA_GEN;
140 
141  ----------------------------------------------------
142  -- Initial Synchronization Data Sequence (ILAS)
143  ilasGen_INST: entity work.JesdIlasGen
144  generic map (
145  TPD_G => TPD_G,
146  F_G => F_G)
147  port map (
148  clk => devClk_i,
149  rst => devRst_i,
150  enable_i => enable_i,
151  ilas_i => s_ila,
152  lmfc_i => lmfc_i,
153  ilasData_o => s_ilaDataMux,
154  ilasK_o => s_ilaKMux);
155 
156  ----------------------------------------------------
157  -- Sample data with added synchronization characters TODO
158  AlignChGen_INST: entity work.JesdAlignChGen
159  generic map (
160  TPD_G => TPD_G,
161  F_G => F_G)
162  port map (
163  clk => devClk_i,
164  rst => devRst_i,
167  inv_i => inv_i,
168  lmfc_i => lmfc_i,
169  dataValid_i => s_dataValid,
171  sampleData_o => s_sampleDataMux,
172  sampleK_o => s_sampleKMux);
173 
174  ----------------------------------------------------
175  -- Output multiplexers
176  s_data_sel <= s_dataValid & s_ila;
177 
178  with s_data_sel select
179  r_jesdGtTx.dataK <= s_commaKMux when "00",
180  s_ilaKMux when "01",
181  s_sampleKMux when "10",
182  s_commaKMux when others;
183 
184  with s_data_sel select
185  r_jesdGtTx.data <= s_commaDataMux when "00",
186  s_ilaDataMux when "01",
187  s_sampleDataMux when "10",
188  s_commaDataMux when others;
189 
190  -- Output assignment
191  status_o <= s_refDetected & enable_i & nSync_i & s_ila & s_dataValid & gtTxReady_i;
192  --------------------------------------------
193 end rtl;
K_Gpositive := 32
Definition: JesdTxLane.vhd:54
TPD_Gtime := 1 ns
in ilas_isl
Definition: JesdIlasGen.vhd:41
out ilasK_oslv( GT_WORD_SIZE_C- 1 downto 0)
Definition: JesdIlasGen.vhd:49
in devClk_isl
Definition: JesdTxLane.vhd:59
std_logic sl
Definition: StdRtlPkg.vhd:28
in subClass_isl
Definition: JesdTxLane.vhd:63
F_Gpositive := 2
slv( GT_WORD_SIZE_C- 1 downto 0) dataK
Definition: Jesd204bPkg.vhd:63
positive := 6 TX_STAT_WIDTH_C
Definition: Jesd204bPkg.vhd:46
out dataValid_osl
NUM_ILAS_MF_Gpositive := 4
in sampleData_islv( GT_WORD_SIZE_C* 8- 1 downto 0)
in enable_isl
Definition: JesdIlasGen.vhd:38
out status_oslv( TX_STAT_WIDTH_C- 1 downto 0)
Definition: JesdTxLane.vhd:84
in nSync_isl
Definition: JesdTxLane.vhd:75
TPD_Gtime := 1 ns
Definition: JesdTxLane.vhd:51
F_Gpositive := 2
Definition: JesdTxLane.vhd:52
in devRst_isl
Definition: JesdTxLane.vhd:60
slv( 7 downto 0) := x"BC" K_CHAR_C
Definition: Jesd204bPkg.vhd:35
in replEnable_isl
Definition: JesdTxLane.vhd:67
in scrEnable_isl
Definition: JesdTxLane.vhd:68
positive := 4 GT_WORD_SIZE_C
Definition: Jesd204bPkg.vhd:31
in inv_isl
Definition: JesdTxLane.vhd:69
out sampleData_oslv( GT_WORD_SIZE_C* 8- 1 downto 0)
in sampleData_islv(( GT_WORD_SIZE_C* 8)- 1 downto 0)
Definition: JesdTxLane.vhd:87
F_Gpositive := 2
Definition: JesdIlasGen.vhd:32
in enable_isl
Definition: JesdTxLane.vhd:66
in lmfc_isl
Definition: JesdTxLane.vhd:72
in sysRef_isl
Definition: JesdTxLane.vhd:81
out r_jesdGtTxjesdGtTxLaneType
Definition: JesdTxLane.vhd:91
in inv_isl := '0'
out sampleK_oslv( GT_WORD_SIZE_C- 1 downto 0)
TPD_Gtime := 1 ns
out ilasData_oslv( GT_WORD_SIZE_C* 8- 1 downto 0)
Definition: JesdIlasGen.vhd:47
_library_ ieeeieee
in lmfc_isl
Definition: JesdIlasGen.vhd:44
slv(( GT_WORD_SIZE_C* 8)- 1 downto 0) data
Definition: Jesd204bPkg.vhd:62
TPD_Gtime := 1 ns
Definition: JesdIlasGen.vhd:31
in gtTxReady_isl
Definition: JesdTxLane.vhd:78
std_logic_vector slv
Definition: StdRtlPkg.vhd:29