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

Subversion Repositories esoc

[/] [esoc/] [trunk/] [Sources/] [logixa/] [esoc_port_processor_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_processor_inbound
19
-- Last modified : Mon Apr 14 12:49:30 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_inbound is
31
  generic(
32
    esoc_port_nr : integer := 0);
33
  port(
34
    clk_data           : in     std_logic;
35
    data               : inout  std_logic_vector(63 downto 0);
36
    data_eof           : inout  std_logic;
37
    data_gnt_wr        : in     std_logic;
38
    data_port_sel      : inout  std_logic_vector(esoc_port_count-1 downto 0);
39
    data_req           : out    std_logic;
40
    data_sof           : inout  std_logic;
41
    inbound_data       : in     std_logic_vector(63 downto 0);
42
    inbound_data_full  : in     std_logic;
43
    inbound_data_read  : out    std_logic;
44
    inbound_done_cnt   : out    std_logic;
45
    inbound_drop_cnt   : out    std_logic;
46
    inbound_info       : in     std_logic_vector(31 downto 0);
47
    inbound_info_empty : in     std_logic;
48
    inbound_info_read  : out    std_logic;
49
    reset              : in     std_logic;
50
    search_data        : in     STD_LOGIC_VECTOR(15 downto 0);
51
    search_empty       : in     STD_LOGIC;
52
    search_read        : out    STD_LOGIC);
53
end entity esoc_port_processor_inbound;
54
 
55
--------------------------------------------------------------------------------
56
-- Object        : Architecture work.esoc_port_processor_inbound.esoc_port_processor_inbound
57
-- Last modified : Mon Apr 14 12:49:30 2014.
58
--------------------------------------------------------------------------------
59
 
60
 
61
architecture esoc_port_processor_inbound of esoc_port_processor_inbound is
62
 
63
type   data_transfer_states is (idle, granted, transfer, wait_gnt, wait_no_gnt);
64
signal data_transfer_state: data_transfer_states;
65
 
66
signal data_o             : std_logic_vector(data'high downto 0);
67
signal data_sof_o         : std_logic;
68
signal data_eof_o         : std_logic;
69
signal data_port_sel_o    : std_logic_vector(data_port_sel'high downto 0);
70
 
71
signal clear_data_req     : std_logic;
72
 
73
signal inbound_drop       : std_logic;
74
signal inbound_data_full_i: std_logic;
75
signal inbound_data_read_o: std_logic;
76
signal inbound_info_length: integer range 2**esoc_inbound_info_length_size-1 downto 0;
77
 
78
begin
79
 
80
-- control the data bus when bus request is granted by arbiter for write access
81
data            <= data_o           when data_gnt_wr = '1' else (others => 'Z');
82
data_sof        <= data_sof_o       when data_gnt_wr = '1' else 'Z';
83
data_eof        <= data_eof_o       when data_gnt_wr = '1' else 'Z';
84
data_port_sel   <= data_port_sel_o  when data_gnt_wr = '1' else (others => 'Z');
85
 
86
--=============================================================================================================
87
-- Process                : read the inbound fifo's and control the data bus
88
-- Description  : 
89
--=============================================================================================================    
90
dbus:      process(clk_data, reset)
91
            begin
92
              if reset = '1' then
93
                data_o            <= (others => '0');
94
                data_sof_o        <= '0';
95
                data_eof_o        <= '0';
96
                data_port_sel_o   <= (others => '0');
97
                data_req          <= '0';
98
                clear_data_req    <= '0';
99
 
100
                inbound_info_read   <= '0';
101
                inbound_data_read_o <= '0';
102
                search_read         <= '0';
103
 
104
                inbound_info_length <= 0;
105
                inbound_done_cnt    <= '0';
106
                inbound_drop_cnt    <= '0';
107
                inbound_drop        <= '0';
108
                inbound_data_full_i <= '0';
109
 
110
              elsif clk_data'event and clk_data = '1' then
111
                -- reset one clock active signals
112
                inbound_info_read   <= '0';
113
                search_read         <= '0';
114
                data_eof_o          <= '0';
115
                clear_data_req      <= '0';
116
                inbound_done_cnt    <= '0';
117
                inbound_drop_cnt    <= '0';
118
 
119
                -- detect rising edges of the inbound_data_full input and count!
120
                inbound_data_full_i <= inbound_data_full;
121
 
122
                if inbound_data_full_i = '0' and inbound_data_full = '1'  then
123
                  inbound_drop_cnt <= '1';
124
                end if;
125
 
126
                -- request for data bus as long as there are new packets ready to transfer with a destination, de-assert one clock between
127
                -- two request to acknowledge the grant to the arbiter.
128
                if inbound_info_empty = '0' and search_empty = '0' and to_integer(unsigned(search_data)) /=0 and clear_data_req = '0' then
129
                  data_req <= '1';
130
                elsif clear_data_req = '1' then
131
                  data_req <= '0';
132
                end if;
133
 
134
                case data_transfer_state is
135
                  when idle     =>      -- new info and search data present? Ready to transfer packet, prepare and wait for bus grant!
136
                                        if inbound_info_empty = '0' and search_empty = '0' then
137
                                          -- INFO FIFO -> store packet length from fifo for further processing
138
                                          inbound_info_length <= to_integer(unsigned(inbound_info(esoc_inbound_info_length+esoc_inbound_info_length_size-1 downto esoc_inbound_info_length)));
139
 
140
                                          -- INFO FIFO -> drive the data bus signals with packet info like eSOC source port, length. VLAN and flags
141
                                          data_o(esoc_dbus_packet_info_sport+3 downto esoc_dbus_packet_info_sport)                                     <= std_logic_vector(to_unsigned(esoc_port_nr,4));
142
                                          data_o(esoc_dbus_packet_info_length+esoc_dbus_packet_info_length_size-1 downto esoc_dbus_packet_info_length) <= inbound_info(esoc_inbound_info_length+esoc_inbound_info_length_size-1 downto esoc_inbound_info_length);
143
                                          data_o(esoc_dbus_packet_info_unused3_flag downto esoc_dbus_packet_info_vlan_flag)                            <= inbound_info(esoc_inbound_info_unused3_flag downto esoc_inbound_info_vlan_flag);
144
                                          data_o(esoc_dbus_packet_info_vlan_tci+15 downto esoc_dbus_packet_info_vlan_tci)                              <= inbound_info(esoc_inbound_info_vlan_tci+15 downto esoc_inbound_info_vlan_tci);
145
 
146
                                          -- SEARCH FIFO -> drive data bus port select signals with data from SEARCH FIFO, only valid destinations will be enabled
147
                                          data_port_sel_o <= search_data(data_port_sel_o'high downto 0);
148
 
149
                                          -- DATA FIFO -> start acknowledging data from the DATA FIFO, real acknowledge depends on outcome of if-then-else statement below!
150
                                          -- No drop -> real acknowledges when bus grant is detectt, drop -> acknowledges immediately
151
                                          inbound_data_read_o <= '1';
152
 
153
                                          -- if there are no ports selected then packet must be dropped else request data bus and acknowledge data from search and info FIFO
154
                                          if to_integer(unsigned(search_data)) = 0 then
155
                                            inbound_drop        <= '1';
156
                                            search_read         <= '1';
157
                                            inbound_info_read   <= '1';
158
                                            data_transfer_state <= transfer;
159
                                          else
160
                                            data_sof_o <= '1';
161
                                            inbound_drop <= '0';
162
                                            data_transfer_state <= wait_gnt;
163
                                          end if;
164
                                        end if;
165
 
166
                  when wait_gnt =>      -- Wait for bus grant from arbiter before acknowledge data from the INFO and SEARCH FIFO when granted
167
                                        -- If data_gnt_wr is sampled high the first word is already transferred, remove SOF, provide next word.
168
                                        if data_gnt_wr = '1' then
169
                                          -- Bus grant received, clear request and acknowledge data from search and info FIFO
170
                                          clear_data_req      <= '1';
171
                                          search_read         <= '1';
172
                                          inbound_info_read   <= '1';
173
 
174
                                          -- First word (packet info) send, remove Start of Frame and provide the first data of packet
175
                                          data_sof_o          <= '0';
176
                                          data_o              <= inbound_data;
177
                                          inbound_info_length <= inbound_info_length - 8;
178
                                          data_transfer_state <= transfer;
179
                                        end if;
180
 
181
                  when transfer     =>  -- Keep on reading data FIFO until last word is read, terminate bus (End of Frame) if the packet isn't dropped
182
                                        if inbound_info_length > 8 then
183
                                          inbound_info_length <= inbound_info_length - 8;
184
                                          data_o <= inbound_data;
185
 
186
                                        else
187
                                          -- Provide last data, stop accessing data FIFO
188
                                          data_o <= inbound_data;
189
                                          inbound_data_read_o <= '0';
190
 
191
                                          -- Termination of bus access and increment of drop counter depends on the drop status
192
                                          data_eof_o <= not(inbound_drop);
193
                                          inbound_drop_cnt <= inbound_drop;
194
                                          inbound_done_cnt <= not(inbound_drop);
195
                                          data_transfer_state <= wait_no_gnt;
196
                                        end if;
197
 
198
                  when  wait_no_gnt =>  -- Wait for no bus grant from bus arbiter , bus arbiter must proces the EOF of this module, wait one clock cycle before next packet can be processed.
199
                                        data_transfer_state <= idle;
200
 
201
                  when others       =>  data_transfer_state <= idle;
202
                end case;
203
              end if;
204
            end process;
205
 
206
            -- Read from fifo is under control of the data bus grant signal or drop decision
207
            inbound_data_read <= inbound_data_read_o when data_gnt_wr = '1' or inbound_drop = '1' else '0';
208
 
209
end architecture esoc_port_processor_inbound ; -- of esoc_port_processor_inbound
210
 

powered by: WebSVN 2.1.0

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