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

Subversion Repositories esoc

[/] [esoc/] [trunk/] [Sources/] [logixa/] [esoc_port_processor_outbound.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_processor_outbound
19
-- Last modified : Mon Apr 14 12:49:34 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_processor_outbound is
31
  generic(
32
    esoc_port_nr : integer := 0);
33
  port(
34
    clk_data             : in     std_logic;
35
    data                 : in     std_logic_vector(63 downto 0);
36
    data_eof             : in     std_logic;
37
    data_gnt_rd          : in     std_logic;
38
    data_port_sel        : in     std_logic_vector(esoc_port_count-1 downto 0);
39
    data_sof             : in     std_logic;
40
    outbound_data        : out    std_logic_vector(63 downto 0);
41
    outbound_data_full   : in     std_logic;
42
    outbound_data_write  : out    std_logic;
43
    outbound_done_cnt    : out    std_logic;
44
    outbound_drop_cnt    : out    std_logic;
45
    outbound_info        : out    std_logic_vector(15 downto 0);
46
    outbound_info_write  : out    std_logic;
47
    outbound_vlan_id     : out    STD_LOGIC_VECTOR(11 downto 0);
48
    outbound_vlan_member : in     STD_LOGIC_VECTOR(0 downto 0);
49
    reset                : in     std_logic);
50
end entity esoc_port_processor_outbound;
51
 
52
--------------------------------------------------------------------------------
53
-- Object        : Architecture work.esoc_port_processor_outbound.esoc_port_processor_outbound
54
-- Last modified : Mon Apr 14 12:49:34 2014.
55
--------------------------------------------------------------------------------
56
 
57
 
58
architecture esoc_port_processor_outbound of esoc_port_processor_outbound is
59
 
60
type   data_transfer_states is (idle, request, transfer);
61
signal data_transfer_state: data_transfer_states;
62
 
63
signal data_i             : std_logic_vector(data'high downto 0);
64
signal data_sof_i         : std_logic;
65
signal data_eof_i         : std_logic;
66
signal data_port_sel_i    : std_logic_vector(data_port_sel'high downto 0);
67
 
68
signal outbound_info_length: integer range 2**esoc_outbound_info_length_size-1 downto 0;
69
signal outbound_info_counter: integer range 2**esoc_outbound_info_length_size-1 downto 0;
70
 
71
signal outbound_data_write_i: std_logic;
72
 
73
signal outbound_vlan_member_check: std_logic;
74
 
75
begin
76
 
77
-- control the data bus when bus request is granted by arbiter for read access
78
data_i          <= data             when data_gnt_rd = '1'  else (others => '0');
79
data_sof_i      <= data_sof         when data_gnt_rd = '1'  else '0';
80
data_eof_i      <= data_eof         when data_gnt_rd = '1'  else '0';
81
data_port_sel_i <= data_port_sel    when data_gnt_rd = '1'  else (others => '0');
82
 
83
--=============================================================================================================
84
-- Process                : control the data bus and drive the outbound fifo's 
85
-- Description  : 
86
--=============================================================================================================    
87
dbus: process(clk_data, reset)
88
      begin
89
        if reset = '1' then
90
          outbound_data         <= (others => '0');
91
          outbound_data_write_i <= '0';
92
 
93
          outbound_info         <= (others => '0');
94
          outbound_info_write   <= '0';
95
          outbound_info_length  <= 0;
96
          outbound_info_counter <= 0;
97
 
98
          outbound_vlan_id      <= (others => '0');
99
          outbound_vlan_member_check <= '0';
100
 
101
          outbound_done_cnt     <= '0';
102
          outbound_drop_cnt     <= '0';
103
 
104
        elsif clk_data'event and clk_data = '1' then
105
          -- reset one clock active signals
106
          outbound_info_write   <= '0';
107
          outbound_data_write_i <= '0';
108
 
109
          outbound_done_cnt     <= '0';
110
          outbound_drop_cnt     <= '0';
111
 
112
          -- define unused bits to avoid inferred latch warning during analysis & synthesis
113
          outbound_info(esoc_outbound_info_unused3_flag downto esoc_outbound_info_unused2_flag) <= (others => '0');
114
 
115
          case data_transfer_state is
116
            when idle     =>  -- store packet info (VID, LENGTH) when port is selected and SOF is asserted
117
                              if data_port_sel_i(esoc_port_nr) = '1' and data_sof_i = '1' then
118
                                -- store packet if there is still space in the FIFO else increment counters
119
                                if outbound_data_full = '0' then
120
                                  -- get length of packet
121
                                  outbound_info_length        <= to_integer(unsigned(data_i(esoc_dbus_packet_info_length + esoc_dbus_packet_info_length_size-1 downto esoc_dbus_packet_info_length)));
122
 
123
                                  -- get VLAN ID of packet and check whether this port is member of the VLAN or not
124
                                  outbound_vlan_id            <= data_i(esoc_dbus_packet_info_vlan_tci+11 downto esoc_dbus_packet_info_vlan_tci);
125
                                  outbound_vlan_member_check  <= '0';
126
                                  outbound_info_counter       <= 0;
127
                                  outbound_info(esoc_outbound_info_vlan_flag) <= data_i(esoc_dbus_packet_info_vlan_flag);
128
                                  data_transfer_state         <= transfer;
129
 
130
                                else
131
                                  outbound_drop_cnt     <= '1';
132
                                end if;
133
                              end if;
134
 
135
            when transfer =>  -- if outbound data fifo is full or port is selected but not member of VLAN -> drop packet, drop packet is done 
136
                              -- in the esoc_mal_outbound entity, an error and the amount of bytes yet stored are set here and forwarded to that 
137
                              -- entity. Note: a part of the packet is yet stored, so calculate the number of stored bytes and do not use only
138
                              -- the packet length that is sent by the source.
139
                              if outbound_data_full = '1' or (outbound_vlan_member = "0" and outbound_vlan_member_check = '1') then
140
                                outbound_info(esoc_outbound_info_length + esoc_outbound_info_length_size -1 downto esoc_outbound_info_length) <= std_logic_vector(to_unsigned(outbound_info_counter-8,esoc_outbound_info_length_size));
141
                                outbound_info(esoc_outbound_info_error_flag) <= '1';
142
                                outbound_info_write   <= '1';
143
                                outbound_drop_cnt     <= '1';
144
                                data_transfer_state   <= idle;
145
 
146
                              -- no error, write data into data FIFO, update outbound_info_counter, this outbound_info_counter is used to 
147
                              -- calculate stored bytes when packet storage is aborted before packet is complete due to an error (data FIFO 
148
                              -- full or port not member of VLAN)
149
                              else
150
                                outbound_data <= data_i;
151
                                outbound_data_write_i <= '1';
152
                                outbound_info_counter <= outbound_info_counter + 8;
153
 
154
                                -- end of packet, store length and flags in info FIFO
155
                                if data_eof_i = '1' then
156
                                  outbound_info(esoc_outbound_info_length + esoc_outbound_info_length_size -1 downto esoc_outbound_info_length) <= std_logic_vector(to_unsigned(outbound_info_length,esoc_outbound_info_length_size));
157
                                  outbound_info(esoc_outbound_info_error_flag) <= '0';
158
                                  outbound_info_write   <= '1';
159
                                  outbound_done_cnt     <= '1';
160
                                  data_transfer_state   <= idle;
161
                                end if;
162
                              end if;
163
 
164
                              -- next time vlan membership is known, memory requires additional clock cycle, enable checking!
165
                              outbound_vlan_member_check <= '1';
166
 
167
            when others   =>  data_transfer_state <= idle;
168
          end case;
169
        end if;
170
      end process;
171
 
172
      -- write when FIFO is not full!
173
      outbound_data_write <= outbound_data_write_i and not(outbound_data_full);
174
 
175
end architecture esoc_port_processor_outbound ; -- of esoc_port_processor_outbound
176
 

powered by: WebSVN 2.1.0

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