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

Subversion Repositories xmatchpro

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

Go to most recent revision | 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       = 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
--  DATA = external data ( for decompression )
32
--  ENABLE = enable count if not enable then zero
33
--  CLEAR = asyncronus clear of the counter
34
--  CLK   = master clock
35
--  COUNT = count output
36
--  RL_DETECTED = run length internal detection
37
 
38
library ieee,dzx;
39
use ieee.std_logic_1164.all;
40
use dzx.bit_arith.all;
41
use dzx.bit_utils.all;
42
 
43
entity RLI_COUNTER_D is
44
port (LOAD: in bit;
45
          DATA: in bit_vector(7 downto 0);
46
          ENABLE_D : in bit;
47
          CLEAR : in bit;
48
          RESET : in bit;
49
          CLK : in bit;
50
          END_COUNT : out bit
51
          );
52
 
53
end RLI_COUNTER_D;
54
 
55
architecture STRUCTURAL of RLI_COUNTER_D is
56
 
57
signal COUNT_AUX : bit_vector(7 downto 0);
58
signal ENABLE_INT : bit;
59
signal LATCH_DATA : bit_vector(7 downto 0);
60
 
61
begin
62
 
63
ENABLE_INT <= ENABLE_D;
64
 
65
LATCH : process(CLK,CLEAR,LOAD)
66
begin
67
        -- asynchronous RESET signal forces all outputs LOW
68
      if (CLEAR = '0') then
69
            LATCH_DATA <= "00000000";
70
            -- check for +ve clock edge
71
        elsif ((CLK'event) and (CLK = '1')) then
72
             if (RESET = '0') then
73
                                 LATCH_DATA <= "00000000";
74
              elsif (LOAD = '1') then
75
                                   LATCH_DATA <= DATA;
76
                   else
77
                                   LATCH_DATA <= LATCH_DATA;
78
                        end if;
79
        end if;
80
 
81
end process LATCH;
82
 
83
 
84
 
85
COUNTING : process (CLK,CLEAR,ENABLE_INT)
86
 
87
begin
88
        -- asynchronous RESET signal forces all outputs LOW
89
      if (CLEAR = '0') then
90
            COUNT_AUX <= "00000000";
91
            -- check for +ve clock edge
92
          elsif ((CLK'event) and (CLK = '1')) then
93
                         if (RESET = '0') then
94
                                        COUNT_AUX <= "00000000";
95
                         elsif( ENABLE_INT = '1') then
96
                           COUNT_AUX <= COUNT_AUX+"00000001";
97
                          else
98
                                    COUNT_AUX <= "00000000";
99
                                end if;
100
         end if;
101
 
102
end process COUNTING;
103
 
104
 
105
END_COUNT <= '1' when COUNT_AUX = LATCH_DATA-"00000010" else '0';
106
 
107
end STRUCTURAL;
108
 

powered by: WebSVN 2.1.0

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