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

Subversion Repositories esoc

[/] [esoc/] [trunk/] [Sources/] [logixa/] [esoc_port_processor_control.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_control
19
-- Last modified : Mon Apr 14 12:49:26 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_control is
31
  generic(
32
    esoc_port_nr : integer := 0);
33
  port(
34
    clk_control             : in     std_logic;
35
    clk_data                : in     std_logic;
36
    clk_search              : in     std_logic;
37
    ctrl_address            : in     std_logic_vector(15 downto 0);
38
    ctrl_rd                 : in     std_logic;
39
    ctrl_rddata             : out    std_logic_vector(31 downto 0);
40
    ctrl_vlan_id            : out    std_logic_vector(11 downto 0);
41
    ctrl_vlan_id_member_in  : in     std_logic_vector(0 downto 0);
42
    ctrl_vlan_id_member_out : out    std_logic_vector(0 downto 0);
43
    ctrl_vlan_id_wr         : out    std_logic;
44
    ctrl_wait               : out    std_logic;
45
    ctrl_wr                 : in     std_logic;
46
    ctrl_wrdata             : in     std_logic_vector(31 downto 0);
47
    inbound_done_cnt        : in     std_logic;
48
    inbound_drop_cnt        : in     std_logic;
49
    outbound_done_cnt       : in     std_logic;
50
    outbound_drop_cnt       : in     std_logic;
51
    reset                   : in     STD_LOGIC := '0';
52
    search_done_cnt         : in     std_logic;
53
    search_drop_cnt         : in     std_logic);
54
end entity esoc_port_processor_control;
55
 
56
--------------------------------------------------------------------------------
57
-- Object        : Architecture work.esoc_port_processor_control.esoc_port_processor_control
58
-- Last modified : Mon Apr 14 12:49:26 2014.
59
--------------------------------------------------------------------------------
60
 
61
 
62
architecture esoc_port_processor_control of esoc_port_processor_control is
63
 
64
---------------------------------------------------------------------------------------------------------------
65
-- registers
66
---------------------------------------------------------------------------------------------------------------
67
constant reg_port_proc_vlan_control_add: integer                                := 407;
68
 
69
constant reg_port_proc_outbound_done_count_add: integer                         := 406;
70
signal reg_port_proc_outbound_done_count: std_logic_vector(31 downto 0);
71
signal reg_port_proc_outbound_done_count_i: std_logic_vector(31 downto 0);
72
constant reg_port_proc_outbound_done_count_rst: std_logic_vector(31 downto 0)   := X"00000000";
73
 
74
constant reg_port_proc_outbound_drop_count_add: integer                         := 405;
75
signal reg_port_proc_outbound_drop_count: std_logic_vector(31 downto 0);
76
signal reg_port_proc_outbound_drop_count_i: std_logic_vector(31 downto 0);
77
constant reg_port_proc_outbound_drop_count_rst: std_logic_vector(31 downto 0)   := X"00000000";
78
 
79
constant reg_port_proc_inbound_done_count_add: integer                          := 404;
80
signal reg_port_proc_inbound_done_count: std_logic_vector(31 downto 0);
81
signal reg_port_proc_inbound_done_count_i: std_logic_vector(31 downto 0);
82
constant reg_port_proc_inbound_done_count_rst: std_logic_vector(31 downto 0)    := X"00000000";
83
 
84
constant reg_port_proc_inbound_drop_count_add: integer                          := 403;
85
signal reg_port_proc_inbound_drop_count: std_logic_vector(31 downto 0);
86
signal reg_port_proc_inbound_drop_count_i: std_logic_vector(31 downto 0);
87
constant reg_port_proc_inbound_drop_count_rst: std_logic_vector(31 downto 0)    := X"00000000";
88
 
89
constant reg_port_proc_search_done_count_add: integer                           := 402;
90
signal reg_port_proc_search_done_count: std_logic_vector(31 downto 0);
91
signal reg_port_proc_search_done_count_i: std_logic_vector(31 downto 0);
92
constant reg_port_proc_search_done_count_rst: std_logic_vector(31 downto 0)     := X"00000000";
93
 
94
constant reg_port_proc_search_drop_count_add: integer                           := 401;
95
signal reg_port_proc_search_drop_count: std_logic_vector(31 downto 0);
96
signal reg_port_proc_search_drop_count_i: std_logic_vector(31 downto 0);
97
constant reg_port_proc_search_drop_count_rst: std_logic_vector(31 downto 0)     := X"00000000";
98
 
99
constant reg_port_proc_stat_ctrl_add: integer                                   := 400;
100
signal reg_port_proc_stat_ctrl: std_logic_vector(31 downto 0);
101
constant reg_port_proc_stat_ctrl_rst: std_logic_vector(31 downto 0)             := X"00000000";
102
 
103
---------------------------------------------------------------------------------------------------------------
104
-- signals
105
---------------------------------------------------------------------------------------------------------------
106
signal search_cnt_update_ack_sync: std_logic_vector(esoc_meta_ffs-1 downto 0);
107
signal search_cnt_update_sync    : std_logic_vector(esoc_meta_ffs-1 downto 0);
108
signal search_cnt_update         : std_logic;
109
signal search_cnt_update_ack     : std_logic;
110
 
111
signal inbound_cnt_update_ack_sync: std_logic_vector(esoc_meta_ffs-1 downto 0);
112
signal inbound_cnt_update_sync    : std_logic_vector(esoc_meta_ffs-1 downto 0);
113
signal inbound_cnt_update         : std_logic;
114
signal inbound_cnt_update_ack     : std_logic;
115
 
116
signal outbound_cnt_update_ack_sync: std_logic_vector(esoc_meta_ffs-1 downto 0);
117
signal outbound_cnt_update_sync    : std_logic_vector(esoc_meta_ffs-1 downto 0);
118
signal outbound_cnt_update         : std_logic;
119
signal outbound_cnt_update_ack     : std_logic;
120
 
121
signal ctrl_rddata_i: std_logic_vector(ctrl_rddata'high downto 0);
122
signal ctrl_wait_i: std_logic;
123
signal ctrl_bus_enable: std_logic;
124
 
125
begin
126
 
127
--=============================================================================================================
128
-- Process                : access registers when addressed or provide data  to the ctrl_rddata_i bus
129
-- Description  : 
130
--=============================================================================================================    
131
registers:  process(clk_control, reset)
132
            begin
133
              if reset = '1' then
134
                reg_port_proc_stat_ctrl <= reg_port_proc_stat_ctrl_rst;
135
 
136
                ctrl_vlan_id <= (others => '0');
137
                ctrl_vlan_id_member_out <= (others => '0');
138
                ctrl_vlan_id_wr <= '0';
139
 
140
                ctrl_rddata_i   <= (others => '0');
141
                ctrl_wait_i     <= '1';
142
                ctrl_bus_enable <= '0';
143
 
144
              elsif clk_control'event and clk_control = '1' then
145
                ctrl_wait_i     <= '1';
146
                ctrl_bus_enable <= '0';
147
                ctrl_vlan_id_wr <= '0';
148
 
149
                -- continu if memory space of this entity is addressed
150
                if (to_integer(unsigned(ctrl_address)) >= esoc_port_nr * esoc_port_base_offset + esoc_port_proc_base) and (to_integer(unsigned(ctrl_address)) < esoc_port_nr * esoc_port_base_offset + esoc_port_proc_base + esoc_port_proc_size) then
151
                  -- claim the bus for ctrl_wait and ctrl_rddata
152
                  ctrl_bus_enable <= '1';
153
 
154
                  -- 
155
                        -- READ CYCLE started, unit addressed?
156
                        --
157
                        if ctrl_rd = '1' then
158
                                -- Check register address and provide data when addressed
159
                          case to_integer(unsigned(ctrl_address))- esoc_port_nr * esoc_port_base_offset is
160
                      when reg_port_proc_vlan_control_add           =>  ctrl_rddata_i <= (others => '0');
161
                                                                        ctrl_rddata_i(30 downto 30) <= ctrl_vlan_id_member_in;
162
                                                                        ctrl_wait_i <= '0';
163
 
164
                      when reg_port_proc_outbound_done_count_add    =>  if outbound_cnt_update_ack = '1' then
165
                                                                          ctrl_rddata_i <= reg_port_proc_outbound_done_count;
166
                                                                          ctrl_wait_i <= '0';
167
                                                                        end if;
168
 
169
                      when reg_port_proc_outbound_drop_count_add    =>  if outbound_cnt_update_ack = '1' then
170
                                                                          ctrl_rddata_i <= reg_port_proc_outbound_drop_count;
171
                                                                          ctrl_wait_i <= '0';
172
                                                                        end if;
173
 
174
                      when reg_port_proc_inbound_done_count_add     =>  if inbound_cnt_update_ack = '1' then
175
                                                                          ctrl_rddata_i <= reg_port_proc_inbound_done_count;
176
                                                                          ctrl_wait_i <= '0';
177
                                                                        end if;
178
 
179
                      when reg_port_proc_inbound_drop_count_add     =>  if inbound_cnt_update_ack = '1' then
180
                                                                          ctrl_rddata_i <= reg_port_proc_inbound_drop_count;
181
                                                                          ctrl_wait_i <= '0';
182
                                                                        end if;
183
 
184
                      when reg_port_proc_search_done_count_add      =>  if search_cnt_update_ack = '1' then
185
                                                                          ctrl_rddata_i <= reg_port_proc_search_done_count;
186
                                                                          ctrl_wait_i <= '0';
187
                                                                        end if;
188
 
189
                      when reg_port_proc_search_drop_count_add      =>  if search_cnt_update_ack = '1' then
190
                                                                          ctrl_rddata_i <= reg_port_proc_search_drop_count;
191
                                                                          ctrl_wait_i <= '0';
192
                                                                        end if;
193
 
194
                      when reg_port_proc_stat_ctrl_add              =>  ctrl_rddata_i <= reg_port_proc_stat_ctrl;
195
                                                                        ctrl_wait_i <= '0';
196
 
197
                      when others                                   =>  NULL;
198
                    end case;
199
 
200
                  --
201
                  -- WRITE CYCLE started, unit addressed?
202
                  --
203
                  elsif ctrl_wr = '1' then
204
                        -- Check address and accept data when addressed
205
                        case to_integer(unsigned(ctrl_address))- esoc_port_nr * esoc_port_base_offset is
206
                      when reg_port_proc_vlan_control_add           =>  ctrl_vlan_id_wr  <= ctrl_wrdata(31);
207
                                                                        ctrl_vlan_id_member_out <= ctrl_wrdata(30 downto 30);
208
                                                                        ctrl_vlan_id <= ctrl_wrdata(11 downto 0);
209
                                                                        ctrl_wait_i <= '0';
210
 
211
                      when reg_port_proc_stat_ctrl_add              =>  reg_port_proc_stat_ctrl <= ctrl_wrdata;
212
                                                                        ctrl_wait_i <= '0';
213
 
214
                      when others                                   =>  NULL;
215
                    end case;
216
                  end if;
217
                end if;
218
              end if;
219
            end process;
220
 
221
            -- Create tristate outputs
222
            ctrl_wait   <= ctrl_wait_i    when ctrl_bus_enable = '1' else 'Z';
223
            ctrl_rddata <= ctrl_rddata_i  when ctrl_bus_enable = '1' else (others => 'Z');
224
 
225
--=============================================================================================================
226
-- Process                : Update counters and transfer values from search clock domain to control clock domain
227
-- Description  : 
228
--=============================================================================================================    
229
sync1a: process(clk_search, reset)
230
        begin
231
          if reset = '1' then
232
            reg_port_proc_search_done_count_i <= reg_port_proc_search_done_count_rst;
233
            reg_port_proc_search_drop_count_i <= reg_port_proc_search_drop_count_rst;
234
 
235
          elsif clk_search'event and clk_search = '1' then
236
            -- Update DONE counter
237
            if search_done_cnt = '1' then
238
              reg_port_proc_search_done_count_i <= std_logic_vector(to_unsigned(to_integer(unsigned(reg_port_proc_search_done_count_i)) + 1,reg_port_proc_search_done_count_i'length));
239
            end if;
240
 
241
            -- Update DROP counter
242
            if search_drop_cnt = '1' then
243
              reg_port_proc_search_drop_count_i <= std_logic_vector(to_unsigned(to_integer(unsigned(reg_port_proc_search_drop_count_i)) + 1,reg_port_proc_search_drop_count_i'length));
244
            end if;
245
          end if;
246
        end process;
247
 
248
sync1b: process(clk_search, reset)
249
        begin
250
          if reset = '1' then
251
            search_cnt_update  <= '0';
252
            search_cnt_update_ack_sync <= (others => '0');
253
            reg_port_proc_search_done_count <= reg_port_proc_search_done_count_rst;
254
            reg_port_proc_search_drop_count <= reg_port_proc_search_drop_count_rst;
255
 
256
          elsif clk_search'event and clk_search = '1' then
257
            -- synchronise update acknowledge indication
258
            search_cnt_update_ack_sync <= search_cnt_update_ack & search_cnt_update_ack_sync(search_cnt_update_ack_sync'high downto 1);
259
 
260
            -- no running update? start updating the other clock domain, use a copy of the counters, because they can change during the update!
261
            if search_cnt_update = '0' and search_cnt_update_ack_sync(0) = '0' then
262
              search_cnt_update <= '1';
263
              reg_port_proc_search_done_count <= reg_port_proc_search_done_count_i;
264
              reg_port_proc_search_drop_count <= reg_port_proc_search_drop_count_i;
265
 
266
            -- finalize update when acknowledge is received
267
            elsif search_cnt_update_ack_sync(0) = '1' then
268
              search_cnt_update <= '0';
269
            end if;
270
          end if;
271
        end process;
272
 
273
sync1c: process(clk_control, reset)
274
        begin
275
          if reset = '1' then
276
            search_cnt_update_sync  <= (others => '0');
277
 
278
          -- synchronise counter update indication
279
          elsif clk_control'event and clk_control = '1' then
280
            search_cnt_update_sync <= search_cnt_update & search_cnt_update_sync(search_cnt_update_sync'high downto 1);
281
          end if;
282
        end process;
283
 
284
        -- send update acknowledge
285
        search_cnt_update_ack <=  search_cnt_update_sync(0);
286
 
287
--=============================================================================================================
288
-- Process                : Update counters and transfer values from data clock domain to control clock domain
289
-- Description  : 
290
--=============================================================================================================    
291
sync2a: process(clk_data, reset)
292
        begin
293
          if reset = '1' then
294
            reg_port_proc_inbound_done_count_i <= reg_port_proc_inbound_done_count_rst;
295
            reg_port_proc_inbound_drop_count_i <= reg_port_proc_inbound_drop_count_rst;
296
 
297
          elsif clk_data'event and clk_data = '1' then
298
            -- Update DONE counter
299
            if inbound_done_cnt = '1' then
300
              reg_port_proc_inbound_done_count_i <= std_logic_vector(to_unsigned(to_integer(unsigned(reg_port_proc_inbound_done_count_i)) + 1,reg_port_proc_inbound_done_count_i'length));
301
            end if;
302
 
303
            -- Update DROP counter
304
            if inbound_drop_cnt = '1' then
305
              reg_port_proc_inbound_drop_count_i <= std_logic_vector(to_unsigned(to_integer(unsigned(reg_port_proc_inbound_drop_count_i)) + 1,reg_port_proc_inbound_drop_count_i'length));
306
            end if;
307
          end if;
308
        end process;
309
 
310
sync2b: process(clk_data, reset)
311
        begin
312
          if reset = '1' then
313
            inbound_cnt_update  <= '0';
314
            inbound_cnt_update_ack_sync <= (others => '0');
315
            reg_port_proc_inbound_done_count <= reg_port_proc_inbound_done_count_rst;
316
            reg_port_proc_inbound_drop_count <= reg_port_proc_inbound_drop_count_rst;
317
 
318
          elsif clk_data'event and clk_data = '1' then
319
            -- synchronise update acknowledge indication
320
            inbound_cnt_update_ack_sync <= inbound_cnt_update_ack & inbound_cnt_update_ack_sync(inbound_cnt_update_ack_sync'high downto 1);
321
 
322
            -- no running update? start updating the other clock domain, use a copy of the counters, because they can change during the update!
323
            if inbound_cnt_update = '0' and inbound_cnt_update_ack_sync(0) = '0' then
324
              inbound_cnt_update <= '1';
325
              reg_port_proc_inbound_done_count <= reg_port_proc_inbound_done_count_i;
326
              reg_port_proc_inbound_drop_count <= reg_port_proc_inbound_drop_count_i;
327
 
328
            -- finalize update when acknowledge is received
329
            elsif inbound_cnt_update_ack_sync(0) = '1' then
330
              inbound_cnt_update <= '0';
331
            end if;
332
          end if;
333
        end process;
334
 
335
sync2c: process(clk_control, reset)
336
        begin
337
          if reset = '1' then
338
            inbound_cnt_update_sync  <= (others => '0');
339
 
340
          -- synchronise counter update indication
341
          elsif clk_control'event and clk_control = '1' then
342
            inbound_cnt_update_sync <= inbound_cnt_update & inbound_cnt_update_sync(inbound_cnt_update_sync'high downto 1);
343
          end if;
344
        end process;
345
 
346
        -- send update acknowledge
347
        inbound_cnt_update_ack <=  inbound_cnt_update_sync(0);
348
 
349
--=============================================================================================================
350
-- Process                : Update counters and transfer values from data clock domain to control clock domain
351
-- Description  : 
352
--=============================================================================================================    
353
sync3a: process(clk_data, reset)
354
        begin
355
          if reset = '1' then
356
            reg_port_proc_outbound_done_count_i <= reg_port_proc_outbound_done_count_rst;
357
            reg_port_proc_outbound_drop_count_i <= reg_port_proc_outbound_drop_count_rst;
358
 
359
          elsif clk_data'event and clk_data = '1' then
360
            -- Update DONE counter
361
            if outbound_done_cnt = '1' then
362
              reg_port_proc_outbound_done_count_i <= std_logic_vector(to_unsigned(to_integer(unsigned(reg_port_proc_outbound_done_count_i)) + 1,reg_port_proc_outbound_done_count_i'length));
363
            end if;
364
 
365
            -- Update DROP counter
366
            if outbound_drop_cnt = '1' then
367
              reg_port_proc_outbound_drop_count_i <= std_logic_vector(to_unsigned(to_integer(unsigned(reg_port_proc_outbound_drop_count_i)) + 1,reg_port_proc_outbound_drop_count_i'length));
368
            end if;
369
          end if;
370
        end process;
371
 
372
sync3b: process(clk_data, reset)
373
        begin
374
          if reset = '1' then
375
            outbound_cnt_update  <= '0';
376
            outbound_cnt_update_ack_sync <= (others => '0');
377
            reg_port_proc_outbound_done_count <= reg_port_proc_outbound_done_count_rst;
378
            reg_port_proc_outbound_drop_count <= reg_port_proc_outbound_drop_count_rst;
379
 
380
          elsif clk_data'event and clk_data = '1' then
381
            -- synchronise update acknowledge indication
382
            outbound_cnt_update_ack_sync <= outbound_cnt_update_ack & outbound_cnt_update_ack_sync(outbound_cnt_update_ack_sync'high downto 1);
383
 
384
            -- no running update? start updating the other clock domain, use a copy of the counters, because they can change during the update!
385
            if outbound_cnt_update = '0' and outbound_cnt_update_ack_sync(0) = '0' then
386
              outbound_cnt_update <= '1';
387
              reg_port_proc_outbound_done_count <= reg_port_proc_outbound_done_count_i;
388
              reg_port_proc_outbound_drop_count <= reg_port_proc_outbound_drop_count_i;
389
 
390
            -- finalize update when acknowledge is received
391
            elsif outbound_cnt_update_ack_sync(0) = '1' then
392
              outbound_cnt_update <= '0';
393
            end if;
394
          end if;
395
        end process;
396
 
397
sync3c: process(clk_control, reset)
398
        begin
399
          if reset = '1' then
400
            outbound_cnt_update_sync  <= (others => '0');
401
 
402
          -- synchronise counter update indication
403
          elsif clk_control'event and clk_control = '1' then
404
            outbound_cnt_update_sync <= outbound_cnt_update & outbound_cnt_update_sync(outbound_cnt_update_sync'high downto 1);
405
          end if;
406
        end process;
407
 
408
        -- send update acknowledge
409
        outbound_cnt_update_ack <=  outbound_cnt_update_sync(0);
410
end architecture esoc_port_processor_control ; -- of esoc_port_processor_control
411
 

powered by: WebSVN 2.1.0

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