ROD firmware  1.0.5
ATLAS l1-calo - ROD_eFEX and ROD_jFEX firmware for the L1Calo ROD board

Back to ROD documentation
event_trailer_CRC20.vhd
1 ----------------------------------------------------------------------------------
2 -- Company:
3 -- Engineer:
4 --
5 -- Create Date: 21.09.2018 16:08:58
6 -- Design Name:
7 -- Module Name: event_trailer_CRC20 - RTL
8 -- Project Name:
9 -- Target Devices:
10 -- Tool Versions:
11 -- Description:
12 --
13 -- Dependencies:
14 --
15 -- Revision:
16 -- Revision 0.01 - File Created
17 -- Additional Comments:
18 --
19 ----------------------------------------------------------------------------------
20 
21 
22 library IEEE;
23 use IEEE.STD_LOGIC_1164.ALL;
24 
25 -- Uncomment the following library declaration if using
26 -- arithmetic functions with Signed or Unsigned values
27 --use IEEE.NUMERIC_STD.ALL;
28 
29 -- Uncomment the following library declaration if instantiating
30 -- any Xilinx leaf cells in this code.
31 --library UNISIM;
32 --use UNISIM.VComponents.all;
33 
34 
35 --the data input should be the event fifo input data
36 --when the trailer needs to be put into the crc, the sel_packet_trailer signal is activated and calc is activated
37 --this puts the trailer onto the fifo input, and the crc input, but fifo s_tvalid is not asserted so it doesn't go into the fifo
38 --the sel_packet_trailer signal also forces the crc field of the trailer to be all zeros for the calculation
39 
41  generic(
42  crc20_G_Poly : std_logic_vector(19 downto 0) := x"8349f"; --old poly
43  Nbits : positive := 64;
44  CRC_Width : positive := 20;
45  G_Poly: Std_Logic_Vector :=x"c1acf";
46  G_InitVal: std_logic_vector:=x"fffff"
47  );
48  Port (
49  CRC : out std_logic_vector(CRC_Width-1 downto 0);
50  Calc : in std_logic;
51  Clock : in std_logic;
52  S_tdata : in std_logic_vector(Nbits-1 downto 0);
53  crc_reset : in std_logic;
54  sel_packet_trailer : in std_logic
55 
56  );
58 
59 architecture RTL of event_trailer_CRC20 is
60 
61 component flx_CRC is
62  generic(
63  Nbits : positive := 64;
64  CRC_Width : positive := 20;
65  G_Poly: Std_Logic_Vector :=x"c1acf";
66  G_InitVal: std_logic_vector:=x"fffff"
67  );
68  port(
69  CRC : out std_logic_vector(CRC_Width-1 downto 0);
70  Calc : in std_logic;
71  Clk : in std_logic;
72  DIn : in std_logic_vector(Nbits-1 downto 0);
73  Reset : in std_logic);
74 end component;
75 
76 signal data : std_logic_vector(63 downto 0);
77 signal swap_data : std_logic_vector(63 downto 0);
78 
79 begin
80 
81 crc_block : flx_CRC
82  generic map (
83  Nbits => 64,
84  CRC_Width => 20,
85  -- G_Poly => x"c1acf",
86 -- G_Poly => x"8349f",
87  G_Poly => crc20_g_poly,
88  G_InitVal => x"fffff"
89  )
90  port map (
91  CRC => CRC,
92  Calc => Calc,
93  Clk => Clock,
94  DIn => swap_data,
95  Reset => crc_reset
96  );
97 
98 with sel_packet_trailer select
99  data <= (x"00000" & s_tdata(43 downto 32) & s_tdata(31 downto 0)) when '1',
100  s_tdata when others;
101 
102 
103 swap_data(31 downto 0) <= data(63 downto 32);
104 swap_data(63 downto 32) <= data(31 downto 0);
105 
106 --the crc input may need to be registered in orded for the crc to meet timing. This will add one more trailer build cycle
107 -- process (Clock) begin
108 -- if rising_edge (clock) then
109 -- data <= S_tdata;
110 -- end if;
111 -- end process;
112 
113 end RTL;
114 
115 
116 
117 
118 
119 
120