1 ------------------------------------------------------------------------------- 2 -- File : GlinkDecoder.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2012-03-12 5 -- Last update: 2015-12-07 6 ------------------------------------------------------------------------------- 7 -- Description: Decoder for the Condition Inversion Master Transition coding 8 -- used by the GLink Protocol. 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 ------------------------------------------------------------------------------- 20 use ieee.std_logic_1164.
all;
24 use work.GlinkPkg.
all;
27 --! @ingroup protocols_glink_core 33 FLAGSEL_G : := false);
44 end entity GLinkDecoder;
48 type RegType is record 49 deglitch : slv(3 downto 0);
54 constant REG_INIT_C : RegType := ( 55 deglitch => (others => '0'), 59 signal r : RegType := REG_INIT_C;
79 variable glinkWordVar : GLinkWordType;
84 v.deglitch(3) := r.gLinkRx.error;
85 v.deglitch(2 downto 0) := r.deglitch(3 downto 1);
87 -- Update the TX and RX MGT ready values 91 -- Reset strobe signals 98 -- Convert input to GLinkWordType to use GLinkPkg functions for decoding 99 glinkWordVar := toGLinkWord(gtRxData);
101 if (not isValidWord(glinkWordVar)) then 102 -- Invalid input, don't decode 105 -- Valid input, decode the input 106 -- Check for control word 107 if (isControlWord(glinkWordVar)) then 108 -- Check for idle word (subcase of control word) 109 if (not isIdleWord(glinkWordVar)) then 112 v.gLinkRx.data := getControlPayload(glinkWordVar);
116 -- Check for data word 117 if (isDataWord(glinkWordVar)) then 118 -- Set the gLinkRx bus 121 v.gLinkRx.data := getDataPayload(gLinkWordVar);
-- Bit flip done by function 122 v.gLinkRx.flag := getFlag(gLinkWordVar);
123 -- Check if FLAG is used for additional error checking 128 -- Check for first data frame 130 -- First frame Detected 132 -- Latch the flag value 133 v.toggle := getFlag(gLinkWordVar);
135 -- Check for flag error 136 if (r.toggle = getFlag(gLinkWordVar)) then 137 -- Invalid flag detected 140 -- Latch the flag value 141 v.toggle := getFlag(gLinkWordVar);
147 -- Invert if necessary 148 if (isInvertedWord(glinkWordVar)) then 158 -- Register the variable for next clock cycle 168 seq :
process (
clk,
rst)
is 170 if rising_edge(clk) then 172 r <= rin after TPD_G;
175 -- Asynchronous Reset 177 r <= REG_INIT_C after TPD_G;
181 end architecture rtl;
in rstsl :=not RST_POLARITY_G
in gtRxDataslv( 19 downto 0)
RST_ASYNC_Gboolean := false
FLAGSEL_Gboolean := false
RST_ASYNC_Gboolean := false