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

Subversion Repositories esoc

[/] [esoc/] [trunk/] [Sources/] [logixa/] [esoc_search_engine_control.vhd] - Blame information for rev 55

Go to most recent revision | 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_search_engine_control
19
-- Last modified : Mon Apr 14 12:49:59 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_search_engine_control is
31
  port(
32
    clk_control               : in     std_logic;
33
    clk_search                : in     std_logic;
34
    ctrl_address              : in     std_logic_vector(15 downto 0);
35
    ctrl_rd                   : in     std_logic;
36
    ctrl_rddata               : out    std_logic_vector(31 downto 0);
37
    ctrl_wait                 : out    std_logic;
38
    ctrl_wr                   : in     std_logic;
39
    ctrl_wrdata               : in     std_logic_vector(31 downto 0);
40
    reset                     : in     std_logic;
41
    search_entry_age_time     : out    std_logic_vector(11 downto 0);
42
    search_entry_age_time_ena : out    std_logic;
43
    search_sa_drop_cnt        : in     std_logic;
44
    search_sa_overload_cnt    : in     std_logic);
45
end entity esoc_search_engine_control;
46
 
47
--------------------------------------------------------------------------------
48
-- Object        : Architecture work.esoc_search_engine_control.esoc_search_engine_control
49
-- Last modified : Mon Apr 14 12:49:59 2014.
50
--------------------------------------------------------------------------------
51
 
52
 
53
architecture esoc_search_engine_control of esoc_search_engine_control is
54
---------------------------------------------------------------------------------------------------------------
55
-- registers
56
---------------------------------------------------------------------------------------------------------------
57
constant reg_search_engine_sa_overload_count_add: integer                           := 2;
58
signal reg_search_engine_sa_overload_count: std_logic_vector(31 downto 0);
59
signal reg_search_engine_sa_overload_count_i: std_logic_vector(31 downto 0);
60
constant reg_search_engine_sa_overload_count_rst: std_logic_vector(31 downto 0)     := X"00000000";
61
 
62
constant reg_search_engine_sa_drop_count_add: integer                               := 1;
63
signal reg_search_engine_sa_drop_count: std_logic_vector(31 downto 0);
64
signal reg_search_engine_sa_drop_count_i: std_logic_vector(31 downto 0);
65
constant reg_search_engine_sa_drop_count_rst: std_logic_vector(31 downto 0)         := X"00000000";
66
 
67
constant reg_search_engine_stat_ctrl_add: integer                                   := 0;
68
signal reg_search_engine_stat_ctrl: std_logic_vector(31 downto 0);
69
constant reg_search_engine_stat_ctrl_rst: std_logic_vector(31 downto 0)             := X"8000012C";
70
constant reg_search_engine_stat_ctrl_rst_sim: std_logic_vector(31 downto 0)         := X"00000002";
71
  alias  reg_search_engine_stat_ctrl_age_timer_ena : std_logic is reg_search_engine_stat_ctrl(31);
72
  alias  reg_search_engine_stat_ctrl_age_timer     : std_logic_vector(11 downto 0) is reg_search_engine_stat_ctrl(11 downto 0);
73
 
74
---------------------------------------------------------------------------------------------------------------
75
-- signals
76
---------------------------------------------------------------------------------------------------------------
77
signal search_sa_cnt_update_ack_sync: std_logic_vector(esoc_meta_ffs-1 downto 0);
78
signal search_sa_cnt_update_sync    : std_logic_vector(esoc_meta_ffs-1 downto 0);
79
signal search_sa_cnt_update         : std_logic;
80
signal search_sa_cnt_update_ack     : std_logic;
81
 
82
signal ctrl_rddata_i: std_logic_vector(ctrl_rddata'high downto 0);
83
signal ctrl_wait_i: std_logic;
84
signal ctrl_bus_enable: std_logic;
85
 
86
begin
87
 
88
--=============================================================================================================
89
-- Process                : access registers when addressed or provide data  to the ctrl_rddata_i bus
90
-- Description  : 
91
--=============================================================================================================    
92
registers:  process(clk_control, reset)
93
            begin
94
              if reset = '1' then
95
                -- Reset value depends on esoc mode, simulation requires short aging timer
96
                if esoc_mode = simulation then
97
                  reg_search_engine_stat_ctrl <= reg_search_engine_stat_ctrl_rst_sim;
98
                else
99
                  reg_search_engine_stat_ctrl <= reg_search_engine_stat_ctrl_rst;
100
                end if;
101
 
102
                ctrl_rddata_i   <= (others => '0');
103
                ctrl_wait_i     <= '1';
104
                ctrl_bus_enable <= '0';
105
 
106
              elsif clk_control'event and clk_control = '1' then
107
                ctrl_wait_i     <= '1';
108
                ctrl_bus_enable <= '0';
109
 
110
                -- continu if memory space of this entity is addressed
111
                if (to_integer(unsigned(ctrl_address)) >= esoc_search_engine_base) and (to_integer(unsigned(ctrl_address)) < esoc_search_engine_base + esoc_search_engine_size) then
112
                  -- claim the bus for ctrl_wait and ctrl_rddata
113
                  ctrl_bus_enable <= '1';
114
 
115
                  -- 
116
                        -- READ CYCLE started, unit addressed?
117
                        --
118
                        if ctrl_rd = '1' then
119
                                -- Check register address and provide data when addressed
120
                          case to_integer(unsigned(ctrl_address)) - esoc_search_engine_base is
121
                            when reg_search_engine_sa_overload_count_add  =>  if search_sa_cnt_update_ack = '1' then
122
                                                                          ctrl_rddata_i <= reg_search_engine_sa_overload_count;
123
                                                                          ctrl_wait_i <= '0';
124
                                                                        end if;
125
 
126
                      when reg_search_engine_sa_drop_count_add      =>  if search_sa_cnt_update_ack = '1' then
127
                                                                          ctrl_rddata_i <= reg_search_engine_sa_drop_count;
128
                                                                          ctrl_wait_i <= '0';
129
                                                                        end if;
130
 
131
                      when reg_search_engine_stat_ctrl_add          =>  ctrl_rddata_i <= reg_search_engine_stat_ctrl;
132
                                                                        ctrl_wait_i <= '0';
133
 
134
                      when others                                   =>  NULL;
135
                    end case;
136
 
137
                  --
138
                  -- WRITE CYCLE started, unit addressed?
139
                  --
140
                  elsif ctrl_wr = '1' then
141
                        -- Check address and accept data when addressed
142
                        case to_integer(unsigned(ctrl_address)) - esoc_search_engine_base is
143
                      when reg_search_engine_stat_ctrl_add  =>  reg_search_engine_stat_ctrl <= ctrl_wrdata;
144
                                                                ctrl_wait_i <= '0';
145
 
146
                      when others                           =>  NULL;
147
                    end case;
148
                  end if;
149
                end if;
150
              end if;
151
            end process;
152
 
153
            -- Create tristate outputs
154
            ctrl_wait   <= ctrl_wait_i    when ctrl_bus_enable = '1' else 'Z';
155
            ctrl_rddata <= ctrl_rddata_i  when ctrl_bus_enable = '1' else (others => 'Z');
156
 
157
            -- use register content
158
            search_entry_age_time     <= reg_search_engine_stat_ctrl_age_timer;
159
            search_entry_age_time_ena <= reg_search_engine_stat_ctrl_age_timer_ena;
160
 
161
--=============================================================================================================
162
-- Process                : Update counters and transfer values from search clock domain to control clock domain
163
-- Description  : 
164
--=============================================================================================================    
165
sync1a: process(clk_search, reset)
166
        begin
167
          if reset = '1' then
168
            reg_search_engine_sa_drop_count_i <= reg_search_engine_sa_drop_count_rst;
169
            reg_search_engine_sa_overload_count_i <= reg_search_engine_sa_overload_count_rst;
170
 
171
          elsif clk_search'event and clk_search = '1' then
172
            -- Update source address DROP counter
173
            if search_sa_drop_cnt = '1' then
174
              reg_search_engine_sa_drop_count_i <= std_logic_vector(to_unsigned(to_integer(unsigned(reg_search_engine_sa_drop_count_i)) + 1,reg_search_engine_sa_drop_count_i'length));
175
            end if;
176
 
177
            -- Update source address OVERLOAD counter
178
            if search_sa_overload_cnt = '1' then
179
              reg_search_engine_sa_overload_count_i <= std_logic_vector(to_unsigned(to_integer(unsigned(reg_search_engine_sa_overload_count_i)) + 1,reg_search_engine_sa_overload_count_i'length));
180
            end if;
181
          end if;
182
        end process;
183
 
184
sync1b: process(clk_search, reset)
185
        begin
186
          if reset = '1' then
187
            search_sa_cnt_update  <= '0';
188
            search_sa_cnt_update_ack_sync <= (others => '0');
189
            reg_search_engine_sa_drop_count <= reg_search_engine_sa_drop_count_rst;
190
            reg_search_engine_sa_overload_count <= reg_search_engine_sa_overload_count_rst;
191
 
192
          elsif clk_search'event and clk_search = '1' then
193
            -- synchronise update acknowledge indication
194
            search_sa_cnt_update_ack_sync <= search_sa_cnt_update_ack & search_sa_cnt_update_ack_sync(search_sa_cnt_update_ack_sync'high downto 1);
195
 
196
            -- no running update? start updating the other clock domain, use a copy of the counters, because they can change during the update!
197
            if search_sa_cnt_update = '0' and search_sa_cnt_update_ack_sync(0) = '0' then
198
              search_sa_cnt_update <= '1';
199
              reg_search_engine_sa_drop_count <= reg_search_engine_sa_drop_count_i;
200
              reg_search_engine_sa_overload_count <= reg_search_engine_sa_overload_count_i;
201
 
202
            -- finalize update when acknowledge is received
203
            elsif search_sa_cnt_update_ack_sync(0) = '1' then
204
              search_sa_cnt_update <= '0';
205
            end if;
206
          end if;
207
        end process;
208
 
209
sync1c: process(clk_control, reset)
210
        begin
211
          if reset = '1' then
212
            search_sa_cnt_update_sync  <= (others => '0');
213
 
214
          -- synchronise counter update indication
215
          elsif clk_control'event and clk_control = '1' then
216
            search_sa_cnt_update_sync <= search_sa_cnt_update & search_sa_cnt_update_sync(search_sa_cnt_update_sync'high downto 1);
217
          end if;
218
        end process;
219
 
220
        -- send update acknowledge
221
        search_sa_cnt_update_ack <=  search_sa_cnt_update_sync(0);
222
 
223
end architecture esoc_search_engine_control ; -- of esoc_search_engine_control
224
 

powered by: WebSVN 2.1.0

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