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

Subversion Repositories xmatchpro

[/] [xmatchpro/] [trunk/] [xmw4-comdec/] [xmatch_sim7/] [src/] [full_match_d.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       = 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
 
70
begin
71
 
72
FULL_MATCH_VECTOR_aux <= (SAME_LENGTH_4 and PRIORITY_6) or (SAME_LENGTH_3 and PRIORITY_5) or (SAME_LENGTH_2 and PRIORITY_2);
73
 
74
FULL_MATCH <= or_bits(FULL_MATCH_VECTOR_aux);
75
 
76
FULL_MATCH_AT_ZERO <= FULL_MATCH_VECTOR_aux(15) and FULL_MATCH_VECTOR_old(15);
77
 
78
FULL_MATCH_VECTOR <= FULL_MATCH_VECTOR_aux;
79
 
80
 
81
-- we need to store the old full match vector to know if a new full match is detected in the same position
82
 
83
LOCATE_SAME_POSITION : process(CLK, CLEAR)
84
begin
85
 
86
if (CLEAR = '0') then
87
        FULL_MATCH_VECTOR_old <= x"0000";
88
elsif (CLK'event and CLK = '1') then
89
        if(RESET = '0') then
90
                FULL_MATCH_VECTOR_old <= x"0000";
91
        elsif ( MOVE_ENABLE = '0') then
92
                FULL_MATCH_VECTOR_old <= FULL_MATCH_VECTOR_aux;
93
  else
94
                FULL_MATCH_VECTOR_old <= FULL_MATCH_VECTOR_old;
95
        end if;
96
end if;
97
 
98
end process;
99
 
100
VERIFY_SAME_POSITION : process(FULL_MATCH_VECTOR_old,FULL_MATCH_VECTOR_aux,NFL_M_ONE)
101
 
102
variable NFL_INT : integer range 0 to 15;
103
 
104
begin
105
 
106
NFL_INT := to_integer(unsigned(to_stdlogicvector(NFL_M_ONE)));
107
 
108
for i in 15 downto 0 loop -- 16 location dictionary
109
  if i >= (15-NFL_INT) then
110
                NOR_ARRAY(i) <= FULL_MATCH_VECTOR_old(i) xor FULL_MATCH_VECTOR_aux(i);
111
        else
112
                NOR_ARRAY(i) <= '0';
113
        end if;
114
end loop;
115
 
116
end process;
117
 
118
SAME_POSITION <= nor_bits(NOR_ARRAY);
119
 
120
--SAME_POSITION <= nor_bits(FULL_MATCH_VECTOR_old xor FULL_MATCH_VECTOR_aux);
121
 
122
end STRUCTURAL;

powered by: WebSVN 2.1.0

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