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

Subversion Repositories xmatchpro

[/] [xmatchpro/] [trunk/] [xmw4-comdec/] [src/] [BUFFER_U_2.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       = DECODING_BUFFER_CU              --
19
--  version      = 1.0                             --
20
--  last update  = 16/6/00                         --
21
--  author       = Jose Nunez                      --
22
-----------------------------------------------------
23
 
24
 
25
-- FUNCTION
26
-- Control unit that controls the decoding buffer
27
 
28
 
29
--  PIN LIST
30
--  START : enable writting to the buffer
31
--  FINISHED : the block has been process in the decompression engine stop requesting data.
32
--  UNDERFLOW_GEN : 64 bit of compressed data are needed.
33
--  THRESHOLD : more data is available in the buffer to be decompressed than the threshold limit.
34
--  CODING_READ_ADDRESS : buffer location that it is being read
35
--  CODING_WRITE_ADDRESS : buffer location that it is being written
36
--  CLK : clock
37
--  CLEAR : clear
38
--  BUS_REQUEST : more compressed data is required if after getting data the bus is denied and data is in the internal buffer stop requesting.
39
--  CODING_OVERFLOW : the CU detects a coding overflow stop inputting compressed data 
40
--  CODING_UNDERFLOW_GEN : the CU detects a coding UNDERFLOW_GEN stop outputting compressed data
41
--  ENABLE_WRITE : enable writting to the buffer
42
--  FINISH : the buffer process
43
--  ENABLE_READ : enable reading from the buffer
44
 
45
library ieee;
46
use ieee.std_logic_1164.all;
47
library dzx;
48
use dzx.bit_arith.all;
49
use dzx.bit_utils.all;
50
 
51
 
52
entity BUFFER_U_2 is
53
port
54
(
55
          START_D : in bit;  --  enter decompression mode
56
          START_C : in bit;  --  enter test mode since compression is active
57
          FINISHED_D : in bit; --  finish decompression mode
58
          FINISHED_C : in bit; -- finish test mode
59
          BUS_ACKNOWLEDGE : in bit;
60
          WAITN : in bit; -- wait states being introduced
61
          THRESHOLD_LEVEL : in bit_vector(8 downto 0);
62
          DECODING_READ_ADDRESS : in bit_vector(8 downto 0);
63
          DECODING_WRITE_ADDRESS : in bit_vector(8 downto 0);
64
          CLK : in bit;
65
          CLEAR : in bit;
66
          BUS_REQUEST : out bit;
67
          DECODING_UNDERFLOW_GEN : out bit;
68
          ENABLE_WRITE : out bit;
69
          FINISH : out bit; -- the buffer process
70
          CLEAR_COUNTERS : out bit;
71
          C_DATA_V : in bit; -- compressed data available in test mode
72
          UNDERFLOW : in bit; -- the engine requests data
73
          ENABLE_READ : out bit
74
);
75
end BUFFER_U_2;
76
 
77
architecture STRUCTURAL of BUFFER_U_2 is
78
 
79
signal CURRENT_STATE : bit_vector(3 downto 0);
80
signal NEXT_STATE : bit_vector(3 downto 0);
81
signal DECODING_OVERFLOW_AUX : bit;
82
signal UNDERFLOW_GEN : bit;
83
signal ENABLE_READ_INT : bit;
84
signal DECODING_UNDERFLOW_GEN_INT : bit; -- to hold UNDERFLOW_GEN until threshold is overpassed
85
signal ENABLE_WRITE_INT : bit;
86
signal BUS_ACKNOWLEDGE_INT : bit;
87
--signal DECODING_UNDERFLOW_GEN_DELAY : bit;
88
 
89
begin
90
 
91
 
92
UNDERFLOW_GEN <= UNDERFLOW;
93
 
94
 
95
STATES : process (C_DATA_V, WAITN, START_C, START_D, THRESHOLD_LEVEL, CURRENT_STATE, FINISHED_C, FINISHED_D,
96
UNDERFLOW_GEN, DECODING_OVERFLOW_AUX, DECODING_READ_ADDRESS, DECODING_WRITE_ADDRESS, BUS_ACKNOWLEDGE)
97
begin
98
 
99
case CURRENT_STATE is
100
        when "0000" =>  -- state 0 buffer inactive. Two modes: test mode and decompression mode
101
                if (START_D = '0') then
102
                        NEXT_STATE <= "0001";
103
                elsif (START_C = '0') then
104
                        NEXT_STATE <= "1001";
105
                else
106
                        NEXT_STATE <= CURRENT_STATE;
107
                end if;
108
            BUS_ACKNOWLEDGE_INT <= '0';
109
                DECODING_UNDERFLOW_GEN_INT <= '0';
110
                ENABLE_READ_INT <= '0';
111
                ENABLE_WRITE_INT <= '0';
112
                BUS_REQUEST <= '1';
113
                FINISH <= '1';
114
                CLEAR_COUNTERS <= '1'; -- read and write counters are at 0
115
 
116
 
117
   when "1110" =>    -- wait state. state reading from the buffer but waiting to write more data
118
                if (FINISHED_C ='0')  then --stop writting to the buffer process terminates
119
                        NEXT_STATE <= "1100"; -- only reading data from the buffer      
120
                elsif (C_DATA_V = '0') then
121
                        if (UNDERFLOW_GEN = '1') then
122
                                NEXT_STATE <= "0000"; -- total wait do not read or write 
123
                        else
124
                                NEXT_STATE <= "1011";
125
                        end if;
126
                elsif (UNDERFLOW_GEN = '1') then -- total wait do not read or write
127
                        NEXT_STATE <= "1011"; -- read and write
128
                else
129
                        NEXT_STATE <= CURRENT_STATE;
130
                end if;
131
                DECODING_UNDERFLOW_GEN_INT <= '0';
132
                BUS_ACKNOWLEDGE_INT <= '1';
133
                ENABLE_READ_INT <= '1';
134
                ENABLE_WRITE_INT <= '0';
135
                BUS_REQUEST <= '1';
136
                FINISH <= '1';
137
        CLEAR_COUNTERS <= '0';
138
 
139
    when "1101" =>    -- signal finish
140
                DECODING_UNDERFLOW_GEN_INT <= '0';
141
                BUS_ACKNOWLEDGE_INT <= '0';
142
                NEXT_STATE <= "0000"; -- end
143
                ENABLE_READ_INT <= '0';
144
                ENABLE_WRITE_INT <= '0';
145
                BUS_REQUEST <= '1';
146
                FINISH <= '0';
147
                CLEAR_COUNTERS <= '0';
148
        when "1111" =>    -- wait state. state reading from the buffer but waiting to write more data
149
                if (FINISHED_C ='0')  then --stop writting to the buffer process terminates
150
                        NEXT_STATE <= "1100"; -- only reading data from the buffer      
151
                elsif(C_DATA_V = '0') then -- do not read or write
152
                        NEXT_STATE <= "1010"; -- write to the buffer
153
                else
154
                        NEXT_STATE <= CURRENT_STATE;
155
                end if;
156
                DECODING_UNDERFLOW_GEN_INT <= '1';
157
                BUS_ACKNOWLEDGE_INT <= '1';
158
                ENABLE_READ_INT <= '0';
159
                ENABLE_WRITE_INT <= '0';
160
                BUS_REQUEST <= '1';
161
                FINISH <= '1';
162
        CLEAR_COUNTERS <= '0';
163
         when others =>
164
                NEXT_STATE <= "0000";
165
                BUS_ACKNOWLEDGE_INT <= '0';
166
                DECODING_UNDERFLOW_GEN_INT <= '0';
167
                ENABLE_READ_INT <= '0';
168
                ENABLE_WRITE_INT <= '0';
169
                BUS_REQUEST <= '1';
170
                FINISH <= '1';
171
                CLEAR_COUNTERS <= '1';
172
 
173
end  case;
174
end process STATES;
175
 
176
DECODING_OVERFLOW_AUX <= '0' when ((DECODING_READ_ADDRESS(8 downto 1) = DECODING_WRITE_ADDRESS(8 downto 1) + "00000001") and (BUS_ACKNOWLEDGE_INT = '1')) else '1'; -- decoding overflow goes out of the chip is active with zero if bus_akcnowledge 1 then all the data is inside never generate overflow
177
ENABLE_READ <= ENABLE_READ_INT and not(UNDERFLOW_GEN); -- if decoding UNDERFLOW_GEN disable the read counter and (BUS_ACKNOWLEDGE_INT = '1') and ()
178
ENABLE_WRITE <= ENABLE_WRITE_INT and DECODING_OVERFLOW_AUX; -- if overflow disable writting inmediatly
179
 
180
 
181
 
182
FLIP_FLOPS : process(CLK, CLEAR)
183
begin
184
 
185
if (CLEAR = '0') then
186
        CURRENT_STATE <= "0000"; --state 0
187
elsif ((CLK'event) and (CLK='1')) then
188
        CURRENT_STATE <= NEXT_STATE;
189
end if;
190
 
191
end process FLIP_FLOPS;
192
 
193
--DELAY_UNDERFLOW_GEN : process(CLK, CLEAR, DECODING_UNDERFLOW_GEN_DELAY)
194
--begin 
195
 
196
--if (CLEAR = '0') then
197
--      DECODING_UNDERFLOW_GEN <= '0';
198
--elsif ((CLK'event) and (CLK='1')) then
199
--      DECODING_UNDERFLOW_GEN <= DECODING_UNDERFLOW_GEN_DELAY;
200
--end if;
201
--end process DELAY_UNDERFLOW_GEN;
202
 
203
 
204
 
205
--DECODING_UNDERFLOW_GEN <= UNDERFLOW_GEN;
206
 
207
--or DECODING_UNDERFLOW_GEN_INT; -- never signal UNDERFLOW_GEN if bus_acknowledge has gone to 1 it means that all the compressed data has been fed to the buffer. It has to terminate
208
 
209
 
210
end STRUCTURAL;
211
 

powered by: WebSVN 2.1.0

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