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

Subversion Repositories xmatchpro

[/] [xmatchpro/] [trunk/] [xmw4-comdec/] [xmatch_sim7/] [src/] [rli_counter_c.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       = RLI_COUNTER        --
19
--  version      = 1.0                --
20
--  last update  = 22/11/99           --
21
--  author       = Jose Nunez         --
22
----------------------------------------
23
 
24
 
25
-- FUNCTION
26
-- 8 bit counter for the RLI process
27
 
28
 
29
--  PIN LIST
30
--  LOAD = load external data ( for decompression )
31
--  LOCATION_ZERO = run length at location zero
32
--  SAME_POSITION = to detect a full match at the same position
33
--  DATA = external data ( for decompression )
34
--  ENABLE = enable count if not enable then zero
35
--  CLEAR = asyncronus clear of the counter
36
--  CLK   = master clock
37
--  COUNT = count output
38
--  RL_DETECTED = run length internal detection
39
 
40
library ieee,dzx;
41
use ieee.std_logic_1164.all;
42
use dzx.bit_arith.all;
43
use dzx.bit_utils.all;
44
 
45
entity RLI_COUNTER_C is
46
port (
47
          MOVE_ENABLE : in bit;
48
          ENABLE_C : in bit;
49
          LOCATION_ZERO : in bit;
50
          SAME_POSITION : in bit;
51
          CLEAR : in bit;
52
          RESET : in bit;
53
          CLK : in bit;
54
          COUNT : out bit_vector(7 downto 0);
55
          RL_DETECTED : out bit
56
          );
57
 
58
end RLI_COUNTER_C;
59
 
60
architecture STRUCTURAL of RLI_COUNTER_C is
61
 
62
signal NEXT_COUNT : bit_vector(7 downto 0);
63
signal CURRENT_COUNT : bit_vector(7 downto 0);
64
signal ENABLE_INT : bit;
65
signal COUNTER_RESET : bit;
66
 
67
 
68
begin
69
 
70
ENABLE_INT <= ENABLE_C;
71
 
72
 
73
STATES: process (MOVE_ENABLE, ENABLE_INT, SAME_POSITION, CURRENT_COUNT, COUNTER_RESET, LOCATION_ZERO)
74
begin
75
if (MOVE_ENABLE = '0') then
76
        case CURRENT_COUNT is
77
        when "00000000" =>
78
                if( ENABLE_INT = '1') then
79
                        NEXT_COUNT <= "00000001";
80
                else
81
                        NEXT_COUNT<= "00000000";
82
                end if;
83
        when "11111111" =>
84
                if( ENABLE_INT = '1') then
85
                        NEXT_COUNT <= "00000001";
86
                else
87
                        NEXT_COUNT<= "00000000";
88
                end if;
89
        when others =>
90
                if ((SAME_POSITION = '1' and COUNTER_RESET = '0') or (LOCATION_ZERO = '1')) then
91
                        NEXT_COUNT <= CURRENT_COUNT + "00000001";
92
                elsif (ENABLE_INT = '1') then
93
                        NEXT_COUNT <= "00000001";
94
                else
95
                        NEXT_COUNT <= "00000000";
96
                end if;
97
        end case;
98
else
99
        NEXT_COUNT <= CURRENT_COUNT; -- "00000000";
100
end if;
101
end process STATES;
102
 
103
INCREASE_COUNT : process (LOCATION_ZERO,CURRENT_COUNT)
104
begin
105
if(LOCATION_ZERO='0' and CURRENT_COUNT = "00000101") then
106
        COUNTER_RESET <= '1';
107
else
108
        COUNTER_RESET <= '0';
109
end if;
110
end process INCREASE_COUNT;
111
 
112
 
113
 
114
COUNTING : process (CLK,CLEAR)
115
 
116
begin
117
 
118
        -- asynchronous RESET signal forces all outputs LOW
119
      if (CLEAR = '0') then
120
            CURRENT_COUNT <= "00000000";
121
            -- check for +ve clock edge
122
          elsif ((CLK'event) and (CLK = '1')) then
123
                            if (RESET = '0') then
124
                                         CURRENT_COUNT <= "00000000";
125
                    else
126
                                        CURRENT_COUNT <= NEXT_COUNT;
127
                            end if;
128
         end if;
129
 
130
end process COUNTING;
131
 
132
RL_DETECTED <= '1' when CURRENT_COUNT > "00000001" else '0'; -- run length detection
133
 
134
COUNT <= CURRENT_COUNT;
135
 
136
 
137
end STRUCTURAL;
138
 

powered by: WebSVN 2.1.0

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