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

Subversion Repositories xmatchpro

[/] [xmatchpro/] [trunk/] [xmw4-comdec/] [xmatch_sim7/] [src/] [csm_c_2.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       = CSM         --
19
--  version      = 4.0         --
20
--  last update  = 20/04/00    --
21
--  author       = Jose Nunez --
22
---------------------------------
23
 
24
 
25
-- FUNCTION
26
-- control state machine.
27
 
28
 
29
--  PIN LIST
30
--  START        = indicates start of a compress or decompress operation
31
--  STOP         = forces the end of the current operation
32
--  COMPRESS     = selects compression mode
33
--  DECOMPRESS   = selects decompression mode
34
--  CLEAR        = asyncronous clear
35
--  END_OF_BLOCK = indicates that a complete block has been processed
36
--  FLUSH_END    = indicates end of flushing cycle during compression
37
--  CLK          = master clock
38
--  COMP         = indicates unit is compressing data
39
--  DECOMP       = indicates unit is decompressing data
40
--  FLUSH        = indicates unit is in a flush cycle during compression
41
--  FINISH       = end of current operation
42
--  LOAD_BS      = load block size for the current operation
43
--  INC_TC       = increment tuple counter
44
--  MOVE_ENABLE  = enable movement logic for the CAM array
45
--  CLEAR_INT    = asynchronously clear (or preset) all internal storage
46
 
47
 
48
library ieee;
49
use ieee.std_logic_1164.all;
50
 
51
entity CSM_C_2 is
52
port
53
(
54
        START_C : in bit ; -- load BS and start engine => the buffer is ready
55
        STOP_C : in bit; -- stop engine when parser finish
56
        FINISH_BUFFER : in bit; -- data exhausted from buffer almost finish wait for parser
57
        STOP : in bit ;
58
        FLUSH_END : in bit ;
59
        CLK : in bit ;
60
        CLEAR : in bit ;
61
        COMP : out bit ;
62
        FLUSH : out bit ;
63
        MOVE_ENABLE : out bit ;
64
        RESET : out bit
65
);
66
 
67
 
68
end CSM_C_2;
69
 
70
architecture STATE of CSM_C_2 is
71
 
72
 
73
 
74
--State S9 to delay the activation of the counter incrementation due to pipeline
75
--Now State S6 111001001111 INC disable same as S9
76
 
77
signal CURRENT_STATE : bit_vector(4 downto 0);
78
signal NEXT_STATE : bit_vector(4 downto 0);
79
signal CLEAR_AUX : bit;
80
 
81
 
82
begin
83
 
84
 
85
 
86
COMBINATIONAL : process (CURRENT_STATE , START_C , STOP_C, STOP , FLUSH_END, FINISH_BUFFER)
87
begin
88
 
89
case CURRENT_STATE is
90
        -- state S0
91
        when "01110" =>
92
                if (START_C = '1') then
93
                        NEXT_STATE <= "00101";  -- goto state S2
94
                else
95
                                NEXT_STATE <= CURRENT_STATE;    -- remain in current state
96
 
97
                end if;
98
 
99
        -- state S1
100
--      when "1111" =>
101
--          if (STOP = '0') then
102
--                      NEXT_STATE <= "1110";   -- goto state S0
103
--              elsif (START_C = '1') then
104
--                      NEXT_STATE <= "0101";
105
--              else 
106
--                      NEXT_STATE <= CURRENT_STATE;    -- goto state S2
107
--              end if;
108
 
109
        -- state S2
110
        when "00101" =>
111
           if (START_C = '0' and FINISH_BUFFER = '0') then -- --FINISG_BUFER indicates that all data has been read from buffer wait only for PARSER to finish
112
                        NEXT_STATE <= "00111"; --wait
113
            elsif (STOP_C = '1') then -- block is completely finish
114
                        NEXT_STATE <= "00011";  -- goto state S3 flush
115
                else
116
                        NEXT_STATE <= CURRENT_STATE;    -- remain in current state
117
                end if;
118
 
119
        -- state S3 flushing
120
        when "00011" =>
121
     if (START_C = '1') then
122
                        NEXT_STATE <= "00101";
123
                elsif (STOP_C = '1') then
124
                        NEXT_STATE <= "10011";
125
                elsif (FLUSH_END = '0') then
126
                        NEXT_STATE <= "01110";
127
                else
128
                        NEXT_STATE <= CURRENT_STATE;    -- remain in current state
129
                end if;
130
--              if (FLUSH_END = '1') then
131
--                      NEXT_STATE <= "00111";  -- goto state S4
132
--              else
133
--                      NEXT_STATE <= CURRENT_STATE;    -- goto state S5
134
--              end if;
135
 
136
        -- state S4
137
        when "00111" =>
138
                if (START_C = '1') then
139
                        NEXT_STATE <= "00101";
140
                elsif (STOP_C = '1') then
141
                        NEXT_STATE <= "10011";
142
                elsif (FLUSH_END = '0') then
143
                        NEXT_STATE <= "01110";
144
                else
145
                        NEXT_STATE <= CURRENT_STATE;    -- remain in current state
146
                end if;
147
 
148
        when "10011" =>
149
          if (FLUSH_END = '1') then
150
                        NEXT_STATE <= "10111";  -- goto state S4
151
                else
152
                        NEXT_STATE <= CURRENT_STATE;    -- goto state S5
153
     end if;
154
 
155
        -- state S4
156
        when "10111" =>
157
          if (FLUSH_END = '0') then
158
                        NEXT_STATE <= "01110";
159
                else
160
                        NEXT_STATE <= CURRENT_STATE;    -- remain in current state
161
                end if;
162
 
163
        -- anything else (illegal states)
164
        when others =>
165
                NEXT_STATE <= "01110";  -- goto state S0
166
 
167
 
168
 
169
end case;
170
 
171
 
172
end process COMBINATIONAL;
173
 
174
 
175
 
176
FLIP_FLOPS : process(CLK,CLEAR)
177
 
178
begin
179
 
180
if (CLEAR = '0') then
181
        CURRENT_STATE <= "01110";       -- reset state is S0
182
elsif ((CLK'event) and (CLK='1')) then
183
        if (STOP = '0') then -- force stop
184
             CURRENT_STATE <= "01110";
185
        else
186
                        CURRENT_STATE <= NEXT_STATE;            -- otherwise latch next state
187
        end if;
188
end if;
189
 
190
end process FLIP_FLOPS;
191
 
192
-- assign outputs directly from state register (Moore machine with registered outputs)
193
 
194
 
195
COMP <= CURRENT_STATE(3);
196
FLUSH <= CURRENT_STATE(2);
197
MOVE_ENABLE <= CURRENT_STATE(1);
198
RESET <= CURRENT_STATE(0);
199
 
200
end STATE;  -- end of architecture
201
 
202
 
203
 

powered by: WebSVN 2.1.0

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