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

Subversion Repositories xmatchpro

[/] [xmatchpro/] [trunk/] [xmw4-comdec/] [src/] [full_match_d.vhd] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 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       = FULL_MATCH_D            --
19
--  version      = 1.0                     --
20
--  last update  = 3/06/01                 --
21
--  author       = Jose Nunez              --
22
---------------------------------------------
23
 
24
 
25
-- FUNCTION
26
-- the full match detection unit detects a full match with the same length for movement generation
27
 
28
-- PIN LIST
29
 
30
-- PRIORITY_6 : 4 bytes match
31
-- PRIORITY_5 : 3 bytes match
32
-- PRIORITY_2 : 2 bytes match
33
-- SAME_LENGTH_2 : detect the same length of 2 search and present
34
-- SAME_LENGTH_3 : detect the same length of 3 search and present
35
-- SAME_LENGTH_4 : detect the same length of 4 search and present
36
-- FULL_MATCH_VECTOR : output with only one bit set to 1 for full match with same length
37
 
38
library ieee;
39
use ieee.std_logic_1164.all;
40
use ieee.numeric_std.all;
41
library dzx;
42
use dzx.bit_utils.all;
43
 
44
entity FULL_MATCH_D is
45
port (
46
                  NFL_M_ONE : in bit_vector(7 downto 0); --control how many locations are active
47
                  MOVE_ENABLE : in bit;
48
       PRIORITY_6: in bit_vector(15 downto 0);
49
                  PRIORITY_5: in bit_vector(15 downto 0);
50
                  PRIORITY_2: in bit_vector(15 downto 0);
51
                  SAME_LENGTH_2: in bit_vector(15 downto 0);
52
                  SAME_LENGTH_3: in bit_vector(15 downto 0);
53
                  SAME_LENGTH_4: in bit_vector(15 downto 0);
54
                  CLK : in bit;
55
                  CLEAR : in bit;
56
                  RESET : in bit;
57
                  FULL_MATCH : out bit;
58
                  FULL_MATCH_AT_ZERO : out bit;
59
                  SAME_POSITION : out bit;
60
                  FULL_MATCH_VECTOR : out bit_vector(15 downto 0)
61
          );
62
end FULL_MATCH_D;
63
 
64
architecture STRUCTURAL of FULL_MATCH_D is
65
 
66
signal FULL_MATCH_VECTOR_aux : bit_vector(15 downto 0);
67
signal FULL_MATCH_VECTOR_old : bit_vector(15 downto 0);
68
signal NOR_ARRAY :  bit_vector(15 downto 0);
69
signal FULL_MATCH_aux : bit;
70
 
71
begin
72
 
73
FULL_MATCH_VECTOR_aux <= (SAME_LENGTH_4 and PRIORITY_6) or (SAME_LENGTH_3 and PRIORITY_5) or (SAME_LENGTH_2 and PRIORITY_2);
74
 
75
FULL_MATCH_aux <= or_bits(FULL_MATCH_VECTOR_aux);
76
 
77
FULL_MATCH <= FULL_MATCH_aux;
78
 
79
FULL_MATCH_AT_ZERO <= FULL_MATCH_VECTOR_aux(15) and FULL_MATCH_VECTOR_old(15);
80
 
81
FULL_MATCH_VECTOR <= FULL_MATCH_VECTOR_aux;
82
 
83
 
84
-- we need to store the old full match vector to know if a new full match is detected in the same position
85
 
86
LOCATE_SAME_POSITION : process(CLK, CLEAR)
87
begin
88
 
89
if (CLEAR = '0') then
90
        FULL_MATCH_VECTOR_old <= x"0000";
91
elsif (CLK'event and CLK = '1') then
92
        if(RESET = '0') then
93
                FULL_MATCH_VECTOR_old <= x"0000";
94
        elsif ( MOVE_ENABLE = '0') then
95
                FULL_MATCH_VECTOR_old <= FULL_MATCH_VECTOR_aux;
96
  else
97
                FULL_MATCH_VECTOR_old <= FULL_MATCH_VECTOR_old;
98
        end if;
99
end if;
100
 
101
end process;
102
 
103
VERIFY_SAME_POSITION : process(FULL_MATCH_VECTOR_old,FULL_MATCH_VECTOR_aux,NFL_M_ONE)
104
 
105
variable NFL_INT : integer range 0 to 15;
106
 
107
begin
108
 
109
NFL_INT := to_integer(unsigned(to_stdlogicvector(NFL_M_ONE)));
110
 
111
for i in 15 downto 0 loop -- 16 location dictionary
112
  if i >= (15-NFL_INT) then
113
                NOR_ARRAY(i) <= FULL_MATCH_VECTOR_old(i) xor FULL_MATCH_VECTOR_aux(i);
114
        else
115
                NOR_ARRAY(i) <= '0';
116
        end if;
117
end loop;
118
 
119
end process;
120
 
121
SAME_POSITION <= nor_bits(NOR_ARRAY) when FULL_MATCH_aux = '1' else '0';
122
 
123
--SAME_POSITION <= nor_bits(FULL_MATCH_VECTOR_old xor FULL_MATCH_VECTOR_aux);
124
 
125
end STRUCTURAL;

powered by: WebSVN 2.1.0

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