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

Subversion Repositories gecko3

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

Go to most recent revision | 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:  16:52:52 01/28/2010 
29
--  Description:
30
--      This is the top module for the GECKO3com simple IP core.
31
--      Not the one for Xilinx EDK (with PLB bus), for processor less designs.
32
--
33
--      This core provides a simple FIFO and register interface to the
34
--      USB data transfer capabilities of the GECKO3COM/GECKO3main system.
35
--
36
--      Look at GECKO3COM_loopback.vhd for an example how to use it.
37
--
38
--  Target Devices:     Xilinx FPGA's Spartan3 and up or Virtex4 and up.
39
--  Tool versions:      11.1
40
--
41
--------------------------------------------------------------------------------
42
 
43
library IEEE;
44
use IEEE.STD_LOGIC_1164.ALL;
45
use IEEE.STD_LOGIC_ARITH.ALL;
46
use IEEE.STD_LOGIC_UNSIGNED.ALL;
47
 
48
library work;
49
use work.GECKO3COM_defines.all;
50
 
51
 
52
entity GECKO3COM_simple is
53
  generic (
54
    BUSWIDTH : integer := 16);          -- vector size of the FIFO databusses
55
  port (
56
    i_nReset : in std_logic;
57
    i_sysclk : in std_logic;            -- FPGA System CLK
58
 
59
    i_receive_fifo_rd_en     : in  std_logic;
60
    o_receive_fifo_empty     : out std_logic;
61
    o_receive_fifo_data      : out std_logic_vector(BUSWIDTH-1 downto 0);
62
    o_receive_transfersize   : out std_logic_vector(31 downto 0);
63
    o_receive_end_of_message : out std_logic;
64
    o_receive_newdata        : out std_logic;
65
 
66
    i_send_fifo_wr_en      : in  std_logic;
67
    o_send_fifo_full       : out std_logic;
68
    i_send_fifo_data       : in  std_logic_vector(BUSWIDTH-1 downto 0);
69
    i_send_transfersize    : in  std_logic_vector(31 downto 0);
70
    i_send_transfersize_en : in  std_logic;
71
    o_send_data_request    : out std_logic;
72
    o_send_finished        : out std_logic;
73
 
74
    o_rx : out std_logic;               -- receiving data signalisation
75
    o_tx : out std_logic;               -- transmitting data signalisation
76
 
77
    -- Interface signals to the EZ-USB FX2
78
    i_IFCLK    : in    std_logic;  -- GPIF CLK (GPIF is Master and provides the clock)
79
    i_WRU      : in    std_logic;       -- write from GPIF
80
    i_RDYU     : in    std_logic;       -- GPIF is ready
81
    o_WRX      : out   std_logic;       -- To write to GPIF
82
    o_RDYX     : out   std_logic;       -- IP Core is ready
83
    b_gpif_bus : inout std_logic_vector(SIZE_DBUS_GPIF-1 downto 0)  -- bidirect data bus
84
    );
85
end GECKO3COM_simple;
86
 
87
 
88
architecture Behavioral of GECKO3COM_simple is
89
 
90
  -----------------------------------------------------------------------------
91
  -- COMPONENTS
92
  -----------------------------------------------------------------------------
93
 
94
  component gpif_com
95
    port (
96
      i_nReset   : in    std_logic;
97
      i_SYSCLK   : in    std_logic;
98
      o_ABORT    : out   std_logic;
99
      o_RX       : out   std_logic;
100
      o_TX       : out   std_logic;
101
      i_RD_EN    : in    std_logic;
102
      o_EMPTY    : out   std_logic;
103
      o_RX_DATA  : out   std_logic_vector(SIZE_DBUS_GPIF-1 downto 0);
104
      i_EOM      : in    std_logic;
105
      i_WR_EN    : in    std_logic;
106
      o_FULL     : out   std_logic;
107
      i_TX_DATA  : in    std_logic_vector(SIZE_DBUS_GPIF-1 downto 0);
108
      i_IFCLK    : in    std_logic;
109
      i_WRU      : in    std_logic;
110
      i_RDYU     : in    std_logic;
111
      o_WRX      : out   std_logic;
112
      o_RDYX     : out   std_logic;
113
      b_gpif_bus : inout std_logic_vector(SIZE_DBUS_GPIF-1 downto 0));
114
  end component;
115
 
116
  component GECKO3COM_simple_datapath
117
    generic (
118
      BUSWIDTH : integer);
119
    port (
120
      i_nReset                     : in  std_logic;
121
      i_sysclk                     : in  std_logic;
122
      i_rx_data                    : in  std_logic_vector(SIZE_DBUS_GPIF-1 downto 0);
123
      o_tx_data                    : out std_logic_vector(SIZE_DBUS_GPIF-1 downto 0);
124
      i_receive_fifo_rd_en         : in  std_logic;
125
      i_receive_fifo_wr_en         : in  std_logic;
126
      o_receive_fifo_empty         : out std_logic;
127
      o_receive_fifo_full          : out std_logic;
128
      o_receive_fifo_data          : out std_logic_vector(BUSWIDTH-1 downto 0);
129
      i_receive_fifo_reset         : in  std_logic;
130
      o_receive_transfersize       : out std_logic_vector(31 downto 0);
131
      i_receive_transfersize_en    : in  std_logic_vector((32/SIZE_DBUS_GPIF)-1 downto 0);
132
      i_receive_counter_load       : in  std_logic;
133
      i_receive_counter_en         : in  std_logic;
134
      o_receive_counter_zero       : out std_logic;
135
      o_dev_dep_msg_out            : out std_logic;
136
      o_request_dev_dep_msg_in     : out std_logic;
137
      i_btag_reg_en                : in  std_logic;
138
      i_nbtag_reg_en               : in  std_logic;
139
      o_btag_correct               : out std_logic;
140
      o_eom_bit_detected           : out std_logic;
141
      i_send_fifo_rd_en            : in  std_logic;
142
      i_send_fifo_wr_en            : in  std_logic;
143
      o_send_fifo_empty            : out std_logic;
144
      o_send_fifo_full             : out std_logic;
145
      i_send_fifo_data             : in  std_logic_vector(BUSWIDTH-1 downto 0);
146
      i_send_fifo_reset            : in  std_logic;
147
      i_send_transfersize          : in  std_logic_vector(31 downto 0);
148
      i_send_transfersize_en       : in  std_logic;
149
      i_send_counter_load          : in  std_logic;
150
      i_send_counter_en            : in  std_logic;
151
      o_send_counter_zero          : out std_logic;
152
      i_send_mux_sel               : in  std_logic_vector(2 downto 0);
153
      o_send_finished              : out std_logic;
154
      i_receive_newdata_set        : in  std_logic;
155
      o_receive_newdata            : out std_logic;
156
      i_receive_end_of_message_set : in  std_logic;
157
      o_receive_end_of_message     : out std_logic;
158
      i_send_data_request_set      : in  std_logic;
159
      o_send_data_request          : out std_logic);
160
  end component;
161
 
162
  component GECKO3COM_simple_fsm
163
    port (
164
      i_nReset                     : in  std_logic;
165
      i_sysclk                     : in  std_logic;
166
      o_receive_fifo_wr_en         : out std_logic;
167
      i_receive_fifo_full          : in  std_logic;
168
      o_receive_fifo_reset         : out std_logic;
169
      o_receive_transfersize_en    : out std_logic_vector((32/SIZE_DBUS_GPIF)-1 downto 0);
170
      o_receive_counter_load       : out std_logic;
171
      o_receive_counter_en         : out std_logic;
172
      i_receive_counter_zero       : in  std_logic;
173
      i_dev_dep_msg_out            : in  std_logic;
174
      i_request_dev_dep_msg_in     : in  std_logic;
175
      o_btag_reg_en                : out std_logic;
176
      o_nbtag_reg_en               : out std_logic;
177
      i_btag_correct               : in  std_logic;
178
      i_eom_bit_detected           : in  std_logic;
179
      i_send_transfersize_en       : in  std_logic;
180
      o_send_fifo_rd_en            : out std_logic;
181
      i_send_fifo_empty            : in  std_logic;
182
      o_send_fifo_reset            : out std_logic;
183
      o_send_counter_load          : out std_logic;
184
      o_send_counter_en            : out std_logic;
185
      i_send_counter_zero          : in  std_logic;
186
      o_send_mux_sel               : out std_logic_vector(2 downto 0);
187
      o_receive_newdata_set        : out std_logic;
188
      o_receive_end_of_message_set : out std_logic;
189
      o_send_data_request_set      : out std_logic;
190
      i_gpif_rx                    : in  std_logic;
191
      i_gpif_rx_empty              : in  std_logic;
192
      o_gpif_rx_rd_en              : out std_logic;
193
      i_gpif_tx                    : in  std_logic;
194
      i_gpif_tx_full               : in  std_logic;
195
      o_gpif_tx_wr_en              : out std_logic;
196
      i_gpif_abort                 : in  std_logic;
197
      o_gpif_eom                   : out std_logic);
198
  end component;
199
 
200
  -----------------------------------------------------------------------------
201
  -- interconection signals
202
  -----------------------------------------------------------------------------
203
 
204
  -- gpif_com internal signals
205
  signal s_gpif_abort           : std_logic;
206
  signal s_gpif_rx_rd_en        : std_logic;
207
  signal s_gpif_rx_empty        : std_logic;
208
  signal s_gpif_rx_data         : std_logic_vector(SIZE_DBUS_GPIF-1 downto 0);
209
  signal s_gpif_rx              : std_logic;
210
  signal s_gpif_eom             : std_logic;
211
  signal s_gpif_tx_wr_en        : std_logic;
212
  signal s_gpif_tx_full         : std_logic;
213
  signal s_gpif_tx_data         : std_logic_vector(SIZE_DBUS_GPIF-1 downto 0);
214
  signal s_gpif_tx              : std_logic;
215
 
216
  -- GECKO3COM_simple_datapath internal signals
217
  signal s_receive_fifo_wr_en      : std_logic;
218
  signal s_receive_fifo_empty      : std_logic;
219
  signal s_receive_fifo_full       : std_logic;
220
  signal s_receive_fifo_reset      : std_logic;
221
  signal s_receive_transfersize_en : std_logic_vector((32/SIZE_DBUS_GPIF)-1 downto 0);
222
  signal s_receive_counter_load    : std_logic;
223
  signal s_receive_counter_en      : std_logic;
224
  signal s_receive_counter_zero    : std_logic;
225
 
226
  signal s_dev_dep_msg_out         : std_logic;
227
  signal s_request_dev_dep_msg_in  : std_logic;
228
  signal s_btag_reg_en             : std_logic;
229
  signal s_nbtag_reg_en            : std_logic;
230
  signal s_btag_correct            : std_logic;
231
  signal s_eom_bit_detected        : std_logic;
232
 
233
  signal s_send_fifo_rd_en         : std_logic;
234
  signal s_send_fifo_empty         : std_logic;
235
  signal s_send_fifo_reset         : std_logic;
236
  signal s_send_counter_load       : std_logic;
237
  signal s_send_counter_en         : std_logic;
238
  signal s_send_counter_zero       : std_logic;
239
  signal s_send_mux_sel            : std_logic_vector(2 downto 0);
240
 
241
  signal s_receive_newdata_set        : std_logic;
242
  signal s_receive_end_of_message_set : std_logic;
243
  signal s_send_data_request_set      : std_logic;
244
 
245
begin  -- behaviour
246
 
247
  GPIF_INTERFACE: gpif_com
248
    port map (
249
      i_nReset   => i_nReset,
250
      i_SYSCLK   => i_sysclk,
251
      o_ABORT    => s_gpif_abort,
252
      o_RX       => s_gpif_rx,
253
      o_TX       => s_gpif_tx,
254
      i_RD_EN    => s_gpif_rx_rd_en,
255
      o_EMPTY    => s_gpif_rx_empty,
256
      o_RX_DATA  => s_gpif_rx_data,
257
      i_EOM      => s_gpif_eom,
258
      i_WR_EN    => s_gpif_tx_wr_en,
259
      o_FULL     => s_gpif_tx_full,
260
      i_TX_DATA  => s_gpif_tx_data,
261
      i_IFCLK    => i_IFCLK,
262
      i_WRU      => i_WRU,
263
      i_RDYU     => i_RDYU,
264
      o_WRX      => o_WRX,
265
      o_RDYX     => o_RDYX,
266
      b_gpif_bus => b_gpif_bus);
267
 
268
  o_rx <= s_gpif_rx;
269
  o_tx <= s_gpif_tx;
270
 
271
  GECKO3COM_simple_datapath_1 : GECKO3COM_simple_datapath
272
    generic map (
273
      BUSWIDTH => BUSWIDTH)
274
    port map (
275
      i_nReset                     => i_nReset,
276
      i_sysclk                     => i_sysclk,
277
      i_rx_data                    => s_gpif_rx_data,
278
      o_tx_data                    => s_gpif_tx_data,
279
      i_receive_fifo_rd_en         => i_receive_fifo_rd_en,
280
      i_receive_fifo_wr_en         => s_receive_fifo_wr_en,
281
      o_receive_fifo_empty         => s_receive_fifo_empty,
282
      o_receive_fifo_full          => s_receive_fifo_full,
283
      o_receive_fifo_data          => o_receive_fifo_data,
284
      i_receive_fifo_reset         => s_receive_fifo_reset,
285
      o_receive_transfersize       => o_receive_transfersize,
286
      i_receive_transfersize_en    => s_receive_transfersize_en,
287
      i_receive_counter_load       => s_receive_counter_load,
288
      i_receive_counter_en         => s_receive_counter_en,
289
      o_receive_counter_zero       => s_receive_counter_zero,
290
      o_dev_dep_msg_out            => s_dev_dep_msg_out,
291
      o_request_dev_dep_msg_in     => s_request_dev_dep_msg_in,
292
      i_btag_reg_en                => s_btag_reg_en,
293
      i_nbtag_reg_en               => s_nbtag_reg_en,
294
      o_btag_correct               => s_btag_correct,
295
      o_eom_bit_detected           => s_eom_bit_detected,
296
      i_send_fifo_rd_en            => s_send_fifo_rd_en,
297
      i_send_fifo_wr_en            => i_send_fifo_wr_en,
298
      o_send_fifo_empty            => s_send_fifo_empty,
299
      o_send_fifo_full             => o_send_fifo_full,
300
      i_send_fifo_data             => i_send_fifo_data,
301
      i_send_fifo_reset            => s_send_fifo_reset,
302
      i_send_transfersize          => i_send_transfersize,
303
      i_send_transfersize_en       => i_send_transfersize_en,
304
      i_send_counter_load          => s_send_counter_load,
305
      i_send_counter_en            => s_send_counter_en,
306
      o_send_counter_zero          => s_send_counter_zero,
307
      i_send_mux_sel               => s_send_mux_sel,
308
      i_receive_newdata_set        => s_receive_newdata_set,
309
      o_receive_newdata            => o_receive_newdata,
310
      i_receive_end_of_message_set => s_receive_end_of_message_set,
311
      o_receive_end_of_message     => o_receive_end_of_message,
312
      i_send_data_request_set      => s_send_data_request_set,
313
      o_send_data_request          => o_send_data_request);
314
 
315
    o_receive_fifo_empty <= s_receive_fifo_empty;
316
 
317
  GECKO3COM_simple_fsm_1: GECKO3COM_simple_fsm
318
    port map (
319
      i_nReset                     => i_nReset,
320
      i_sysclk                     => i_sysclk,
321
      o_receive_fifo_wr_en         => s_receive_fifo_wr_en,
322
      i_receive_fifo_full          => s_receive_fifo_full,
323
      o_receive_fifo_reset         => s_receive_fifo_reset,
324
      o_receive_transfersize_en    => s_receive_transfersize_en,
325
      o_receive_counter_load       => s_receive_counter_load,
326
      o_receive_counter_en         => s_receive_counter_en,
327
      i_receive_counter_zero       => s_receive_counter_zero,
328
      i_dev_dep_msg_out            => s_dev_dep_msg_out,
329
      i_request_dev_dep_msg_in     => s_request_dev_dep_msg_in,
330
      o_btag_reg_en                => s_btag_reg_en,
331
      o_nbtag_reg_en               => s_nbtag_reg_en,
332
      i_btag_correct               => s_btag_correct,
333
      i_eom_bit_detected           => s_eom_bit_detected,
334
      i_send_transfersize_en       => i_send_transfersize_en,
335
      o_send_fifo_rd_en            => s_send_fifo_rd_en,
336
      i_send_fifo_empty            => s_send_fifo_empty,
337
      o_send_fifo_reset            => s_send_fifo_reset,
338
      o_send_counter_load          => s_send_counter_load,
339
      o_send_counter_en            => s_send_counter_en,
340
      i_send_counter_zero          => s_send_counter_zero,
341
      o_send_mux_sel               => s_send_mux_sel,
342
      o_receive_newdata_set        => s_receive_newdata_set,
343
      o_receive_end_of_message_set => s_receive_end_of_message_set,
344
      o_send_data_request_set      => s_send_data_request_set,
345
      i_gpif_rx                    => s_gpif_rx,
346
      i_gpif_rx_empty              => s_gpif_rx_empty,
347
      o_gpif_rx_rd_en              => s_gpif_rx_rd_en,
348
      i_gpif_tx                    => s_gpif_tx,
349
      i_gpif_tx_full               => s_gpif_tx_full,
350
      o_gpif_tx_wr_en              => s_gpif_tx_wr_en,
351
      i_gpif_abort                 => s_gpif_abort,
352
      o_gpif_eom                   => s_gpif_eom);
353
 
354
end Behavioral;
355
 

powered by: WebSVN 2.1.0

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