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

Subversion Repositories xmatchpro

[/] [xmatchpro/] [trunk/] [xmw4-comdec/] [src/] [csm_c.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       = 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 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;
69
 
70
architecture STATE of CSM_C 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(3 downto 0);
78
signal NEXT_STATE : bit_vector(3 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)
87
begin
88
 
89
case CURRENT_STATE is
90
        -- state S0
91
        when "1110" =>
92
                if ((START_C = '1') and (STOP = '1')) then
93
                        NEXT_STATE <= "1111";   -- goto state S1
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 "0101" =>
111
                if (STOP = '0') then -- force stop
112
                NEXT_STATE <= "1110";
113
                elsif (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
114
                        NEXT_STATE <= "1111"; --wait
115
            elsif (STOP_C = '1') then -- block is completely finish
116
                        NEXT_STATE <= "0011";   -- goto state S3 flush
117
                else
118
                        NEXT_STATE <= CURRENT_STATE;    -- remain in current state
119
                end if;
120
 
121
        -- state S3 flushing
122
        when "0011" =>
123
                if (FLUSH_END = '1') then
124
                        NEXT_STATE <= "0111";   -- goto state S4
125
                else
126
                        NEXT_STATE <= CURRENT_STATE;    -- goto state S5
127
                end if;
128
 
129
        -- state S4
130
        when "0111" =>
131
                if (FLUSH_END = '0') then
132
                        NEXT_STATE <= "1110";
133
                else
134
                        NEXT_STATE <= CURRENT_STATE;    -- remain in current state
135
                end if;
136
 
137
 
138
        -- anything else (illegal states)
139
        when others =>
140
                NEXT_STATE <= "1110";   -- goto state S0
141
 
142
 
143
 
144
end case;
145
 
146
 
147
end process COMBINATIONAL;
148
 
149
 
150
 
151
FLIP_FLOPS : process(CLK,CLEAR)
152
 
153
begin
154
 
155
if (CLEAR = '0') then
156
        CURRENT_STATE <= "1110";        -- reset state is S0
157
elsif ((CLK'event) and (CLK='1')) then
158
        CURRENT_STATE <= NEXT_STATE;            -- otherwise latch next state
159
end if;
160
 
161
end process FLIP_FLOPS;
162
 
163
-- assign outputs directly from state register (Moore machine with registered outputs)
164
 
165
 
166
COMP <= CURRENT_STATE(3);
167
FLUSH <= CURRENT_STATE(2);
168
MOVE_ENABLE <= CURRENT_STATE(1);
169
RESET <= CURRENT_STATE(0);
170
 
171
end STATE;  -- end of architecture
172
 
173
 
174
 

powered by: WebSVN 2.1.0

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