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

Subversion Repositories udp_ipv4_for_10g_ethernet

[/] [udp_ipv4_for_10g_ethernet/] [trunk/] [src/] [hdl/] [frame_gen_fifo_if.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 DFC
-------------------------------------------------------------------------------
2
--
3
-- (C) Copyright 2017 DFC Design, s.r.o., Brno, Czech Republic
4
-- Author: Marek Kvas (m.kvas@dfcdesign.cz)
5
--
6
-------------------------------------------------------------------------------
7
-- This file is part of UDP/IPv4 for 10 G Ethernet core.
8
-- 
9
-- UDP/IPv4 for 10 G Ethernet core is free software: you can 
10
-- redistribute it and/or modify it under the terms of 
11
-- the GNU Lesser General Public License as published by the Free 
12
-- Software Foundation, either version 3 of the License, or
13
-- (at your option) any later version.
14
-- 
15
-- UDP/IPv4 for 10 G Ethernet core is distributed in the hope that 
16
-- it will be useful, but WITHOUT ANY WARRANTY; without even 
17
-- the implied warranty of MERCHANTABILITY or FITNESS FOR A 
18
-- PARTICULAR PURPOSE.  See the GNU Lesser General Public License 
19
-- for more details.
20
-- 
21
-- You should have received a copy of the GNU Lesser General Public 
22
-- License along with UDP/IPv4 for 10 G Ethernet core.  If not, 
23
-- see <http://www.gnu.org/licenses/>.
24
-------------------------------------------------------------------------------
25
--
26
-- This module is aimed to be used together with frame_tx_if module.
27
-- Together they provide FIFO buffering for frame_gen module that makes
28
-- it a bit more convenient in cases where data are not available 
29
-- in every cycle and/or length of data is not known in advance.
30
--
31
-- It transform frame_gen interface to FIFO interface sink.
32
--
33
-------------------------------------------------------------------------------
34
 
35
library ieee;
36
use ieee.std_logic_1164.all;
37
use ieee.numeric_std.all;
38
 
39
library work;
40
use work.frame_pkg.all;
41
 
42
Library UNISIM;
43
use UNISIM.vcomponents.all;
44
 
45
 
46
entity frame_gen_fifo_if is
47
   port (
48
      CLK            : in  std_logic;
49
 
50
      DST_MAC        : out mac_addr_type;
51
      DST_IP         : out ip_addr_type;
52
      SRC_UDP        : out udp_port_type;
53
      DST_UDP        : out udp_port_type;
54
 
55
      -- Frame generator if
56
      FG_TX_EN       : out std_logic;
57
      FG_BUSY        : in  std_logic;
58
      FG_DATA_REN    : in  std_logic;
59
      FG_DATA_IN     : out std_logic_vector(63 downto 0);
60
      FG_DATA_LEN    : out std_logic_vector(15 downto 0);
61
 
62
      -- Tag and data fifos
63
      DFIFO_DATA     : in  txi_dfifo_data_type;
64
      DFIFO_RD_EN    : out std_logic;
65
      DFIFO_EMPTY    : in  std_logic;
66
 
67
      TFIFO_DATA     : in  txi_tfifo_data_type;
68
      TFIFO_RD_EN    : out std_logic;
69
      TFIFO_EMPTY    : in  std_logic
70
 
71
        );
72
end entity;
73
 
74
architecture synthesis of frame_gen_fifo_if is
75
 
76
   signal dfifo_data_be    : std_logic_vector(7 downto 0);
77
   signal dfifo_data_data  : std_logic_vector(63 downto 0);
78
   signal dfifo_data_data_d: std_logic_vector(63 downto 0);
79
   signal dfifo_rd_en_i    : std_logic;
80
   signal tfifo_rd_en_i    : std_logic;
81
 
82
   signal dst_mac_i        : mac_addr_type;
83
   signal dst_udp_i        : udp_port_type;
84
 
85
   signal fg_data_ren_d    : std_logic;
86
 
87
begin
88
 
89
   dfifo_data_data <= DFIFO_DATA(63 downto 0);
90
   dfifo_data_be <= DFIFO_DATA(71 downto 64);
91
 
92
   destination_info_proc : process(CLK)
93
   begin
94
      if rising_edge(CLK) then
95
         fg_data_ren_d <= FG_DATA_REN;
96
         dfifo_data_data_d <= dfifo_data_data;
97
         if dfifo_rd_en_i = '1' then
98
            dst_mac_i <= dfifo_data_data(63 downto 16);
99
            dst_udp_i <= dfifo_data_data(15 downto 0);
100
            DST_IP  <= dst_mac_i(DST_IP'range);
101
            SRC_UDP <= dst_udp_i;
102
         end if;
103
      end if;
104
   end process;
105
 
106
 
107
   rd_proc : process(TFIFO_EMPTY, FG_BUSY, DFIFO_EMPTY, dfifo_data_be,
108
                     fg_data_ren_d, FG_DATA_REN)
109
   begin
110
      dfifo_rd_en_i <= '0';
111
      tfifo_rd_en_i <= '0';
112
      FG_TX_EN <= '0';
113
 
114
      if TFIFO_EMPTY = '0' and FG_BUSY = '0' then
115
         -- Whole frame is ready for us, start transfer
116
         FG_TX_EN <= '1';
117
         tfifo_rd_en_i <= '1';
118
      end if;
119
 
120
 
121
      if DFIFO_EMPTY = '0' then
122
         if unsigned(dfifo_data_be) = 0 or
123
                  FG_DATA_REN = '1' then
124
            -- This is either destination info or empty word 
125
            dfifo_rd_en_i <= '1';
126
         end if;
127
      end if;
128
 
129
   end process;
130
 
131
   FG_DATA_IN  <= dfifo_data_data_d;
132
   FG_DATA_LEN <= TFIFO_DATA;
133
   DFIFO_RD_EN <= dfifo_rd_en_i;
134
   TFIFO_RD_EN <= tfifo_rd_en_i;
135
 
136
   DST_MAC <= dst_mac_i;
137
   DST_UDP <= dst_udp_i;
138
 
139
end architecture;
140
 
141
 
142
 
143
 

powered by: WebSVN 2.1.0

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