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

Subversion Repositories gecko3

[/] [gecko3/] [trunk/] [GECKO3COM/] [gecko3com-ip/] [core/] [GECKO3COM_simple_fsm.vhd] - Blame information for rev 28

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 22 nussgipfel
--  GECKO3COM IP Core
2
--
3
--  Copyright (C) 2009 by
4
--   ___    ___   _   _
5
--  (  _ \ (  __)( ) ( )
6
--  | (_) )| (   | |_| |   Bern University of Applied Sciences
7
--  |  _ < |  _) |  _  |   School of Engineering and
8
--  | (_) )| |   | | | |   Information Technology
9
--  (____/ (_)   (_) (_)
10
--
11
--  This program is free software: you can redistribute it and/or modify
12
--  it under the terms of the GNU General Public License as published by
13
--  the Free Software Foundation, either version 3 of the License, or
14
--  (at your option) any later version.
15
--
16
--  This program is distributed in the hope that it will be useful,
17
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
18
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
--  GNU General Public License for more details. 
20
--  You should have received a copy of the GNU General Public License
21
--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
--
23
--  URL to the project description: 
24
--    http://labs.ti.bfh.ch/gecko/wiki/systems/gecko3com/start
25
--------------------------------------------------------------------------------
26
--
27
--  Author:  Christoph Zimmermann
28
--  Date of creation:  3 february 2010 
29
--  Description:
30
--      This is the finite-state-mashine for the GECKO3com simple IP core.
31
--   
32
--      This core provides a simple FIFO and register interface to the
33
--      USB data transfer capabilities of the GECKO3COM/GECKO3main system.
34
--
35 23 nussgipfel
--      Look at GECKO3COM_simple_test.vhd for an example how to use it.
36 22 nussgipfel
--
37
--  Target Devices:     general
38
--  Tool versions:      11.1
39
--
40
--------------------------------------------------------------------------------
41
 
42
library IEEE;
43
use IEEE.STD_LOGIC_1164.all;
44
use IEEE.STD_LOGIC_ARITH.all;
45
use IEEE.STD_LOGIC_UNSIGNED.all;
46
 
47
library work;
48
use work.GECKO3COM_defines.all;
49
 
50
 
51
entity GECKO3COM_simple_fsm is
52
 
53
  port (
54
    i_nReset                     : in  std_logic;
55
    i_sysclk                     : in  std_logic;
56
    o_receive_fifo_wr_en         : out std_logic;
57
    i_receive_fifo_full          : in  std_logic;
58
    o_receive_fifo_reset         : out std_logic;
59
    o_receive_transfersize_en    : out std_logic_vector((32/SIZE_DBUS_GPIF)-1 downto 0);
60 26 nussgipfel
    i_receive_transfersize_lsb   : in  std_logic;
61 22 nussgipfel
    o_receive_counter_load       : out std_logic;
62
    o_receive_counter_en         : out std_logic;
63
    i_receive_counter_zero       : in  std_logic;
64
    i_dev_dep_msg_out            : in  std_logic;
65
    i_request_dev_dep_msg_in     : in  std_logic;
66
    o_btag_reg_en                : out std_logic;
67
    o_nbtag_reg_en               : out std_logic;
68
    i_btag_correct               : in  std_logic;
69
    i_eom_bit_detected           : in  std_logic;
70
    i_send_transfersize_en       : in  std_logic;
71
    o_send_fifo_rd_en            : out std_logic;
72
    i_send_fifo_empty            : in  std_logic;
73
    o_send_fifo_reset            : out std_logic;
74
    o_send_counter_load          : out std_logic;
75
    o_send_counter_en            : out std_logic;
76
    i_send_counter_zero          : in  std_logic;
77
    o_send_mux_sel               : out std_logic_vector(2 downto 0);
78
    o_send_finished              : out std_logic;
79
    o_receive_newdata_set        : out std_logic;
80
    o_receive_end_of_message_set : out std_logic;
81
    o_send_data_request_set      : out std_logic;
82
    i_gpif_rx                    : in  std_logic;
83
    i_gpif_rx_empty              : in  std_logic;
84
    o_gpif_rx_rd_en              : out std_logic;
85
    i_gpif_tx                    : in  std_logic;
86
    i_gpif_tx_full               : in  std_logic;
87
    o_gpif_tx_wr_en              : out std_logic;
88
    i_gpif_abort                 : in  std_logic;
89
    o_gpif_eom                   : out std_logic);
90
 
91
end GECKO3COM_simple_fsm;
92
 
93
 
94
architecture fsm of GECKO3COM_simple_fsm is
95
 
96
  -- XST specific synthesize attributes
97
  attribute safe_implementation : string;
98
  attribute safe_recovery_state : string;
99 27 nussgipfel
  attribute fsm_encoding       : string;
100 22 nussgipfel
 
101 26 nussgipfel
  type   state_type is (st1_idle, st2_abort, st3_read_msg_id, st4_check_msg_id,
102
                        st5_read_nbtag, st6_read_transfer_size_low,
103 22 nussgipfel
                        st7_read_transfer_size_high, st8_check_attributes,
104
                        st9_signal_data_request, st10_signal_receive_new_data,
105
                        st11_receive_data, st12_receive_wait,
106
                        st13_wait_for_receive_end, st14_read_align_bytes,
107
                        st15_start_response, st16_send_msg_id,
108
                        st17_send_nbtag, st18_send_transfer_size_low,
109
                        st19_send_transfer_size_high, st20_send_attributes,
110 26 nussgipfel
                        st21_send_reserved, st22_send_data, st23_send_wait,
111 22 nussgipfel
                        st24_wait_for_send_end);
112
  signal state, next_state : state_type;
113
 
114
  -- XST specific synthesize attributes
115
  attribute safe_recovery_state of state : signal is "st1_idle";
116
  attribute safe_implementation of state : signal is "yes";
117 27 nussgipfel
  attribute fsm_encoding of state        : signal is "johnson";
118 22 nussgipfel
 
119 27 nussgipfel
 
120 22 nussgipfel
  --Declare internal signals for all outputs of the state-machine
121
  signal s_receive_fifo_wr_en         : std_logic;
122
  signal s_receive_fifo_reset         : std_logic;
123
  signal s_receive_transfersize_en    : std_logic_vector((32/SIZE_DBUS_GPIF)-1 downto 0);
124
  signal s_receive_counter_load       : std_logic;
125
  signal s_receive_counter_en         : std_logic;
126
  signal s_btag_reg_en                : std_logic;
127
  signal s_nbtag_reg_en               : std_logic;
128
  signal s_send_fifo_rd_en            : std_logic;
129
  signal s_send_fifo_reset            : std_logic;
130
  signal s_send_counter_load          : std_logic;
131
  signal s_send_counter_en            : std_logic;
132
  signal s_send_mux_sel               : std_logic_vector(2 downto 0);
133
  signal s_send_finished              : std_logic;
134
  signal s_receive_newdata_set        : std_logic;
135
  signal s_receive_end_of_message_set : std_logic;
136
  signal s_send_data_request_set      : std_logic;
137
  signal s_gpif_eom                   : std_logic;
138
  signal s_gpif_rx_rd_en              : std_logic;
139
  signal s_gpif_tx_wr_en              : std_logic;
140
 
141
 
142
begin  -- fsm
143 26 nussgipfel
 
144
  o_receive_fifo_wr_en         <= s_receive_fifo_wr_en;
145
  o_receive_transfersize_en    <= s_receive_transfersize_en;
146
  o_receive_counter_load       <= s_receive_counter_load;
147
  o_receive_counter_en         <= s_receive_counter_en;
148
  o_btag_reg_en                <= s_btag_reg_en;
149
  o_nbtag_reg_en               <= s_nbtag_reg_en;
150
  o_send_fifo_rd_en            <= s_send_fifo_rd_en;
151
  o_send_counter_load          <= s_send_counter_load;
152
  o_send_counter_en            <= s_send_counter_en;
153
  o_send_mux_sel               <= s_send_mux_sel;
154
  o_send_finished              <= s_send_finished;
155
  o_receive_newdata_set        <= s_receive_newdata_set;
156
  o_receive_end_of_message_set <= s_receive_end_of_message_set;
157
  o_send_data_request_set      <= s_send_data_request_set;
158
  o_gpif_eom                   <= s_gpif_eom;
159
  o_gpif_rx_rd_en              <= s_gpif_rx_rd_en;
160
  o_gpif_tx_wr_en              <= s_gpif_tx_wr_en;
161
 
162 22 nussgipfel
 
163
  SYNC_PROC : process (i_sysclk)
164
  begin
165
    if (i_sysclk'event and i_sysclk = '1') then
166
      if (i_nReset = '0') then
167
        state <= st1_idle;
168 28 nussgipfel
 
169
        o_receive_fifo_reset         <= '0';
170
        o_send_fifo_reset            <= '0';
171 22 nussgipfel
      else
172
        state <= next_state;
173 28 nussgipfel
 
174
        o_receive_fifo_reset         <= s_receive_fifo_reset;
175
        o_send_fifo_reset            <= s_send_fifo_reset;
176 22 nussgipfel
      end if;
177
    end if;
178
  end process;
179
 
180
  --MEALY State-Machine - Outputs based on state and inputs
181
  OUTPUT_DECODE : process (state, i_receive_fifo_full,
182
                           i_receive_counter_zero, i_dev_dep_msg_out,
183 26 nussgipfel
                           i_request_dev_dep_msg_in, --i_btag_correct,
184 22 nussgipfel
                           i_eom_bit_detected, i_send_transfersize_en,
185
                           i_send_fifo_empty, i_send_counter_zero,
186
                           i_gpif_rx, i_gpif_rx_empty, i_gpif_tx,
187 26 nussgipfel
                           i_gpif_tx_full, i_gpif_abort,
188
                           i_receive_transfersize_lsb)
189 22 nussgipfel
  begin
190
 
191
    s_receive_fifo_wr_en         <= '0';
192
    s_receive_fifo_reset         <= '0';
193
    s_receive_transfersize_en    <= (others => '0');
194
    s_receive_counter_load       <= '0';
195
    s_receive_counter_en         <= '0';
196
    s_btag_reg_en                <= '0';
197
    s_nbtag_reg_en               <= '0';
198
    s_send_fifo_rd_en            <= '0';
199
    s_send_fifo_reset            <= '0';
200
    s_send_counter_load          <= '0';
201
    s_send_counter_en            <= '0';
202
    s_send_mux_sel               <= (others => '0');
203 24 nussgipfel
    s_send_finished              <= '0';
204 22 nussgipfel
    s_receive_newdata_set        <= '0';
205
    s_receive_end_of_message_set <= '0';
206
    s_send_data_request_set      <= '0';
207
    s_gpif_eom                   <= '0';
208
    s_gpif_rx_rd_en              <= '0';
209
    s_gpif_tx_wr_en              <= '0';
210
 
211
    if state = st11_receive_data then
212
      s_receive_fifo_wr_en <= '1';
213
    end if;
214
 
215
    if state = st2_abort then
216
      s_receive_fifo_reset <= '1';
217
    end if;
218
 
219
    if state = st6_read_transfer_size_low then
220
      s_receive_transfersize_en <= "01";
221
    elsif state = st7_read_transfer_size_high then
222
      s_receive_transfersize_en <= "10";
223
    end if;
224
 
225 26 nussgipfel
    if state = st8_check_attributes and
226
      i_dev_dep_msg_out = '1' and
227
      i_gpif_rx_empty = '0'
228
    then
229 22 nussgipfel
      s_receive_counter_load <= '1';
230
    end if;
231
 
232
    if (state = st10_signal_receive_new_data and
233
        i_gpif_rx_empty = '0' and
234 26 nussgipfel
        i_receive_fifo_full = '0' and
235
        i_receive_transfersize_lsb = '0')  -- if it is '1' then we have to read
236
                                           -- one time more from the fifo (which
237
                                           -- is 16bit wide)
238
      or (state = st11_receive_data and
239
          i_receive_counter_zero = '0' and
240
          i_gpif_rx_empty = '0' and
241
          i_receive_fifo_full = '0')
242 22 nussgipfel
      or (state = st12_receive_wait and
243
          i_gpif_rx_empty = '0' and
244 26 nussgipfel
          i_receive_fifo_full = '0')
245 22 nussgipfel
    then
246
      s_receive_counter_en <= '1';
247
    end if;
248
 
249
    if state = st3_read_msg_id then
250
      s_btag_reg_en <= '1';
251
    end if;
252
 
253 26 nussgipfel
    if state = st5_read_nbtag then
254 22 nussgipfel
      s_nbtag_reg_en <= '1';
255
    end if;
256
 
257 26 nussgipfel
    if (state = st21_send_reserved and
258 22 nussgipfel
        i_gpif_tx_full = '0' and
259
        i_send_fifo_empty = '0')
260 26 nussgipfel
      or (state = st22_send_data and
261
          i_gpif_tx_full = '0' and
262
          i_send_fifo_empty = '0' and
263
          i_send_counter_zero = '0')
264 22 nussgipfel
      or (state = st23_send_wait and
265
          i_gpif_tx_full = '0' and
266
          i_send_fifo_empty = '0')
267
    then
268
      s_send_fifo_rd_en <= '1';
269
    end if;
270
 
271 23 nussgipfel
    if state = st2_abort or state = st24_wait_for_send_end then
272 22 nussgipfel
      s_send_fifo_reset <= '1';
273
    end if;
274
 
275 26 nussgipfel
    if state = st20_send_attributes then
276 22 nussgipfel
      s_send_counter_load <= '1';
277
    end if;
278
 
279 28 nussgipfel
    if --(state = st21_send_reserved and i_gpif_tx_full = '0' and
280
        --i_send_fifo_empty = '0')
281
      (state = st22_send_data and
282 26 nussgipfel
          i_gpif_tx_full = '0' and
283
          i_send_fifo_empty = '0' and
284
          i_send_counter_zero = '0')
285
      or (state = st23_send_wait and
286
          i_gpif_tx_full = '0' and
287
          i_send_fifo_empty = '0')
288 22 nussgipfel
    then
289
      s_send_counter_en <= '1';
290
    end if;
291
 
292
    if state = st16_send_msg_id then
293
      s_send_mux_sel <= "000";
294
    elsif state = st17_send_nbtag then
295
      s_send_mux_sel <= "001";
296
    elsif state =st18_send_transfer_size_low then
297
      s_send_mux_sel <= "010";
298
    elsif state = st19_send_transfer_size_high then
299
      s_send_mux_sel <= "011";
300
    elsif state = st20_send_attributes then
301
      s_send_mux_sel <= "100";
302 26 nussgipfel
    elsif state = st21_send_reserved then
303 22 nussgipfel
      s_send_mux_sel <= "101";
304 26 nussgipfel
    elsif state = st22_send_data or state = st23_send_wait then
305
      s_send_mux_sel <= "110";
306 22 nussgipfel
    end if;
307
 
308
    if state = st24_wait_for_send_end and i_gpif_tx = '0' then
309 24 nussgipfel
      s_send_finished <= '1';
310 22 nussgipfel
    end if;
311
 
312
    if state = st10_signal_receive_new_data then
313
      s_receive_newdata_set <= '1';
314
    end if;
315
 
316
    if state = st8_check_attributes and i_eom_bit_detected = '1' then
317
      s_receive_end_of_message_set <= '1';
318
    end if;
319
 
320
    if state = st9_signal_data_request then
321
      s_send_data_request_set <= '1';
322
    end if;
323 24 nussgipfel
 
324 26 nussgipfel
    if (state = st22_send_data and i_send_counter_zero = '1')
325
      or state = st24_wait_for_send_end
326
    then
327 22 nussgipfel
      s_gpif_eom <= '1';
328
    end if;
329
 
330
    if (i_gpif_rx_empty = '0' and
331
        (state = st1_idle or
332 26 nussgipfel
         state = st5_read_nbtag or
333 22 nussgipfel
         state = st6_read_transfer_size_low or
334
         state = st7_read_transfer_size_high or
335
         state = st8_check_attributes))
336 26 nussgipfel
      or (state = st4_check_msg_id and
337
          i_gpif_rx_empty = '0' and
338
          (i_dev_dep_msg_out = '1' or i_request_dev_dep_msg_in = '1'))
339 22 nussgipfel
      or ((state = st10_signal_receive_new_data or state = st12_receive_wait)
340
          and i_gpif_rx_empty = '0' and i_receive_fifo_full = '0')
341 26 nussgipfel
      or (state = st11_receive_data and
342
          i_receive_counter_zero = '0' and
343
          i_gpif_rx_empty = '0' and
344
          i_receive_fifo_full = '0')
345
      or (state = st12_receive_wait and
346
          i_gpif_rx_empty = '0' and
347
          i_receive_fifo_full = '0')
348 22 nussgipfel
      or (state = st14_read_align_bytes and i_gpif_rx_empty = '0')
349
    then
350
      s_gpif_rx_rd_en <= '1';
351
    end if;
352
 
353
    if (i_gpif_tx_full = '0' and
354
        (state = st16_send_msg_id or
355
         state = st17_send_nbtag or
356
         state = st18_send_transfer_size_low or
357
         state = st19_send_transfer_size_high or
358
         state = st20_send_attributes or
359 26 nussgipfel
         state = st21_send_reserved))
360 27 nussgipfel
      or (state = st22_send_data and
361
          i_gpif_tx_full = '0' and
362
          i_send_fifo_empty = '0')
363
      or (state = st23_send_wait and
364
          i_gpif_tx_full = '0' and
365
          i_send_fifo_empty = '0')
366 22 nussgipfel
    then
367
      s_gpif_tx_wr_en <= '1';
368
    end if;
369
  end process;
370
 
371
  NEXT_STATE_DECODE : process (state, i_receive_fifo_full,
372
                               i_receive_counter_zero, i_dev_dep_msg_out,
373
                               i_request_dev_dep_msg_in, i_btag_correct,
374
                               i_eom_bit_detected, i_send_transfersize_en,
375
                               i_send_fifo_empty, i_send_counter_zero,
376
                               i_gpif_rx, i_gpif_rx_empty, i_gpif_tx,
377
                               i_gpif_tx_full, i_gpif_abort)
378
  begin
379
    --declare default state for next_state to avoid latches
380
    next_state <= state;                --default is to stay in current state
381
 
382
    case (state) is
383
      when st1_idle =>
384
        if i_gpif_abort = '1' then
385
          next_state <= st2_abort;
386
        elsif i_gpif_rx_empty = '0' then
387
          next_state <= st3_read_msg_id;
388
        end if;
389
 
390
      when st2_abort =>
391 27 nussgipfel
        if i_gpif_abort = '0' then
392
          next_state <= st1_idle;
393
        end if;
394 22 nussgipfel
 
395
      when st3_read_msg_id =>
396 26 nussgipfel
        next_state <= st4_check_msg_id;
397
 
398
      when st4_check_msg_id =>
399 22 nussgipfel
        if i_gpif_abort = '1' then
400
          next_state <= st2_abort;
401 26 nussgipfel
        elsif i_dev_dep_msg_out = '0' and i_request_dev_dep_msg_in = '0' then
402
          next_state <= st1_idle;
403
        elsif i_gpif_rx_empty = '0' and
404
          (i_dev_dep_msg_out = '1' or i_request_dev_dep_msg_in = '1')
405
        then
406
          next_state <= st5_read_nbtag;
407 22 nussgipfel
        end if;
408
 
409 26 nussgipfel
      when st5_read_nbtag =>
410 22 nussgipfel
        if i_gpif_abort = '1' then
411
          next_state <= st2_abort;
412
        elsif i_gpif_rx_empty = '0' then
413 26 nussgipfel
          next_state <= st6_read_transfer_size_low;
414 22 nussgipfel
        end if;
415
 
416 26 nussgipfel
      when st6_read_transfer_size_low =>
417 22 nussgipfel
        if i_gpif_abort = '1' then
418
          next_state <= st2_abort;
419
        elsif i_btag_correct = '0' then
420
          next_state <= st1_idle;
421 26 nussgipfel
        elsif i_gpif_rx_empty = '0' and i_btag_correct = '1' then
422 22 nussgipfel
          next_state <= st7_read_transfer_size_high;
423
        end if;
424
 
425
      when st7_read_transfer_size_high =>
426
        if i_gpif_abort = '1' then
427
          next_state <= st2_abort;
428
        elsif i_gpif_rx_empty = '0' then
429
          next_state <= st8_check_attributes;
430
        end if;
431
 
432
      when st8_check_attributes =>
433
        if i_gpif_abort = '1' then
434
          next_state <= st2_abort;
435 26 nussgipfel
        elsif i_dev_dep_msg_out = '0' and i_request_dev_dep_msg_in = '0' then
436
          next_state <= st1_idle;
437 22 nussgipfel
        elsif i_gpif_rx_empty = '0' and i_request_dev_dep_msg_in = '1' then
438
          next_state <= st9_signal_data_request;
439
        elsif i_gpif_rx_empty = '0' and i_dev_dep_msg_out = '1' then
440
          next_state <= st10_signal_receive_new_data;
441
        end if;
442
 
443
      when st9_signal_data_request =>
444
        if i_gpif_abort = '1' then
445
          next_state <= st2_abort;
446
        elsif i_send_transfersize_en = '1' then
447
          next_state <= st15_start_response;
448
        end if;
449
 
450
      when st10_signal_receive_new_data =>
451
        if i_gpif_abort = '1' then
452
          next_state <= st2_abort;
453
        elsif i_gpif_rx_empty = '0' and i_receive_fifo_full = '0' then
454
          next_state <= st11_receive_data;
455
        end if;
456
 
457
      when st11_receive_data =>
458
        if i_gpif_abort = '1' then
459
          next_state <= st2_abort;
460
        elsif i_receive_counter_zero = '1' then
461 26 nussgipfel
          --next_state <= st13_wait_for_receive_end;
462
          next_state <= st1_idle;
463 22 nussgipfel
        elsif  i_gpif_rx_empty = '1' or i_receive_fifo_full = '1' then
464
          next_state <= st12_receive_wait;
465
        end if;
466
 
467
      when st12_receive_wait =>
468
        if i_gpif_abort = '1' then
469
          next_state <= st2_abort;
470
        elsif  i_gpif_rx_empty = '0' and i_receive_fifo_full = '0' then
471
          next_state <= st11_receive_data;
472
        end if;
473
 
474
      when st13_wait_for_receive_end =>
475
        if i_gpif_abort = '1' then
476
          next_state <= st2_abort;
477
        elsif i_gpif_rx = '0' then
478
          next_state <= st14_read_align_bytes;
479
        end if;
480
 
481
      when st14_read_align_bytes =>
482
        if i_gpif_abort = '1' then
483
          next_state <= st2_abort;
484
        elsif i_gpif_rx_empty = '1' then
485
          next_state <= st1_idle;
486
        end if;
487
 
488
      when st15_start_response =>
489
        if i_gpif_abort = '1' then
490
          next_state <= st2_abort;
491
        elsif i_gpif_tx_full = '0' then
492
          next_state <= st16_send_msg_id;
493
        end if;
494
 
495
      when st16_send_msg_id =>
496
        if i_gpif_abort = '1' then
497
          next_state <= st2_abort;
498
        elsif i_gpif_tx_full = '0' then
499
          next_state <= st17_send_nbtag;
500
        end if;
501
 
502
      when st17_send_nbtag =>
503
        if i_gpif_abort = '1' then
504
          next_state <= st2_abort;
505
        elsif i_gpif_tx_full = '0' then
506
          next_state <= st18_send_transfer_size_low;
507
        end if;
508
 
509
      when st18_send_transfer_size_low =>
510
        if i_gpif_abort = '1' then
511
          next_state <= st2_abort;
512
        elsif i_gpif_tx_full = '0' then
513
          next_state <= st19_send_transfer_size_high;
514
        end if;
515
 
516
      when st19_send_transfer_size_high =>
517
        if i_gpif_abort = '1' then
518
          next_state <= st2_abort;
519
        elsif i_gpif_tx_full = '0' then
520
          next_state <= st20_send_attributes;
521
        end if;
522
 
523
      when st20_send_attributes =>
524
        if i_gpif_abort = '1' then
525
          next_state <= st2_abort;
526
        elsif i_gpif_tx_full = '0' then
527 26 nussgipfel
          next_state <= st21_send_reserved;
528 22 nussgipfel
        end if;
529
 
530 26 nussgipfel
      when st21_send_reserved =>
531 22 nussgipfel
        if i_gpif_abort = '1' then
532
          next_state <= st2_abort;
533
        elsif i_gpif_tx_full = '0' and i_send_fifo_empty = '0' then
534
          next_state <= st22_send_data;
535
        end if;
536
 
537
      when st22_send_data =>
538
        if i_gpif_abort = '1' then
539
          next_state <= st2_abort;
540
        elsif i_send_counter_zero = '1' then
541
          next_state <= st24_wait_for_send_end;
542
        elsif i_gpif_tx_full = '1' or i_send_fifo_empty = '1' then
543
          next_state <= st23_send_wait;
544
        end if;
545
 
546
      when st23_send_wait =>
547
        if i_gpif_abort = '1' then
548
          next_state <= st2_abort;
549
        elsif i_gpif_tx_full = '0' and i_send_fifo_empty = '0' then
550
          next_state <= st22_send_data;
551
        end if;
552
 
553
      when st24_wait_for_send_end =>
554
        if i_gpif_abort = '1' then
555
          next_state <= st2_abort;
556
        elsif i_gpif_tx = '0' then
557
          next_state <= st1_idle;
558
        end if;
559
 
560
      when others =>
561
        next_state <= st1_idle;
562
    end case;
563
  end process;
564
 
565
end fsm;

powered by: WebSVN 2.1.0

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