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

Subversion Repositories xmatchpro

[/] [xmatchpro/] [trunk/] [xmw4-comdec/] [xmatch_sim7/] [src/] [cam_array_zero.vhd] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 eejlny
--This library is free software; you can redistribute it and/or
2
--modify it under the terms of the GNU Lesser General Public
3
--License as published by the Free Software Foundation; either
4
--version 2.1 of the License, or (at your option) any later version.
5
 
6
--This library is distributed in the hope that it will be useful,
7
--but WITHOUT ANY WARRANTY; without even the implied warranty of
8
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9
--Lesser General Public License for more details.
10
 
11
--You should have received a copy of the GNU Lesser General Public
12
--License along with this library; if not, write to the Free Software
13
--Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
14
 
15
-- e_mail : j.l.nunez-yanez@byacom.co.uk
16
 
17
--------------------------------------
18
--  ENTITY       = CAM_ARRAY_MASK   --
19
--  version      = 1.0              --
20
--  last update  = 2/09/99          --
21
--  author       = Jose Nunez       --
22
--------------------------------------
23
 
24
 
25
-- FUNCTION
26
-- 16 element CAM array with masking capabilities.
27
 
28
 
29
--  PIN LIST
30
--  PREVIOUS  = input to load data word in the dictionary
31
--  SEARCH    = input search data word
32
--  MASK      = new mask for the data being loaded
33
--  MOVE      = movement control
34
--  SEL       = selection of data element to be multiplexed out
35
--  CLK       = master clock
36
--  CLEAR     = asynchronous reset of the data latch (active LOW)
37
--  SAME_LENGTH = vector to detect a full match of variable width
38
--  MTYPE_A   = bit 3 (MSB) of the match type for each location
39
--  MTYPE_B   = bit 2 of the match type for each location
40
--  MTYPE_C   = bit 1 of the match type for each location
41
--  MTYPE_D   = bit 0 (LSB) of the match type for each location
42
 
43
 
44
library ieee,dzx;
45
use ieee.std_logic_1164.all;
46
use ieee.std_logic_arith.all;
47
use dzx.bit_utils.all;
48
use dzx.attributes.all;
49
 
50
entity CAM_ARRAY_ZERO is
51
port
52
(
53
        SEARCH_DATA : in bit_vector(31 downto 0);
54
        SEARCH_MASK : in bit_vector(3 downto 0);
55
        PREVIOUS_DATA : in bit_vector(31 downto 0);
56
        PREVIOUS_MASK: in bit_vector(3 downto 0);
57
        ENABLE : in bit; -- do not load tuple 0 when waiting for data from the buffer
58
        MOVE : in bit_vector(15 downto 1);
59
        CLEAR : in bit ;
60
        RESET : in bit;
61
        CLK : in bit ;
62
        SAME_LENGTH_2 : out bit_vector(15 downto 0);
63
        SAME_LENGTH_3: out bit_vector(15 downto 0);
64
        SAME_LENGTH_4: out bit_vector(15 downto 0);
65
    MTYPE_A : out bit_vector(15 downto 0);
66
    MTYPE_B : out bit_vector(15 downto 0);
67
    MTYPE_C : out bit_vector(15 downto 0);
68
    MTYPE_D : out bit_vector(15 downto 0)
69
);
70
 
71
end CAM_ARRAY_ZERO;
72
 
73
architecture ARRAY1 of CAM_ARRAY_ZERO is
74
 
75
 
76
component MASK_WORD
77
port
78
(
79
        SEARCH: in bit_vector(3 downto 0);
80
        PREVIOUS : in bit_vector(3 downto 0);
81
        MOVE : in bit;
82
        CLEAR : in bit;
83
        RESET : in bit;
84
        CLK : in bit;
85
        DOUT : out bit_vector(3 downto 0);
86
        SAME_LENGTH_2 : out bit;
87
        SAME_LENGTH_3 : out bit;
88
        SAME_LENGTH_4 : out bit;
89
        MATCH: out bit_vector(3 downto 0)
90
);
91
end component;
92
 
93
component CAM_WORD_ZERO
94
port
95
(
96
        SEARCH : in bit_vector(31 downto 0);
97
        PREVIOUS : in bit_vector(31 downto 0);
98
        MOVE : in bit;
99
        CLEAR : in bit;
100
        RESET : in bit;
101
        CLK : in bit;
102
        DOUT : out bit_vector(31 downto 0);
103
        MATCH : out bit_vector(3 downto 0)
104
);
105
end component;
106
 
107
 
108
type MTYPE_ARRAY is array(15 downto 0) of bit_vector(3 downto 0);
109
signal MTYPE_OUT : MTYPE_ARRAY;
110
 
111
type DATA_ARRAY is array(15 downto 0) of bit_vector(31 downto 0);
112
signal MUX_DATA : DATA_ARRAY;
113
 
114
type MUX_ARRAY is array(31 downto 0) of bit_vector(15 downto 0);
115
 
116
type MTYPE_ARRAY_MASK is array(15 downto 0) of bit_vector(3 downto 0);
117
signal MTYPE_OUT_MASK : MTYPE_ARRAY_MASK;
118
 
119
type DATA_ARRAY_MASK is array(15 downto 0) of bit_vector(3 downto 0);
120
signal MUX_DATA_MASK : DATA_ARRAY_MASK;
121
 
122
type MUX_ARRAY_MASK is array(3 downto 0) of bit_vector(15 downto 0);
123
 
124
signal FIRST : bit;
125
 
126
 
127
begin
128
 
129
FIRST <= not(ENABLE);
130
 
131
C_ARRAY : for I in 0 to 15 generate
132
 
133
    FIRST_DATA_MASK : if (I=0) generate
134
        FIRST_D : CAM_WORD_ZERO port map ( SEARCH => SEARCH_DATA,
135
                                                PREVIOUS => PREVIOUS_DATA,
136
                                                                        MOVE => FIRST, -- always load data even if it is a single byte. Remove next cycle,  do not load when waiting for buffer
137
                                                                        CLEAR => CLEAR,
138
                                                                                RESET => RESET,
139
                                                                        CLK => CLK,
140
                                                                        DOUT => MUX_DATA(I),
141
                                                                        MATCH => MTYPE_OUT(I));
142
 
143
        FIRST_M : MASK_WORD  port map (   SEARCH => SEARCH_MASK,
144
                                                PREVIOUS => PREVIOUS_MASK,
145
                                                                        MOVE => FIRST,
146
                                                                        CLEAR => CLEAR,
147
                                                                                RESET => RESET,
148
                                                                        CLK => CLK,
149
                                                                        DOUT => MUX_DATA_MASK(I),
150
                                                                        SAME_LENGTH_2 => SAME_LENGTH_2(15-I),
151
                                                                        SAME_LENGTH_3 => SAME_LENGTH_3(15-I),
152
                                                                        SAME_LENGTH_4 => SAME_LENGTH_4(15-I),
153
                                                                        MATCH => MTYPE_OUT_MASK(I)
154
                                                                                );
155
 
156
      end generate;
157
    REMAINING_DATA : if (I>0) generate
158
        REST_D : CAM_WORD_ZERO port map ( SEARCH => SEARCH_DATA,
159
                                                PREVIOUS => MUX_DATA(I-1),
160
                                                                        MOVE => MOVE(I),
161
                                                                        CLEAR => CLEAR,
162
                                                                                RESET => RESET,
163
                                                                        CLK => CLK,
164
                                                                        DOUT => MUX_DATA(I),
165
                                                                        MATCH => MTYPE_OUT(I));
166
 
167
        REST_M : MASK_WORD port map ( SEARCH => SEARCH_MASK,
168
                                                PREVIOUS => MUX_DATA_MASK(I-1),
169
                                                                        MOVE => MOVE(I),
170
                                                                        CLEAR => CLEAR,
171
                                                                        RESET => RESET,
172
                                                                        CLK => CLK,
173
                                                                        DOUT => MUX_DATA_MASK(I),
174
                                                                        SAME_LENGTH_2 => SAME_LENGTH_2(15-I),
175
                                                                        SAME_LENGTH_3 => SAME_LENGTH_3(15-I),
176
                                                                        SAME_LENGTH_4 => SAME_LENGTH_4(15-I),
177
                                                                        MATCH => MTYPE_OUT_MASK(I));
178
 
179
 
180
        end generate;
181
end generate;
182
 
183
 
184
 
185
ASSIGN_MTYPE : process (MTYPE_OUT, MTYPE_OUT_MASK)  -- assign match types to the port map
186
begin
187
for I in 0 to 15 loop
188
    MTYPE_A(I) <= MTYPE_OUT(I)(3) or MTYPE_OUT_MASK(I)(3);
189
    MTYPE_B(I) <= MTYPE_OUT(I)(2) or MTYPE_OUT_MASK(I)(2);
190
    MTYPE_C(I) <= MTYPE_OUT(I)(1) or MTYPE_OUT_MASK(I)(1);
191
    MTYPE_D(I) <= MTYPE_OUT(I)(0) or MTYPE_OUT_MASK(I)(0);
192
end loop;
193
end process ASSIGN_MTYPE;
194
 
195
 
196
 
197
end ARRAY1;  -- end of architecture
198
 
199
 
200
 

powered by: WebSVN 2.1.0

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