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

Subversion Repositories esoc

[/] [esoc/] [trunk/] [Sources/] [logixa/] [esoc_port_mal_inbound.vhd] - Blame information for rev 53

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 42 lmaarsen
--------------------------------------------------------------------------------
2 53 lmaarsen
--
3
-- This VHDL file was generated by EASE/HDL 7.4 Revision 4 from HDL Works B.V.
4
--
5
-- Ease library  : work
6
-- HDL library   : work
7
-- Host name     : S212065
8
-- User name     : df768
9
-- Time stamp    : Tue Aug 19 08:05:18 2014
10
--
11
-- Designed by   : L.Maarsen
12
-- Company       : LogiXA
13
-- Project info  : eSoC
14
--
15 42 lmaarsen
--------------------------------------------------------------------------------
16 53 lmaarsen
 
17 42 lmaarsen
--------------------------------------------------------------------------------
18
-- Object        : Entity work.esoc_port_mal_inbound
19
-- Last modified : Mon Apr 14 12:49:11 2014.
20
--------------------------------------------------------------------------------
21
 
22
 
23
 
24
library ieee, std, work;
25
use ieee.std_logic_1164.all;
26
use std.textio.all;
27
use ieee.numeric_std.all;
28
use work.package_esoc_configuration.all;
29
 
30
entity esoc_port_mal_inbound is
31
  port(
32
    clk_control           : in     STD_LOGIC;
33
    ff_rx_a_empty         : in     STD_LOGIC;
34
    ff_rx_a_full          : in     STD_LOGIC;
35
    ff_rx_data            : in     STD_LOGIC_VECTOR(31 downto 0);
36
    ff_rx_dsav            : in     STD_LOGIC;
37
    ff_rx_dval            : in     STD_LOGIC;
38
    ff_rx_eop             : in     STD_LOGIC;
39
    ff_rx_mod             : in     STD_LOGIC_VECTOR(1 downto 0);
40
    ff_rx_rdy             : out    STD_LOGIC;
41
    ff_rx_sop             : in     STD_LOGIC;
42
    force_vlan_default_in : in     std_logic;
43
    inbound_data          : out    std_logic_vector(31 downto 0);
44
    inbound_data_full     : in     std_logic;
45
    inbound_data_write    : out    std_logic;
46
    inbound_header        : out    std_logic_vector(111 downto 0);
47
    inbound_header_write  : out    std_logic;
48
    inbound_info          : out    std_logic_vector(31 downto 0);
49
    inbound_info_write    : out    std_logic;
50
    port_vlan_default     : in     std_logic_vector(15 downto 0);
51
    reset                 : in     STD_LOGIC;
52
    rx_err_stat           : in     STD_LOGIC_VECTOR(17 downto 0);
53
    rx_frm_type           : in     STD_LOGIC_VECTOR(3 downto 0));
54
end entity esoc_port_mal_inbound;
55
 
56
--------------------------------------------------------------------------------
57
-- Object        : Architecture work.esoc_port_mal_inbound.esoc_port_mal_inbound
58
-- Last modified : Mon Apr 14 12:49:11 2014.
59
--------------------------------------------------------------------------------
60
 
61
 
62
---------------------------------------------------------------------------------------------------------------
63
-- architecture and declarations
64
---------------------------------------------------------------------------------------------------------------
65
architecture esoc_port_mal_inbound of esoc_port_mal_inbound is
66
 
67
---------------------------------------------------------------------------------------------------------------
68
-- registers
69
---------------------------------------------------------------------------------------------------------------
70
 
71
---------------------------------------------------------------------------------------------------------------
72
-- signals
73
---------------------------------------------------------------------------------------------------------------
74
signal ff_rx_counter: integer range 2**esoc_inbound_info_length_size-1 downto 0;
75
 
76
signal boundary64: std_logic;
77
signal boundary64_write: std_logic;
78
 
79
begin
80
 
81
--=============================================================================================================
82
-- Process                : write header and information - DMAC, SMAC, VLAN ID, LENGTH, FLAGS  - into HEADER and INFO FIFO
83
-- Description  : header information is used by the search process in the esoc_port_processor
84
--                info information is used by the data process in the esoc_port_processor
85
--=============================================================================================================    
86
infoheader: process(clk_control, reset)
87
            begin
88
              if reset = '1' then
89
                inbound_header          <= (others => '0');
90
                inbound_info            <= (others => '0');
91
                inbound_data            <= (others => '0');
92
 
93
                inbound_header_write    <= '0';
94
                inbound_info_write      <= '0';
95
                inbound_data_write      <= '0';
96
 
97
                ff_rx_counter           <= 0;
98
                boundary64              <= '0';
99
                boundary64_write        <= '0';
100
 
101
              elsif clk_control'event and clk_control = '1' then
102
                -- clear one-clock active signals
103
                inbound_header_write  <= '0';
104
                inbound_info_write    <= '0';
105
                inbound_data_write    <= '0';
106
                boundary64_write      <= '0';
107
 
108
                -- define unused bits to avoid inferred latch warning during analysis & synthesis
109
                inbound_header(esoc_inbound_header_unused3_flag downto esoc_inbound_header_unused1_flag) <= (others => '0');
110
                inbound_info(esoc_inbound_info_unused3_flag downto esoc_inbound_info_unused1_flag) <= (others => '0');
111
 
112
                --
113
                -- MONITOR THE ST INTERFACE TO MAC
114
                --
115
                -- finalise packet storage, always write at 64b boundaries, because the other side of the FIFO has a width of 64 bit!
116
                -- create dummy write if the packet at completion does not end on a 64 bit boundary.  
117
                inbound_data_write <= boundary64_write;
118
 
119
                if ff_rx_dval = '1' then
120
                  -- store data in FIFO
121
                  if ff_rx_sop = '1' or ff_rx_counter > 0 then
122
                    inbound_data_write    <= '1';
123
                    inbound_data          <= ff_rx_data;
124
                    ff_rx_counter         <= ff_rx_counter + 4;
125
 
126
                    -- init boundary64 signal at start of new packet
127
                    if ff_rx_sop = '1' then
128
                      boundary64 <= '1';
129
                    else
130
                      boundary64 <= not(boundary64);
131
                    end if;
132
                  end if;
133
 
134
                  --
135
                  -- MANIPULATE DATA
136
                  --
137
                  case ff_rx_counter is
138
                    when 0  =>      -- store DMAC (4 MSbs) in data FIFO and prepare header FIFO input
139
                                    if ff_rx_sop = '1' then
140
                                      inbound_header(esoc_inbound_header_dmac_hi+31 downto esoc_inbound_header_dmac_hi) <= ff_rx_data;
141
                                    end if;
142
 
143
                    when 4  =>      -- store DMAC (2LSBs), SMAC (2MSBs) in data FIFO and prepare header FIFO input
144
                                    inbound_header(esoc_inbound_header_dmac_lo+15 downto esoc_inbound_header_smac_hi) <= ff_rx_data;
145
 
146
                    when 8  =>      -- store SMAC (4 LSBs) in data FIFO and prepare header FIFO input
147
                                    inbound_header(esoc_inbound_header_smac_lo+31 downto esoc_inbound_header_smac_lo) <= ff_rx_data;
148
 
149
                    when 12 =>      -- tagged packet? store VLAN ID/TCI in data FIFO and prepare header FIFO input
150
                                    if ff_rx_data(31 downto 16) = esoc_ethernet_vlan_type then
151
                                      -- tagged with VLAN ID 0 is a QoS Packet only - or force default VLAN ID - replace VLAN ID with port default VLAN ID
152
                                      if ff_rx_data(11 downto 0) = esoc_ethernet_vlan_qos or force_vlan_default_in = '1' then
153
                                        inbound_data(15 downto 0) <= port_vlan_default;
154
 
155
                                        -- store default port VLAN ID in the header FIFO for the search operation
156
                                        inbound_header(esoc_inbound_header_vlan+11 downto esoc_inbound_header_vlan) <= port_vlan_default(11 downto 0);
157
                                        inbound_header(esoc_inbound_header_vlan_flag) <= '1';
158
 
159
                                        -- store  default port VLAN tag in the info FIFO for the data transfer operation
160
                                        inbound_info(esoc_inbound_info_vlan_tci+15 downto esoc_inbound_info_vlan_tci) <= port_vlan_default;
161
                                        inbound_info(esoc_inbound_info_vlan_flag) <= '1';
162
 
163
                                      -- tagged with VLAN ID > 0
164
                                      else
165
                                        -- store only VLAN ID in the header FIFO for the search operation
166
                                        inbound_header(esoc_inbound_header_vlan+11 downto esoc_inbound_header_vlan) <= ff_rx_data(11 downto 0);
167
                                        inbound_header(esoc_inbound_header_vlan_flag) <= '1';
168
 
169
                                        -- store comlete VLAN tag in the info FIFO for the data transfer operation
170
                                        inbound_info(esoc_inbound_info_vlan_tci+15 downto esoc_inbound_info_vlan_tci) <= ff_rx_data(15 downto 0);
171
                                        inbound_info(esoc_inbound_info_vlan_flag) <= '1';
172
                                      end if;
173
 
174
                                    -- untagged packet
175
                                    else
176
                                      -- store default port VLAN ID in the header FIFO for the search operation
177
                                      inbound_header(esoc_inbound_header_vlan+11 downto esoc_inbound_header_vlan) <= port_vlan_default(11 downto 0);
178
                                      inbound_header(esoc_inbound_header_vlan_flag) <= '0';
179
 
180
                                      -- store  default port VLAN tag in the info FIFO for the data transfer operation
181
                                      inbound_info(esoc_inbound_info_vlan_tci+15 downto esoc_inbound_info_vlan_tci) <= port_vlan_default;
182
                                      inbound_info(esoc_inbound_info_vlan_flag) <= '0';
183
                                    end if;
184
 
185
                                    -- write header when complete, search operation can start!
186
                                    inbound_header_write <= '1';
187
 
188
                    when others =>  -- Write information in to fifo when packet is complete, data operation can start!
189
                                    if ff_rx_eop = '1' then
190
                                      ff_rx_counter    <= 0;
191
                                      inbound_info(esoc_inbound_info_length+esoc_inbound_info_length_size-1 downto esoc_inbound_info_length) <= std_logic_vector(to_unsigned(ff_rx_counter + 4 - to_integer(unsigned(ff_rx_mod)),esoc_inbound_info_length_size));
192
                                      inbound_info_write <= '1';
193
                                      boundary64_write <= not(boundary64);
194
                                    end if;
195
                  end case;
196
                end if;
197
              end if;
198
            end process;
199
 
200
--=============================================================================================================
201
-- Process                : write packet into DATA FIFO
202
-- Description  : 
203
--=============================================================================================================                
204
            -- FULL signal of FIFO is used to drive READY of ST Sink interface
205
            ff_rx_rdy <= not(inbound_data_full);
206
 
207
end architecture esoc_port_mal_inbound ; -- of esoc_port_mal_inbound

powered by: WebSVN 2.1.0

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