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

Subversion Repositories pcie_sg_dma

[/] [pcie_sg_dma/] [branches/] [Virtex6/] [ML605_ISE13.3/] [MySource/] [DMA_Calculate.vhd] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 barabba
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer: 
4
-- 
5
-- Design Name: 
6
-- Module Name:    DMA_Calculate - Behavioral 
7
-- Project Name: 
8
-- Target Devices: 
9
-- Tool versions: 
10
-- Description: 
11
--
12
-- Dependencies: 
13
--
14
-- Revision 1.20 - Taken out from the original version.   26.07.2007
15
-- 
16
-- Revision 1.10 - Msg inserted.   26.02.2007
17
-- 
18
-- Revision 1.00 - Created. 09.02.2007
19
-- 
20
-- Additional Comments: 
21
--
22
----------------------------------------------------------------------------------
23
 
24
library IEEE;
25
use IEEE.STD_LOGIC_1164.ALL;
26
use IEEE.STD_LOGIC_ARITH.ALL;
27
use IEEE.STD_LOGIC_UNSIGNED.ALL;
28
 
29
library work;
30
use work.abb64Package.all;
31
 
32
 
33
-- Uncomment the following library declaration if instantiating
34
-- any Xilinx primitives in this code.
35
--library UNISIM;
36
--use UNISIM.VComponents.all;
37
 
38
entity DMA_Calculate is
39
    port (
40
      -- Downstream Registers from MWr Channel
41
      DMA_PA             : IN  std_logic_vector(C_DBUS_WIDTH-1 downto 0);  -- EP   (local)
42
      DMA_HA             : IN  std_logic_vector(C_DBUS_WIDTH-1 downto 0);  -- Host (remote)
43
      DMA_BDA            : IN  std_logic_vector(C_DBUS_WIDTH-1 downto 0);
44
      DMA_Length         : IN  std_logic_vector(C_DBUS_WIDTH-1 downto 0);
45
      DMA_Control        : IN  std_logic_vector(C_DBUS_WIDTH-1 downto 0);
46
 
47
      -- Calculation in advance, for better timing
48
      HA_is_64b          : IN  std_logic;
49
      BDA_is_64b         : IN  std_logic;
50
 
51
      -- Calculation in advance, for better timing
52
      Leng_Hi19b_True    : IN  std_logic;
53
      Leng_Lo7b_True     : IN  std_logic;
54
 
55
 
56
      -- Parameters fed to DMA_FSM
57
      DMA_PA_Loaded      : OUT std_logic_vector(C_DBUS_WIDTH-1 downto 0);
58
      DMA_PA_Var         : OUT std_logic_vector(C_DBUS_WIDTH-1 downto  0);
59
      DMA_HA_Var         : OUT std_logic_vector(C_DBUS_WIDTH-1 downto  0);
60
 
61
      DMA_BDA_fsm        : OUT std_logic_vector(C_DBUS_WIDTH-1 downto 0);
62
      BDA_is_64b_fsm     : OUT std_logic;
63
 
64
 
65
      DMA_Snout_Length   : OUT std_logic_vector(C_MAXSIZE_FLD_BIT_TOP downto  0);
66
      DMA_Body_Length    : OUT std_logic_vector(C_MAXSIZE_FLD_BIT_TOP downto 0);
67
      DMA_Tail_Length    : OUT std_logic_vector(C_TLP_FLD_WIDTH_OF_LENG+1 downto  0);
68
 
69
      -- Only for downstream channel
70
      DMA_PA_Snout       : OUT std_logic_vector(C_DBUS_WIDTH-1 downto 0);
71
      DMA_BAR_Number     : OUT std_logic_vector(C_ENCODE_BAR_NUMBER-1 downto 0);
72
 
73
      -- Engine control signals
74
      DMA_Start          : IN  std_logic;
75
      DMA_Start2         : IN  std_logic;   -- out of consecutive dex
76
 
77
      -- Control signals to FSM
78
      No_More_Bodies     : OUT std_logic;   -- No more block(s) of Max_Size
79
      ThereIs_Snout      : OUT std_logic;   -- 1st packet before Body blocks
80
      ThereIs_Body       : OUT std_logic;   -- Block(s) of Max_Size
81
      ThereIs_Tail       : OUT std_logic;   -- Last packet with size less than Max_Size
82
      ThereIs_Dex        : OUT std_logic;   -- Not the last descriptor
83
      HA64bit            : OUT std_logic;   -- Host Address is 64-bit
84
      Addr_Inc           : OUT std_logic;   -- Peripheral Address increase token
85
 
86
 
87
      -- FSM indicators
88
      State_Is_LoadParam : IN  std_logic;
89
      State_Is_Snout     : IN  std_logic;
90
      State_Is_Body      : IN  std_logic;
91
--      State_Is_Tail      : IN  std_logic;
92
 
93
 
94
      -- Additional
95
      Param_Max_Cfg      : IN  std_logic_vector(2 downto 0);
96
 
97
      -- Common ports
98
      dma_clk            : IN  std_logic;
99
      dma_reset          : IN  std_logic
100
    );
101
 
102
end entity DMA_Calculate;
103
 
104
 
105
 
106
architecture Behavioral of DMA_Calculate is
107
 
108
  --  Significant bits from the MaXSiZe parameter
109
  signal  Max_TLP_Size         :  std_logic_vector(C_MAXSIZE_FLD_BIT_TOP downto 0);
110
 
111
  signal  mxsz_left            :  std_logic_vector(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT);
112
  signal  mxsz_mid             :  std_logic_vector(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT);
113
  signal  mxsz_right           :  std_logic_vector(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT);
114
 
115
  --  Signals masked by MaxSize
116
  signal  DMA_Leng_Left_Msk    :  std_logic_vector(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT);
117
  signal  DMA_Leng_Mid_Msk     :  std_logic_vector(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT);
118
  signal  DMA_Leng_Right_Msk   :  std_logic_vector(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT);
119
 
120
  -- Alias
121
  signal  Lo_Leng_Left_Msk_is_True  :  std_logic;
122
  signal  Lo_Leng_Mid_Msk_is_True   :  std_logic;
123
  signal  Lo_Leng_Right_Msk_is_True :  std_logic;
124
 
125
  -- Masked values of HA and Length
126
  signal  DMA_HA_Msk           :  std_logic_vector(C_MAXSIZE_FLD_BIT_TOP downto 0);
127
  signal  DMA_Length_Msk       :  std_logic_vector(C_MAXSIZE_FLD_BIT_TOP downto 0);
128
 
129
 
130
  -- Indicates whether the DMA_PA is already accepted
131
  signal  PA_is_taken          : std_logic;
132
 
133
  -- Calculation for the PA of the next DMA, if UPA bit = 0
134
  signal  DMA_PA_next          : std_logic_vector(C_DBUS_WIDTH-1 downto 0);
135
  signal  DMA_PA_current       : std_logic_vector(C_DBUS_WIDTH-1 downto 0);
136
 
137
  -- eventual PA parameter for the current DMA transaction
138
  signal  DMA_PA_Loaded_i      : std_logic_vector(C_DBUS_WIDTH-1 downto 0);
139
 
140
  -- Calculation in advance, only for better timing
141
  signal  Carry_PA_plus_Leng   : std_logic_vector(CBIT_CARRY downto 0);
142
  signal  Carry_PAx_plus_Leng  : std_logic_vector(CBIT_CARRY downto 0);
143
  signal  Leng_Hi_plus_PA_Hi   : std_logic_vector(C_DBUS_WIDTH-1 downto CBIT_CARRY);
144
  signal  Leng_Hi_plus_PAx_Hi  : std_logic_vector(C_DBUS_WIDTH-1 downto CBIT_CARRY);
145
 
146
  -- DMA parameters from the register module
147
  signal  DMA_PA_i             : std_logic_vector(C_DBUS_WIDTH-1 downto 0);
148
  signal  DMA_HA_i             : std_logic_vector(C_DBUS_WIDTH-1 downto 0);
149
  signal  DMA_BDA_i            : std_logic_vector(C_DBUS_WIDTH-1 downto 0);
150
  signal  DMA_Length_i         : std_logic_vector(C_DBUS_WIDTH-1 downto 0);
151
  signal  DMA_Control_i        : std_logic_vector(C_DBUS_WIDTH-1 downto 0);
152
 
153
  --  delay
154
  signal  State_Is_Snout_r1    : std_logic;
155
  signal  State_Is_Body_r1     : std_logic;
156
 
157
  -- from control word
158
  signal  Dex_is_Last          : std_logic;
159
  signal  Engine_Ends          : std_logic;
160
 
161
  -- Major FSM control signals
162
  signal  ThereIs_Snout_i      : std_logic;
163
  signal  ThereIs_Body_i       : std_logic;
164
  signal  ThereIs_Tail_i       : std_logic;
165
  signal  Snout_Only           : std_logic;
166
 
167
  signal  ThereIs_Dex_i        : std_logic;
168
  signal  No_More_Bodies_i     : std_logic;
169
 
170
  -- Address/Length combination
171
  signal  ALc                  : std_logic_vector(C_MAXSIZE_FLD_BIT_TOP downto  0);
172
  -- Compressed ALc
173
      --  ALc_B bit means the ALc has carry in, making an extra Body block.
174
  signal  ALc_B                : std_logic;
175
  signal  ALc_B_wire           : std_logic;
176
      --  ALc_T bit means the ALc has trailer, making a final Tail block.
177
  signal  ALc_T                : std_logic;
178
  signal  ALc_T_wire           : std_logic;
179
 
180
  -- Compressed Length
181
      --  Leng_Two bit means Length >= 2 Max_Size.
182
  signal  Leng_Two             : std_logic;
183
      --  Leng_One bit means Length >= 1 Max_Size.
184
  signal  Leng_One             : std_logic;
185
      --  Leng_nint bit means Length is not integral of Max_Sizes.
186
  signal  Leng_nint            : std_logic;
187
 
188
 
189
  signal  Length_analysis      : std_logic_vector(2 downto  0);
190
  signal  Snout_Body_Tail      : std_logic_vector(2 downto  0);
191
 
192
  -- Byte counter
193
  signal  DMA_Byte_Counter     : std_logic_vector(C_DBUS_WIDTH-1 downto  0);  -- !!! Elastic
194
  signal  Length_minus         : std_logic_vector(C_DBUS_WIDTH-1 downto  0);
195
  signal  DMA_BC_Carry         : std_logic_vector(CBIT_CARRY downto  0);
196
 
197
  -- Remote & Local Address variable
198
  signal  DMA_HA_Var_i         : std_logic_vector(C_DBUS_WIDTH-1 downto  0);
199
  signal  DMA_HA_Carry32       : std_logic_vector(C_DBUS_WIDTH/2 downto  0);
200
  signal  DMA_PA_Var_i         : std_logic_vector(C_DBUS_WIDTH-1 downto  0);
201
 
202
  -- BDA parameter is buffered for FSM module
203
  signal  DMA_BDA_fsm_i        : std_logic_vector(C_DBUS_WIDTH-1 downto 0);
204
  signal  BDA_is_64b_fsm_i     : std_logic;
205
 
206
  -- Token bits out of Control word
207
  signal  HA64bit_i            : std_logic;
208
  signal  Addr_Inc_i           : std_logic;
209
  signal  use_PA               : std_logic;
210
 
211
  --      for better timing
212
  signal  HA_gap               : std_logic_vector(C_MAXSIZE_FLD_BIT_TOP downto  0);
213
 
214
  --
215
  signal  DMA_Snout_Length_i   : std_logic_vector(C_MAXSIZE_FLD_BIT_TOP downto  0);
216
  signal  DMA_Tail_Length_i    : std_logic_vector(C_TLP_FLD_WIDTH_OF_LENG+1 downto  0);
217
  --      for better timing
218
  signal  raw_Tail_Length      : std_logic_vector(C_TLP_FLD_WIDTH_OF_LENG+1 downto  0);
219
 
220
  signal  DMA_PA_Snout_Carry   : std_logic_vector(CBIT_CARRY downto  0);
221
  signal  DMA_PA_Body_Carry    : std_logic_vector(CBIT_CARRY downto  0);
222
 
223
  signal  DMA_BAR_Number_i     : std_logic_vector(C_ENCODE_BAR_NUMBER-1 downto 0);
224
 
225
begin
226
 
227
   --  Partition indicators
228
   No_More_Bodies     <= No_More_Bodies_i   ;
229
   ThereIs_Snout      <= ThereIs_Snout_i    ;
230
   ThereIs_Body       <= ThereIs_Body_i     ;
231
   ThereIs_Tail       <= ThereIs_Tail_i     ;
232
   ThereIs_Dex        <= ThereIs_Dex_i      ;
233
        HA64bit            <= HA64bit_i          ;
234
   Addr_Inc           <= Addr_Inc_i         ;
235
 
236
   --
237
   DMA_PA_Loaded      <= DMA_PA_Loaded_i ;
238
   DMA_PA_Var         <= DMA_PA_Var_i    ;
239
   DMA_HA_Var         <= DMA_HA_Var_i    ;
240
        DMA_BDA_fsm        <= DMA_BDA_fsm_i   ;
241
   BDA_is_64b_fsm     <= BDA_is_64b_fsm_i;
242
 
243
   -- Only for downstream channel
244
   DMA_PA_Snout       <= DMA_PA_current(C_DBUS_WIDTH-1 downto 0);
245
   DMA_BAR_Number     <= DMA_BAR_Number_i;
246
 
247
   -- different lengths
248
   DMA_Snout_Length   <= DMA_Snout_Length_i ;
249
   DMA_Body_Length    <= Max_TLP_Size       ;
250
   DMA_Tail_Length    <= DMA_Tail_Length_i  ;
251
 
252
 
253
   --  Register stubs
254
   DMA_PA_i           <=  DMA_PA;
255
   DMA_HA_i           <=  DMA_HA;
256
   DMA_BDA_i          <=  DMA_BDA;
257
   DMA_Length_i       <=  DMA_Length;
258
   DMA_Control_i      <=  DMA_Control;
259
 
260
 
261
 
262
-- ---------------------------------------------------------------
263
-- Parameters should be captured by the start/start2 and be kept 
264
--     in case Pause command comes.
265
--
266
   Syn_Param_Capture:
267
   process ( dma_clk, dma_reset)
268
   begin
269
      if dma_reset = '1' then
270
                        Addr_Inc_i         <= '0';
271
         use_PA             <= '0';
272
         Dex_is_Last        <= '0';
273
         Engine_Ends        <= '1';
274
         DMA_BAR_Number_i   <= (OTHERS=>'0');
275
 
276
                        DMA_BDA_fsm_i      <= (OTHERS=>'0');
277
         BDA_is_64b_fsm_i   <= '0';
278
 
279
      elsif dma_clk'event and dma_clk = '1' then
280
 
281
         if DMA_Start ='1' or DMA_Start2 ='1' then
282
           Addr_Inc_i         <= DMA_Control_i(CINT_BIT_DMA_CTRL_AINC);
283
           use_PA             <= DMA_Control_i(CINT_BIT_DMA_CTRL_UPA);
284
           Dex_is_Last        <= DMA_Control_i(CINT_BIT_DMA_CTRL_LAST);
285
           Engine_Ends        <= DMA_Control_i(CINT_BIT_DMA_CTRL_END);
286
           DMA_BAR_Number_i   <= DMA_Control_i(CINT_BIT_DMA_CTRL_BAR_TOP downto CINT_BIT_DMA_CTRL_BAR_BOT);
287
 
288
           DMA_BDA_fsm_i      <= DMA_BDA_i    ;
289
           BDA_is_64b_fsm_i   <= BDA_is_64b   ;
290
         else
291
                          Addr_Inc_i         <= Addr_Inc_i   ;
292
           use_PA             <= use_PA       ;
293
           Dex_is_Last        <= Dex_is_Last  ;
294
           Engine_Ends        <= Engine_Ends  ;
295
           DMA_BAR_Number_i   <= DMA_BAR_Number_i;
296
 
297
                          DMA_BDA_fsm_i      <= DMA_BDA_fsm_i    ;
298
           BDA_is_64b_fsm_i   <= BDA_is_64b_fsm_i ;
299
         end if;
300
 
301
      end if;
302
   end process;
303
 
304
--   Addr_Inc_i         <= DMA_Control_i(CINT_BIT_DMA_CTRL_AINC);
305
--   use_PA             <= DMA_Control_i(CINT_BIT_DMA_CTRL_UPA);
306
--   Dex_is_Last        <= DMA_Control_i(CINT_BIT_DMA_CTRL_LAST);
307
--   Engine_Ends        <= DMA_Control_i(CINT_BIT_DMA_CTRL_END);
308
--   use_Irpt_Done      <= not DMA_Control_i(CINT_BIT_DMA_CTRL_EDI);
309
 
310
 
311
   -- Means there is consecutive descriptor(s)
312
   ThereIs_Dex_i      <= not Dex_is_Last and not Engine_Ends;
313
 
314
 
315
-- ---------------------------------------------------------------
316
--  PA_i selection
317
--
318
   Syn_Calc_DMA_PA:
319
   process ( dma_clk, dma_reset)
320
   begin
321
      if dma_reset = '1' then
322
         DMA_PA_current       <= (Others=>'0');
323
--         DMA_BAR_Number_i     <= (Others=>'0');
324
         PA_is_taken          <= '0';
325
 
326
      elsif dma_clk'event and dma_clk = '1' then
327
 
328
         if DMA_Start = '1' and PA_is_taken='0' then
329
            DMA_PA_current   <= DMA_PA_i(C_DBUS_WIDTH-1 downto 2) &"00";
330
            PA_is_taken      <= '1';
331
         elsif DMA_Start2 = '1' and PA_is_taken='0' and DMA_Control_i(CINT_BIT_DMA_CTRL_UPA) = '1' then
332
            DMA_PA_current   <= DMA_PA_i(C_DBUS_WIDTH-1 downto 2) &"00";
333
            PA_is_taken      <= '1';
334
         elsif DMA_Start2 = '1' and PA_is_taken='0' and DMA_Control_i(CINT_BIT_DMA_CTRL_UPA) = '0' then
335
            DMA_PA_current(C_DBUS_WIDTH-1 downto 0) <= DMA_PA_next;
336
            PA_is_taken      <= '1';
337
         else
338
            DMA_PA_current   <= DMA_PA_current;
339
            if DMA_Start='0' and DMA_Start2='0' then
340
               PA_is_taken   <= '0';
341
            else
342
               PA_is_taken   <= PA_is_taken;
343
            end if;
344
         end if;
345
 
346
      end if;
347
 
348
   end process;
349
 
350
 
351
-- ---------------------------------------------------------------
352
-- PA_next Calculation
353
--
354
   Syn_Calc_DMA_PA_next:
355
   process ( dma_clk, dma_reset)
356
   begin
357
      if dma_reset = '1' then
358
         DMA_PA_next       <= (Others=>'0');
359
 
360
      elsif dma_clk'event and dma_clk = '1' then
361
 
362
         if DMA_Start = '1' and PA_is_taken='0' then
363
            if DMA_Control_i(CINT_BIT_DMA_CTRL_AINC) = '1' then
364
               DMA_PA_next(CBIT_CARRY-1 downto  0)           <= Carry_PA_plus_Leng(CBIT_CARRY-1 downto 0);
365
               DMA_PA_next(C_DBUS_WIDTH-1 downto CBIT_CARRY) <= Leng_Hi_plus_PA_Hi
366
                                                              + Carry_PA_plus_Leng(CBIT_CARRY);
367
            else
368
               DMA_PA_next <= DMA_PA_i(C_DBUS_WIDTH-1 downto 2) &"00";
369
            end if;
370
 
371
         elsif DMA_Start2 = '1' and PA_is_taken='0' then
372
            if DMA_Control_i(CINT_BIT_DMA_CTRL_AINC) = '1' then
373
               DMA_PA_next(CBIT_CARRY-1 downto  0)           <= Carry_PAx_plus_Leng(CBIT_CARRY-1 downto 0);
374
               DMA_PA_next(C_DBUS_WIDTH-1 downto CBIT_CARRY) <= Leng_Hi_plus_PAx_Hi
375
                                                              + Carry_PAx_plus_Leng(CBIT_CARRY);
376
            else
377
               DMA_PA_next <= DMA_PA_next;
378
            end if;
379
         else
380
            DMA_PA_next    <= DMA_PA_next;
381
         end if;
382
 
383
      end if;
384
 
385
   end process;
386
 
387
 
388
-- ---------------------------------------------------------------
389
-- Carry_PA_plus_Leng(16 downto 0)
390
--
391
   Syn_Calc_Carry_PA_plus_Leng:
392
   process ( dma_clk, dma_reset)
393
   begin
394
      if dma_reset = '1' then
395
         Carry_PA_plus_Leng    <= (Others=>'0');
396
 
397
      elsif dma_clk'event and dma_clk = '1' then
398
         Carry_PA_plus_Leng    <= ('0'& DMA_PA_i(CBIT_CARRY-1 downto 2) &"00")
399
                                + ('0'& DMA_Length_i(CBIT_CARRY-1 downto 2) &"00");
400
      end if;
401
 
402
   end process;
403
 
404
 
405
-- ---------------------------------------------------------------
406
-- Carry_PAx_plus_Leng(16 downto 0)
407
--
408
   Syn_Calc_Carry_PAx_plus_Leng:
409
   process ( dma_clk, dma_reset)
410
   begin
411
      if dma_reset = '1' then
412
         Carry_PAx_plus_Leng   <= (Others=>'0');
413
 
414
      elsif dma_clk'event and dma_clk = '1' then
415
         Carry_PAx_plus_Leng   <= ('0'& DMA_PA_next (CBIT_CARRY-1 downto 2) &"00")
416
                                + ('0'& DMA_Length_i(CBIT_CARRY-1 downto 2) &"00");
417
      end if;
418
 
419
   end process;
420
 
421
 
422
-- ---------------------------------------------------------------
423
-- Leng_Hi_plus_PA_Hi(31 downto 16)
424
--
425
   Syn_Calc_Leng_Hi_plus_PA_Hi:
426
   process ( dma_clk, dma_reset)
427
   begin
428
      if dma_reset = '1' then
429
         Leng_Hi_plus_PA_Hi           <= (Others=>'0');
430
 
431
      elsif dma_clk'event and dma_clk = '1' then
432
         Leng_Hi_plus_PA_Hi           <= DMA_Length_i(C_DBUS_WIDTH-1 downto CBIT_CARRY)
433
                                       + DMA_PA_i(C_DBUS_WIDTH-1 downto CBIT_CARRY);
434
 
435
      end if;
436
 
437
   end process;
438
 
439
 
440
-- ---------------------------------------------------------------
441
-- Leng_Hi_plus_PAx_Hi(31 downto 16)
442
--
443
   Syn_Calc_Leng_Hi_plus_PAx_Hi:
444
   process ( dma_clk, dma_reset)
445
   begin
446
      if dma_reset = '1' then
447
         Leng_Hi_plus_PAx_Hi          <= (Others=>'0');
448
 
449
      elsif dma_clk'event and dma_clk = '1' then
450
         Leng_Hi_plus_PAx_Hi          <= DMA_Length_i(C_DBUS_WIDTH-1 downto CBIT_CARRY)
451
                                       + DMA_PA_next(C_DBUS_WIDTH-1 downto CBIT_CARRY);
452
 
453
      end if;
454
 
455
   end process;
456
 
457
 
458
-- -----------------------------------------------------------------------------------------------------------------------------------
459
   DMA_Leng_Left_Msk        <= DMA_Length_i(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT) and mxsz_left;
460
   DMA_Leng_Mid_Msk         <= DMA_Length_i(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT) and mxsz_mid;
461
   DMA_Leng_Right_Msk       <= DMA_Length_i(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT) and mxsz_right;
462
 
463
-- -----------------------------------------------------------------------------------------------------------------------------------
464
   DMA_HA_Msk               <= (DMA_HA_i(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT) and mxsz_right)
465
                             &  DMA_HA_i(C_MAXSIZE_FLD_BIT_BOT-1 downto 2)
466
                             &  "00";
467
   DMA_Length_Msk           <= (DMA_Length_i(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT) and mxsz_right)
468
                             &  DMA_Length_i(C_MAXSIZE_FLD_BIT_BOT-1 downto 2)
469
                             &  "00";
470
 
471
-- -----------------------------------------------------------------------------------------------------------------------------------
472
   Lo_Leng_Left_Msk_is_True   <= '0' when DMA_Leng_Left_Msk =C_ALL_ZEROS(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT) else '1';
473
   Lo_Leng_Mid_Msk_is_True    <= '0' when DMA_Leng_Mid_Msk  =C_ALL_ZEROS(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT) else '1';
474
   Lo_Leng_Right_Msk_is_True  <= '0' when DMA_Leng_Right_Msk=C_ALL_ZEROS(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT) else '1';
475
 
476
 
477
-- ----------------------------------------------------------
478
-- Synchronous Register: Leng_Info(Compressed Length Information)
479
---
480
   Syn_Calc_Parameter_Leng_Info:
481
   process ( dma_clk, dma_reset)
482
   begin
483
      if dma_reset = '1' then
484
         Leng_Two  <= '0';
485
         Leng_One  <= '0';
486
         Leng_nint <= '0';
487
 
488
      elsif dma_clk'event and dma_clk = '1' then
489
         Leng_Two  <= Leng_Hi19b_True or Lo_Leng_Left_Msk_is_True;
490
         Leng_One  <= Lo_Leng_Mid_Msk_is_True;
491
         Leng_nint <= Leng_Lo7b_True  or Lo_Leng_Right_Msk_is_True;
492
 
493
      end if;
494
   end process;
495
 
496
 
497
-- -----------------------------------------------------------------------------------------------------------------------------------
498
   ALc_B_wire  <= '0' when (ALc(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT) and mxsz_mid)=C_ALL_ZEROS(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT)
499
                      else '1';
500
   ALc_T_wire  <= '0' when (ALc(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT) and mxsz_right)=C_ALL_ZEROS(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT)
501
                           and ALc(C_MAXSIZE_FLD_BIT_BOT-1 downto 0)=C_ALL_ZEROS(C_MAXSIZE_FLD_BIT_BOT-1 downto 0)
502
                      else '1';
503
-- -----------------------------------------------------------------------------------------------------------------------------------
504
 
505
-- -------------------------------------------------------
506
-- Synchronous Register: ALc (Address-Length combination)
507
---
508
   Syn_Calc_Parameter_ALc:
509
   process ( dma_clk, dma_reset)
510
   begin
511
      if dma_reset = '1' then
512
         ALc      <= (Others=>'0');
513
         ALc_B    <= '0';
514
         ALc_T    <= '0';
515
 
516
      elsif dma_clk'event and dma_clk = '1' then
517
 
518
         ALc      <= DMA_Length_Msk + DMA_HA_Msk;
519
         ALc_B    <= ALc_B_wire;
520
         ALc_T    <= ALc_T_wire;
521
 
522
      end if;
523
 
524
   end process;
525
 
526
 
527
   -- concatenation of the Length information
528
   Length_analysis <= Leng_Two & Leng_One & Leng_nint;
529
 
530
   -- -------------------------------------------
531
   -- Analysis on the DMA division
532
   --     truth-table expressions
533
   -- 
534
   Comb_S_B_T:
535
   process (
536
             Length_analysis
537
           , ALc_B
538
           , ALc_T
539
           )
540
   begin
541
     case Length_analysis is
542
 
543
        --   Zero-length DMA, nothing to send
544
        when "000"  =>
545
          Snout_Body_Tail <= "000";
546
 
547
        --   Length < Max_Size. Always Snout and never Body, Tail depends on ALc.
548
        when "001"  =>
549
          Snout_Body_Tail <= '1' & '0' & (ALc_B and ALc_T);
550
 
551
        --   Length = Max_Size. Division depends only on ALc-Tail.
552
        when "010"  =>
553
          Snout_Body_Tail <= ALc_T & not ALc_T & ALc_T;
554
        --   Length = (k+1) Max_Size, k>=1. Always Body. Snout and Tail depend on ALc-Tail.
555
        --                                  Body = Leng_Two or not ALc_T
556
        when "100"  =>
557
          Snout_Body_Tail <= ALc_T & '1' & ALc_T;
558
        when "110"  =>
559
          Snout_Body_Tail <= ALc_T & '1' & ALc_T;
560
 
561
        --   Length = (1+d) Max_Size, 0<d<1. Always Snout. Body and Tail copy ALc.
562
        when "011"  =>
563
          Snout_Body_Tail <= '1' & ALc_B & ALc_T;
564
        --   Length = (k+1+d) Max_Size, k>=1, 0<d<1. Always Snout and Body. Tail copies ALc-Tail.
565
        --                                           Body = Leng_Two or ALc_B
566
        when "101"  =>
567
          Snout_Body_Tail <= '1' & '1' & ALc_T;
568
        when "111"  =>
569
          Snout_Body_Tail <= '1' & '1' & ALc_T;
570
 
571
        --   dealt as zero-length DMA
572
        when Others  =>
573
          Snout_Body_Tail <= "000";
574
 
575
     end case;
576
 
577
   end process;
578
 
579
-- -----------------------------------------------
580
-- Synchronous Register:
581
--                       ThereIs_Snout
582
--                       ThereIs_Body
583
--                       ThereIs_Tail
584
--
585
   Syn_Calc_Parameters_SBT:
586
   process ( dma_clk, dma_reset)
587
   begin
588
      if dma_reset = '1' then
589
         ThereIs_Snout_i   <= '0';
590
         ThereIs_Body_i    <= '0';
591
         ThereIs_Tail_i    <= '0';
592
 
593
         Snout_Only        <= '0';
594
 
595
      elsif dma_clk'event and dma_clk = '1' then
596
 
597
         ThereIs_Snout_i   <= Snout_Body_Tail(2);
598
         ThereIs_Body_i    <= Snout_Body_Tail(1);
599
         ThereIs_Tail_i    <= Snout_Body_Tail(0);
600
 
601
         Snout_Only        <= ALc_T and not Snout_Body_Tail(0);
602
 
603
      end if;
604
 
605
   end process;
606
 
607
 
608
-- -------------------------------------------------------------
609
-- Synchronous reg: 
610
--                  HA_gap
611
--
612
   Syn_Calc_HA_gap:
613
   process ( dma_clk, dma_reset)
614
   begin
615
      if dma_reset = '1' then
616
         HA_gap   <= (OTHERS =>'0');
617
 
618
      elsif dma_clk'event and dma_clk = '1' then
619
         HA_gap   <= Max_TLP_Size - DMA_HA_Msk;
620
      end if;
621
   end process;
622
 
623
 
624
-- -------------------------------------------------------------
625
-- Synchronous reg: 
626
--                  DMA_PA_Snout_Carry
627
--
628
   FSM_Calc_DMA_PA_Snout_Carry:
629
   process ( dma_clk, dma_reset)
630
   begin
631
      if dma_reset = '1' then
632
         DMA_PA_Snout_Carry   <= (OTHERS =>'0');
633
 
634
      elsif dma_clk'event and dma_clk = '1' then
635
         DMA_PA_Snout_Carry   <= ('0'& DMA_PA_current(CBIT_CARRY-1 downto 0)) + HA_gap;
636
 
637
      end if;
638
   end process;
639
 
640
 
641
-- -------------------------------------------------------------
642
-- Synchronous reg: 
643
--                  DMA_PA_Body_Carry
644
--
645
   FSM_Calc_DMA_PA_Body_Carry:
646
   process ( dma_clk, dma_reset)
647
   begin
648
      if dma_reset = '1' then
649
         DMA_PA_Body_Carry <= (OTHERS =>'0');
650
 
651
      elsif dma_clk'event and dma_clk = '1' then
652
         DMA_PA_Body_Carry <= ('0'& DMA_PA_Var_i(CBIT_CARRY-1 downto 0)) + Max_TLP_Size;
653
      end if;
654
   end process;
655
 
656
 
657
-- ------------------------------------------------------------------
658
-- Synchronous Register: Length_minus
659
-- 
660
   Sync_Calc_Length_minus:
661
   process ( dma_clk, dma_reset)
662
   begin
663
      if dma_reset = '1' then
664
         Length_minus  <= (OTHERS =>'0');
665
 
666
      elsif dma_clk'event and dma_clk = '1' then
667
         Length_minus  <= DMA_Length_i - Max_TLP_Size;
668
 
669
      end if;
670
   end process;
671
 
672
 
673
-- -------------------------------------------------------------
674
-- Synchronous reg: 
675
--                  DMA_BC_Carry
676
--
677
   FSM_Calc_DMA_BC_Carry:
678
   process ( dma_clk, dma_reset)
679
   begin
680
      if dma_reset = '1' then
681
         DMA_BC_Carry <= (OTHERS =>'0');
682
 
683
      elsif dma_clk'event and dma_clk = '1' then
684
         DMA_BC_Carry <= ('0'& DMA_Byte_Counter(CBIT_CARRY-1 downto 0)) - Max_TLP_Size;
685
 
686
      end if;
687
   end process;
688
 
689
 
690
-- --------------------------------------------
691
-- Synchronous reg: DMA_Snout_Length
692
--                  DMA_Tail_Length
693
--
694
   FSM_Calc_DMA_Snout_Tail_Lengths:
695
   process ( dma_clk, dma_reset)
696
   begin
697
      if dma_reset = '1' then
698
         DMA_Snout_Length_i   <= (OTHERS =>'0');
699
         DMA_Tail_Length_i    <= (OTHERS =>'0');
700
         raw_Tail_Length      <= (OTHERS =>'0');
701
 
702
      elsif dma_clk'event and dma_clk = '1' then
703
 
704
         DMA_Tail_Length_i(C_TLP_FLD_WIDTH_OF_LENG+1 downto 0) <= (raw_Tail_Length(C_TLP_FLD_WIDTH_OF_LENG+1 downto C_MAXSIZE_FLD_BIT_BOT)
705
                                                                   and mxsz_right(C_TLP_FLD_WIDTH_OF_LENG+1 downto C_MAXSIZE_FLD_BIT_BOT)
706
                                                                  ) &  raw_Tail_Length( C_MAXSIZE_FLD_BIT_BOT-1 downto 0);
707
         if State_Is_LoadParam ='1' then
708
            raw_Tail_Length(C_TLP_FLD_WIDTH_OF_LENG+1 downto 0) <= DMA_Length_Msk(C_TLP_FLD_WIDTH_OF_LENG+1 downto 0)
709
                                                                 + DMA_HA_Msk(C_TLP_FLD_WIDTH_OF_LENG+1 downto 0);
710
            if Snout_Only='1' then
711
              DMA_Snout_Length_i <= DMA_Length_i(C_MAXSIZE_FLD_BIT_TOP downto 2) &"00";
712
            else
713
              DMA_Snout_Length_i <= Max_TLP_Size - DMA_HA_Msk;
714
            end if;
715
 
716
         else
717
            DMA_Snout_Length_i   <= DMA_Snout_Length_i;
718
            raw_Tail_Length      <= raw_Tail_Length;
719
 
720
         end if;
721
 
722
      end if;
723
   end process;
724
 
725
 
726
-- -------------------------------------------------------------
727
-- Synchronous Delays: 
728
--                    State_Is_Snout_r1
729
--                    State_Is_Body_r1
730
--
731
   Syn_Delay_State_is_x:
732
   process ( dma_clk )
733
   begin
734
      if dma_clk'event and dma_clk = '1' then
735
         State_Is_Snout_r1  <= State_Is_Snout;
736
         State_Is_Body_r1   <= State_Is_Body;
737
      end if;
738
 
739
   end process;
740
 
741
 
742
-- -------------------------------------------------------------
743
-- Synchronous reg: 
744
--                  DMA_HA_Carry32
745
--
746
   FSM_Calc_DMA_HA_Carry32:
747
   process ( dma_clk, dma_reset)
748
   begin
749
      if dma_reset = '1' then
750
         DMA_HA_Carry32  <= (OTHERS =>'0');
751
 
752
      elsif dma_clk'event and dma_clk = '1' then
753
 
754
         if State_Is_LoadParam = '1' then
755
            DMA_HA_Carry32  <= '0' & DMA_HA_i(C_DBUS_WIDTH/2-1 downto 2) & "00"; -- temp
756
 
757
         elsif State_Is_Snout = '1' or State_Is_Body  = '1' then
758
            DMA_HA_Carry32(C_DBUS_WIDTH/2 downto C_MAXSIZE_FLD_BIT_BOT)  <= ('0'& DMA_HA_Var_i(C_DBUS_WIDTH/2-1 downto C_MAXSIZE_FLD_BIT_TOP+1) &
759
                                                                           (DMA_HA_Var_i(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT) and not mxsz_right)
760
                                                                          ) + mxsz_mid;
761
 
762
         else
763
            DMA_HA_Carry32  <=  DMA_HA_Carry32;
764
 
765
         end if;
766
 
767
      end if;
768
   end process;
769
 
770
 
771
 
772
-- -------------------------------------------------------------
773
-- Synchronous reg: 
774
--                  DMA_HA_Var
775
--
776
   FSM_Calc_DMA_HA_Var:
777
   process ( dma_clk, dma_reset)
778
   begin
779
      if dma_reset = '1' then
780
         DMA_HA_Var_i  <= (OTHERS =>'0');
781
 
782
      elsif dma_clk'event and dma_clk = '1' then
783
 
784
         if State_Is_LoadParam = '1' then
785
            DMA_HA_Var_i  <= DMA_HA_i(C_DBUS_WIDTH-1 downto 2) & "00"; -- temp
786
 
787
         elsif State_Is_Snout_r1 = '1' or State_Is_Body_r1  = '1' then
788
--         elsif State_Is_Snout = '1' or State_Is_Body  = '1' then
789
            DMA_HA_Var_i(C_DBUS_WIDTH-1 downto C_DBUS_WIDTH/2)  <= DMA_HA_Var_i(C_DBUS_WIDTH-1 downto C_DBUS_WIDTH/2)
790
                                                                 + DMA_HA_Carry32(C_DBUS_WIDTH/2);
791
 
792
            DMA_HA_Var_i(C_DBUS_WIDTH-1 downto C_MAXSIZE_FLD_BIT_BOT)  <= (DMA_HA_Var_i(C_DBUS_WIDTH-1 downto C_MAXSIZE_FLD_BIT_TOP+1)
793
                                                                        & (DMA_HA_Var_i(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT) and not mxsz_right))
794
                                                                        +  mxsz_mid;
795
            DMA_HA_Var_i(C_MAXSIZE_FLD_BIT_BOT-1 downto 0)             <= (Others => '0');  -- MaxSize aligned
796
 
797
         else
798
            DMA_HA_Var_i  <=  DMA_HA_Var_i;
799
 
800
         end if;
801
 
802
      end if;
803
   end process;
804
 
805
 
806
-- -------------------------------------------------------------
807
-- Synchronous reg: 
808
--                  HA64bit
809
--
810
   FSM_Calc_HA64bit:
811
   process ( dma_clk, dma_reset)
812
   begin
813
      if dma_reset = '1' then
814
         HA64bit_i         <=  '0';
815
 
816
      elsif dma_clk'event and dma_clk = '1' then
817
 
818
         if State_Is_LoadParam = '1' then
819
            HA64bit_i      <=  HA_is_64b;
820
         elsif DMA_HA_Carry32(C_DBUS_WIDTH/2) = '1' then
821
            HA64bit_i      <=  '1';
822
         else
823
            HA64bit_i      <=  HA64bit_i;
824
         end if;
825
 
826
      end if;
827
   end process;
828
 
829
 
830
-- -------------------------------------------------------------
831
-- Synchronous reg: 
832
--                  DMA_PA_Var
833
--
834
   FSM_Calc_DMA_PA_Var:
835
   process ( dma_clk, dma_reset)
836
   begin
837
      if dma_reset = '1' then
838
         DMA_PA_Var_i   <= (OTHERS =>'0');
839
 
840
      elsif dma_clk'event and dma_clk = '1' then
841
 
842
         if State_Is_LoadParam = '1' then
843
              if  Addr_Inc_i='1' and ThereIs_Snout_i='1'  then
844
                  DMA_PA_Var_i(CBIT_CARRY-1 downto  0)  <= DMA_PA_current(CBIT_CARRY-1 downto  0)
845
                                                         + HA_gap(C_MAXSIZE_FLD_BIT_TOP downto  0);
846
                  DMA_PA_Var_i(C_DBUS_WIDTH-1 downto CBIT_CARRY)  <= DMA_PA_current(C_DBUS_WIDTH-1 downto CBIT_CARRY);
847
              else
848
                  DMA_PA_Var_i(C_DBUS_WIDTH-1 downto  0)  <= DMA_PA_current(C_DBUS_WIDTH-1 downto  0);
849
              end if;
850
 
851
         elsif State_Is_Snout_r1 = '1' then
852
----         elsif State_Is_Snout = '1' then
853
              if  Addr_Inc_i= '1' then
854
                  DMA_PA_Var_i(CBIT_CARRY-1 downto  0)  <= DMA_PA_Var_i(CBIT_CARRY-1 downto 0);
855
                  DMA_PA_Var_i(C_DBUS_WIDTH-1 downto CBIT_CARRY)  <= DMA_PA_Var_i(C_DBUS_WIDTH-1 downto CBIT_CARRY)
856
                                                                   + DMA_PA_Snout_Carry(CBIT_CARRY);
857
              else
858
                  DMA_PA_Var_i   <= DMA_PA_Var_i;
859
              end if;
860
 
861
         elsif State_Is_Body_r1  = '1' then
862
----         elsif State_Is_Body  = '1' then
863
              if  Addr_Inc_i= '1' then
864
                  DMA_PA_Var_i(CBIT_CARRY-1 downto  0)  <= DMA_PA_Body_Carry(CBIT_CARRY-1 downto 0);
865
                  DMA_PA_Var_i(C_DBUS_WIDTH-1 downto CBIT_CARRY)  <= DMA_PA_Var_i(C_DBUS_WIDTH-1 downto CBIT_CARRY)
866
                                                                   + DMA_PA_Body_Carry(CBIT_CARRY);
867
              else
868
                  DMA_PA_Var_i   <= DMA_PA_Var_i;
869
              end if;
870
 
871
         else
872
              DMA_PA_Var_i   <= DMA_PA_Var_i;
873
 
874
         end if;
875
 
876
      end if;
877
   end process;
878
 
879
 
880
-- -------------------------------------------------------------
881
-- Synchronous reg: 
882
--                  DMA_PA_Loaded_i
883
--
884
   FSM_Calc_DMA_PA_Loaded_i:
885
   process ( dma_clk, dma_reset)
886
   begin
887
      if dma_reset = '1' then
888
         DMA_PA_Loaded_i   <= (OTHERS =>'0');
889
 
890
      elsif dma_clk'event and dma_clk = '1' then
891
 
892
         if State_Is_LoadParam = '1' then
893
            DMA_PA_Loaded_i <= DMA_PA_current(C_DBUS_WIDTH-1 downto 0);
894
         else
895
            DMA_PA_Loaded_i <= DMA_PA_Loaded_i;
896
         end if;
897
 
898
      end if;
899
   end process;
900
 
901
 
902
-- -------------------------------------------------------------
903
-- Synchronous reg: DMA_Byte_Counter
904
---
905
   FSM_Calc_DMA_Byte_Counter:
906
   process ( dma_clk, dma_reset)
907
   begin
908
      if dma_reset = '1' then
909
         DMA_Byte_Counter <= (OTHERS =>'0');
910
 
911
      elsif dma_clk'event and dma_clk = '1' then
912
 
913
         if State_Is_LoadParam = '1' then
914
               if ALc_B='0' and ALc_T='1' then
915
                 DMA_Byte_Counter <= Length_minus;
916
               else
917
                 DMA_Byte_Counter <= DMA_Length_i(C_DBUS_WIDTH-1 downto 2) & "00";
918
               end if;
919
 
920
--         elsif State_Is_Body_r1 = '1' then
921
         elsif State_Is_Body = '1' then
922
                DMA_Byte_Counter(C_DBUS_WIDTH-1 downto CBIT_CARRY) <= DMA_Byte_Counter(C_DBUS_WIDTH-1 downto CBIT_CARRY)
923
                                                                    - DMA_BC_Carry(CBIT_CARRY);
924
                DMA_Byte_Counter(CBIT_CARRY-1 downto C_MAXSIZE_FLD_BIT_BOT)  <= DMA_BC_Carry(CBIT_CARRY-1 downto C_MAXSIZE_FLD_BIT_BOT);
925
         else
926
                DMA_Byte_Counter <= DMA_Byte_Counter;
927
         end if;
928
 
929
      end if;
930
   end process;
931
 
932
 
933
-- -------------------------------------------------------------
934
-- Synchronous reg: No_More_Bodies
935
---
936
   FSM_Calc_No_More_Bodies:
937
   process ( dma_clk, dma_reset)
938
   begin
939
      if dma_reset = '1' then
940
         No_More_Bodies_i <= '0';
941
 
942
      elsif dma_clk'event and dma_clk = '1' then
943
 
944
         if State_Is_LoadParam = '1' then
945
               No_More_Bodies_i  <= not ThereIs_Body_i;
946
 
947
--         elsif State_Is_Body_r1 = '1' then
948
         elsif State_Is_Body = '1' then
949
               if DMA_Byte_Counter(C_DBUS_WIDTH-1 downto C_MAXSIZE_FLD_BIT_TOP+1)=C_ALL_ZEROS(C_DBUS_WIDTH-1 downto C_MAXSIZE_FLD_BIT_TOP+1)
950
                  and (DMA_Byte_Counter(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT) and mxsz_left)=C_ALL_ZEROS(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT)
951
                  and (DMA_Byte_Counter(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT) and mxsz_mid)/=C_ALL_ZEROS(C_MAXSIZE_FLD_BIT_TOP downto C_MAXSIZE_FLD_BIT_BOT)
952
                  then
953
                      No_More_Bodies_i <= '1';
954
               else
955
                      No_More_Bodies_i <= '0';
956
               end if;
957
 
958
         else
959
               No_More_Bodies_i  <= No_More_Bodies_i;
960
         end if;
961
 
962
      end if;
963
   end process;
964
 
965
 
966
  -- ------------------------------------------
967
  -- Configuration pamameters: Param_Max_Cfg
968
  --
969
    Syn_Config_Param_Max_Cfg:
970
    process ( dma_clk, dma_reset)
971
    begin
972
       if dma_reset = '1' then  -- 0x0080 Bytes
973
               mxsz_left      <= "111110";         -- 6 bits
974
               mxsz_mid       <= "000001";         -- 6 bits
975
               mxsz_right     <= "000000";         -- 6 bits
976
 
977
       elsif dma_clk'event and dma_clk = '1' then
978
 
979
          case Param_Max_Cfg is
980
 
981
            when "000" =>  -- 0x0080 Bytes
982
               mxsz_left      <= "111110";
983
               mxsz_mid       <= "000001";
984
               mxsz_right     <= "000000";
985
 
986
            when "001" =>  -- 0x0100 Bytes
987
               mxsz_left      <= "111100";
988
               mxsz_mid       <= "000010";
989
               mxsz_right     <= "000001";
990
 
991
            when "010" =>  -- 0x0200 Bytes
992
               mxsz_left      <= "111000";
993
               mxsz_mid       <= "000100";
994
               mxsz_right     <= "000011";
995
 
996
            when "011" =>  -- 0x0400 Bytes
997
               mxsz_left      <= "110000";
998
               mxsz_mid       <= "001000";
999
               mxsz_right     <= "000111";
1000
 
1001
            when "100" =>  -- 0x0800 Bytes
1002
               mxsz_left      <= "100000";
1003
               mxsz_mid       <= "010000";
1004
               mxsz_right     <= "001111";
1005
 
1006
            when "101" =>  -- 0x1000 Bytes
1007
               mxsz_left      <= "000000";
1008
               mxsz_mid       <= "100000";
1009
               mxsz_right     <= "011111";
1010
 
1011
            when Others => -- as 0x0080 Bytes
1012
               mxsz_left      <= "111110";
1013
               mxsz_mid       <= "000001";
1014
               mxsz_right     <= "000000";
1015
 
1016
          end case;
1017
 
1018
       end if;
1019
    end process;
1020
 
1021
    Max_TLP_Size  <= mxsz_mid & CONV_STD_LOGIC_VECTOR(0, C_MAXSIZE_FLD_BIT_BOT);
1022
 
1023
 
1024
end architecture Behavioral;

powered by: WebSVN 2.1.0

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