Altera公司的三速以太网(TSE)是一个可配置的FPGA软核MAC,主要应用于10/100 Mbps (快速以太网)和1000 Mbps (千兆以太网)线路卡、NIC卡以及交换机等。
官方资源:
http://www.altera.com.cn/support/ip/interface-protocols/ips-inp-tse.html
http://www.altera.com.cn/literature/ug/ug_ethernet.pdf
http://www.altera.com.cn/support/refdesigns/ip/interface/ref-triple-speed-ethernet-data-path.html
http://www.altera.com.cn/literature/an/an647.pdf
http://www.altera.com.cn/literature/an/an440.pdf
http://www.altera.com.cn/literature/an/an483.pdf
http://www.altera.com/support/ip/interface-protocols/ips-inp-tse.html
官方实例: http://download.csdn.net/detail/xgbing/5286324
官方的FPGA开发套件提供了与Marvell 88E1111 PHY工作的实例,但俺没有银子,最便宜的DE2开发板也得3000块吧。我用手头的EP2C8Q208C8搭建了一个测试平台:
(1)发送测试:
(2)接收测试:
Id1 = 0x13, Id2 = 0x78e2.
Wait reset.
Reset ok.
cOnfig= 0x3100.
MII status = 0x7809.
Reg 4 = 0x1e1.
Wait Auto-nego...OK.
cOnfig= 0x3100.
MII status = 0x782d.
MII status2 = 0x4780.
Link OK.
-----------------------------
RX 0x3c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 06 00 01
0010: 08 00 06 04 00 01 00 25 11 06 07 39 C0 A8 01 A0
0020: 00 00 00 00 00 00 C0 A8 01 79 00 00 00 00 00 00
0030: 00 00 00 00 00 00 00 00 00 00 00 00
-----------------------------
RX 0x3c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 06 00 01
0010: 08 00 06 04 00 01 00 25 11 06 07 39 C0 A8 01 A0
0020: 00 00 00 00 00 00 C0 A8 01 79 00 00 00 00 00 00
0030: 00 00 00 00 00 00 00 00 00 00 00 00
-----------------------------
RX 0x3c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 06 00 01
0010: 08 00 06 04 00 01 00 25 11 06 07 39 C0 A8 01 A0
0020: 00 00 00 00 00 00 C0 A8 01 79 00 00 00 00 00 00
0030: 00 00 00 00 00 00 00 00 00 00 00 00
-----------------------------
RX 0x3c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 06 00 01
0010: 08 00 06 04 00 01 00 25 11 06 07 39 C0 A8 01 A0
0020: 00 00 00 00 00 00 C0 A8 01 79 00 00 00 00 00 00
0030: 00 00 00 00 00 00 00 00 00 00 00 00
-----------------------------
RX 0x5c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 4E 10 76 00 00 40 11 E5 39 C0 A8 01 A0 C0 A8
0020: 01 FF 00 89 00 89 00 3A AA 2E 80 D7 01 10 00 01
0030: 00 00 00 00 00 00 20 45 44 45 42 45 4A 46 48 46
0040: 46 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 43 41 00 00 20 00 01
-----------------------------
RX 0x5c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 4E 10 86 00 00 40 11 E5 29 C0 A8 01 A0 C0 A8
0020: 01 FF 00 89 00 89 00 3A AA 2E 80 D7 01 10 00 01
0030: 00 00 00 00 00 00 20 45 44 45 42 45 4A 46 48 46
0040: 46 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 43 41 00 00 20 00 01
-----------------------------
RX 0x5c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 4E 10 95 00 00 40 11 E5 1A C0 A8 01 A0 C0 A8
0020: 01 FF 00 89 00 89 00 3A AA 2E 80 D7 01 10 00 01
0030: 00 00 00 00 00 00 20 45 44 45 42 45 4A 46 48 46
0040: 46 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 43 41 00 00 20 00 01
-----------------------------
RX 0x5c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 4E 10 A6 00 00 40 11 E5 09 C0 A8 01 A0 C0 A8
0020: 01 FF 00 89 00 89 00 3A AA 2F 80 D8 01 10 00 01
0030: 00 00 00 00 00 00 20 45 44 45 42 45 4A 46 48 46
0040: 46 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 41 41 00 00 20 00 01
-----------------------------
RX 0x5c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 4E 10 B5 00 00 40 11 E4 FA C0 A8 01 A0 C0 A8
0020: 01 FF 00 89 00 89 00 3A AA 2F 80 D8 01 10 00 01
0030: 00 00 00 00 00 00 20 45 44 45 42 45 4A 46 48 46
0040: 46 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 41 41 00 00 20 00 01
-----------------------------
RX 0x5c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 4E 10 C4 00 00 40 11 E4 EB C0 A8 01 A0 C0 A8
0020: 01 FF 00 89 00 89 00 3A AA 2F 80 D8 01 10 00 01
0030: 00 00 00 00 00 00 20 45 44 45 42 45 4A 46 48 46
0040: 46 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 41 41 00 00 20 00 01
-----------------------------
RX 0xd8 bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 CA 10 D3 00 00 40 11 E4 60 C0 A8 01 A0 C0 A8
0020: 01 FF 00 8A 00 8A 00 B6 50 4C 11 02 80 D9 C0 A8
0030: 01 A0 00 8A 00 A0 00 00 20 45 48 45 50 45 4F 45
0040: 48 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 43 41 41 41 00 20 45 49 45 49 43
0060: 41 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0070: 41 43 41 43 41 43 41 43 41 42 4E 00 FF 53 4D 42
0080: 25 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0090: 00 00 00 00 00 00 00 00 00 00 00 00 11 00 00 06
00A0: 00 00 00 00 00 00 00 00 00 E8 03 00 00 00 00 00
00B0: 00 00 00 06 00 56 00 03 00 01 00 01 00 02 00 17
00C0: 00 5C 4D 41 49 4C 53 4C 4F 54 5C 42 52 4F 57 53
00D0: 45 00 09 04 0E 00 00 00
-----------------------------
RX 0x5c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 4E 10 D4 00 00 40 11 E4 DB C0 A8 01 A0 C0 A8
0020: 01 FF 00 89 00 89 00 3A A8 33 80 DB 01 10 00 01
0030: 00 00 00 00 00 00 20 45 49 45 49 43 41 43 41 43
0040: 41 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 42 4C 00 00 20 00 01
-----------------------------
RX 0x5c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 4E 10 E8 00 00 40 11 E4 C7 C0 A8 01 A0 C0 A8
0020: 01 FF 00 89 00 89 00 3A A8 33 80 DB 01 10 00 01
0030: 00 00 00 00 00 00 20 45 49 45 49 43 41 43 41 43
0040: 41 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 42 4C 00 00 20 00 01
-----------------------------
RX 0x5c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 4E 10 F7 00 00 40 11 E4 B8 C0 A8 01 A0 C0 A8
0020: 01 FF 00 89 00 89 00 3A A8 33 80 DB 01 10 00 01
0030: 00 00 00 00 00 00 20 45 49 45 49 43 41 43 41 43
0040: 41 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 42 4C 00 00 20 00 01
-----------------------------
RX 0xd8 bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 CA 11 0A 00 00 40 11 E4 29 C0 A8 01 A0 C0 A8
0020: 01 FF 00 8A 00 8A 00 B6 50 49 11 02 80 DC C0 A8
0030: 01 A0 00 8A 00 A0 00 00 20 45 48 45 50 45 4F 45
0040: 48 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 43 41 41 41 00 20 45 49 45 49 43
0060: 41 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0070: 41 43 41 43 41 43 41 43 41 42 4E 00 FF 53 4D 42
0080: 25 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0090: 00 00 00 00 00 00 00 00 00 00 00 00 11 00 00 06
00A0: 00 00 00 00 00 00 00 00 00 E8 03 00 00 00 00 00
00B0: 00 00 00 06 00 56 00 03 00 01 00 01 00 02 00 17
00C0: 00 5C 4D 41 49 4C 53 4C 4F 54 5C 42 52 4F 57 53
00D0: 45 00 09 04 0E 00 00 00
-----------------------------
RX 0x5c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 4E 11 0B 00 00 40 11 E4 A4 C0 A8 01 A0 C0 A8
0020: 01 FF 00 89 00 89 00 3A A8 30 80 DE 01 10 00 01
0030: 00 00 00 00 00 00 20 45 49 45 49 43 41 43 41 43
0040: 41 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 42 4C 00 00 20 00 01
-----------------------------
RX 0x5c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 4E 11 20 00 00 40 11 E4 8F C0 A8 01 A0 C0 A8
0020: 01 FF 00 89 00 89 00 3A A8 30 80 DE 01 10 00 01
0030: 00 00 00 00 00 00 20 45 49 45 49 43 41 43 41 43
0040: 41 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 42 4C 00 00 20 00 01
-----------------------------
RX 0x5c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 4E 11 30 00 00 40 11 E4 7F C0 A8 01 A0 C0 A8
0020: 01 FF 00 89 00 89 00 3A A8 30 80 DE 01 10 00 01
0030: 00 00 00 00 00 00 20 45 49 45 49 43 41 43 41 43
0040: 41 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 42 4C 00 00 20 00 01
-----------------------------
RX 0xd8 bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 CA 11 44 00 00 40 11 E3 EF C0 A8 01 A0 C0 A8
0020: 01 FF 00 8A 00 8A 00 B6 50 46 11 02 80 DF C0 A8
0030: 01 A0 00 8A 00 A0 00 00 20 45 48 45 50 45 4F 45
0040: 48 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 43 41 41 41 00 20 45 49 45 49 43
0060: 41 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0070: 41 43 41 43 41 43 41 43 41 42 4E 00 FF 53 4D 42
0080: 25 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0090: 00 00 00 00 00 00 00 00 00 00 00 00 11 00 00 06
00A0: 00 00 00 00 00 00 00 00 00 E8 03 00 00 00 00 00
00B0: 00 00 00 06 00 56 00 03 00 01 00 01 00 02 00 17
00C0: 00 5C 4D 41 49 4C 53 4C 4F 54 5C 42 52 4F 57 53
00D0: 45 00 09 04 0E 00 00 00
-----------------------------
RX 0x5c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 4E 11 45 00 00 40 11 E4 6A C0 A8 01 A0 C0 A8
0020: 01 FF 00 89 00 89 00 3A A8 2D 80 E1 01 10 00 01
0030: 00 00 00 00 00 00 20 45 49 45 49 43 41 43 41 43
0040: 41 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 42 4C 00 00 20 00 01
-----------------------------
RX 0x5c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 4E 11 59 00 00 40 11 E4 56 C0 A8 01 A0 C0 A8
0020: 01 FF 00 89 00 89 00 3A A8 2D 80 E1 01 10 00 01
0030: 00 00 00 00 00 00 20 45 49 45 49 43 41 43 41 43
0040: 41 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 42 4C 00 00 20 00 01
-----------------------------
RX 0x5c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 4E 11 69 00 00 40 11 E4 46 C0 A8 01 A0 C0 A8
0020: 01 FF 00 89 00 89 00 3A A8 2D 80 E1 01 10 00 01
0030: 00 00 00 00 00 00 20 45 49 45 49 43 41 43 41 43
0040: 41 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 42 4C 00 00 20 00 01
-----------------------------
RX 0x5c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 4E 11 7C 00 00 40 11 E4 33 C0 A8 01 A0 C0 A8
0020: 01 FF 00 89 00 89 00 3A A5 2B 80 E3 01 10 00 01
0030: 00 00 00 00 00 00 20 45 49 45 49 43 41 43 41 43
0040: 41 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 42 4F 00 00 20 00 01
-----------------------------
RX 0x5c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 4E 11 8B 00 00 40 11 E4 24 C0 A8 01 A0 C0 A8
0020: 01 FF 00 89 00 89 00 3A A5 2B 80 E3 01 10 00 01
0030: 00 00 00 00 00 00 20 45 49 45 49 43 41 43 41 43
0040: 41 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 42 4F 00 00 20 00 01
-----------------------------
RX 0x5c bytes:
0000: FF FF FF FF FF FF 00 25 11 06 07 39 08 00 45 00
0010: 00 4E 11 9A 00 00 40 11 E4 15 C0 A8 01 A0 C0 A8
0020: 01 FF 00 89 00 89 00 3A A5 2B 80 E3 01 10 00 01
0030: 00 00 00 00 00 00 20 45 49 45 49 43 41 43 41 43
0040: 41 43 41 43 41 43 41 43 41 43 41 43 41 43 41 43
0050: 41 43 41 43 41 42 4F 00 00 20 00 01
(3) tse 12.1版本已经可以支持IEEE 1588V2精密时间协议(PTP)协议。
IEEE1588的全称是“网络测量和控制系统的精密时钟同步协议标准”,是通用的提升网络系统定时同步能力的规范,在起草过程中主要参考以太网来编制,使分布式通信网络能够具有严格的定时同步,并且应用于工业自动化系统。基本构思是通过硬件和软件将网络设备(客户机)的内时钟与主控机的主时钟实现同步,提供同步建立时间小于10μs的运用,与未执行IEEE1588协议的以太网延迟时间1,000μs相比,整个网络的定时同步指标有显著的改善。