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

Subversion Repositories xmatchpro

[/] [xmatchpro/] [trunk/] [xmw4-comdec/] [xmatch_sim7/] [src/] [c_bs_counter_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       = C_BS_COUNTER        --
19
--  version      = 1.0                 --
20
--  last update  = 6/9/00              --
21
--  author       = Jose Nunez          --
22
----------------------------------------
23
 
24
 
25
-- FUNCTION
26
-- 16 bit counter to control the compressed block size
27
 
28
 
29
--  PIN LIST
30
--  LOAD = load compressed block size ( for decompression )
31
--  C_BS_IN = compressed block size external data ( for decompression )
32
--  ENABLE = enable count
33
--  CLEAR = asyncronus clear of the counter
34
--  CLK   = master clock
35
--  ALL_C_DATA = for decompression the value loaded has been reached
36
--  C_BS_OUT = compressed block size available after compression
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
 
44
entity C_BS_COUNTER_D is
45
port
46
(
47
        C_BS_IN : in bit_vector(31 downto 0);
48
        DECOMPRESS : in bit;
49
    CLEAR_COUNTER : in bit;
50
        CLEAR : in bit;
51
        CLK : in bit;
52
        ENABLE_D : in bit;
53
        ALL_C_DATA : out bit;
54
        C_BS_OUT : out bit_vector(31 downto 0)
55
);
56
 
57
end C_BS_COUNTER_D;
58
 
59
 
60
 
61
architecture STRUCTURAL of C_BS_COUNTER_D is
62
 
63
signal COUNT_AUX : bit_vector(29 downto 0); -- bytes
64
signal LATCH_DATA : bit_vector(31 downto 0); -- tuples
65
signal DECOMPRESS_INT : bit;
66
signal ENABLE_DQ : bit;
67
 
68
begin
69
 
70
LATCH : process(CLK,CLEAR,DECOMPRESS)
71
begin
72
        -- asynchronous RESET signal forces all outputs LOW
73
      if (CLEAR = '0') then
74
            LATCH_DATA <= "11111111111111111111111111111111";
75
            DECOMPRESS_INT <= '1';
76
            -- check for +ve clock edge
77
        elsif ((CLK'event) and (CLK = '1')) then
78
                if(CLEAR_COUNTER = '0') then
79
                                LATCH_DATA <= "11111111111111111111111111111111";
80
                        DECOMPRESS_INT <= '1';
81
                elsif (DECOMPRESS = '0') then
82
                                   LATCH_DATA <= C_BS_IN;
83
                                   DECOMPRESS_INT <='0';
84
                        else
85
                                    DECOMPRESS_INT <=DECOMPRESS_INT;
86
                                   LATCH_DATA <= LATCH_DATA;
87
                        end if;
88
        end if;
89
 
90
end process LATCH;
91
 
92
 
93
 
94
COUNTING : process (CLK,CLEAR,ENABLE_DQ,DECOMPRESS_INT,CLEAR_COUNTER)
95
 
96
begin
97
        -- asynchronous RESET signal forces all outputs LOW
98
      if (CLEAR = '0') then
99
            COUNT_AUX <= "000000000000000000000000000000";
100
            -- check for +ve clock edge
101
          elsif ((CLK'event) and (CLK = '1')) then
102
                         if(CLEAR_COUNTER = '0') then
103
                                COUNT_AUX <= "000000000000000000000000000000";
104
                 elsif ( ENABLE_DQ = '0' and DECOMPRESS_INT = '0') then
105
                               COUNT_AUX <= COUNT_AUX+"000000000000000000000000000001";
106
                         else
107
                               COUNT_AUX <= COUNT_AUX;
108
                         end if;
109
         end if;
110
 
111
end process COUNTING;
112
 
113
DELAY_ENABLE : process(CLK,CLEAR,ENABLE_D)
114
begin
115
        -- asynchronous RESET signal forces all outputs LOW
116
      if (CLEAR = '0') then
117
                ENABLE_DQ <= '1';
118
        elsif ((CLK'event) and (CLK = '1')) then
119
                if(CLEAR_COUNTER = '0') then
120
                        ENABLE_DQ <= '1';
121
                else
122
                        ENABLE_DQ <= ENABLE_D;
123
                end if;
124
        end if;
125
end process DELAY_ENABLE;
126
 
127
 
128
 
129
ALL_C_DATA <= '1' when COUNT_AUX & "00" = LATCH_DATA else '0';
130
C_BS_OUT <= COUNT_AUX & "00"; -- bytes. always a multiple of 4 bytes.
131
 
132
 
133
end STRUCTURAL;
134
 

powered by: WebSVN 2.1.0

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