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

Subversion Repositories tv80

[/] [tv80/] [trunk/] [rtl/] [simple_gmii/] [simple_gmii_top.v] - Blame information for rev 90

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 65 ghutchis
//
2
// Simple GMII-Like Interface for TV80
3
//
4
// Copyright (c) 2005 Guy Hutchison (ghutchis@opencores.org)
5
//
6
// Permission is hereby granted, free of charge, to any person obtaining a 
7
// copy of this software and associated documentation files (the "Software"), 
8
// to deal in the Software without restriction, including without limitation 
9
// the rights to use, copy, modify, merge, publish, distribute, sublicense, 
10
// and/or sell copies of the Software, and to permit persons to whom the 
11
// Software is furnished to do so, subject to the following conditions:
12
//
13
// The above copyright notice and this permission notice shall be included 
14
// in all copies or substantial portions of the Software.
15
//
16
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
17
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
18
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
19
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
20
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
21
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
22
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
 
24
module simple_gmii_top (/*AUTOARG*/
25
  // Outputs
26
  rd_data, doe, int_n, tx_data, tx_dv, tx_er,
27
  // Inputs
28
  clk, reset, iorq_n, rd_n, addr, wr_data, wr_n, rx_clk, rx_data,
29
  rx_dv, rx_er, tx_clk
30
  );
31
 
32
  parameter txbuf_sz = 512, rxbuf_sz = 512;
33 90 ghutchis
  parameter wr_ptr_sz = 9;
34 65 ghutchis
 
35
  input                 clk;                    // To core0 of simple_gmii_core.v, ...
36
  input                 reset;                  // To core0 of simple_gmii_core.v, ...
37
 
38
  // TV80 Controls
39
  input                 iorq_n;                 // To regs0 of simple_gmii_regs.v
40
  input                 rd_n;                   // To regs0 of simple_gmii_regs.v
41
  input [15:0]          addr;                   // To regs0 of simple_gmii_regs.v
42
  input [7:0]           wr_data;                // To regs0 of simple_gmii_regs.v
43
  output [7:0]          rd_data;                // From regs0 of simple_gmii_regs.v
44
  input                 wr_n;                   // To regs0 of simple_gmii_regs.v
45
  output                doe;                    // From regs0 of simple_gmii_regs.v
46
  output                int_n;                  // From regs0 of simple_gmii_regs.v
47
 
48
  // GMII RX
49
  input                 rx_clk;                 // To core0 of simple_gmii_core.v
50
  input [7:0]           rx_data;                // To core0 of simple_gmii_core.v, ...
51
  input                 rx_dv;                  // To core0 of simple_gmii_core.v
52
  input                 rx_er;                  // To core0 of simple_gmii_core.v
53
 
54
  // GMII TX
55
  input                 tx_clk;                 // To core0 of simple_gmii_core.v
56
  output [7:0]          tx_data;
57
  output                tx_dv;
58
  output                tx_er;
59
 
60
  wire [1:0]            status_set;
61
  wire [15:0]           rx_len;
62
  wire [7:0]            rx_rd_data;
63
  wire [7:0]            tx_wr_data;
64
  wire                  tx_wr_stb;
65
  wire                  en_preamble;
66
  wire                  start_transmit;
67
  wire                  rx_rd_stb;
68
 
69
   // RX Buf RAM
70
  wire                  rxbuf_we;
71
  wire [wr_ptr_sz-1:0]  rx_wr_ptr;
72
  wire [wr_ptr_sz-1:0]  rx_rd_ptr;
73
  wire [7:0]            rxbuf_data;
74
 
75
   // TX Buf RAM
76
  wire                  wr_sel_tx_data;
77
  wire [wr_ptr_sz-1:0]  txi_wr_ptr;
78
  wire [7:0]            io_data_in;
79
  wire [wr_ptr_sz-1:0]  txo_xm_ptr;
80
  wire [7:0]            txbuf_data;
81
 
82
  simple_gmii_core #(txbuf_sz, rxbuf_sz, wr_ptr_sz) core0
83
    (
84
     // Outputs
85
     .status_set                        (status_set),
86
     .rx_len                            (rx_len),
87
     .rx_rd_data                        (rx_rd_data),
88
 
89
     // GMII TX Interface
90
     .tx_clk                            (tx_clk),
91
     .tx_data (tx_data),
92
     .tx_dv   (tx_dv),
93
     .tx_er   (tx_er),
94
 
95
     // GMII RX Interface
96
     .rx_data                           (rx_data),
97
     .rx_clk                            (rx_clk),
98
     .rx_dv                             (rx_dv),
99
     .rx_er                             (rx_er),
100
 
101
     // RX Buf RAM
102
     .rxbuf_we (rxbuf_we),
103
     .rx_wr_ptr (rx_wr_ptr),
104
     .rx_rd_ptr (rx_rd_ptr),
105
     .rxbuf_data (rxbuf_data),
106
 
107
     // TX Buf RAM
108
     .wr_sel_tx_data (wr_sel_tx_data),
109
     .txi_wr_ptr (txi_wr_ptr),
110
     //.io_data_in (io_data_in),
111
     .txo_xm_ptr (txo_xm_ptr),
112
     .txbuf_data (txbuf_data),
113
 
114
     // Register Interface
115
     .clk                               (clk),
116
     .reset                             (reset),
117
     .start_transmit                    (start_transmit),
118
     .rx_rd_stb                         (rx_rd_stb),
119
     //.tx_wr_data                        (tx_wr_data),
120
     .tx_wr_stb                         (tx_wr_stb),
121
     .en_preamble                       (en_preamble));
122
 
123
  ram_1r_1w #(8, rxbuf_sz, wr_ptr_sz) rxbuf
124
    (.clk     (rx_clk),
125
     .wr_en   (rxbuf_we),
126
     .wr_addr (rx_wr_ptr),
127
     .wr_data (rx_data),
128
 
129
     .rd_addr (rx_rd_ptr),
130
     .rd_data (rxbuf_data));
131
 
132
  ram_1r_1w #(8, txbuf_sz, wr_ptr_sz) txbuf
133
    (.clk     (clk),
134
     .wr_en   (wr_sel_tx_data),
135
     .wr_addr (txi_wr_ptr),
136
     .wr_data (tx_wr_data),
137
 
138
     .rd_addr (txo_xm_ptr),
139
     .rd_data (txbuf_data));
140
 
141
  simple_gmii_regs regs0
142
    (
143
     // Outputs
144
     .rd_data                           (rd_data),
145
     .doe                               (doe),
146
     .status_msk                        (),
147
     .control                           (start_transmit),
148
     .rx_data_stb                       (rx_rd_stb),
149
     .tx_data                           (tx_wr_data),
150
     .tx_data_stb                       (tx_wr_stb),
151 90 ghutchis
     .cfg                               (en_preamble),
152 65 ghutchis
     .int_n                             (int_n),
153
     // Inputs
154
     .clk                               (clk),
155
     .reset                             (reset),
156
     .addr                              (addr[15:0]),
157
     .wr_data                           (wr_data),
158
     .rd_n                              (rd_n),
159
     .wr_n                              (wr_n),
160
     .iorq_n                            (iorq_n),
161
     .status_set                        (status_set[1:0]),
162
     .control_clr                       (start_transmit),  // auto-clear when set
163
     .rx_len0                           (rx_len[7:0]),
164
     .rx_len1                           (rx_len[15:8]),
165
     .rx_data                           (rx_rd_data));
166
 
167
endmodule // simple_gmii

powered by: WebSVN 2.1.0

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