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

Subversion Repositories esoc

[/] [esoc/] [trunk/] [Sources/] [logixa/] [esoc_port_mal_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_mal_outbound
19
-- Last modified : Mon Apr 14 12:49:17 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_outbound is
31
  port(
32
    clk_control            : in     STD_LOGIC;
33
    ff_tx_a_empty          : in     STD_LOGIC;
34
    ff_tx_a_full           : in     STD_LOGIC;
35
    ff_tx_crc_fwd          : out    STD_LOGIC;
36
    ff_tx_data             : out    STD_LOGIC_VECTOR(31 downto 0);
37
    ff_tx_eop              : out    STD_LOGIC;
38
    ff_tx_err              : out    STD_LOGIC;
39
    ff_tx_mod              : out    STD_LOGIC_VECTOR(1 downto 0);
40
    ff_tx_rdy              : in     STD_LOGIC;
41
    ff_tx_septy            : in     STD_LOGIC;
42
    ff_tx_sop              : out    STD_LOGIC;
43
    ff_tx_wren             : out    STD_LOGIC;
44
    force_vlan_default_out : in     std_logic;
45
    outbound_data          : in     std_logic_vector(31 downto 0);
46
    outbound_data_read     : out    std_logic;
47
    outbound_info          : in     std_logic_vector(15 downto 0);
48
    outbound_info_empty    : in     std_logic;
49
    outbound_info_read     : out    std_logic;
50
    port_vlan_default      : in     std_logic_vector(15 downto 0);
51
    reset                  : in     STD_LOGIC;
52
    tx_ff_uflow            : in     STD_LOGIC);
53
end entity esoc_port_mal_outbound;
54
 
55
--------------------------------------------------------------------------------
56
-- Object        : Architecture work.esoc_port_mal_outbound.esoc_port_mal_outbound
57
-- Last modified : Mon Apr 14 12:49:17 2014.
58
--------------------------------------------------------------------------------
59
 
60
 
61
architecture esoc_port_mal_outbound of esoc_port_mal_outbound is
62
 
63
---------------------------------------------------------------------------------------------------------------
64
-- registers
65
---------------------------------------------------------------------------------------------------------------
66
 
67
---------------------------------------------------------------------------------------------------------------
68
-- signals
69
---------------------------------------------------------------------------------------------------------------
70
type   ff_tx_states is (idle, running, drop);
71
signal ff_tx_state: ff_tx_states;
72
 
73
signal ff_tx_byte_counter: integer range 2**esoc_outbound_info_length_size-1 downto 0;
74
signal ff_tx_word_counter: integer range ((2**esoc_outbound_info_length_size)/4)-1 downto 0;
75
 
76
signal outbound_data_read_enable: std_logic;
77
signal outbound_data_read_dummy: std_logic;
78
signal outbound_data_modify_enable: std_logic;
79
signal outbound_data_modify: std_logic_vector(outbound_data'high downto 0);
80
 
81
signal outbound_info_vlan_flag: std_logic;
82
 
83
signal boundary64: std_logic;
84
 
85
begin
86
 
87
 
88
--=============================================================================================================
89
-- Process                : capture and store data when ready acycle occurs
90
-- Description  : 
91
--=============================================================================================================    
92
capture:    process(clk_control, reset)
93
            begin
94
              if reset = '1' then
95
                ff_tx_sop     <= '0';
96
                ff_tx_eop     <= '0';
97
                ff_tx_wren    <= '0';
98
                ff_tx_mod     <= (others => '0');
99
                ff_tx_byte_counter <= 0;
100
                ff_tx_word_counter <= 0;
101
 
102
                outbound_info_vlan_flag   <= '0';
103
 
104
                outbound_data_modify_enable <= '0';
105
                outbound_data_modify <= (others => '0');
106
 
107
                outbound_info_read        <= '0';
108
                outbound_data_read_dummy   <= '0';
109
                outbound_data_read_enable <= '0';
110
 
111
                boundary64    <= '0';
112
 
113
              elsif clk_control'event and clk_control = '1' then
114
                -- clear one-clock active signals
115
                outbound_info_read          <= '0';
116
                outbound_data_read_dummy    <= '0';
117
                outbound_data_modify_enable <= '0';
118
 
119
                case ff_tx_state is
120
                  when idle =>      -- create dummy read if the previous transaction does not end on a 64 bit boundary
121
                                    if boundary64 = '1' then
122
                                      boundary64 <= '0';
123
                                      outbound_data_read_dummy <= '1';
124
 
125
                                    -- Info fifo not empty? Get length from info fifo and acknowledge info fifo read! Start packet transmission.
126
                                    elsif outbound_info_empty = '0' then
127
                                      -- get the length, subtract 4 byes because first word is provided on ST interface immediately, acknowledge info from fifo
128
                                      outbound_info_read      <= '1';
129
                                      ff_tx_word_counter      <= 0;
130
                                      ff_tx_byte_counter      <= to_integer(unsigned(outbound_info(esoc_outbound_info_length+esoc_outbound_info_length_size-1 downto esoc_outbound_info_length)))-4;
131
                                      outbound_info_vlan_flag <= outbound_info(esoc_outbound_info_vlan_flag);
132
 
133
                                      -- send packet to MAC or drop packet if an error is indicated, error can be packet in data FIFO not complete due to overrun
134
                                      if outbound_info(esoc_outbound_info_error_flag) = '0' then
135
                                        outbound_data_read_enable <= '1';
136
                                        ff_tx_sop                 <= '1';
137
                                        ff_tx_wren                <= '1';
138
                                        ff_tx_state               <= running;
139
 
140
                                      -- receive data has an error, drop it!
141
                                      else
142
                                        outbound_data_read_dummy  <= '1';
143
                                        ff_tx_state               <= drop;
144
                                      end if;
145
                                    end if;
146
 
147
                  when running =>   -- provide next data when ready is asserted (=acknowledge of current data)
148
                                    if ff_tx_rdy = '1' then
149
                                      --
150
                                      -- CONTROL THE ST INTERFACE TO MAC
151
                                      --
152
                                      -- deassert the start of packet
153
                                      ff_tx_sop <= '0';
154
 
155
                                      -- last word of transaction read by ST Sink port, stop transfer
156
                                      if ff_tx_byte_counter = 0 then
157
                                        outbound_data_read_enable <= '0';
158
                                        ff_tx_eop                 <= '0';
159
                                        ff_tx_wren                <= '0';
160
                                        ff_tx_state               <= idle;
161
 
162
                                      -- last word of transaction to be read by ST Sink port?
163
                                      elsif ff_tx_byte_counter <= 4 then
164
                                        ff_tx_eop <= '1';
165
                                        ff_tx_byte_counter <= 0;
166
                                        ff_tx_mod <= std_logic_vector(to_unsigned(4-ff_tx_byte_counter,ff_tx_mod'length));
167
 
168
                                      -- transaction not finished, update counter
169
                                      else
170
                                        ff_tx_byte_counter <= ff_tx_byte_counter - 4;
171
                                      end if;
172
 
173
                                      -- toggle to know from which boundary is read, 32b or 64b
174
                                      boundary64 <= not(boundary64);
175
 
176
                                      --
177
                                      -- MANIPULATE DATA
178
                                      --
179
                                      -- modify vlan id with default vlan id if packet is tagged and force default vlan is enabled
180
                                      if ff_tx_word_counter = 2 then
181
                                        if outbound_info_vlan_flag = '1' and force_vlan_default_out = '1' then
182
                                          outbound_data_modify_enable <= '1';
183
                                          outbound_data_modify        <= esoc_ethernet_vlan_type & port_vlan_default;
184
                                        end if;
185
                                      end if;
186
 
187
                                      ff_tx_word_counter <= ff_tx_word_counter + 1;
188
 
189
                                    end if;
190
 
191
                  when drop =>      -- read erroneous packet from FIFO and drop!  
192
                                    -- size of packet always multiple of 8 bytes, no boundary64 mechanism required
193
                                    if ff_tx_byte_counter <= 4 then
194
                                      ff_tx_state <= idle;
195
 
196
                                    else
197
                                      ff_tx_byte_counter <= ff_tx_byte_counter - 4;
198
                                    end if;
199
 
200
                                    outbound_data_read_dummy  <= '1';
201
 
202
                  when others =>    ff_tx_state <= idle;
203
                end case;
204
              end if;
205
            end process;
206
 
207
            ff_tx_err           <= '0';
208
            ff_tx_crc_fwd       <= '0';
209
            ff_tx_data          <= outbound_data when outbound_data_modify_enable = '0' else outbound_data_modify;
210
            outbound_data_read  <= (ff_tx_rdy and outbound_data_read_enable) or outbound_data_read_dummy;
211
 
212
end architecture esoc_port_mal_outbound ; -- of esoc_port_mal_outbound

powered by: WebSVN 2.1.0

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