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

Subversion Repositories tcp_socket

[/] [tcp_socket/] [trunk/] [TCPIP.rst] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 jondawson
Chips-2.0 Demo for SP605 Development Card
2
=========================================
3
 
4
:Author: Jonathan P Dawson
5
:Date: 2013-10-17
6
:email: chips@jondawson.org.uk
7
 
8
This project implements a TCP/IP stack. The TCP/IP stack acts as a server, and
9
can accept a single connection to a TCP port. The connection is provided as a
10
bidirectional stream of data to the application. The following protocols are supported:
11
 
12
        + ARP request/response (with 16 level cache)
13
        + ICMP echo request/response (ping)
14
        + TCP/IP socket
15
 
16
Synthesis Estimate
17
==================
18
 
19
The TCP/IP server consumes around 800 LUTs and 300 Flip-Flops in a Xilinx Spartan 6 device.
20
 
21
 
22
Dependencies
23
============
24
 
25
The stack is implemented in C, and needs Chips-2.0 to compile it into a Verilog
26
module.
27
 
28
Source Files
29
============
30
 
31
The TCP/IP stack is provided by two source files:
32
 
33
        + source/server.h
34
        + source/server.c
35
 
36
Configuration
37
=============
38
 
39
The following parameters can be configured at compile time within source/server.h:
40
 
41
        + Local Ethernet MAC address
42
        + Local IP Address
43
        + Local TCP Port number
44
 
45
Compile
46
=======
47
 
48
Compile into a Verilog module (server.v) using the following command::
49
 
50
        $ chip2/c2verilog source/server.v
51
 
52
Interface
53
=========
54
 
55
Ethernet Interface
56
------------------
57
 
58
The Ethernet interface consists of two streams of data:
59
 
60
        + An input, input_eth_rx.
61
        + An output, output_eth_tx.
62
 
63
Both streams are 16 bits wide, and use the following protocol:
64
 
65
 
66
+------+-----------------+
67
| word |   designation   |
68
+------+-----------------+
69
|  0   | length in bytes |
70
+------+-----------------+
71
|  n   |       data      |
72
+------+-----------------+
73
 
74
 
75
Socket Interface
76
----------------
77
 
78
The socket interface consists of two streams of data:
79
 
80
        + An input, input_socket.
81
        + An output, output_socket.
82
 
83
Both streams are 16 bits wide, and use the following protocol:
84
 
85
 
86
+------+-----------------+
87
| word |   designation   |
88
+------+-----------------+
89
|  0   | length in bytes |
90
+------+-----------------+
91
|  n   |       data      |
92
+------+-----------------+
93
 
94
 
95
Stream Interconnect Conventions
96
===============================
97
 
98
The main aims of the interface are:
99
 
100
  - To be simple to implement.
101
  - Add little performance/logic overhead.
102
  - Allow designs to grow without adding extra levels of asynchronous logic.
103
  - Easy to interface with standard interconnects.
104
 
105
::
106
 
107
  RST >-o-----------------------------+
108
  CLK >-+-o-------------------------+ |
109
        | |                         | |
110
        | |   +-----------+         | |     +--------------+
111
        | |   | TX        |         | |     | RX           |
112
        | +--->           |         | +----->              |
113
        +----->           |         +------->              |
114
              |           |                 |              |
115
              |           |       |              |
116
              |       out >=================> in           |
117
              |           | _STB  |              |
118
              |       out >-----------------> in           |
119
              |           | _ACK  |              |
120
              |       in  <-----------------< out          |
121
              |           |                 |              |
122
              +-----------+                 +--------------+
123
 
124
Global Signals
125
--------------
126
 
127
 
128
 
129
+------+-----------+------+-------------+
130
| Name | Direction | Type | Description |
131
+------+-----------+------+-------------+
132
| CLK  |   input   | bit  |    Clock    |
133
+------+-----------+------+-------------+
134
| RST  |   input   | bit  |    Reset    |
135
+------+-----------+------+-------------+
136
 
137
 
138
 
139
Interconnect Signals
140
--------------------
141
 
142
 
143
 
144
+----------------+-----------+------+-----------------------------------------------------------+
145
|      Name      | Direction | Type |                        Description                        |
146
+----------------+-----------+------+-----------------------------------------------------------+
147
|      |  TX to RX | bus  |                        Payload Data                       |
148
+----------------+-----------+------+-----------------------------------------------------------+
149
| _STB |  TX to RX | bit  | '1' indicates that payload data is valid and TX is ready. |
150
+----------------+-----------+------+-----------------------------------------------------------+
151
| _ACK |  TX to RX | bit  |              '1' indicates that RX is ready.              |
152
+----------------+-----------+------+-----------------------------------------------------------+
153
 
154
 
155
 
156
Interconnect Bus Transaction
157
----------------------------
158
 
159
- Both transmitter and receiver shall be synchronised to the '0' -> '1' transition of CLK.
160
- If RST is set to '1' upon the '0' -> '1' transition of clock the transmitter shall terminate any active bus transaction and set _STB to '0'.
161
- If RST is set to '1' upon the '0' -> '1' transition of clock the receiver shall terminate any active bus transaction and set _ACK to '0'.
162
- If RST is set to '0', normal operation shall commence as follows:
163
- The transmitter may insert wait states on the bus by setting _STB '0'.
164
- The transmitter shall set _STB to '1' to signify that data is valid.
165
- Once _STB has been set to '1', it shall remain at '1' until the transaction completes.
166
- The transmitter shall ensure that  contains valid data for the entire period that _STB is '1'.
167
- The transmitter may set  to any value when _STB is '0'.
168
- The receiver may insert wait states on the bus by setting _ACK to '0'.
169
- The receiver shall set _ACK to '1' to signify that it is ready to receive data.
170
- Once _ACK has been set to '1', it shall remain at '1' until the transaction completes.
171
- Whenever _STB is '1' and _ACK are '1', a bus transaction shall complete on the following '0' -> '1' transition of CLK.
172
 
173
::
174
 
175
        RST
176
                         --------------------------------------------------------------
177
                           -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
178
         CLK              | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
179
                         -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
180
 
181
                         ----- ------- ------------------------------------------------
182
                    X VALID X
183
                         ----- ------- ------------------------------------------------
184
                               -------
185
        _STB        |       |
186
                         -----         ------------------------------------------------
187
                                   ---
188
        _ACK            |   |
189
                         ---------     ------------------------------------------------
190
 
191
 
192
                               ^^^^ RX adds wait states
193
 
194
                                   ^^^^  Data transfers
195
 
196
        RST
197
                         --------------------------------------------------------------
198
                           -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
199
         CLK              | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
200
                         -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
201
 
202
                         ----- ------- ------------------------------------------------
203
                    X VALID X
204
                         ----- ------- ------------------------------------------------
205
                                   ---
206
        _STB            |   |
207
                         ---------     ------------------------------------------------
208
                               -------
209
        _ACK        |       |
210
                         -----         ------------------------------------------------
211
 
212
 
213
                               ^^^^ TX adds wait states
214
 
215
                                   ^^^^  Data transfers
216
 
217
..
218
 
219
- Both the transmitter and receiver may commence a new transaction without inserting any wait states.
220
 
221
::
222
 
223
        RST
224
                         --------------------------------------------------------------
225
                           -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
226
         CLK              | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
227
                         -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
228
 
229
                         ----- ------- ---- ---- --------------------------------------
230
                    X D0    X D1 X D2 X
231
                         ----- ------- ---- ---- --------------------------------------
232
                                   -------------
233
        _STB            |             |
234
                         ---------               --------------------------------------
235
                               -----------------
236
        _ACK        |                 |
237
                         -----                   --------------------------------------
238
 
239
                                ^^^^ TX adds wait states
240
 
241
                                     ^^^^  Data transfers
242
 
243
                                         ^^^^ STB and ACK needn't return to 0 between data words
244
 
245
..
246
 
247
 
248
- The receiver may delay a transaction by inserting wait states until the transmitter indicates that data is available.
249
 
250
- The transmitter shall not delay a transaction by inserting wait states until the receiver is ready to accept data.
251
 
252
- Deadlock would occur if both the transmitter and receiver delayed a transaction until the other was ready.

powered by: WebSVN 2.1.0

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