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

Subversion Repositories gecko3

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 nussgipfel
--  GECKO3COM IP Core
2
--
3 23 nussgipfel
--  Copyright (C) 2010 by
4 14 nussgipfel
--   ___    ___   _   _
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 23 nussgipfel
--------------------------------------------------------------------------------
26 14 nussgipfel
--
27
--  Author:  Andreas Habegger, Christoph Zimmermann
28 23 nussgipfel
--  Date of creation: 11. February 2010
29 14 nussgipfel
--  Description:
30 23 nussgipfel
--      Test scenario for the GECKO3com simple IP core.
31
--      (Not the one for Xilinx EDK)
32
--      This test module has two operation mode (selectable by external switch):
33
--      - Send back a response message stored in rom
34 25 nussgipfel
--      - Send back a stream of pseudo random data. Size is defined as a
35
--        constant (currently 1 MiB)
36 14 nussgipfel
--
37
--  Target Devices:     general
38
--  Tool versions:      11.1
39
--  Dependencies:
40
--
41 23 nussgipfel
--------------------------------------------------------------------------------
42 14 nussgipfel
 
43 11 nussgipfel
library ieee;
44
use ieee.std_logic_1164.all;
45 24 nussgipfel
use ieee.std_logic_unsigned.all;
46 11 nussgipfel
 
47
library work;
48 14 nussgipfel
use work.GECKO3COM_defines.all;
49 11 nussgipfel
 
50 24 nussgipfel
 
51 23 nussgipfel
entity GECKO3COM_simple_test is
52 11 nussgipfel
  port (
53 23 nussgipfel
    i_nReset      : in    std_logic;
54
    i_sysclk      : in    std_logic;    -- FPGA System CLK
55
    -- Interface signals to the EZ-USB FX2
56
    i_IFCLK       : in    std_logic;    -- GPIF CLK
57
    i_WRU         : in    std_logic;    -- write from GPIF
58
    i_RDYU        : in    std_logic;    -- GPIF is ready
59
    o_WRX         : out   std_logic;    -- To write to GPIF
60
    o_RDYX        : out   std_logic;    -- IP Core is ready
61
    -- bidirect data bus
62 24 nussgipfel
    b_gpif_bus    : inout std_logic_vector(SIZE_DBUS_GPIF-1 downto 0);
63 23 nussgipfel
    -- simple test "user interface" signals
64
    o_LEDrx       : out   std_logic;    -- controll LED receive data
65
    o_LEDtx       : out   std_logic;    -- controll LED send data
66
    o_LEDrun      : out   std_logic;    -- power LED
67 26 nussgipfel
    o_dummy       : out   std_logic;    -- dummy output for otherwise unused signals
68 23 nussgipfel
    i_mode_switch : in    std_logic_vector(2 downto 0));
69
end GECKO3COM_simple_test;
70 11 nussgipfel
 
71
 
72
 
73 23 nussgipfel
architecture behavour of GECKO3COM_simple_test is
74 11 nussgipfel
 
75 23 nussgipfel
  ----------------------------------------------------------------------------- 
76
  --     CONSTANTS  
77
  -----------------------------------------------------------------------------
78
  constant BUSWIDTH : integer := 32; -- you can choose here 32 or 16
79
 
80
  -- lenght of the message stored in the response message rom:
81 24 nussgipfel
  signal c_transfer_size_rom : std_logic_vector(31 downto 0) := x"0000000E";
82 23 nussgipfel
 
83
  -- we will transmitt 1 MiB data when the pseude random number generator
84
  -- is used:
85 29 nussgipfel
  signal c_transfer_size_prng : std_logic_vector(31 downto 0) := x"00100000";
86
  --signal c_transfer_size_prng : std_logic_vector(31 downto 0) := x"00000001";
87 23 nussgipfel
 
88 11 nussgipfel
 
89 23 nussgipfel
  ----------------------------------------------------------------------------- 
90
  --     COMPONENTS  
91
  -----------------------------------------------------------------------------
92
  component GECKO3COM_simple
93
    generic (
94
      BUSWIDTH : integer);
95
    port (
96
      i_nReset                 : in    std_logic;
97
      i_sysclk                 : in    std_logic;
98
      i_receive_fifo_rd_en     : in    std_logic;
99
      o_receive_fifo_empty     : out   std_logic;
100
      o_receive_fifo_data      : out   std_logic_vector(BUSWIDTH-1 downto 0);
101
      o_receive_transfersize   : out   std_logic_vector(31 downto 0);
102
      o_receive_end_of_message : out   std_logic;
103
      o_receive_newdata        : out   std_logic;
104
      i_send_fifo_wr_en        : in    std_logic;
105
      o_send_fifo_full         : out   std_logic;
106
      i_send_fifo_data         : in    std_logic_vector(BUSWIDTH-1 downto 0);
107
      i_send_transfersize      : in    std_logic_vector(31 downto 0);
108
      i_send_transfersize_en   : in    std_logic;
109
      i_send_have_more_data    : in    std_logic;
110
      o_send_data_request      : out   std_logic;
111
      o_send_finished          : out   std_logic;
112
      o_rx                     : out   std_logic;
113
      o_tx                     : out   std_logic;
114
      i_IFCLK                  : in    std_logic;
115
      i_WRU                    : in    std_logic;
116
      i_RDYU                   : in    std_logic;
117
      o_WRX                    : out   std_logic;
118
      o_RDYX                   : out   std_logic;
119
      b_gpif_bus               : inout std_logic_vector(SIZE_DBUS_GPIF-1 downto 0));
120
  end component;
121
 
122
 
123
  component response_message_rom
124
    port (
125
      A : in  std_logic_vector(3 downto 0);
126
      D : out std_logic_vector(31 downto 0));
127
  end component;
128 11 nussgipfel
 
129 23 nussgipfel
  -----------------------------------------------------------------------------
130
  -- interconection signals
131
  -----------------------------------------------------------------------------
132 11 nussgipfel
 
133 23 nussgipfel
  signal s_receive_fifo_rd_en     : std_logic;
134
  signal s_receive_fifo_empty     : std_logic;
135
  signal s_receive_fifo_data      : std_logic_vector(BUSWIDTH-1 downto 0);
136
  signal s_receive_transfersize   : std_logic_vector(31 downto 0);
137
  signal s_receive_end_of_message : std_logic;
138
  signal s_receive_newdata        : std_logic;
139
  signal s_send_fifo_wr_en        : std_logic;
140
  signal s_send_fifo_full         : std_logic;
141
  signal s_send_fifo_data         : std_logic_vector(BUSWIDTH-1 downto 0);
142
  signal s_send_transfersize      : std_logic_vector(31 downto 0);
143
  signal s_send_transfersize_en   : std_logic;
144
  signal s_send_have_more_data    : std_logic;
145
  signal s_send_data_request      : std_logic;
146
  signal s_send_finished          : std_logic;
147
 
148
  signal s_mode                              : std_logic_vector(1 downto 0);
149
  signal s_transfer_size_reg_select          : std_logic;
150
  signal s_transfer_size_reg_en              : std_logic;
151
  signal s_send_counter_reset                : std_logic;
152
  signal s_send_counter_en                   : std_logic;
153
  signal s_send_counter_equals_transfer_size : std_logic;
154
  signal s_prng_en                           : std_logic;
155
  signal s_prng_feedback                     : std_logic;
156
  signal s_receive_data_error                : std_logic;
157
 
158
  signal s_receive_data_old        : std_logic_vector(31 downto 0);
159
  signal s_selected_transfer_size  : std_logic_vector(31 downto 0);
160
  signal s_remaining_transfer_size : std_logic_vector(31 downto 0);
161 24 nussgipfel
  signal s_subtract_value          : std_logic_vector(31 downto 0);
162 23 nussgipfel
  signal s_send_counter_value      : std_logic_vector(31 downto 0);
163
  signal s_prng_data               : std_logic_vector(31 downto 0);
164
  signal s_message_rom_data        : std_logic_vector(31 downto 0);
165
 
166 24 nussgipfel
 
167 11 nussgipfel
  -----------------------------------------------------------------------------
168 23 nussgipfel
  -- finite state machine signals
169 11 nussgipfel
  -----------------------------------------------------------------------------
170 23 nussgipfel
    -- XST specific synthesize attributes
171
  attribute safe_implementation: string;
172
  attribute safe_recovery_state: string;
173 11 nussgipfel
 
174 23 nussgipfel
  type t_fsmState is (st1_idle, st2_get_data, st3_load_total_transfer_size,
175
                      st4_save_remaining_transfer_size, st5_send_data,
176
                      st6_send_wait, st7_subtract_transfered_data,
177
                      st8_reset_send_counter);
178 11 nussgipfel
 
179 23 nussgipfel
  signal state, next_state : t_fsmState;
180
 
181
  -- XST specific synthesize attributes
182 24 nussgipfel
  attribute safe_recovery_state of state : signal is "st1_idle";
183
  attribute safe_implementation of state : signal is "yes";
184 14 nussgipfel
 
185
 
186 11 nussgipfel
 
187 23 nussgipfel
begin --  behavour
188 11 nussgipfel
 
189 23 nussgipfel
  GECKO3COM_simple_1: GECKO3COM_simple
190
    generic map (
191
      BUSWIDTH => BUSWIDTH)
192
    port map (
193
      i_nReset                 => i_nReset,
194
      i_sysclk                 => i_sysclk,
195
      i_receive_fifo_rd_en     => s_receive_fifo_rd_en,
196
      o_receive_fifo_empty     => s_receive_fifo_empty,
197
      o_receive_fifo_data      => s_receive_fifo_data,
198
      o_receive_transfersize   => s_receive_transfersize,
199
      o_receive_end_of_message => s_receive_end_of_message,
200
      o_receive_newdata        => s_receive_newdata,
201
      i_send_fifo_wr_en        => s_send_fifo_wr_en,
202
      o_send_fifo_full         => s_send_fifo_full,
203
      i_send_fifo_data         => s_send_fifo_data,
204
      i_send_transfersize      => s_send_transfersize,
205
      i_send_transfersize_en   => s_send_transfersize_en,
206
      i_send_have_more_data    => s_send_have_more_data,
207
      o_send_data_request      => s_send_data_request,
208
      o_send_finished          => s_send_finished,
209
      o_rx                     => o_LEDrx,
210
      o_tx                     => o_LEDtx,
211
      i_IFCLK                  => i_IFCLK,
212
      i_WRU                    => i_WRU,
213
      i_RDYU                   => i_RDYU,
214
      o_WRX                    => o_WRX,
215
      o_RDYX                   => o_RDYX,
216
      b_gpif_bus               => b_gpif_bus);
217 11 nussgipfel
 
218
 
219 23 nussgipfel
  response_message_rom_1: response_message_rom
220
    port map (
221 26 nussgipfel
      A => s_send_counter_value(5 downto 2),
222 23 nussgipfel
      D => s_message_rom_data);
223
 
224
 
225
  o_LEDrun <= '1';
226
 
227 26 nussgipfel
  o_dummy <= s_send_finished or s_receive_end_of_message or s_receive_newdata
228
             or s_receive_data_error;
229 23 nussgipfel
 
230 26 nussgipfel
 
231 23 nussgipfel
  -- purpose: converts the mode_switch input to a binary coded value
232
  -- type   : combinational
233
  -- inputs : i_mode_switch
234
  -- outputs: s_mode
235
  mode_switch_decoder: process (i_mode_switch)
236
  begin  -- process mode_switch_decoder
237 24 nussgipfel
    if i_mode_switch = "001" then
238 23 nussgipfel
      s_mode <= "00";
239 24 nussgipfel
    elsif i_mode_switch = "010" then
240 23 nussgipfel
      s_mode <= "01";
241 24 nussgipfel
    elsif i_mode_switch = "100" then
242 23 nussgipfel
      s_mode <= "10";
243
    else
244
      s_mode <= "00";
245 11 nussgipfel
    end if;
246 23 nussgipfel
  end process mode_switch_decoder;
247 11 nussgipfel
 
248
 
249
  -----------------------------------------------------------------------------
250 23 nussgipfel
  -- components needed in the send path
251
  -----------------------------------------------------------------------------
252
 
253
  -- purpose: mulitiplexer to select the send data source
254
  -- type   : combinational
255
  -- inputs : s_mode, s_prng_data, s_message_rom_data
256
  -- outputs: s_send_fifo_data
257
  send_data_mux: process (s_mode, s_prng_data, s_message_rom_data)
258
  begin  -- process send_data_mux
259 24 nussgipfel
    case s_mode is
260 27 nussgipfel
      -- we have to change here the "16bit word order" else the data is
261
      -- transmitted in the wrong order
262
      when "00" => s_send_fifo_data <= s_message_rom_data(15 downto 0) &
263
                                       s_message_rom_data(31 downto 16);
264
      when "01" => s_send_fifo_data <= s_prng_data(15 downto 0) &
265
                                       s_prng_data(31 downto 16);
266 24 nussgipfel
      when others => s_send_fifo_data <= (others => 'X');
267 23 nussgipfel
    end case;
268
  end process send_data_mux;
269 11 nussgipfel
 
270 23 nussgipfel
 
271
  -- purpose: mulitiplexer to select the send transfer size
272
  -- type   : combinational
273
  -- inputs : s_mode, c_transfer_size_rom, c_transfer_size_prng
274
  -- outputs: s_selected_transfer_size
275
  send_transfersize_mode_mux: process (s_mode, c_transfer_size_rom, c_transfer_size_prng)
276
  begin  -- process send_transfersize_mode_mux
277
    case s_mode is
278
      when "00" => s_selected_transfer_size <= c_transfer_size_rom;
279
      when "01" => s_selected_transfer_size <= c_transfer_size_prng;
280 24 nussgipfel
      when others => s_selected_transfer_size <= (others => 'X');
281 23 nussgipfel
    end case;
282
  end process send_transfersize_mode_mux;
283 11 nussgipfel
 
284
 
285 23 nussgipfel
  -- purpose: stores the initial or remaining transfer size
286
  -- type   : sequential
287
  -- inputs : i_sysclk, i_nReset, s_transfer_size_reg_en, s_transfer_size_reg_select,
288
  --          s_subtract_value
289
  -- outputs: s_remaining_transfer_size
290
  remaining_transfer_size_reg: process (i_sysclk, i_nReset)
291
  begin  -- process current_transfer_size_reg
292
    if i_nReset = '0' then              -- asynchronous reset (active low)
293
      s_remaining_transfer_size <= (others => '0');
294
    elsif i_sysclk'event and i_sysclk = '1' then  -- rising clock edge
295
      if s_transfer_size_reg_en = '1' then
296
        if s_transfer_size_reg_select = '1' then
297
          s_remaining_transfer_size <= s_selected_transfer_size;
298
        else
299
          s_remaining_transfer_size <= s_subtract_value;
300
        end if;
301
      end if;
302
    end if;
303 24 nussgipfel
  end process remaining_transfer_size_reg;
304 11 nussgipfel
 
305 23 nussgipfel
 
306
  -- maximum alowed transfer size comparator
307 24 nussgipfel
  s_send_have_more_data <=
308 23 nussgipfel
    '1' when s_remaining_transfer_size > s_receive_transfersize else
309
    '0';
310
 
311
 
312
  -- purpose: mulitiplexer to select the send transfer size
313
  -- type   : combinational
314
  -- inputs : s_have_more_data, s_remaining_transfer_size,
315
  --          s_receive_transfersize
316
  -- outputs: s_send_transfersize
317 24 nussgipfel
  send_transfersize_mux: process (s_send_have_more_data, s_receive_transfersize,
318
                                  s_remaining_transfer_size)
319
 
320 23 nussgipfel
  begin  -- process send_transfersize_mux
321 24 nussgipfel
    case s_send_have_more_data is
322 23 nussgipfel
      when '0' => s_send_transfersize <= s_remaining_transfer_size;
323 24 nussgipfel
      when '1' => s_send_transfersize <= s_receive_transfersize;
324
      when others => s_send_transfersize <= (others => 'X');
325 23 nussgipfel
    end case;
326
  end process send_transfersize_mux;
327
 
328
 
329
  -- purpose: up counter for the send transfer size
330
  -- type   : sequential
331
  -- inputs : i_sysclk, i_nReset, s_send_counter_en, s_send_counter_reset
332
  --          
333
  -- outputs: s_send_counter_value
334
  send_counter : process (i_sysclk, i_nReset)
335
  begin  -- process send_counter
336
    if i_nReset = '0' then              -- asynchronous reset (active low)
337
      s_send_counter_value <= (others => '0');
338
    elsif i_sysclk'event and i_sysclk = '1' then  -- rising clock edge
339 28 nussgipfel
      if s_send_counter_reset = '1' and  s_send_counter_en = '0' then
340 23 nussgipfel
        s_send_counter_value <= (others => '0');
341 11 nussgipfel
      end if;
342 28 nussgipfel
      if s_send_counter_reset = '0' and s_send_counter_en = '1' then
343 26 nussgipfel
        s_send_counter_value(31 downto 2) <=
344
          s_send_counter_value(31 downto 2) + 1;
345
        s_send_counter_value(1 downto 0) <= "00";  -- every fifo write (32bit)
346
                                                   -- transfers 4 bytes.
347 23 nussgipfel
      end if;
348
    end if;
349
  end process send_counter;
350
 
351
  -- transfer size counter comparator
352
  s_send_counter_equals_transfer_size <=
353 28 nussgipfel
    '1' when s_send_counter_value > s_send_transfersize else
354 23 nussgipfel
    '0';
355 11 nussgipfel
 
356
 
357 30 nussgipfel
  -- purpose: subracts the send counter end value from the remaining transfer
358
  -- size value
359 23 nussgipfel
  -- type   : combinational
360
  -- inputs : s_remaining_transfer_size, s_send_counter_value
361
  -- outputs: s_subtract_value
362
  transfer_size_subract: process (s_remaining_transfer_size, s_send_counter_value)
363
  begin  -- process transfer_size_subract
364
    s_subtract_value <= s_remaining_transfer_size - s_send_counter_value;
365
  end process transfer_size_subract;
366 11 nussgipfel
 
367 23 nussgipfel
 
368
 
369
  -----------------------------------------------------------------------------
370
  -- components needed in the receive path
371
  -----------------------------------------------------------------------------
372
 
373
  -- purpose: saves the previous received data word
374
  -- type   : sequential
375
  -- inputs : i_sysclk, i_nReset, s_receive_fifo_data, s_receive_fifo_rd_en
376
  -- outputs: s_receive_fifo_data_old
377
  receive_fifo_data_reg: process (i_sysclk, i_nReset)
378
  begin  -- process receive_fifo_data_reg
379
    if i_nReset = '0' then              -- asynchronous reset (active low)
380 24 nussgipfel
      s_receive_data_old <= (others => '0');
381 23 nussgipfel
    elsif i_sysclk'event and i_sysclk = '1' then  -- rising clock edge
382
      if s_receive_fifo_rd_en = '1' then
383 24 nussgipfel
        s_receive_data_old <= s_receive_fifo_data;
384 23 nussgipfel
      end if;
385
    end if;
386
  end process receive_fifo_data_reg;
387
 
388
 
389
  -- receive data comparator
390
  -- (use together with test data with incrementing values)
391
  s_receive_data_error <=
392 24 nussgipfel
    '0' when s_receive_data_old + 1 = s_receive_fifo_data else
393 23 nussgipfel
    '1';
394
 
395
 
396
  -- purpose: linear shift register for the pseude random number
397
  --          generator (PRNG)
398
  -- type   : sequential
399
  -- inputs : i_sysclk, i_nReset, s_prng_en, s_prng_feedback
400
  -- outputs: s_prng_data
401
  prng_shiftregister: process (i_sysclk, i_nReset)
402
  begin  -- process prng_shiftregister
403
    if i_nReset = '0' then              -- asynchronous reset (active low)
404 24 nussgipfel
      s_prng_data <= "01010101010101010101010101010101";
405 23 nussgipfel
    elsif i_sysclk'event and i_sysclk = '1' then  -- rising clock edge
406
      if s_prng_en = '1' then
407 24 nussgipfel
        s_prng_data(31 downto 1) <= s_prng_data(30 downto 0);
408
        s_prng_data(0) <= s_prng_feedback;
409 23 nussgipfel
      end if;
410
    end if;
411
  end process prng_shiftregister;
412
 
413
  -- purpose: feedback polynom for the pseudo random number generator (PRNG)
414
  -- inputs : s_prng_data
415
  -- outputs: s_prng_feedback
416
  s_prng_feedback <= s_prng_data(15) xor s_prng_data(13) xor s_prng_data(12)
417
                     xor s_prng_data(10);
418
 
419
 
420 24 nussgipfel
 
421 23 nussgipfel
  -----------------------------------------------------------------------------
422
  -- finite state machine (moore)
423
  -----------------------------------------------------------------------------
424
 
425
  -- state reg
426
  fsm_state_reg : process(i_sysclk, i_nReset)
427
  begin
428
    if i_nReset = '0' then
429
      state <= st1_idle;
430
    elsif i_sysclk'event and i_sysclk = '1' then
431
        state <= next_state;
432
    end if;
433
  end process fsm_state_reg;
434
 
435
 
436
  -- comb logic
437
  next_state_decode: process(state, s_receive_fifo_empty, s_send_fifo_full,
438 24 nussgipfel
                             s_send_data_request, s_send_have_more_data, s_mode,
439
                             s_send_counter_equals_transfer_size)
440 23 nussgipfel
  begin  -- process next_state_decode
441
 
442
    --declare default state for next_state to avoid latches
443
    next_state <= state;           --default is to stay in current state
444
 
445
    -- default signal values to avoid latches:
446
    s_receive_fifo_rd_en       <= '0';
447
    s_send_transfersize_en     <= '0';
448
    s_send_fifo_wr_en          <= '0';
449
    s_transfer_size_reg_select <= '0';
450
    s_transfer_size_reg_en     <= '0';
451
    s_send_counter_reset       <= '0';
452
    s_send_counter_en          <= '0';
453
    s_prng_en                  <= '0';
454
 
455
    case state is
456
      -- controll
457
 
458
      when st1_idle =>
459
 
460
        if s_receive_fifo_empty = '0' then
461
          next_state <= st2_get_data;
462
        elsif s_send_data_request = '1' then
463
          next_state <= st3_load_total_transfer_size;
464 11 nussgipfel
        end if;
465 23 nussgipfel
 
466
      when st2_get_data =>
467 27 nussgipfel
        if s_receive_fifo_empty = '0' then
468
          s_receive_fifo_rd_en <= '1';
469
        end if;
470 11 nussgipfel
 
471 23 nussgipfel
        if s_receive_fifo_empty = '1' then
472
          next_state <= st1_idle;
473
        end if;
474
 
475
      when st3_load_total_transfer_size =>
476
        s_send_counter_reset       <= '1';
477
        s_transfer_size_reg_en     <= '1';
478
        s_transfer_size_reg_select <= '1';
479 11 nussgipfel
 
480 23 nussgipfel
        next_state <= st4_save_remaining_transfer_size;
481
 
482
      when st4_save_remaining_transfer_size =>
483
        s_send_transfersize_en <= '1';
484 11 nussgipfel
 
485 23 nussgipfel
        next_state <= st5_send_data;
486
 
487
      when st5_send_data =>
488 27 nussgipfel
        if s_send_fifo_full = '0' then
489
          s_send_fifo_wr_en <= '1';
490
          s_send_counter_en <= '1';
491
          if s_mode = "01" then
492
            s_prng_en <= '1';
493
          end if;
494 23 nussgipfel
        end if;
495
 
496 24 nussgipfel
        if s_send_counter_equals_transfer_size = '1' and
497
          s_send_have_more_data = '0'
498
        then
499 23 nussgipfel
          next_state <= st1_idle;
500 24 nussgipfel
        elsif s_send_counter_equals_transfer_size = '1' and
501
          s_send_have_more_data = '1'
502
        then
503 23 nussgipfel
          next_state <= st7_subtract_transfered_data;
504
        elsif s_send_fifo_full = '1' then
505
          next_state <= st6_send_wait;
506
        end if;
507
 
508
      when st6_send_wait =>
509 28 nussgipfel
 
510 23 nussgipfel
        if s_send_fifo_full = '0' then
511
          next_state <= st5_send_data;
512
        end if;
513
 
514 24 nussgipfel
      when st7_subtract_transfered_data =>
515 28 nussgipfel
        s_transfer_size_reg_select <= '0';
516 23 nussgipfel
        s_transfer_size_reg_en <= '1';
517
 
518
        if s_send_data_request = '1' then
519 24 nussgipfel
          next_state <= st8_reset_send_counter;
520 23 nussgipfel
        end if;
521
 
522
      when st8_reset_send_counter =>
523
        s_send_counter_reset <= '1';
524
 
525
        next_state <= st4_save_remaining_transfer_size;
526
 
527
      when others =>
528
        next_state <= st1_idle;
529
    end case;
530
 
531
  end process next_state_decode;
532
 
533
end  behavour;
534
 
535
 
536
----------------------------------------------------------------------------- 
537
--  RESPONSE MESSAGE ROM  
538
-----------------------------------------------------------------------------
539
-- This file was generated with hex2rom written by Daniel Wallner
540
 
541 24 nussgipfel
library ieee;
542
use ieee.std_logic_1164.all;
543
use IEEE.numeric_std.all;
544
 
545 23 nussgipfel
entity response_message_rom is
546
        port(
547
                A       : in std_logic_vector(3 downto 0);
548
                D       : out std_logic_vector(31 downto 0)
549
        );
550
end response_message_rom;
551
 
552
architecture rtl of response_message_rom is
553
        subtype ROM_WORD is std_logic_vector(31 downto 0);
554
        type ROM_TABLE is array(0 to 3) of ROM_WORD;
555
        signal ROM: ROM_TABLE := ROM_TABLE'(
556
                "00100010001000000010110000110000",     -- 0x0000
557
                "01100101001000000110111101001110",     -- 0x0004
558
                "01110010011011110111001001110010",     -- 0x0008
559
                "00001010000010100000101000100010");    -- 0x000C
560
begin
561
        D <= ROM(to_integer(unsigned(A)));
562
end;

powered by: WebSVN 2.1.0

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