For every kind of network medium we need an dedicated media interface. For example there is an lvds interface (200MBit), an optical link interface for use with TLK2501 on the TRB and one for the internal serdeses of the lattice chips.
Functionality
Although the media interfaces reside on the lowest level of the network structure, they have to provide some additional functionality. The implementation of these mechanisms is up to the programmer of the media interfaces.
Synchronization to packet boundary
The interface must provide the correct packet number to the multiplexer. The network protocol relies on an accurate counting of the 16Bit packets to ensure that the packet type of each packet can be retrieved. Starting value of the counter is 4, counting for each packet 4-0-1-2-3.
The media interface has to provide a detection for the start of each packet to assure that the counter is aligned properly. This can be done in two ways: On LVDS interfaces with some free lines, one control line can be used to mark the first word of each packet.
For example with the optical link we don't have this opportunity with extra lines. To detect when a word of a packet has been lost, idles may only be sent between two packets, but not between the words of one packet.
If such a wrongly placed idle (or any other code violation, or a not-yet-defined komma character) is detected, the start-up sequence described below is started again, the bits in stat_op are set accordingly and the own transmitter has to send some kind of errors (misplaced idles, a (not yet defined) komma character...) as well.
FIFO sizes
The
FiFos inside the media interfaces should be kept to an absolute minimum, especially on interfaces running slower than the internal logic. The reason is, that a big fifo that might run full prohibits us from effectively switching between channels. (A 16 word deep fifo on a POF-interface might introduce up to 1.2us additional latency!)
Encoding for secure transmission
The media interfaces also have to provide a mechanism to secure the network from bit errors. On the optical link, 8/10bit encoding is used, which is sufficient due the very low bit error rate. On electrical connections this might be too weak. In these cases for example a 8/12 bit encoding might be used to be able to correct single bit errors.
Serdes settings
Please check whether the Elastic Buffers of ECP2M can be kept switched off since they produce a massive amount of latency.
Interface to internal logic
The interface to the medium can not be standardized, but there is a fixed interface layout on the internal connections:
Name |
Width |
Description |
RESET |
1 |
common reset |
CLK |
1 |
internal clock |
MED_DATAREADY_IN |
1 |
data is offered by the internal side |
MED_READ_OUT |
1 |
media interface is reading offered data |
MED_DATA_IN |
16 |
data from internal side |
MED_PACKET_NUM_IN |
2 |
packet number from internal side |
MED_DATAREADY_OUT |
1 |
data is offered for the internal side |
MED_READ_IN |
1 |
internal side is reading offered data (should always be 1) |
MED_DATA_OUT |
16 |
data output |
MED_PACKET_NUM_OUT |
2 |
packet number output |
STAT_OP |
16 |
operational status of the interface (see below) |
CTRL_OP |
16 |
ctrl input for the media interface |
MED_ERROR_OUT
Name |
Description |
ERROR_OK |
Everything is fine |
ERROR_RECOV |
There was a bit error, but it was recovered by internal encoding |
ERROR_FATAL |
Some serious problem occured - restart is needed |
ERROR_WAIT |
Link is starting up / waiting for connection / sending resync |
ERROR_NC |
No cable is connected |
STAT_OP
Bit |
Name |
Meaning |
2..0 |
MED_ERROR_OUT |
Error status of the interface |
3 |
|
|
4 |
LSM[0] |
Link State Machine status bit 0 |
5 |
LSM[1] |
Link State Machine status bit 1 |
6 |
LSM[2] |
Link State Machine status bit 2 |
7 |
LSM[3] |
Link State Machine status bit 3 |
8 |
|
|
9 |
status_led |
LED output showing link status: flashing during start-up, on when link is established |
10 |
rx_led |
LED output showing RX status: pulsing high during receiving |
11 |
tx_led |
LED output showing TX status: pulsing high during sending |
12 |
link error |
strobe signal, when code violation or similar errors happen |
13 |
reset_sequence_received |
reset trbnet logic |
14 |
no_signal |
reset internal logic |
15 |
send_reset_sequence |
send reset over network |
CTRL_OP
Bit |
Meaning |
14 |
reset media interface. switches off link state machine and transmitter |
15 |
send reset over network |
Startup of the optical links
Marek and I (Jan) agreed on the following mechanism to start up an optical link:
- Start sending idle - words acording to data sheet of TLK2501 that is used on the trb
- After receving idles for 650ms, 16bit word alignment is made
- After 1300ms (27 bit counter overflow) receiving of data is enabled
- After 2600ms sending data is enabled
This sequence gives enough time to properly connect a cable and allow the transmitters to synchronize on the probably shaky signal while connecting the cable.
--
JanMichel - 09 Mar 2009