OpenCores
URL https://opencores.org/ocsvn/pcie_sg_dma/pcie_sg_dma/trunk

Subversion Repositories pcie_sg_dma

[/] [pcie_sg_dma/] [trunk/] [rtl/] [RxIn_Delays.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 weng_ziti
----------------------------------------------------------------------------------
2
-- Company:  ziti, Uni. HD
3
-- Engineer:  wgao
4
-- 
5
-- Design Name: 
6
-- Module Name:    RxIn_Delay - Behavioral 
7
-- Project Name: 
8
-- Target Devices: 
9
-- Tool versions: 
10
-- Description: 
11
--
12
-- Dependencies: 
13
--
14
-- Revision 1.00 - first release.  20.02.2007
15
-- 
16
-- Additional Comments: 
17
--
18
----------------------------------------------------------------------------------
19
 
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22
use IEEE.STD_LOGIC_ARITH.ALL;
23
use IEEE.STD_LOGIC_UNSIGNED.ALL;
24
 
25
library work;
26
use work.abb64Package.all;
27
 
28
-- Uncomment the following library declaration if instantiating
29
-- any Xilinx primitives in this code.
30
--library UNISIM;
31
--use UNISIM.VComponents.all;
32
 
33
entity RxIn_Delay is
34
    port (
35
      -- Common ports
36
      trn_clk            : IN  std_logic;
37
      trn_reset_n        : IN  std_logic;
38
      trn_lnk_up_n       : IN  std_logic;
39
 
40
      -- Transaction receive interface
41
      trn_rsof_n         : IN  std_logic;
42
      trn_reof_n         : IN  std_logic;
43
      trn_rd             : IN  std_logic_vector(C_DBUS_WIDTH-1 downto 0);
44
      trn_rrem_n         : IN  std_logic_vector(C_DBUS_WIDTH/8-1 downto 0);
45
      trn_rerrfwd_n      : IN  std_logic;
46
      trn_rsrc_rdy_n     : IN  std_logic;
47
      trn_rsrc_dsc_n     : IN  std_logic;
48
      trn_rbar_hit_n     : IN  std_logic_vector(C_BAR_NUMBER-1 downto 0);
49
      trn_rdst_rdy_n     : OUT std_logic;
50
      Pool_wrBuf_full    : IN  std_logic;
51
      Link_Buf_full      : IN  std_logic;
52
 
53
      -- Delay for one clock
54
      trn_rsof_n_dly     : OUT std_logic;
55
      trn_reof_n_dly     : OUT std_logic;
56
      trn_rd_dly         : OUT std_logic_vector(C_DBUS_WIDTH-1 downto 0);
57
      trn_rrem_n_dly     : OUT std_logic_vector(C_DBUS_WIDTH/8-1 downto 0);
58
      trn_rerrfwd_n_dly  : OUT std_logic;
59
      trn_rsrc_rdy_n_dly : OUT std_logic;
60
      trn_rdst_rdy_n_dly : OUT std_logic;
61
      trn_rsrc_dsc_n_dly : OUT std_logic;
62
      trn_rbar_hit_n_dly : OUT std_logic_vector(C_BAR_NUMBER-1 downto 0);
63
 
64
 
65
      -- TLP resolution
66
      IORd_Type          : OUT std_logic;
67
      IOWr_Type          : OUT std_logic;
68
      MRd_Type           : OUT std_logic_vector(3 downto 0);
69
      MWr_Type           : OUT std_logic_vector(1 downto 0);
70
      CplD_Type          : OUT std_logic_vector(3 downto 0);
71
 
72
      -- From Cpl/D channel
73
      usDMA_dex_Tag      : IN  std_logic_vector(C_TAG_WIDTH-1 downto 0);
74
      dsDMA_dex_Tag      : IN  std_logic_vector(C_TAG_WIDTH-1 downto 0);
75
 
76
      -- To Memory request process modules
77
      Tlp_straddles_4KB  : OUT std_logic;
78
 
79
      -- To Cpl/D channel
80
      Tlp_has_4KB        : OUT std_logic;
81
      Tlp_has_1DW        : OUT std_logic;
82
      CplD_is_the_Last   : OUT std_logic;
83
      CplD_on_Pool       : OUT std_logic;
84
      CplD_on_EB         : OUT std_logic;
85
      Req_ID_Match       : OUT std_logic;
86
      usDex_Tag_Matched  : OUT std_logic;
87
      dsDex_Tag_Matched  : OUT std_logic;
88
      CplD_Tag           : OUT std_logic_vector(C_TAG_WIDTH-1 downto  0);
89
 
90
 
91
      -- Additional
92
      cfg_dcommand       : IN  std_logic_vector(C_CFG_COMMAND_DWIDTH-1 downto 0);
93
      localID            : IN  std_logic_vector(C_ID_WIDTH-1 downto 0)
94
    );
95
 
96
end entity RxIn_Delay;
97
 
98
 
99
 
100
architecture Behavioral of RxIn_Delay is
101
 
102
 
103
-- Max Length Checking
104
   signal   Tlp_has_0_Length       :  std_logic;
105
   signal   Tlp_has_1DW_Length_i   :  std_logic;
106
   signal   MaxReadReqSize_Exceeded:  std_logic;
107
   signal   MaxPayloadSize_Exceeded:  std_logic;
108
 
109
   signal   Tlp_straddles_4KB_i    :  std_logic;
110
   signal   CarryIn_ALC            :  std_logic_vector(C_TLP_FLD_WIDTH_OF_LENG downto 0);
111
   signal   Tlp_has_4KB_i          :  std_logic;
112
   signal   cfg_MRS                :  std_logic_vector(C_CFG_MRS_BIT_TOP-C_CFG_MRS_BIT_BOT downto 0);
113
   signal   cfg_MPS                :  std_logic_vector(C_CFG_MPS_BIT_TOP-C_CFG_MPS_BIT_BOT downto 0);
114
 
115
   signal   cfg_MRS_decoded        :  std_logic_vector(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE);
116
   signal   cfg_MPS_decoded        :  std_logic_vector(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE);
117
 
118
   TYPE     CfgThreshold is ARRAY (C_TLP_FLD_WIDTH_OF_LENG-CBIT_SENSE_OF_MAXSIZE downto 0)
119
                                   of std_logic_vector (C_TLP_FLD_WIDTH_OF_LENG downto 0);
120
 
121
   signal   MaxSize_Thresholds     : CfgThreshold;
122
 
123
-- As one clock of delay
124
   signal   trn_rsof_n_r1          :  std_logic;
125
   signal   trn_reof_n_r1          :  std_logic;
126
   signal   trn_rrem_n_r1          :  std_logic_vector(C_DBUS_WIDTH/8-1 downto 0);
127
   signal   trn_rd_r1              :  std_logic_vector(C_DBUS_WIDTH-1 downto 0);
128
   signal   trn_rerrfwd_n_r1       :  std_logic;
129
   signal   trn_rsrc_rdy_n_r1      :  std_logic;
130
   signal   trn_rdst_rdy_n_i       :  std_logic;
131
   signal   trn_rdst_rdy_n_r1      :  std_logic;
132
   signal   trn_rsrc_dsc_n_r1      :  std_logic;
133
   signal   trn_rbar_hit_n_r1      :  std_logic_vector(C_BAR_NUMBER-1 downto 0);
134
 
135
-- TLP type decision
136
   signal   TLP_is_MRd_BAR0_H3DW   :  std_logic;
137
   signal   TLP_is_MRd_BAR1_H3DW   :  std_logic;
138
   signal   TLP_is_MRd_BAR2_H3DW   :  std_logic;
139
   signal   TLP_is_MRd_BAR3_H3DW   :  std_logic;
140
 
141
   signal   TLP_is_MRd_BAR0_H4DW   :  std_logic;
142
   signal   TLP_is_MRd_BAR1_H4DW   :  std_logic;
143
   signal   TLP_is_MRd_BAR2_H4DW   :  std_logic;
144
   signal   TLP_is_MRd_BAR3_H4DW   :  std_logic;
145
 
146
   signal   TLP_is_MRdLk_BAR0_H3DW :  std_logic;
147
   signal   TLP_is_MRdLk_BAR1_H3DW :  std_logic;
148
   signal   TLP_is_MRdLk_BAR2_H3DW :  std_logic;
149
   signal   TLP_is_MRdLk_BAR3_H3DW :  std_logic;
150
 
151
   signal   TLP_is_MRdLk_BAR0_H4DW :  std_logic;
152
   signal   TLP_is_MRdLk_BAR1_H4DW :  std_logic;
153
   signal   TLP_is_MRdLk_BAR2_H4DW :  std_logic;
154
   signal   TLP_is_MRdLk_BAR3_H4DW :  std_logic;
155
 
156
   signal   TLP_is_MWr_BAR0_H3DW   :  std_logic;
157
   signal   TLP_is_MWr_BAR1_H3DW   :  std_logic;
158
   signal   TLP_is_MWr_BAR2_H3DW   :  std_logic;
159
   signal   TLP_is_MWr_BAR3_H3DW   :  std_logic;
160
 
161
   signal   TLP_is_MWr_BAR0_H4DW   :  std_logic;
162
   signal   TLP_is_MWr_BAR1_H4DW   :  std_logic;
163
   signal   TLP_is_MWr_BAR2_H4DW   :  std_logic;
164
   signal   TLP_is_MWr_BAR3_H4DW   :  std_logic;
165
 
166
   signal   TLP_is_IORd_BAR0       :  std_logic;
167
   signal   TLP_is_IORd_BAR1       :  std_logic;
168
   signal   TLP_is_IORd_BAR2       :  std_logic;
169
   signal   TLP_is_IORd_BAR3       :  std_logic;
170
 
171
   signal   TLP_is_IOWr_BAR0       :  std_logic;
172
   signal   TLP_is_IOWr_BAR1       :  std_logic;
173
   signal   TLP_is_IOWr_BAR2       :  std_logic;
174
   signal   TLP_is_IOWr_BAR3       :  std_logic;
175
 
176
   signal   TLP_is_IORd            :  std_logic;
177
   signal   TLP_is_IOWr            :  std_logic;
178
 
179
   signal   TLP_is_CplD            :  std_logic;
180
   signal   TLP_is_Cpl             :  std_logic;
181
   signal   TLP_is_CplDLk          :  std_logic;
182
   signal   TLP_is_CplLk           :  std_logic;
183
 
184
 
185
   signal   TLP_is_MRd_H3DW        :  std_logic;
186
   signal   TLP_is_MRd_H4DW        :  std_logic;
187
   signal   TLP_is_MRdLk_H3DW      :  std_logic;
188
   signal   TLP_is_MRdLk_H4DW      :  std_logic;
189
 
190
   signal   TLP_is_MWr_H3DW        :  std_logic;
191
   signal   TLP_is_MWr_H4DW        :  std_logic;
192
 
193
 
194
   signal   IORd_Type_i            :  std_logic;
195
   signal   IOWr_Type_i            :  std_logic;
196
   signal   MRd_Type_i             :  std_logic_vector(3 downto 0);
197
   signal   MWr_Type_i             :  std_logic_vector(1 downto 0);
198
   signal   CplD_Type_i            :  std_logic_vector(3 downto 0);
199
 
200
   signal   Req_ID_Match_i         :  std_logic;
201
 
202
   signal   usDex_Tag_Matched_i    :  std_logic;
203
   signal   dsDex_Tag_Matched_i    :  std_logic;
204
 
205
 
206
   -----------------------------------------------------------------
207
   -- Inbound DW counter
208
   signal   TLP_Payload_Address_i  : std_logic_vector(C_DBUS_WIDTH-1   downto 0);
209
   signal   TLP_DW_Length_i        : std_logic_vector(C_TLP_FLD_WIDTH_OF_LENG-1 downto 0);
210
   signal   TLP_Address_sig        : std_logic_vector(C_TLP_FLD_WIDTH_OF_LENG   downto 0);
211
   signal   MWr_on_Pool            :  std_logic;
212
   signal   MWr_on_EB              :  std_logic;
213
   signal   CplD_on_Pool_i         : std_logic;
214
   signal   CplD_on_EB_i           : std_logic;
215
   signal   CplD_is_the_Last_i     : std_logic;
216
   signal   CplD_Tag_i             : std_logic_vector(C_TAG_WIDTH-1 downto  0);
217
 
218
   --   Counter inside a TLP
219
   type TLPCntStates is            ( TK_RST
220
                                   , TK_Idle
221
--                                   , TK_MWr_3Hdr_B
222
                                   , TK_MWr_3Hdr_C
223
--                                   , TK_MWr_4Hdr_B
224
                                   , TK_MWr_4Hdr_C
225
--                                   , TK_MWr_4Hdr_D
226
--                                   , TK_CplD_Hdr_B
227
                                   , TK_CplD_Hdr_C
228
                                   , TK_Body
229
                                   );
230
 
231
   signal FSM_TLP_Cnt              : TLPCntStates;
232
 
233
   signal FSM_TLP_Cnt_r1           : TLPCntStates;
234
 
235
   --   CplD tag capture FSM (Address at tRAM)
236
   type AddrOnRAM_States is        ( AOtSt_RST
237
                                   , AOtSt_Idle
238
                                   , AOtSt_HdrA
239
                                   , AOtSt_HdrB
240
                                   , AOtSt_Body
241
                                   );
242
 
243
   signal FSM_AOtRAM               : AddrOnRAM_States;
244
 
245
 
246
begin
247
 
248
   trn_rdst_rdy_n        <=  trn_rdst_rdy_n_i     ;   -- and trn_rsof_n and trn_rsof_n_r1  ;
249
 
250
   -- Delay
251
   trn_rsof_n_dly        <=  trn_rsof_n_r1        ;
252
   trn_reof_n_dly        <=  trn_reof_n_r1        ;
253
   trn_rrem_n_dly        <=  trn_rrem_n_r1        ;
254
   trn_rd_dly            <=  trn_rd_r1            ;
255
   trn_rerrfwd_n_dly     <=  trn_rerrfwd_n_r1     ;
256
   trn_rsrc_rdy_n_dly    <=  trn_rsrc_rdy_n_r1    ;
257
   trn_rdst_rdy_n_dly    <=  trn_rdst_rdy_n_r1    ;   -- trn_rdst_rdy_n_r1    ;
258
   trn_rsrc_dsc_n_dly    <=  trn_rsrc_dsc_n_r1    ;
259
   trn_rbar_hit_n_dly    <=  trn_rbar_hit_n_r1    ;
260
 
261
 
262
   -- TLP resolution
263
   IORd_Type             <=  '0' ;                 -- IORd_Type_i          ;
264
   IOWr_Type             <=  '0' ;                 -- IOWr_Type_i          ;
265
   MRd_Type              <=  MRd_Type_i           ;
266
   MWr_Type              <=  MWr_Type_i           ;
267
   CplD_Type             <=  CplD_Type_i          ;
268
 
269
   -- To Cpl/D channel
270
   Req_ID_Match          <=  Req_ID_Match_i       ;
271
 
272
   usDex_Tag_Matched     <=  usDex_Tag_Matched_i  ;
273
   dsDex_Tag_Matched     <=  dsDex_Tag_Matched_i  ;
274
 
275
   CplD_Tag              <=  CplD_Tag_i           ;
276
   CplD_is_the_Last      <=  CplD_is_the_Last_i   ;
277
   CplD_on_Pool          <=  CplD_on_Pool_i       ;
278
   CplD_on_EB            <=  CplD_on_EB_i         ;
279
 
280
 
281
   Tlp_has_4KB           <=  Tlp_has_4KB_i        ;
282
   Tlp_has_1DW           <=  Tlp_has_1DW_Length_i ;
283
 
284
   Tlp_straddles_4KB     <=  '0';                  --Tlp_straddles_4KB_i  ;
285
 
286
 
287
   --  !! !! 
288
   MaxReadReqSize_Exceeded  <=  '0';
289
   MaxPayloadSize_Exceeded  <=  '0';
290
 
291
 
292
 
293
----------------------------------------------
294
--
295
-- Synchronous Registered: TLP_DW_Length
296
--                         Tlp_has_4KB
297
--                         Tlp_has_1DW_Length
298
--                         Tlp_has_0_Length
299
--
300
   FSM_TLP_1ST_DW_Info:
301
   process ( trn_clk, trn_reset_n)
302
   begin
303
      if trn_reset_n = '0' then
304
         TLP_DW_Length_i        <= (OTHERS => '0');
305
         Tlp_has_4KB_i          <= '0';
306
         Tlp_has_1DW_Length_i   <= '0';
307
         Tlp_has_0_Length       <= '0';
308
 
309
      elsif trn_clk'event and trn_clk = '1' then
310
         if trn_rsof_n='0' then
311
            TLP_DW_Length_i        <= trn_rd(C_TLP_LENG_BIT_TOP downto C_TLP_LENG_BIT_BOT);
312
         else
313
            TLP_DW_Length_i        <= TLP_DW_Length_i;
314
         end if;
315
 
316
         if trn_rsof_n ='0' then
317
            if trn_rd(C_TLP_LENG_BIT_TOP downto C_TLP_LENG_BIT_BOT)=C_ALL_ZEROS(C_TLP_FLD_WIDTH_OF_LENG-1 downto 0) then
318
               Tlp_has_4KB_i <= '1' ;
319
            else
320
               Tlp_has_4KB_i <= '0' ;
321
            end if;
322
         else
323
            Tlp_has_4KB_i <= Tlp_has_4KB_i ;
324
         end if;
325
 
326
         if trn_rsof_n ='0' then
327
            if trn_rd(C_TLP_LENG_BIT_TOP downto C_TLP_LENG_BIT_BOT)
328
               = CONV_STD_LOGIC_VECTOR(1, C_TLP_FLD_WIDTH_OF_LENG) then
329
               Tlp_has_1DW_Length_i  <= '1';
330
            else
331
               Tlp_has_1DW_Length_i  <= '0';
332
            end if;
333
         else
334
            Tlp_has_1DW_Length_i  <= Tlp_has_1DW_Length_i;
335
         end if;
336
 
337
         if trn_rsof_n ='0' then
338
            if trn_rd(C_TLP_LENG_BIT_TOP downto C_TLP_LENG_BIT_BOT)
339
               = CONV_STD_LOGIC_VECTOR(1, C_TLP_FLD_WIDTH_OF_LENG)
340
               and trn_rd(2)='0' then
341
               Tlp_has_0_Length  <= '1';
342
            else
343
               Tlp_has_0_Length  <= '0';
344
            end if;
345
         else
346
            Tlp_has_0_Length  <= Tlp_has_0_Length;
347
         end if;
348
 
349
      end if;
350
   end process;
351
 
352
 
353
 
354
---- --------------------------------------------------------------------------
355
--   -- Max Payload Size bits
356
--   cfg_MPS               <= cfg_dcommand(C_CFG_MPS_BIT_TOP downto C_CFG_MPS_BIT_BOT);
357
--
358
--   -- Max Read Request Size bits
359
--   cfg_MRS               <= cfg_dcommand(C_CFG_MRS_BIT_TOP downto C_CFG_MRS_BIT_BOT);
360
--
361
--
362
--
363
--   -- --------------------------------
364
--   -- Decoding MPS
365
--   --
366
--   Trn_Rx_Decoding_MPS:
367
--   process ( trn_clk )
368
--   begin
369
--      if trn_clk'event and trn_clk = '1' then
370
--
371
--         case cfg_MPS is
372
--           when CONV_STD_LOGIC_VECTOR(0, 3) =>
373
--              cfg_MPS_decoded   <= MaxSize_Thresholds(0)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE);
374
--
375
--           when CONV_STD_LOGIC_VECTOR(1, 3) =>
376
--              cfg_MPS_decoded   <= MaxSize_Thresholds(1)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE);
377
--
378
--           when CONV_STD_LOGIC_VECTOR(2, 3) =>
379
--              cfg_MPS_decoded   <= MaxSize_Thresholds(2)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE);
380
--
381
--           when CONV_STD_LOGIC_VECTOR(3, 3) =>
382
--              cfg_MPS_decoded   <= MaxSize_Thresholds(3)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE);
383
--
384
--           when CONV_STD_LOGIC_VECTOR(4, 3) =>
385
--              cfg_MPS_decoded   <= MaxSize_Thresholds(4)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE);
386
--
387
--           when CONV_STD_LOGIC_VECTOR(5, 3) =>
388
--              cfg_MPS_decoded   <= MaxSize_Thresholds(5)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE);
389
--
390
--           when Others =>
391
--              cfg_MPS_decoded   <= MaxSize_Thresholds(0)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE);
392
--
393
--         end case;
394
--
395
--      end if;
396
--   end process;
397
--
398
--
399
--   -- --------------------------------
400
--   -- Decoding MRS
401
--   --
402
--   Trn_Rx_Decoding_MRS:
403
--   process ( trn_clk )
404
--   begin
405
--      if trn_clk'event and trn_clk = '1' then
406
--
407
--         case cfg_MRS is
408
--           when CONV_STD_LOGIC_VECTOR(0, 3) =>
409
--              cfg_MRS_decoded   <= MaxSize_Thresholds(0)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE);
410
--
411
--           when CONV_STD_LOGIC_VECTOR(1, 3) =>
412
--              cfg_MRS_decoded   <= MaxSize_Thresholds(1)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE);
413
--
414
--           when CONV_STD_LOGIC_VECTOR(2, 3) =>
415
--              cfg_MRS_decoded   <= MaxSize_Thresholds(2)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE);
416
--
417
--           when CONV_STD_LOGIC_VECTOR(3, 3) =>
418
--              cfg_MRS_decoded   <= MaxSize_Thresholds(3)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE);
419
--
420
--           when CONV_STD_LOGIC_VECTOR(4, 3) =>
421
--              cfg_MRS_decoded   <= MaxSize_Thresholds(4)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE);
422
--
423
--           when CONV_STD_LOGIC_VECTOR(5, 3) =>
424
--              cfg_MRS_decoded   <= MaxSize_Thresholds(5)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE);
425
--
426
--           when Others =>
427
--              cfg_MRS_decoded   <= MaxSize_Thresholds(0)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE);
428
--
429
--         end case;
430
--
431
--      end if;
432
--   end process;
433
--
434
--
435
--   -------------------------------------------------------------
436
--   MaxSize_Thresholds(0) <= (CBIT_SENSE_OF_MAXSIZE=>'1', Others=>'0');
437
--   Gen_MaxSizes:
438
--   FOR i IN 1 TO C_TLP_FLD_WIDTH_OF_LENG-CBIT_SENSE_OF_MAXSIZE GENERATE
439
--     MaxSize_Thresholds(i) <= MaxSize_Thresholds(i-1)(C_TLP_FLD_WIDTH_OF_LENG-1 downto 0)&'0';
440
--   END GENERATE;
441
--
442
--   -- --------------------------------
443
--   -- Calculation of MPS exceed
444
--   --
445
--   Trn_Rx_MaxPayloadSize_Exceeded:
446
--   process ( trn_clk )
447
--   begin
448
--      if trn_clk'event and trn_clk = '1' then
449
--
450
--         case cfg_MPS_decoded is
451
--
452
----           when CONV_STD_LOGIC_VECTOR(1, 6)  =>   -- MaxSize_Thresholds(0)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE) =>
453
----             if trn_rd(C_TLP_FLD_WIDTH_OF_LENG-1 downto 0) > MaxSize_Thresholds(0) then
454
----                MaxPayloadSize_Exceeded <= '1';
455
----             else
456
----                MaxPayloadSize_Exceeded <= '0';
457
----             end if;
458
--
459
--           when CONV_STD_LOGIC_VECTOR(2, 6)  =>   -- MaxSize_Thresholds(1)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE) =>
460
--             if trn_rd(C_TLP_FLD_WIDTH_OF_LENG-1 downto 0) > MaxSize_Thresholds(1) then
461
--                MaxPayloadSize_Exceeded <= '1';
462
--             else
463
--                MaxPayloadSize_Exceeded <= '0';
464
--             end if;
465
--
466
--           when CONV_STD_LOGIC_VECTOR(4, 6)  =>   -- MaxSize_Thresholds(2)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE) =>
467
--             if trn_rd(C_TLP_FLD_WIDTH_OF_LENG-1 downto 0) > MaxSize_Thresholds(2) then
468
--                MaxPayloadSize_Exceeded <= '1';
469
--             else
470
--                MaxPayloadSize_Exceeded <= '0';
471
--             end if;
472
--
473
--           when CONV_STD_LOGIC_VECTOR(8, 6)  =>   -- MaxSize_Thresholds(3)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE) =>
474
--             if trn_rd(C_TLP_FLD_WIDTH_OF_LENG-1 downto 0) > MaxSize_Thresholds(3) then
475
--                MaxPayloadSize_Exceeded <= '1';
476
--             else
477
--                MaxPayloadSize_Exceeded <= '0';
478
--             end if;
479
--
480
--           when CONV_STD_LOGIC_VECTOR(16, 6)  =>   -- MaxSize_Thresholds(4)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE) =>
481
--             if trn_rd(C_TLP_FLD_WIDTH_OF_LENG-1 downto 0) > MaxSize_Thresholds(4) then
482
--                MaxPayloadSize_Exceeded <= '1';
483
--             else
484
--                MaxPayloadSize_Exceeded <= '0';
485
--             end if;
486
--
487
--           when CONV_STD_LOGIC_VECTOR(32, 6)  =>   -- MaxSize_Thresholds(5)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE) =>
488
--                MaxPayloadSize_Exceeded <= '0';            -- !!
489
--
490
--           when OTHERS  =>
491
--             if trn_rd(C_TLP_FLD_WIDTH_OF_LENG-1 downto 0) > MaxSize_Thresholds(0) then
492
--                MaxPayloadSize_Exceeded <= '1';
493
--             else
494
--                MaxPayloadSize_Exceeded <= '0';
495
--             end if;
496
--
497
--        end case;
498
--
499
--      end if;
500
--   end process;
501
--
502
--
503
--   -- --------------------------------
504
--   -- Calculation of MRS exceed
505
--   --
506
--   Trn_Rx_MaxReadReqSize_Exceeded:
507
--   process ( trn_clk )
508
--   begin
509
--      if trn_clk'event and trn_clk = '1' then
510
--
511
--         case cfg_MRS_decoded is
512
--
513
----           when CONV_STD_LOGIC_VECTOR(1, 6)  =>   -- MaxSize_Thresholds(0)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE) =>
514
----             if trn_rd(C_TLP_FLD_WIDTH_OF_LENG-1 downto 0) > MaxSize_Thresholds(0) then
515
----                MaxReadReqSize_Exceeded <= '1';
516
----             else
517
----                MaxReadReqSize_Exceeded <= '0';
518
----             end if;
519
--
520
--           when CONV_STD_LOGIC_VECTOR(2, 6)  =>   -- MaxSize_Thresholds(1)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE) =>
521
--             if trn_rd(C_TLP_FLD_WIDTH_OF_LENG-1 downto 0) > MaxSize_Thresholds(1) then
522
--                MaxReadReqSize_Exceeded <= '1';
523
--             else
524
--                MaxReadReqSize_Exceeded <= '0';
525
--             end if;
526
--
527
--           when CONV_STD_LOGIC_VECTOR(4, 6)  =>   -- MaxSize_Thresholds(2)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE) =>
528
--             if trn_rd(C_TLP_FLD_WIDTH_OF_LENG-1 downto 0) > MaxSize_Thresholds(2) then
529
--                MaxReadReqSize_Exceeded <= '1';
530
--             else
531
--                MaxReadReqSize_Exceeded <= '0';
532
--             end if;
533
--
534
--           when CONV_STD_LOGIC_VECTOR(8, 6)  =>   -- MaxSize_Thresholds(3)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE) =>
535
--             if trn_rd(C_TLP_FLD_WIDTH_OF_LENG-1 downto 0) > MaxSize_Thresholds(3) then
536
--                MaxReadReqSize_Exceeded <= '1';
537
--             else
538
--                MaxReadReqSize_Exceeded <= '0';
539
--             end if;
540
--
541
--           when CONV_STD_LOGIC_VECTOR(16, 6)  =>   -- MaxSize_Thresholds(4)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE) =>
542
--             if trn_rd(C_TLP_FLD_WIDTH_OF_LENG-1 downto 0) > MaxSize_Thresholds(4) then
543
--                MaxReadReqSize_Exceeded <= '1';
544
--             else
545
--                MaxReadReqSize_Exceeded <= '0';
546
--             end if;
547
--
548
--           when CONV_STD_LOGIC_VECTOR(32, 6)  =>   -- MaxSize_Thresholds(5)(C_TLP_FLD_WIDTH_OF_LENG downto CBIT_SENSE_OF_MAXSIZE) =>
549
--                MaxReadReqSize_Exceeded <= '0';            -- !!
550
--
551
--           when OTHERS  =>
552
--             if trn_rd(C_TLP_FLD_WIDTH_OF_LENG-1 downto 0) > MaxSize_Thresholds(0) then
553
--                MaxReadReqSize_Exceeded <= '1';
554
--             else
555
--                MaxReadReqSize_Exceeded <= '0';
556
--             end if;
557
--
558
--        end case;
559
--
560
--      end if;
561
--   end process;
562
 
563
 
564
 
565
 
566
   --    ---------------------------------------------------------
567
   ----  Pipelining all trn_rx input signals for one clock
568
   ----    to get better timing
569
   ---- 
570
   Trn_Rx_Inputs_Delayed:
571
   process ( trn_clk )
572
   begin
573
      if trn_clk'event and trn_clk = '1' then
574
         trn_rsof_n_r1      <= trn_rsof_n;
575
         trn_reof_n_r1      <= trn_reof_n;
576
         trn_rrem_n_r1      <= trn_rrem_n;
577
         trn_rd_r1          <= trn_rd;
578
         trn_rerrfwd_n_r1   <= trn_rerrfwd_n;
579
         trn_rsrc_rdy_n_r1  <= trn_rsrc_rdy_n;
580
         trn_rdst_rdy_n_r1  <= trn_rdst_rdy_n_i;
581
         trn_rsrc_dsc_n_r1  <= trn_rsrc_dsc_n;
582
         trn_rbar_hit_n_r1  <= trn_rbar_hit_n;
583
      end if;
584
   end process;
585
 
586
 
587
   -- -----------------------------------------
588
   -- TLP Types
589
   --
590
   TLP_Decision_Registered:
591
   process ( trn_clk, trn_reset_n)
592
   begin
593
      if trn_reset_n = '0' then
594
         TLP_is_MRd_H3DW   <= '0';
595
 
596
         TLP_is_MRdLk_H3DW <= '0';
597
 
598
         TLP_is_MRd_H4DW   <= '0';
599
 
600
         TLP_is_MRdLk_H4DW <= '0';
601
 
602
         TLP_is_MWr_H3DW   <= '0';
603
 
604
         TLP_is_MWr_H4DW   <= '0';
605
 
606
         TLP_is_IORd       <= '0';
607
 
608
         TLP_is_IOWr       <= '0';
609
 
610
         TLP_is_CplD       <= '0';
611
         TLP_is_CplDLk     <= '0';
612
         TLP_is_Cpl        <= '0';
613
         TLP_is_CplLk      <= '0';
614
 
615
      elsif trn_clk'event and trn_clk = '1' then
616
 
617
         -- IORd
618
         if     trn_rd(C_TLP_FMT_BIT_TOP  downto C_TLP_FMT_BIT_BOT)  = C_FMT3_NO_DATA
619
            and trn_rd(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT) = C_TYPE_IO_REQ
620
            and trn_rd(C_TLP_EP_BIT) ='0'
621
--            and trn_rbar_hit_n(CINT_REGS_SPACE_BAR) ='0'
622
            and trn_rbar_hit_n(CINT_BAR_SPACES-1 downto 0) /= C_ALL_ONES(CINT_BAR_SPACES-1 downto 0)
623
            and trn_rsrc_rdy_n ='0'
624
            and trn_rsof_n ='0'
625
            then
626
                TLP_is_IORd   <= '1';
627
         else
628
                TLP_is_IORd   <= '0';
629
         end if;
630
 
631
 
632
         -- IOWr
633
         if     trn_rd(C_TLP_FMT_BIT_TOP  downto C_TLP_FMT_BIT_BOT)  = C_FMT3_WITH_DATA
634
            and trn_rd(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT) = C_TYPE_IO_REQ
635
            and trn_rd(C_TLP_EP_BIT) ='0'
636
--            and trn_rbar_hit_n(CINT_REGS_SPACE_BAR) ='0'
637
            and trn_rbar_hit_n(CINT_BAR_SPACES-1 downto 0) /= C_ALL_ONES(CINT_BAR_SPACES-1 downto 0)
638
            and trn_rsrc_rdy_n ='0'
639
            and trn_rsof_n ='0'
640
            then
641
                TLP_is_IOWr   <= '1';
642
         else
643
                TLP_is_IOWr   <= '0';
644
         end if;
645
 
646
 
647
         -- MRd
648
         if     trn_rd(C_TLP_FMT_BIT_TOP  downto C_TLP_FMT_BIT_BOT)  = C_FMT3_NO_DATA
649
            and trn_rd(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT) = C_TYPE_MEM_REQ
650
            and trn_rd(C_TLP_EP_BIT) ='0'
651
--            and trn_rbar_hit_n(CINT_REGS_SPACE_BAR) ='0'
652
            and trn_rbar_hit_n(CINT_BAR_SPACES-1 downto 0) /= C_ALL_ONES(CINT_BAR_SPACES-1 downto 0)
653
            and trn_rsrc_rdy_n ='0'
654
            and trn_rsof_n ='0'
655
            then
656
                TLP_is_MRd_H3DW   <= '1';
657
         else
658
                TLP_is_MRd_H3DW   <= '0';
659
         end if;
660
 
661
 
662
 
663
         if     trn_rd(C_TLP_FMT_BIT_TOP  downto C_TLP_FMT_BIT_BOT)  = C_FMT4_NO_DATA
664
            and trn_rd(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT) = C_TYPE_MEM_REQ
665
            and trn_rd(C_TLP_EP_BIT) ='0'
666
--            and trn_rbar_hit_n(CINT_REGS_SPACE_BAR) ='0'
667
            and trn_rbar_hit_n(CINT_BAR_SPACES-1 downto 0) /= C_ALL_ONES(CINT_BAR_SPACES-1 downto 0)
668
            and trn_rsrc_rdy_n ='0'
669
            and trn_rsof_n ='0'
670
            then
671
                TLP_is_MRd_H4DW   <= '1';
672
         else
673
                TLP_is_MRd_H4DW   <= '0';
674
         end if;
675
 
676
 
677
         -- MRdLk
678
         if     trn_rd(C_TLP_FMT_BIT_TOP  downto C_TLP_FMT_BIT_BOT)  = C_FMT3_NO_DATA
679
            and trn_rd(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT) = C_TYPE_MEM_REQ_LK
680
            and trn_rd(C_TLP_EP_BIT) ='0'
681
--            and trn_rbar_hit_n(CINT_REGS_SPACE_BAR) ='0'
682
            and trn_rbar_hit_n(CINT_BAR_SPACES-1 downto 0) /= C_ALL_ONES(CINT_BAR_SPACES-1 downto 0)
683
            and trn_rsrc_rdy_n ='0'
684
            and trn_rsof_n ='0'
685
            then
686
                TLP_is_MRdLk_H3DW   <= '1';
687
         else
688
                TLP_is_MRdLk_H3DW   <= '0';
689
         end if;
690
 
691
 
692
         if     trn_rd(C_TLP_FMT_BIT_TOP  downto C_TLP_FMT_BIT_BOT)  = C_FMT4_NO_DATA
693
            and trn_rd(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT) = C_TYPE_MEM_REQ_LK
694
            and trn_rd(C_TLP_EP_BIT) ='0'
695
--            and trn_rbar_hit_n(CINT_REGS_SPACE_BAR) ='0'
696
            and trn_rbar_hit_n(CINT_BAR_SPACES-1 downto 0) /= C_ALL_ONES(CINT_BAR_SPACES-1 downto 0)
697
            and trn_rsrc_rdy_n ='0'
698
            and trn_rsof_n ='0'
699
            then
700
                TLP_is_MRdLk_H4DW   <= '1';
701
         else
702
                TLP_is_MRdLk_H4DW   <= '0';
703
         end if;
704
 
705
 
706
 
707
         -- MWr
708
         if     trn_rd(C_TLP_FMT_BIT_TOP  downto C_TLP_FMT_BIT_BOT)  = C_FMT3_WITH_DATA
709
            and trn_rd(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT) = C_TYPE_MEM_REQ
710
            and trn_rd(C_TLP_EP_BIT) ='0'
711
--            and trn_rbar_hit_n(CINT_REGS_SPACE_BAR) ='0'
712
            and trn_rbar_hit_n(CINT_BAR_SPACES-1 downto 0) /= C_ALL_ONES(CINT_BAR_SPACES-1 downto 0)
713
            and trn_rsrc_rdy_n ='0'
714
            and trn_rsof_n ='0'
715
            then
716
                TLP_is_MWr_H3DW   <= '1';
717
         else
718
                TLP_is_MWr_H3DW   <= '0';
719
         end if;
720
 
721
 
722
         if     trn_rd(C_TLP_FMT_BIT_TOP  downto C_TLP_FMT_BIT_BOT)  = C_FMT4_WITH_DATA
723
            and trn_rd(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT) = C_TYPE_MEM_REQ
724
            and trn_rd(C_TLP_EP_BIT) ='0'
725
--            and trn_rbar_hit_n(CINT_REGS_SPACE_BAR) ='0'
726
            and trn_rbar_hit_n(CINT_BAR_SPACES-1 downto 0) /= C_ALL_ONES(CINT_BAR_SPACES-1 downto 0)
727
            and trn_rsrc_rdy_n ='0'
728
            and trn_rsof_n ='0'
729
            then
730
                TLP_is_MWr_H4DW   <= '1';
731
         else
732
                TLP_is_MWr_H4DW   <= '0';
733
         end if;
734
 
735
 
736
 
737
         -- CplD, Cpl/CplDLk, CplLk
738
         if     trn_rd(C_TLP_FMT_BIT_TOP  downto C_TLP_FMT_BIT_BOT)  = C_FMT3_WITH_DATA
739
            and trn_rd(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT) = C_TYPE_COMPLETION
740
            and trn_rd(C_TLP_EP_BIT) ='0'
741
            and trn_rsrc_rdy_n ='0'
742
            and trn_rsof_n ='0'
743
            then
744
                TLP_is_CplD     <= '1';
745
         else
746
                TLP_is_CplD     <= '0';
747
         end if;
748
 
749
         if     trn_rd(C_TLP_FMT_BIT_TOP  downto C_TLP_FMT_BIT_BOT)  = C_FMT3_WITH_DATA
750
            and trn_rd(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT) = C_TYPE_COMPLETION_LK
751
            and trn_rd(C_TLP_EP_BIT) ='0'
752
            and trn_rsrc_rdy_n ='0'
753
            and trn_rsof_n ='0'
754
            then
755
                TLP_is_CplDLk   <= '1';
756
         else
757
                TLP_is_CplDLk   <= '0';
758
         end if;
759
 
760
 
761
         if     trn_rd(C_TLP_FMT_BIT_TOP  downto C_TLP_FMT_BIT_BOT)  = C_FMT3_NO_DATA
762
            and trn_rd(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT) = C_TYPE_COMPLETION
763
            and trn_rd(C_TLP_EP_BIT) ='0'
764
            and trn_rsrc_rdy_n ='0'
765
            and trn_rsof_n ='0'
766
            then
767
                TLP_is_Cpl      <= '1';
768
         else
769
                TLP_is_Cpl      <= '0';
770
         end if;
771
 
772
         if     trn_rd(C_TLP_FMT_BIT_TOP  downto C_TLP_FMT_BIT_BOT)  = C_FMT3_NO_DATA
773
            and trn_rd(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT) = C_TYPE_COMPLETION_LK
774
            and trn_rd(C_TLP_EP_BIT) ='0'
775
            and trn_rsrc_rdy_n ='0'
776
            and trn_rsof_n ='0'
777
            then
778
                TLP_is_CplLk    <= '1';
779
         else
780
                TLP_is_CplLk    <= '0';
781
         end if;
782
 
783
      end if;
784
   end process;
785
 
786
 
787
-- --------------------------------------------------------------------------
788
--   TLP_is_IORd        <=  TLP_is_IORd_BAR0       or TLP_is_IORd_BAR1;
789
--   TLP_is_IOWr        <=  TLP_is_IOWr_BAR0       or TLP_is_IOWr_BAR1;
790
 
791
--   TLP_is_MRd_H3DW    <=  TLP_is_MRd_BAR0_H3DW   or TLP_is_MRd_BAR1_H3DW;
792
--   TLP_is_MRdLk_H3DW  <=  TLP_is_MRdLk_BAR0_H3DW or TLP_is_MRdLk_BAR1_H3DW;
793
 
794
--   TLP_is_MRd_H4DW    <=  TLP_is_MRd_BAR0_H4DW   or TLP_is_MRd_BAR1_H4DW;
795
--   TLP_is_MRdLk_H4DW  <=  TLP_is_MRdLk_BAR0_H4DW or TLP_is_MRdLk_BAR1_H4DW;
796
 
797
--   TLP_is_MWr_H3DW    <=  TLP_is_MWr_BAR0_H3DW   or TLP_is_MWr_BAR1_H3DW;
798
 
799
--   TLP_is_MWr_H4DW    <=  TLP_is_MWr_BAR0_H4DW   or TLP_is_MWr_BAR1_H4DW;
800
 
801
-- --------------------------------------------------------------------------
802
 
803
   IORd_Type_i    <= TLP_is_IORd and Tlp_has_1DW_Length_i;
804
   IOWr_Type_i    <= TLP_is_IOWr and Tlp_has_1DW_Length_i;
805
 
806
 
807
   MRd_Type_i     <= (TLP_is_MRd_H3DW   and not MaxReadReqSize_Exceeded)
808
                   & (TLP_is_MRdLk_H3DW and not MaxReadReqSize_Exceeded)
809
                   & (TLP_is_MRd_H4DW   and not MaxReadReqSize_Exceeded)
810
                   & (TLP_is_MRdLk_H4DW and not MaxReadReqSize_Exceeded)
811
                   ;
812
 
813
   MWr_Type_i     <= (TLP_is_MWr_H3DW   and not MaxPayloadSize_Exceeded)
814
                   & (TLP_is_MWr_H4DW   and not MaxPayloadSize_Exceeded)
815
                   ;
816
 
817
   CplD_Type_i    <= (TLP_is_CplD       and not MaxPayloadSize_Exceeded)
818
                   & (TLP_is_Cpl        and not MaxPayloadSize_Exceeded)
819
                   & (TLP_is_CplDLk     and not MaxPayloadSize_Exceeded)
820
                   & (TLP_is_CplLk      and not MaxPayloadSize_Exceeded)
821
                   ;
822
 
823
 
824
   ---------------------------------------------------
825
   --
826
   -- Synchronous Registered: TLP_Header_Resolution
827
   --
828
   FSM_TLP_Header_Resolution:
829
   process ( trn_clk, trn_reset_n)
830
   begin
831
      if trn_reset_n = '0' then
832
         FSM_TLP_Cnt           <= TK_RST;
833
         TLP_Payload_Address_i <= (OTHERS => '1');
834
         MWr_on_Pool           <= '0';
835
         CplD_on_Pool_i        <= '0';
836
         CplD_on_EB_i          <= '0';
837
         trn_rdst_rdy_n_i      <= '1';
838
 
839
      elsif trn_clk'event and trn_clk = '1' then
840
 
841
        -- States transition
842
        case FSM_TLP_Cnt is
843
 
844
          when TK_RST =>
845
              FSM_TLP_Cnt           <= TK_Idle;
846
              trn_rdst_rdy_n_i      <= '1';
847
 
848
          when TK_Idle =>
849
            trn_rdst_rdy_n_i      <= '0';
850
            if trn_rsof_n='0' and trn_rsrc_rdy_n='0'
851
               and trn_rd(C_TLP_FMT_BIT_TOP downto C_TLP_FMT_BIT_BOT) ="10"
852
               and trn_rd(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_TOP-1) ="00"
853
               then
854
              FSM_TLP_Cnt    <= TK_MWr_3Hdr_C;
855
            elsif trn_rsof_n='0' and trn_rsrc_rdy_n='0'
856
               and trn_rd(C_TLP_FMT_BIT_TOP downto C_TLP_FMT_BIT_BOT) ="11"
857
               and trn_rd(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_TOP-1) ="00"
858
               then
859
              FSM_TLP_Cnt    <= TK_MWr_4Hdr_C;
860
            elsif trn_rsof_n='0' and trn_rsrc_rdy_n='0'
861
               and trn_rd(C_TLP_FMT_BIT_TOP downto C_TLP_FMT_BIT_BOT) ="10"
862
               and trn_rd(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_TOP-1) ="01"
863
               then
864
              FSM_TLP_Cnt    <= TK_CplD_Hdr_C;
865
            else
866
              FSM_TLP_Cnt    <= TK_Idle;
867
            end if;
868
 
869
 
870
          when TK_MWr_3Hdr_C =>
871
            trn_rdst_rdy_n_i      <= '0';
872
            if trn_reof_n='0' and trn_reof_n_r1='1' then  -- falling edge
873
              FSM_TLP_Cnt    <= TK_Idle;
874
            elsif trn_rsrc_rdy_n='1' then
875
              FSM_TLP_Cnt    <= TK_MWr_3Hdr_C;
876
            else
877
              FSM_TLP_Cnt    <= TK_Body;
878
            end if;
879
 
880
          when TK_MWr_4Hdr_C =>
881
            trn_rdst_rdy_n_i      <= '0';
882
            if trn_reof_n='0' and trn_reof_n_r1='1' then  -- falling edge
883
              FSM_TLP_Cnt    <= TK_Idle;
884
            elsif trn_rsrc_rdy_n='1' then
885
              FSM_TLP_Cnt    <= TK_MWr_4Hdr_C;
886
            else
887
              FSM_TLP_Cnt    <= TK_Body;      -- TK_MWr_4Hdr_D;
888
            end if;
889
 
890
 
891
          when TK_Cpld_Hdr_C =>
892
            trn_rdst_rdy_n_i      <= '0';
893
            if trn_reof_n='0' and trn_reof_n_r1='1' then  -- falling edge
894
              FSM_TLP_Cnt    <= TK_Idle;
895
            elsif trn_rsrc_rdy_n='1' then
896
              FSM_TLP_Cnt    <= TK_Cpld_Hdr_C;
897
            else
898
              FSM_TLP_Cnt    <= TK_Body;
899
            end if;
900
 
901
 
902
          when TK_Body =>
903
            if trn_reof_n='0' and trn_reof_n_r1='1' then  -- falling edge
904
              FSM_TLP_Cnt    <= TK_Idle;
905
              trn_rdst_rdy_n_i      <= '0';
906
            else
907
              FSM_TLP_Cnt    <= TK_Body;
908
              trn_rdst_rdy_n_i      <= ((MWr_on_Pool or CplD_on_Pool_i) and Pool_wrBuf_full)
909
                                    or ((MWr_on_EB or CplD_on_EB_i) and Link_Buf_full)
910
                                    ;
911
            end if;
912
 
913
 
914
          when OTHERS  =>
915
              trn_rdst_rdy_n_i    <= trn_rdst_rdy_n_i;
916
              FSM_TLP_Cnt    <= TK_RST;
917
 
918
        end case;
919
 
920
 
921
        -- MWr_on_Pool
922
        case FSM_TLP_Cnt is
923
 
924
          when TK_RST =>
925
              MWr_on_Pool   <= '0';
926
              MWr_on_EB     <= '0';
927
 
928
          when TK_Idle =>
929
            if trn_rsof_n='0' and trn_rsrc_rdy_n='0'
930
               and trn_rd(C_TLP_FMT_BIT_TOP) = '1'
931
               and trn_rd(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_TOP-1) ="00"
932
               then
933
              MWr_on_Pool   <= not trn_rbar_hit_n(CINT_DDR_SPACE_BAR);
934
              MWr_on_EB     <= not trn_rbar_hit_n(CINT_FIFO_SPACE_BAR);
935
            else
936
              MWr_on_Pool   <= MWr_on_Pool;
937
              MWr_on_EB     <= MWr_on_EB;
938
            end if;
939
 
940
 
941
          when OTHERS  =>
942
              MWr_on_Pool   <= MWr_on_Pool;
943
              if trn_reof_n='0' and trn_reof_n_r1='1' then  -- falling edge
944
                MWr_on_EB     <= '0';
945
              else
946
                MWr_on_EB     <= MWr_on_EB;
947
              end if;
948
 
949
        end case;
950
 
951
 
952
        -- CplD_on_Pool
953
        case FSM_TLP_Cnt is
954
 
955
          when TK_RST =>
956
              CplD_on_Pool_i  <= '0';
957
              CplD_on_EB_i    <= '0';
958
 
959
          when TK_Idle =>
960
              CplD_on_Pool_i  <= '0';
961
              CplD_on_EB_i    <= '0';
962
 
963
          when TK_CplD_Hdr_C =>
964
--            if trn_rsof_n='0' and trn_rsrc_rdy_n='0' 
965
--               and trn_rd(C_TLP_FMT_BIT_TOP downto C_TLP_FMT_BIT_BOT) ="10" 
966
--               and trn_rd(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_TOP-1) ="01" 
967
--               then
968
              CplD_on_Pool_i  <= not trn_rd(C_CPLD_TAG_BIT_TOP) and not trn_rd(C_CPLD_TAG_BIT_TOP-1);
969
              CplD_on_EB_i    <= not trn_rd(C_CPLD_TAG_BIT_TOP) and trn_rd(C_CPLD_TAG_BIT_TOP-1);
970
--            else
971
--              CplD_on_Pool_i  <= CplD_on_Pool_i;
972
--              CplD_on_EB_i    <= CplD_on_EB_i;
973
--            end if;
974
 
975
 
976
          when OTHERS  =>
977
              CplD_on_Pool_i  <= CplD_on_Pool_i;
978
              CplD_on_EB_i    <= CplD_on_EB_i;
979
 
980
        end case;
981
 
982
 
983
        -- CplD_Tag
984
        case FSM_TLP_Cnt is
985
 
986
          when TK_RST =>
987
              CplD_Tag_i    <= (OTHERS => '1');
988
 
989
--          when TK_Idle =>
990
--              CplD_Tag_i    <= CplD_Tag_i;
991
 
992
          when TK_CplD_Hdr_C =>
993
--            if trn_reof_n='0' then
994
--              CplD_Tag_i    <= (OTHERS => '1');
995
--            els
996
            if trn_rsrc_rdy_n='0' -- and trn_rdst_rdy_n='0' 
997
               then
998
              CplD_Tag_i    <= trn_rd(C_CPLD_TAG_BIT_TOP downto C_CPLD_TAG_BIT_BOT);
999
            else
1000
              CplD_Tag_i    <= CplD_Tag_i;
1001
            end if;
1002
 
1003
          when OTHERS  =>
1004
              CplD_Tag_i    <= CplD_Tag_i;
1005
 
1006
        end case;
1007
 
1008
 
1009
      end if;
1010
   end process;
1011
 
1012
 
1013
   ---------------------------------------------------
1014
   --
1015
   -- Synchronous Registered: CplD_is_the_Last
1016
   --
1017
   Syn_Calc_CplD_is_the_Last:
1018
   process ( trn_clk, trn_reset_n)
1019
   begin
1020
      if trn_reset_n = '0' then
1021
         CplD_is_the_Last_i    <= '0';
1022
 
1023
      elsif trn_clk'event and trn_clk = '1' then
1024
 
1025
         if trn_rsof_n='0' and trn_rsrc_rdy_n='0' then
1026
            if trn_rd(C_TLP_TYPE_BIT_TOP-1)= '1'
1027
               and (trn_rd(C_TLP_FLD_WIDTH_OF_LENG+1 downto 2)=trn_rd(C_TLP_LENG_BIT_TOP downto C_TLP_LENG_BIT_BOT)
1028
               or trn_rd(1 downto 0)=CONV_STD_LOGIC_VECTOR(1, 2))  -- Zero-length
1029
               then
1030
               CplD_is_the_Last_i <= '1';
1031
            else
1032
               CplD_is_the_Last_i <= '0';
1033
            end if;
1034
         else
1035
           CplD_is_the_Last_i  <= CplD_is_the_Last_i;
1036
         end if;
1037
 
1038
      end if;
1039
   end process;
1040
 
1041
   ---------------------------------------------------
1042
   --
1043
   -- Synchronous Delay: FSM_TLP_Cnt
1044
   --
1045
   SynDelay_FSM_TLP_Cnt:
1046
   process ( trn_clk )
1047
   begin
1048
      if trn_clk'event and trn_clk = '1' then
1049
         FSM_TLP_Cnt_r1   <=  FSM_TLP_Cnt;
1050
      end if;
1051
   end process;
1052
 
1053
 
1054
---- --------------------------------------------------------------------------
1055
--
1056
--   TLP_Address_sig      <=  '0' & trn_rd(C_TLP_FLD_WIDTH_OF_LENG+1 downto 2);
1057
--
1058
---------------------------------------------------------------------------------------
1059
---- Calculates the Address-Length combination carry-in
1060
--   TLP_Calc_CarryIn_ALC:
1061
--   process ( trn_clk, trn_reset_n)
1062
--   begin
1063
--      if trn_reset_n = '0' then
1064
--         CarryIn_ALC    <= (OTHERS =>'0');
1065
--      elsif trn_clk'event and trn_clk = '1' then
1066
--         CarryIn_ALC    <= ('0'& TLP_DW_Length_i) + TLP_Address_sig;
1067
--      end if;
1068
--   end process;
1069
--
1070
--
1071
--   ---------------------------------------------------
1072
--   --
1073
--   -- Synchronous Registered: Tlp_straddles_4KB
1074
--   --
1075
--   FSM_Output_Tlp_straddles_4KB:
1076
--   process ( trn_clk, trn_reset_n)
1077
--   begin
1078
--      if trn_reset_n = '0' then
1079
--         Tlp_straddles_4KB_i   <= '0';
1080
--
1081
--      elsif trn_clk'event and trn_clk = '1' then
1082
--
1083
--        case FSM_TLP_Cnt_r1 is
1084
--
1085
--          when TK_RST =>
1086
--              Tlp_straddles_4KB_i   <= '0';
1087
--
1088
--          when TK_MWr_3Hdr_C =>
1089
--            if Tlp_has_4KB_i='1'
1090
--               and trn_rd(C_TLP_FLD_WIDTH_OF_LENG+1 downto 0) 
1091
--                   /=C_ALL_ZEROS(C_TLP_FLD_WIDTH_OF_LENG+1 downto 0)
1092
--               then
1093
--               Tlp_straddles_4KB_i <= '1';
1094
--            else
1095
--               Tlp_straddles_4KB_i <= CarryIn_ALC(C_TLP_FLD_WIDTH_OF_LENG);
1096
--            end if;
1097
--
1098
--          when TK_MWr_4Hdr_D =>
1099
--            if Tlp_has_4KB_i='1'
1100
--               and trn_rd(C_TLP_FLD_WIDTH_OF_LENG+1 downto 0) 
1101
--                   /=C_ALL_ZEROS(C_TLP_FLD_WIDTH_OF_LENG+1 downto 0)
1102
--               then
1103
--               Tlp_straddles_4KB_i <= '1';
1104
--            else
1105
--               Tlp_straddles_4KB_i <= CarryIn_ALC(C_TLP_FLD_WIDTH_OF_LENG);
1106
--            end if;
1107
--
1108
--
1109
--          when OTHERS  =>
1110
--              Tlp_straddles_4KB_i <= Tlp_straddles_4KB_i;
1111
--
1112
--        end case;
1113
--
1114
--      end if;
1115
--   end process;
1116
--
1117
 
1118
 
1119
 
1120
   --  ---------------------------------------------------------
1121
   --  To Cpl/D channel as indicator when ReqID matched
1122
   --  
1123
   TLP_ReqID_Matched:
1124
   process ( trn_clk, trn_reset_n)
1125
   begin
1126
      if trn_reset_n = '0' then
1127
          Req_ID_Match_i      <= '0';
1128
      elsif trn_clk'event and trn_clk = '1' then
1129
        if trn_rd(C_CPLD_REQID_BIT_TOP downto C_CPLD_REQID_BIT_BOT)=localID then
1130
          Req_ID_Match_i      <= '1';
1131
        else
1132
          Req_ID_Match_i      <= '0';
1133
        end if;
1134
      end if;
1135
   end process;
1136
 
1137
 
1138
   --  ------------------------------------------------------------
1139
   --  To Cpl/D channel as indicator when us Tag_Descriptor matched
1140
   --  
1141
   TLP_usDexTag_Matched:
1142
   process ( trn_clk, trn_reset_n)
1143
   begin
1144
      if trn_reset_n = '0' then
1145
          usDex_Tag_Matched_i      <= '0';
1146
      elsif trn_clk'event and trn_clk = '1' then
1147
        if trn_rd(C_CPLD_TAG_BIT_TOP downto C_CPLD_TAG_BIT_BOT)=usDMA_dex_Tag then
1148
          usDex_Tag_Matched_i      <= '1';
1149
        else
1150
          usDex_Tag_Matched_i      <= '0';
1151
        end if;
1152
      end if;
1153
   end process;
1154
 
1155
 
1156
   --  ------------------------------------------------------------
1157
   --  To Cpl/D channel as indicator when ds Tag_Descriptor matched
1158
   --  
1159
   TLP_dsDexTag_Matched:
1160
   process ( trn_clk, trn_reset_n)
1161
   begin
1162
      if trn_reset_n = '0' then
1163
          dsDex_Tag_Matched_i      <= '0';
1164
      elsif trn_clk'event and trn_clk = '1' then
1165
        if trn_rd(C_CPLD_TAG_BIT_TOP downto C_CPLD_TAG_BIT_BOT)=dsDMA_dex_Tag then
1166
          dsDex_Tag_Matched_i      <= '1';
1167
        else
1168
          dsDex_Tag_Matched_i      <= '0';
1169
        end if;
1170
      end if;
1171
   end process;
1172
 
1173
 
1174
end architecture Behavioral;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.