1 |
19 |
root |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
|
2 |
|
|
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
3 |
|
|
<HTML>
|
4 |
|
|
<META NAME="GENERATOR" CONTENT="TtH 2.67">
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
<H3 align=center>Jamil Khatib </H3>
|
9 |
|
|
|
10 |
|
|
<title> HDLC controller core</title>
|
11 |
|
|
|
12 |
|
|
<H1 align="center">HDLC controller core </H1>
|
13 |
|
|
|
14 |
|
|
<p>
|
15 |
|
|
|
16 |
|
|
<center>(C) Copyright 2001 Jamil Khatib.</center>
|
17 |
|
|
|
18 |
|
|
<p>
|
19 |
|
|
|
20 |
|
|
<H1>Contents </H1><A href="#tth_sEc1"
|
21 |
|
|
>1 List of authors and changes</A><br>
|
22 |
|
|
<A href="#tth_sEc2"
|
23 |
|
|
>2 Project Definition</A><br>
|
24 |
|
|
<A href="#tth_sEc2.1"
|
25 |
|
|
>2.1 Introduction</A><br>
|
26 |
|
|
<A href="#tth_sEc2.2"
|
27 |
|
|
>2.2 Objectives</A><br>
|
28 |
|
|
<A href="#tth_sEc3"
|
29 |
|
|
>3 Specifications</A><br>
|
30 |
|
|
<A href="#tth_sEc3.1"
|
31 |
|
|
>3.1 System Features Specification</A><br>
|
32 |
|
|
<A href="#tth_sEc3.2"
|
33 |
|
|
>3.2 External Interfaces</A><br>
|
34 |
|
|
<A href="#tth_sEc3.2.1"
|
35 |
|
|
>3.2.1 Receive Channel</A><br>
|
36 |
|
|
<A href="#tth_sEc3.2.2"
|
37 |
|
|
>3.2.2 Back-end interface mapping to Wishbone SoC bus</A><br>
|
38 |
|
|
<A href="#tth_sEc3.2.3"
|
39 |
|
|
>3.2.3 Transmit Channel</A><br>
|
40 |
|
|
<A href="#tth_sEc3.2.4"
|
41 |
|
|
>3.2.4 Back-end interface mapping to Wishbone SoC bus</A><br>
|
42 |
|
|
<A href="#tth_sEc3.2.5"
|
43 |
|
|
>3.2.5 CPU interface</A><br>
|
44 |
|
|
<A href="#tth_sEc4"
|
45 |
|
|
>4 Design description</A><br>
|
46 |
|
|
<A href="#tth_sEc4.1"
|
47 |
|
|
>4.1 Receive Channel</A><br>
|
48 |
|
|
<A href="#tth_sEc4.1.1"
|
49 |
|
|
>4.1.1 Design notes</A><br>
|
50 |
|
|
<A href="#tth_sEc4.1.2"
|
51 |
|
|
>4.1.2 Timing</A><br>
|
52 |
|
|
<A href="#tth_sEc4.2"
|
53 |
|
|
>4.2 Transmit Channel</A><br>
|
54 |
|
|
<A href="#tth_sEc4.2.1"
|
55 |
|
|
>4.2.1 Design notes</A><br>
|
56 |
|
|
<A href="#tth_sEc4.2.2"
|
57 |
|
|
>4.2.2 Timing</A><br>
|
58 |
|
|
<A href="#tth_sEc4.3"
|
59 |
|
|
>4.3 External FIFO and registers</A><br>
|
60 |
|
|
<A href="#tth_sEc4.4"
|
61 |
|
|
>4.4 Registers</A><br>
|
62 |
|
|
<A href="#tth_sEc4.4.1"
|
63 |
|
|
>4.4.1 Transmit</A><br>
|
64 |
|
|
<A href="#tth_sEc4.4.2"
|
65 |
|
|
>4.4.2 Receive</A><br>
|
66 |
|
|
<A href="#tth_sEc4.5"
|
67 |
|
|
>4.5 Transmit Frame</A><br>
|
68 |
|
|
<A href="#tth_sEc4.6"
|
69 |
|
|
>4.6 Receive Frame</A><br>
|
70 |
|
|
<A href="#tth_sEc4.7"
|
71 |
|
|
>4.7 Connection to TDM controller</A><br>
|
72 |
|
|
<A href="#tth_sEc4.8"
|
73 |
|
|
>4.8 Clocks Synchronization</A><br>
|
74 |
|
|
<A href="#tth_sEc4.9"
|
75 |
|
|
>4.9 Diagrams</A><br>
|
76 |
|
|
<A href="#tth_sEc5"
|
77 |
|
|
>5 Testing and verifications</A><br>
|
78 |
|
|
<A href="#tth_sEc5.1"
|
79 |
|
|
>5.1 Simulation and Test benches</A><br>
|
80 |
|
|
<A href="#tth_sEc5.2"
|
81 |
|
|
>5.2 Verification techniques and algorithms</A><br>
|
82 |
|
|
<A href="#tth_sEc5.3"
|
83 |
|
|
>5.3 Test plans</A><br>
|
84 |
|
|
<A href="#tth_sEc6"
|
85 |
|
|
>6 Implementations</A><br>
|
86 |
|
|
<A href="#tth_sEc6.1"
|
87 |
|
|
>6.1 Scripts, files and any other information</A><br>
|
88 |
|
|
<A href="#tth_sEc6.2"
|
89 |
|
|
>6.2 Design conventions and coding styles</A><br>
|
90 |
|
|
<A href="#tth_sEc7"
|
91 |
|
|
>7 Reviews and comments</A><br>
|
92 |
|
|
<A href="#tth_sEc8"
|
93 |
|
|
>8 References</A><br>
|
94 |
|
|
|
95 |
|
|
<p>
|
96 |
|
|
<H2><A NAME="tth_sEc1">
|
97 |
|
|
1</A> List of authors and changes</H2>
|
98 |
|
|
|
99 |
|
|
<p>
|
100 |
|
|
|
101 |
|
|
<TaBle border>
|
102 |
|
|
<tr><td>Name </td><td>Changes </td><td>Date </td><td>Contact address</td></tr><tr><td>
|
103 |
|
|
<tr><td>Jamil Khatib </td><td>Initial release </td><td>9-1-2001 </td><td>khatib@ieee.org </td></tr>
|
104 |
|
|
<tr><td>Jamil Khatib </td><td>TX interface added, Spec improved </td><td>27-1-2001 </td><td>khatib@ieee.org </td></tr>
|
105 |
|
|
<tr><td>Jamil Khatib </td><td>External FIFO buffer added </td><td>3-2-2001 </td><td>khatib@ieee.org </td></tr>
|
106 |
|
|
<tr><td>Jamil Khatib </td><td>Registers and CPU interface added </td><td>8-2-2001 </td><td>khatib@ieee.org </td></tr>
|
107 |
|
|
<tr><td>Jamil Khatib </td><td>Drop bit, TDM interface are added </td><td>9-2-2001 </td><td>khatib@ieee.org </td></tr>
|
108 |
|
|
<tr><td>Jamil Khatib </td><td>More design descriptions added </td><td>2-4-2001 </td><td>khatib@ieee.org </td></tr>
|
109 |
|
|
<tr><td>Jamil Khatib </td><td>FIFO buffers calculations added </td><td>9-4-2001 </td><td>khatib@ieee.org </td></tr></TaBle>
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
<p>
|
113 |
|
|
<H2><A NAME="tth_sEc2">
|
114 |
|
|
2</A> Project Definition</H2>
|
115 |
|
|
|
116 |
|
|
<p>
|
117 |
|
|
<H3><A NAME="tth_sEc2.1">
|
118 |
|
|
2.1</A> Introduction</H3>
|
119 |
|
|
HDLC protocol is used as a data link of most of the current communication systems like ISDN, Frame Relay etc. HDLC is a family of protocols that varies in address size, control field, FCS and no. of data bits.
|
120 |
|
|
|
121 |
|
|
<p>
|
122 |
|
|
<H3><A NAME="tth_sEc2.2">
|
123 |
|
|
2.2</A> Objectives</H3>
|
124 |
|
|
The aim of this project is to develop the basic HDLC functionalities to be used by many communication systems.
|
125 |
|
|
|
126 |
|
|
<p>
|
127 |
|
|
<H2><A NAME="tth_sEc3">
|
128 |
|
|
3</A> Specifications</H2>
|
129 |
|
|
|
130 |
|
|
<p>
|
131 |
|
|
<H3><A NAME="tth_sEc3.1">
|
132 |
|
|
3.1</A> System Features Specification</H3>
|
133 |
|
|
|
134 |
|
|
<OL type="1">
|
135 |
|
|
|
136 |
|
|
<li> Synchronous operation
|
137 |
|
|
|
138 |
|
|
<li> 8 bit parallel back-end interface
|
139 |
|
|
|
140 |
|
|
<li> Use external RX and TX clocks
|
141 |
|
|
|
142 |
|
|
<li> Start and end of frame pattern generation
|
143 |
|
|
|
144 |
|
|
<li> Start and end of frame pattern checking
|
145 |
|
|
|
146 |
|
|
<li> Idle pattern generation and detection (all ones)
|
147 |
|
|
|
148 |
|
|
<li> Zero insertion and removal for transparent transmission.
|
149 |
|
|
|
150 |
|
|
<li> Abort pattern generation and checking (7 ones)
|
151 |
|
|
|
152 |
|
|
<li> Address insertion and detection by software
|
153 |
|
|
|
154 |
|
|
<li> CRC generation and checking (CRC-16 or CRC-32 can be used which is configurale at the code top level)
|
155 |
|
|
|
156 |
|
|
<li> FIFO buffers and synchronization (External)
|
157 |
|
|
|
158 |
|
|
<li> Byte aligned data (if data is not aligned to 8-bits error signal is reported to the backend interface)
|
159 |
|
|
|
160 |
|
|
<li> Q.921, LAPD and LAPB compliant.
|
161 |
|
|
|
162 |
|
|
<li> The core should not have internal configuration registers or counters, instead it provides all the signals to implement external registers.
|
163 |
|
|
|
164 |
|
|
<li> There is No limit on the Maximum frame size as long as the backend can read and write data (depends on the external FIFO size)
|
165 |
|
|
|
166 |
|
|
<li> Bus connection is not supported directly (TxEN and RxEN pins can be used for that reason)
|
167 |
|
|
|
168 |
|
|
<li> Retransmission is not supported when there is collision in the Bus connection mode.
|
169 |
|
|
|
170 |
|
|
<li> This controller is used for low speed application only (relative to the backend bus).
|
171 |
|
|
|
172 |
|
|
<li> Supports connection to TDM core via backend interface and software control for time slot selection and control (signaling ,etc.) generation.
|
173 |
|
|
|
174 |
|
|
<li> Backend interface uses the Wishbone bus interface which can be connected directly to the system or via FIFO buffer.
|
175 |
|
|
|
176 |
|
|
<li> Optional External FIFO buffers, configuration and status registers.
|
177 |
|
|
|
178 |
|
|
<li> The core will be made of two levels of hierarchies, the basic functionality and the Optional interfaces and buffers.
|
179 |
|
|
</OL>
|
180 |
|
|
<p>
|
181 |
|
|
<H3><A NAME="tth_sEc3.2">
|
182 |
|
|
3.2</A> External Interfaces</H3>
|
183 |
|
|
|
184 |
|
|
<p>
|
185 |
|
|
<H4><A NAME="tth_sEc3.2.1">
|
186 |
|
|
3.2.1</A> Receive Channel</H4>
|
187 |
|
|
|
188 |
|
|
<p>
|
189 |
|
|
|
190 |
|
|
<TaBle border>
|
191 |
|
|
<tr><td>Signal name</td><td>Direction</td><td>Description</td></tr><tr><td>
|
192 |
|
|
<tr><td>Control interface </td><td></td><td></td></tr><tr><td>
|
193 |
|
|
<tr><td>Rst </td><td>Input </td><td>System asynchronous reset(active low)</td></tr><tr><td>
|
194 |
|
|
<tr><td>Serial Interface </td><td></td><td></td></tr><tr><td>
|
195 |
|
|
<tr><td>RxClk </td><td>Input </td><td>Receive Clock</td></tr>
|
196 |
|
|
<tr><td>Rx </td><td>Input</td><td>Receive Data</td></tr>
|
197 |
|
|
<tr><td>RxEn </td><td>Input </td><td>RX enable (active high)</td></tr><tr><td>
|
198 |
|
|
<tr><td>Back-end Interface </td><td></td><td></td></tr><tr><td>
|
199 |
|
|
<tr><td>RxD[7:0]</td><td>Output</td><td>Receive data bus</td></tr>
|
200 |
|
|
<tr><td>ValidFrame</td><td>Output</td><td>Valid Frame indication during all frame bytes transfer</td></tr>
|
201 |
|
|
<tr><td>FrameErr</td><td>Output</td><td>Error in the received data (lost bits)</td></tr>
|
202 |
|
|
<tr><td>Aborted</td><td>Output</td><td>Aborted Frame</td></tr>
|
203 |
|
|
<tr><td>Read</td><td>Input</td><td>Read byte</td></tr>
|
204 |
|
|
<tr><td>Ready</td><td>Output</td><td>Valid data exists</td></tr></TaBle>
|
205 |
|
|
|
206 |
|
|
|
207 |
|
|
<p>
|
208 |
|
|
<H4><A NAME="tth_sEc3.2.2">
|
209 |
|
|
3.2.2</A> Back-end interface mapping to Wishbone SoC bus</H4>
|
210 |
|
|
The HDLC receive backend interface can be used as a slave core or master according to the below mapping. The core supports SINGLE READ Cycle only using 8-bit data bus without address lines. The choice between master and slave is left for the system integrator and must do the configuration and glue logic as defined in the tables.
|
211 |
|
|
|
212 |
|
|
<p>
|
213 |
|
|
|
214 |
|
|
<p><A NAME="tth_fIg1">
|
215 |
|
|
</A> <a href="wishlogo.ps">Figure</a><A NAME="Logo">
|
216 |
|
|
</A><p>
|
217 |
|
|
<TaBle border>
|
218 |
|
|
<tr><td>Signal Name</td><td>Wishbone signal</td></tr><tr><td>
|
219 |
|
|
<tr><td>Master Configuration connected to FIFO</td><td></td></tr>
|
220 |
|
|
<tr><td>RxClk </td><td>CLK_I</td></tr>
|
221 |
|
|
<tr><td>Rst </td><td>not RST_I</td></tr>
|
222 |
|
|
<tr><td>RxD[7:0]</td><td>DAT_O(7:0)</td></tr>
|
223 |
|
|
<tr><td>ValidFrame</td><td>STB_O</td></tr>
|
224 |
|
|
<tr><td>ValidFrame</td><td>CYC_O</td></tr>
|
225 |
|
|
<tr><td>ReadByte</td><td>ACK_I and not RTY_I</td></tr>
|
226 |
|
|
<tr><td>Ready</td><td>WE_O</td></tr>
|
227 |
|
|
<tr><td>FrameERR</td><td>TAG0_O</td></tr>
|
228 |
|
|
<tr><td>Aborted</td><td>TAG1_O</td></tr>
|
229 |
|
|
<tr><td>Slave FIFO(two-clock domain FIFO)</td><td></td></tr>
|
230 |
|
|
<tr><td>Data[7:0]</td><td>DAT_I(7:0)</td></tr>
|
231 |
|
|
<tr><td>Chip Select</td><td>STB_I</td></tr>
|
232 |
|
|
<tr><td>STB_I and not FullFlag</td><td>ACK_O</td></tr>
|
233 |
|
|
<tr><td>FullFlag</td><td>RTY_O</td></tr>
|
234 |
|
|
<tr><td>Write</td><td>WE_I</td></tr>
|
235 |
|
|
<tr><td>Slave Configuration </td><td></td></tr>
|
236 |
|
|
<tr><td>RxClk </td><td>CLK_I</td></tr>
|
237 |
|
|
<tr><td>Rst </td><td>not RST_I</td></tr>
|
238 |
|
|
<tr><td>RxD[7:0]</td><td>DAT_O(7:0)</td></tr>
|
239 |
|
|
<tr><td>ValidFrame</td><td>TAG0_O</td></tr>
|
240 |
|
|
<tr><td>ReadByte</td><td>not WE_I</td></tr>
|
241 |
|
|
<tr><td>Ready</td><td>not RTY_O</td></tr>
|
242 |
|
|
<tr><td>STB_I and not WR_I</td><td>ACK_O</td></tr>
|
243 |
|
|
<tr><td>FrameERR</td><td>TAG1_O</td></tr>
|
244 |
|
|
<tr><td>Aborted</td><td>TAG2_O</td></tr></TaBle>
|
245 |
|
|
|
246 |
|
|
|
247 |
|
|
<p>
|
248 |
|
|
<H4><A NAME="tth_sEc3.2.3">
|
249 |
|
|
3.2.3</A> Transmit Channel</H4>
|
250 |
|
|
|
251 |
|
|
<TaBle border>
|
252 |
|
|
<tr><td>Signal name</td><td>Direction</td><td>Description</td></tr><tr><td>
|
253 |
|
|
<tr><td>Control interface </td><td></td><td></td></tr><tr><td>
|
254 |
|
|
<tr><td>Rst </td><td>Input </td><td>System asynchronous reset(active low)</td></tr><tr><td>
|
255 |
|
|
<tr><td>Serial Interface </td><td></td><td></td></tr><tr><td>
|
256 |
|
|
<tr><td>TxClk </td><td>Input </td><td>Transmit Clock</td></tr>
|
257 |
|
|
<tr><td>Tx </td><td>Output </td><td>Transmit Data</td></tr>
|
258 |
|
|
<tr><td>TxEn </td><td>Input </td><td>TX enable (active high)</td></tr><tr><td>
|
259 |
|
|
<tr><td>Back-end Interface </td><td></td><td></td></tr><tr><td>
|
260 |
|
|
<tr><td>TxD[7:0]</td><td>Input </td><td>Transmit data bus</td></tr>
|
261 |
|
|
<tr><td>ValidFrame</td><td>Input</td><td>Valid Frame indication during all frame bytes transfer</td></tr>
|
262 |
|
|
<tr><td>AbortedTrans</td><td>Output</td><td>Error in the transmitted data (Abort pattern was generated)</td></tr>
|
263 |
|
|
<tr><td>AbortFrame</td><td>Input</td><td>Abort Frame</td></tr>
|
264 |
|
|
<tr><td>Write</td><td>Input</td><td>Write byte</td></tr>
|
265 |
|
|
<tr><td>Ready</td><td>Output</td><td>Can accept new data</td></tr></TaBle>
|
266 |
|
|
|
267 |
|
|
|
268 |
|
|
<p>
|
269 |
|
|
<H4><A NAME="tth_sEc3.2.4">
|
270 |
|
|
3.2.4</A> Back-end interface mapping to Wishbone SoC bus</H4>
|
271 |
|
|
The HDLC receive backend interface can be used as a slave core or master according to the below mapping. The core supports SINGLE WRITE Cycle only using 8-bit data bus without address lines. The choice between master and slave is left for the system integrator and must do the configuration and glue logic as defined in the tables.
|
272 |
|
|
|
273 |
|
|
<p>
|
274 |
|
|
|
275 |
|
|
<TaBle border>
|
276 |
|
|
<tr><td>Signal Name</td><td>Wishbone signal</td></tr><tr><td>
|
277 |
|
|
<tr><td>Master Configuration connected to FIFO</td><td></td></tr>
|
278 |
|
|
<tr><td>TxClk </td><td>CLK_I</td></tr>
|
279 |
|
|
<tr><td>Rst </td><td>not RST_I</td></tr>
|
280 |
|
|
<tr><td>TxD[7:0]</td><td>DAT_I(7:0)</td></tr>
|
281 |
|
|
<tr><td>Write</td><td>ACK_I and not RTY_I</td></tr>
|
282 |
|
|
<tr><td>Ready</td><td>not WE_O</td></tr>
|
283 |
|
|
<tr><td>AbortedTrans</td><td>TAG0_O</td></tr>
|
284 |
|
|
<tr><td>ValidFrame</td><td>TAG1_I</td></tr>
|
285 |
|
|
<tr><td>AbortFrame</td><td>TAG0_I</td></tr>
|
286 |
|
|
<tr><td>Always Active </td><td>CYC_O</td></tr>
|
287 |
|
|
<tr><td>Always Active </td><td>STB_O</td></tr>
|
288 |
|
|
<tr><td>Slave FIFO(two-clock domain FIFO)</td><td></td></tr>
|
289 |
|
|
<tr><td>Data[7:0]</td><td>DAT_I(7:0)</td></tr>
|
290 |
|
|
<tr><td>EmptyFlag</td><td>RTY_O</td></tr>
|
291 |
|
|
<tr><td>Read</td><td>WE_I</td></tr>
|
292 |
|
|
<tr><td>WE_I and not EmptyFlag</td><td>ACK_O</td></tr>
|
293 |
|
|
<tr><td>ChipSelect</td><td>STB_I</td></tr>
|
294 |
|
|
<tr><td>Slave Configuration </td><td></td></tr>
|
295 |
|
|
<tr><td>TxClk </td><td>CLK_I</td></tr>
|
296 |
|
|
<tr><td>Rst </td><td>not RST_I</td></tr>
|
297 |
|
|
<tr><td>TxD[7:0]</td><td>DAT_I(7:0)</td></tr>
|
298 |
|
|
<tr><td>ValidFrame</td><td>STB_I</td></tr>
|
299 |
|
|
<tr><td>Write</td><td>WE_I</td></tr>
|
300 |
|
|
<tr><td>Ready</td><td>not RTY_O</td></tr>
|
301 |
|
|
<tr><td>STB_I and WR_I</td><td>ACK_O</td></tr>
|
302 |
|
|
<tr><td>AbortFrame</td><td>TAG0_I</td></tr>
|
303 |
|
|
<tr><td>AbortedTrans</td><td>TAG0_O</td></tr></TaBle>
|
304 |
|
|
|
305 |
|
|
|
306 |
|
|
<p>
|
307 |
|
|
<H4><A NAME="tth_sEc3.2.5">
|
308 |
|
|
3.2.5</A> CPU interface</H4>
|
309 |
|
|
This interface is used when the FIFO and registers are included in the Core. This interface is compatible to WishBone slave bus interface that supports single read/write cycles and block cycles. The interface supports the following wishbone signals.
|
310 |
|
|
|
311 |
|
|
<p>
|
312 |
|
|
|
313 |
|
|
<TaBle border>
|
314 |
|
|
<tr><td>Signal</td><td>Note</td></tr><tr><td>
|
315 |
|
|
<tr><td>RST_I</td><td>Reset</td></tr>
|
316 |
|
|
<tr><td>CLK_I</td><td>Clock</td></tr>
|
317 |
|
|
<tr><td>ADR_I(2:0)</td><td>3-bit address line</td></tr>
|
318 |
|
|
<tr><td>DAT_O(7:0)</td><td>8-bit receive data</td></tr>
|
319 |
|
|
<tr><td>DAT_I(7:0)</td><td>8-bit transmit data</td></tr>
|
320 |
|
|
<tr><td>WE_I</td><td>Read/write</td></tr>
|
321 |
|
|
<tr><td>STB_I</td><td>Strobe</td></tr>
|
322 |
|
|
<tr><td>ACK_O</td><td>Acknowledge</td></tr>
|
323 |
|
|
<tr><td>CYC_I</td><td>Cycle</td></tr>
|
324 |
|
|
<tr><td>TAG0_O</td><td>TxDone interrupt</td></tr>
|
325 |
|
|
<tr><td>TAG1_O</td><td>RxReady interrupt</td></tr></TaBle>
|
326 |
|
|
|
327 |
|
|
|
328 |
|
|
<p>
|
329 |
|
|
<H2><A NAME="tth_sEc4">
|
330 |
|
|
4</A> Design description</H2>
|
331 |
|
|
|
332 |
|
|
<p>
|
333 |
|
|
<H3><A NAME="tth_sEc4.1">
|
334 |
|
|
4.1</A> Receive Channel</H3>
|
335 |
|
|
|
336 |
|
|
<p>
|
337 |
|
|
<H4><A NAME="tth_sEc4.1.1">
|
338 |
|
|
4.1.1</A> Design notes</H4>
|
339 |
|
|
|
340 |
|
|
<p>
|
341 |
|
|
Receive channel provides interface to the backend via a simple handshake protocol that can be used to connect the controller to either a shared memory or FIFO buffer. This protocol uses the hand shack protocol of the Wishbone SoC bus.
|
342 |
|
|
|
343 |
|
|
<p>
|
344 |
|
|
Receive channel supports only 8-bits aligned data. Each frame starts with a starting flag (01111110) and ends with starting flag (01111110). Since the receipt ion is synchronous only, the channel uses the external clock and a byte must be read from the channel within the first 7 clock pulses after the ready signal is asserted. If no data is read during this period (while ValidFrame signal is active) FrameErr is signaled reported to the backend as long the ValidFrame is active. FrameErr is signaled also when non 8-bit aligned data is received and when FCS error is found.
|
345 |
|
|
|
346 |
|
|
<p>
|
347 |
|
|
<H4><A NAME="tth_sEc4.1.2">
|
348 |
|
|
4.1.2</A> Timing</H4>
|
349 |
|
|
|
350 |
|
|
<p>
|
351 |
|
|
<H3><A NAME="tth_sEc4.2">
|
352 |
|
|
4.2</A> Transmit Channel</H3>
|
353 |
|
|
Transmit channel provides interface to the backend via a simple handshake protocol that can be used to connect the controller to either a shared memory or FIFO buffer. This protocol uses the handshack protocol of the Wishbone SoC bus.
|
354 |
|
|
|
355 |
|
|
<p>
|
356 |
|
|
Transmit channel supports only 8-bits aligned data. Each frame starts with a starting flag (01111110) and ends with starting flag (01111110). Since the transmission is synchronous only, the channel uses the external clock and a byte must be written to the channel within the first 7 clock pulses after the ready signal is asserted. If no data is inserted during this period (while ValidFrame signal is active) abort pattern is transmitted and reported to the backend via AboredTrans signal as long the ValidFrame is active.
|
357 |
|
|
|
358 |
|
|
<p>
|
359 |
|
|
<H4><A NAME="tth_sEc4.2.1">
|
360 |
|
|
4.2.1</A> Design notes</H4>
|
361 |
|
|
|
362 |
|
|
<p>
|
363 |
|
|
<H4><A NAME="tth_sEc4.2.2">
|
364 |
|
|
4.2.2</A> Timing</H4>
|
365 |
|
|
The channel starts accepting data after asserting the ValidFrame signal. This signal can control no of idle pattern bits (e.g. if this signal is de-asserted for 8 bits only a single Idle pattern (8 ones) is inserted). Valid Frame signal must be asserted for 8 clocks after any valid write operation.
|
366 |
|
|
|
367 |
|
|
<p>
|
368 |
|
|
<H3><A NAME="tth_sEc4.3">
|
369 |
|
|
4.3</A> External FIFO and registers</H3>
|
370 |
|
|
The controller has optional external FIFO buffers, one for data to be transmitted and one for data to be received. Status and control registers are available to control these FIFOs. These two blocks (FIFOs and registers) are built around the HDLC controller core which make them optional if the core is to be used in different kind of applications.
|
371 |
|
|
The current implementation supports the following configuration:
|
372 |
|
|
The size of the Transmit and receive FIFOs is (8×128) bits which enables 128 maximum HDLC frame size.
|
373 |
|
|
|
374 |
|
|
<p>
|
375 |
|
|
The transmit buffer is used to prevent underflow while transmitting bytes to the line. All bytes will be available once the transmit is enabled. The Receive buffer is used to provide data burst transfer to the Back end interface which prevents the back end from reading each byte alone. The FIFO size is suitable for operating frequencies 2.048MHz on the serial interface and 50 MHz on the back end interface. Other frequencies can operate if the delay between HDLC frames is less than the delay needed for the back end to empty the internal FIFO (the next calculations is an example to be applied for different frequencies)
|
376 |
|
|
|
377 |
|
|
<p>
|
378 |
|
|
7 bits (minimum bits between HDLC Frames) / 2.048MHz = 3.418 us
|
379 |
|
|
|
380 |
|
|
<p>
|
381 |
|
|
128 Bytes (Maximum frame size) / 50MHz = 2.56 us
|
382 |
|
|
|
383 |
|
|
<p>
|
384 |
|
|
These FIFOs are implemented on Single port memory. Two interrupt lines are used, one to signal transmission done and one to request transfer of received frame to memory. These interrupts are also reflected in Status registers to support polling mode for the controller.
|
385 |
|
|
|
386 |
|
|
<p>
|
387 |
|
|
<H3><A NAME="tth_sEc4.4">
|
388 |
|
|
4.4</A> Registers</H3>
|
389 |
|
|
All internal registers are 8-bit width.
|
390 |
|
|
|
391 |
|
|
<H4><A NAME="tth_sEc4.4.1">
|
392 |
|
|
4.4.1</A> Transmit</H4>
|
393 |
|
|
|
394 |
|
|
<p>
|
395 |
|
|
|
396 |
|
|
<TaBle>
|
397 |
|
|
<tr><td><b>Tx Status and Control Register: Tx_SC</b> </td><td>Offset Address = 0x0</td></tr></TaBle>
|
398 |
|
|
<br>
|
399 |
|
|
|
400 |
|
|
<p>
|
401 |
|
|
|
402 |
|
|
<TaBle border><tr><td>
|
403 |
|
|
<tr><td>BIT </td><td align="center">7 </td><td align="center">6 </td><td align="center">5 </td><td align="center">4 </td><td align="center">3 </td><td align="center">2 </td><td align="center">1 </td><td align="center">0</td></tr>
|
404 |
|
|
<tr><td>FIELD </td><td align="center">N/A </td><td align="center">N/A </td><td align="center">FCSen </td><td align="center">FIFOOverflow</td><td align="center">Aborted</td><td align="center">TxAbort</td><td align="center">TxEnable</td><td align="center">TxDone</td></tr>
|
405 |
|
|
<tr><td>RESET </td><td align="center">0</td><td align="center">0</td><td align="center">0</td><td align="center">0</td><td align="center">0</td><td align="center">0</td><td align="center">0</td><td align="center">0</td></tr>
|
406 |
|
|
<tr><td>R/W </td><td align="center">RO</td><td align="center">RO</td><td align="center">WO</td><td align="center">RO</td><td align="center">RO</td><td align="center">WO</td><td align="center">WO</td><td align="center">RO</td></tr></TaBle>
|
407 |
|
|
<br>
|
408 |
|
|
|
409 |
|
|
<p>
|
410 |
|
|
|
411 |
|
|
<TaBle>
|
412 |
|
|
<tr><td><b>Tx FIFO buffer register: Tx_Buffer</b> </td><td>Offset Address = 0x1</td></tr></TaBle>
|
413 |
|
|
<br>
|
414 |
|
|
|
415 |
|
|
<p>
|
416 |
|
|
|
417 |
|
|
<TaBle border><tr><td>
|
418 |
|
|
<tr><td>BIT </td><td align="center">7-0</td></tr>
|
419 |
|
|
<tr><td>FIELD </td><td align="center">Transmit Data byte</td></tr>
|
420 |
|
|
<tr><td>RESET </td><td align="center">0x0</td></tr>
|
421 |
|
|
<tr><td>R/W </td><td align="center">WO</td></tr></TaBle>
|
422 |
|
|
|
423 |
|
|
|
424 |
|
|
<p>
|
425 |
|
|
<H4><A NAME="tth_sEc4.4.2">
|
426 |
|
|
4.4.2</A> Receive</H4>
|
427 |
|
|
|
428 |
|
|
<p>
|
429 |
|
|
|
430 |
|
|
<TaBle>
|
431 |
|
|
<tr><td><b>Rx Status and Control Register: Rx_SC</b> </td><td>Offset Address = 0x2</td></tr></TaBle>
|
432 |
|
|
<br>
|
433 |
|
|
|
434 |
|
|
<p>
|
435 |
|
|
|
436 |
|
|
<TaBle border><tr><td>
|
437 |
|
|
<tr><td>BIT </td><td align="center">7 </td><td align="center">6 </td><td align="center">5 </td><td align="center">4 </td><td align="center">3 </td><td align="center">2 </td><td align="center">1 </td><td align="center">0</td></tr>
|
438 |
|
|
<tr><td>FIELD </td><td align="center">N/A </td><td align="center">N/A </td><td align="center">N/A </td><td align="center">FIFOOverflow</td><td align="center">Aborted</td><td align="center">FrameError</td><td align="center">Drop</td><td align="center">RxReady</td></tr>
|
439 |
|
|
<tr><td>RESET </td><td align="center">0</td><td align="center">0</td><td align="center">0</td><td align="center">0</td><td align="center">0</td><td align="center">0</td><td align="center">0</td><td align="center">0</td></tr>
|
440 |
|
|
<tr><td>R/W </td><td align="center">RO</td><td align="center">RO</td><td align="center">RO</td><td align="center">RO</td><td align="center">RO</td><td align="center">RO</td><td align="center">WO</td><td align="center">RO</td></tr></TaBle>
|
441 |
|
|
<br>
|
442 |
|
|
|
443 |
|
|
<p>
|
444 |
|
|
|
445 |
|
|
<TaBle>
|
446 |
|
|
<tr><td><b>Rx FIFO buffer register: Rx_Buffer</b> </td><td>Offset Address = 0x3</td></tr></TaBle>
|
447 |
|
|
<br>
|
448 |
|
|
|
449 |
|
|
<p>
|
450 |
|
|
|
451 |
|
|
<TaBle border><tr><td>
|
452 |
|
|
<tr><td>BIT </td><td align="center">7-0</td></tr>
|
453 |
|
|
<tr><td>FIELD </td><td align="center">Received Data byte</td></tr>
|
454 |
|
|
<tr><td>RESET </td><td align="center">0x0</td></tr>
|
455 |
|
|
<tr><td>R/W </td><td align="center">RO</td></tr></TaBle>
|
456 |
|
|
<br>
|
457 |
|
|
|
458 |
|
|
<p>
|
459 |
|
|
|
460 |
|
|
<TaBle>
|
461 |
|
|
<tr><td><b>Rx Frame length: Rx_Len</b> </td><td>Offset Address = 0x4</td></tr></TaBle>
|
462 |
|
|
<br>
|
463 |
|
|
|
464 |
|
|
<p>
|
465 |
|
|
|
466 |
|
|
<TaBle border><tr><td>
|
467 |
|
|
<tr><td>BIT </td><td align="center">7-0</td></tr>
|
468 |
|
|
<tr><td>FIELD </td><td align="center">Frame Length</td></tr>
|
469 |
|
|
<tr><td>RESET </td><td align="center">0x0</td></tr>
|
470 |
|
|
<tr><td>R/W </td><td align="center">RO</td></tr></TaBle>
|
471 |
|
|
<br>
|
472 |
|
|
|
473 |
|
|
<p>
|
474 |
|
|
<H3><A NAME="tth_sEc4.5">
|
475 |
|
|
4.5</A> Transmit Frame</H3>
|
476 |
|
|
|
477 |
|
|
<UL>
|
478 |
|
|
|
479 |
|
|
<li> The CPU should check TxDone (in Tx status register 0x0) bit of it is '1' or wait for TxDone interrupt. TxDone bit is reset to '0' after the first write to Tx FIFO Buffer register (0x1).
|
480 |
|
|
|
481 |
|
|
<li> The CPU should write frame data bytes to Tx FIFO buffer register (0x1).
|
482 |
|
|
|
483 |
|
|
<li> After writing all data bytes to TX buffer register, the CPU should write '1' to TxEnable to enable data transmission to the line. After writing to this bit no further write operation to Tx FIFO buffer register is allowed till TxDone is set (all writes will be ignored).
|
484 |
|
|
|
485 |
|
|
<li> It is optional for the CPU to check the status bits of Tx status register.
|
486 |
|
|
</UL>
|
487 |
|
|
<p>
|
488 |
|
|
<H3><A NAME="tth_sEc4.6">
|
489 |
|
|
4.6</A> Receive Frame</H3>
|
490 |
|
|
|
491 |
|
|
<UL>
|
492 |
|
|
|
493 |
|
|
<li> The controller sets RxReady bit in Rx Status and control register (0x2) and sets the TxReady interrupt line to indicate valid frame in internal buffer is available.
|
494 |
|
|
|
495 |
|
|
<li> It is recommended that the CPU read the Rx Status and control register (0x3).
|
496 |
|
|
|
497 |
|
|
<li> The CPU should read the Frame length register (0x4) to check the size of the frame. The value of this regiter is valid only after the RxReady bit is set and remains valid till the first read from the Data buffer.
|
498 |
|
|
|
499 |
|
|
<li> The CPU should read Rx FIFO buffer register (0x3) Frame length times to get all frame bytes. Performing extra reads (read from empty buffer) produces invalid data.
|
500 |
|
|
|
501 |
|
|
<li> If the CPU does not read all frame bytes as soon as possible the internal buffer will overflow and FIFOOverflow bit will be set and the current frame should be dropped. No further read operations should be attempted till RxReady bit is set again and RxReady interrupt is signaled indicating new available frame.
|
502 |
|
|
|
503 |
|
|
<li> The software can drop entire frame from the Receive FIFO buffer by writing 1 to drop bit in the status and control receive register (0x3). This is suitable for dropping bad frames (for any reason) or frames with incorrect addresses.
|
504 |
|
|
</UL>
|
505 |
|
|
<p>
|
506 |
|
|
<H3><A NAME="tth_sEc4.7">
|
507 |
|
|
4.7</A> Connection to TDM controller</H3>
|
508 |
|
|
This controller can get/send data from/to TDM controller through software control. The software configures the TDM controller to select the channel. It adds/removes the address and control information fields of the HDLC frame. Then passes the data field between the two controllers through optional DMA transfer.
|
509 |
|
|
|
510 |
|
|
<p>
|
511 |
|
|
<H3><A NAME="tth_sEc4.8">
|
512 |
|
|
4.8</A> Clocks Synchronization</H3>
|
513 |
|
|
Since the core can operate in different clock domains (The serial line domain and the backend interface domain), all control signals pass through two flip flops to reduce the metastability. These Flip Flops are clocked with the same clock of the interface that read these signals.
|
514 |
|
|
|
515 |
|
|
<p>
|
516 |
|
|
<H3><A NAME="tth_sEc4.9">
|
517 |
|
|
4.9</A> Diagrams</H3>
|
518 |
|
|
|
519 |
|
|
<p><A NAME="tth_fIg1">
|
520 |
|
|
</A>
|
521 |
|
|
<a href="HDLC_top.ps">Figure</a>
|
522 |
|
|
|
523 |
|
|
<center>Figure 1: HDLC core</center><A NAME="Core">
|
524 |
|
|
</A>
|
525 |
|
|
<p>
|
526 |
|
|
<p>
|
527 |
|
|
|
528 |
|
|
<p><A NAME="tth_fIg2">
|
529 |
|
|
</A> <a href="HDLC_cont.ps">Figure</a> <center>Figure 2: HDLC controller</center><A NAME="controller">
|
530 |
|
|
</A>
|
531 |
|
|
<p>
|
532 |
|
|
<p>
|
533 |
|
|
<H2><A NAME="tth_sEc5">
|
534 |
|
|
5</A> Testing and verifications</H2>
|
535 |
|
|
|
536 |
|
|
<p>
|
537 |
|
|
|
538 |
|
|
<TaBle border>
|
539 |
|
|
<tr><td>Requirement </td><td>Test method </td><td>Validation method </td></tr><tr><td>
|
540 |
|
|
<tr><td>Interface timing </td><td></td><td></td></tr>
|
541 |
|
|
<tr><td></td><td></td><td></td></tr><tr><td>
|
542 |
|
|
<tr><td>Functionality </td><td></td><td></td></tr></TaBle>
|
543 |
|
|
|
544 |
|
|
|
545 |
|
|
<H3><A NAME="tth_sEc5.1">
|
546 |
|
|
5.1</A> Simulation and Test benches</H3>
|
547 |
|
|
|
548 |
|
|
<p>
|
549 |
|
|
<H3><A NAME="tth_sEc5.2">
|
550 |
|
|
5.2</A> Verification techniques and algorithms</H3>
|
551 |
|
|
|
552 |
|
|
<p>
|
553 |
|
|
<H3><A NAME="tth_sEc5.3">
|
554 |
|
|
5.3</A> Test plans</H3>
|
555 |
|
|
|
556 |
|
|
<p>
|
557 |
|
|
<H2><A NAME="tth_sEc6">
|
558 |
|
|
6</A> Implementations</H2>
|
559 |
|
|
The design is implemented using the VHDL language. The design is divided into three main blocks, serial Receive channel, Serial Transmit channel and the Top blocks.
|
560 |
|
|
The Receive and Transmit serial channels perform the HDLC
|
561 |
|
|
functionality. The Top blocks perform the FCS calculation (Which is
|
562 |
|
|
either FCS-16 or FCS-32), the frame buffering the interface with the
|
563 |
|
|
back end system and the synchronization between the clocks. The FCS and Buffering can be changed by replacing the corresponding files.
|
564 |
|
|
|
565 |
|
|
<p>
|
566 |
|
|
<H3><A NAME="tth_sEc6.1">
|
567 |
|
|
6.1</A> Scripts, files and any other information</H3>
|
568 |
|
|
|
569 |
|
|
<TaBle border>
|
570 |
|
|
<tr><td>RX </td><td></td></tr>
|
571 |
|
|
<tr><td>RxChannel.vhd </td><td>Top Rx Channel </td></tr>
|
572 |
|
|
<tr><td>Rxcont.vhd </td><td>Rx Controller </td></tr>
|
573 |
|
|
<tr><td>Zero_detect.vhd </td><td>Zero detect and serial to parallel </td></tr>
|
574 |
|
|
<tr><td>flag_detect.vhd </td><td>Flag detection </td></tr>
|
575 |
|
|
<tr><td>TX </td><td></td></tr>
|
576 |
|
|
<tr><td>TxChannel.vhd </td><td>Top Tx channel </td></tr>
|
577 |
|
|
<tr><td>TXcont.vhd </td><td>Tx Controller</td></tr>
|
578 |
|
|
<tr><td>zero_ins.vhd </td><td>Zero insertion and parallel to serial </td></tr>
|
579 |
|
|
<tr><td>flag_ins.vhd </td><td>Flag insertion </td></tr>
|
580 |
|
|
<tr><td>Top </td><td></td></tr>
|
581 |
|
|
<tr><td>TxBuff.vhd</td><td>Tx buffer</td></tr>
|
582 |
|
|
<tr><td>TxFCS.vhd </td><td>Tx FCS-16</td></tr>
|
583 |
|
|
<tr><td>TxSync.vhd </td><td>Tx synchronization</td></tr>
|
584 |
|
|
<tr><td>RxBuff.vhd</td><td>Rx buffer</td></tr>
|
585 |
|
|
<tr><td>RxFCS.vhd </td><td>Rx FCS-16</td></tr>
|
586 |
|
|
<tr><td>RxSync.vhd </td><td>Rx synchronization</td></tr>
|
587 |
|
|
<tr><td>WB_IF.vhd </td><td>WishBone interface</td></tr>
|
588 |
|
|
<tr><td>hdlc.vhd </td><td>Top HDLC controller</td></tr></TaBle>
|
589 |
|
|
|
590 |
|
|
|
591 |
|
|
<p>
|
592 |
|
|
<H3><A NAME="tth_sEc6.2">
|
593 |
|
|
6.2</A> Design conventions and coding styles</H3>
|
594 |
|
|
|
595 |
|
|
<p>
|
596 |
|
|
<H2><A NAME="tth_sEc7">
|
597 |
|
|
7</A> Reviews and comments</H2>
|
598 |
|
|
|
599 |
|
|
<p>
|
600 |
|
|
<H2><A NAME="tth_sEc8">
|
601 |
|
|
8</A> References</H2>
|
602 |
|
|
|
603 |
|
|
<p>
|
604 |
|
|
|
605 |
|
|
<p><hr><small>File translated from
|
606 |
|
|
T<sub><font size="-1">E</font></sub>X
|
607 |
|
|
by <a href="http://hutchinson.belmont.ma.us/tth/">
|
608 |
|
|
T<sub><font size="-1">T</font></sub>H</a>,
|
609 |
|
|
version 2.67.<br>On 9 Apr 2001, 23:57.</small>
|
610 |
|
|
</HTML>
|