Professional Documents
Culture Documents
An374-V2 3
An374-V2 3
Design
Introduction The Altera® Video Over IP Reference Design implements a system that
bridges between MPEG transport stream (TS) data and Ethernet-based
internet protocol (IP) networks.
The reference design can accept TS data from several inputs and
encapsulate it for transmission over an Ethernet network. The design uses
industry standard user datagram protocol (UDP)/IP network
encapsulation, with real-time transport protocol (RTP) encapsulation and
Pro-MPEG Code of Practice #3 (CoP3) forward error correction (FEC)
available as an option. The design supports both 100-megabits per second
(Mbps) (full-duplex) and 1-gigabit per second (Gbps) Ethernet
connections and can process up to 256 individual streams. By using
hardware encapsulation, the design can achieve line-rate gigabit Ethernet
performance with minimal transmission latency.
The design can also accept up to 256 individual streams from an Ethernet
network and recover the TS data. For RTP encapsulated data, the design
includes a receiver buffer to absorb network jitter and correct for packet
reordering and duplication. CoP3 FEC-based lost packet recovery is
available as an option.
Specifications & Many standards and industry specifications have been referenced in
creating this reference design. These standards are summarized in this
Standards section.
DVB-ASI
The DVB Project defined an asynchronous serial interface (ASI) for the
transmission of MPEG-2 TS data. It is specified by European Standard EN
50083-9.
ASI is a 270-Mbps serial link that carries 188 or 204 byte MPEG-2 TS
packets over a physical and signalling interface layer based on fibre
channel. One or more programs can be carried over a single ASI.
Altera Corporation 1
AN-374-2.3 Preliminary
Video Over IP Reference Design
f For more information on the ASI MegaCore function, see the ASI
MegaCore Function User Guide.
RTP is primarily aimed at the distribution of audio and video over the
internet for applications such as video conferencing and video streaming.
However, this protocol is also useful for the distribution of video over
Ethernet in the more controlled environment of a broadcast facility. RTP
offers features for time stamping and detection of packet loss or re-
ordering.
RFC2250 defines an RTP payload format for MPEG-1 and MPEG-2 video.
It includes details for the encapsulation of MPEG-2 TS data, and is
referenced by the Pro-MPEG CoP3 and the DVB-IP Handbook.
UDP/IP
RTP is a transport protocol. Most commonly, it uses UDP as the host-to-
host layer and IP as the internet layer.
2 Altera Corporation
Preliminary
Functional Description
Description
Altera Corporation 3
Preliminary
Video Over IP Reference Design
TS 100/1000
Input RTP PHY Ethernet Ethernet
TS
Input Transmitter Interface PHY
UDP/IP or
TS Ethernet
Output RTP- MAC
RTP Receiver
to-TS (Optional)
TS Ethernet
4 Altera Corporation
Preliminary
Functional Description
The Nios II processor uses the flash memory and SSRAM on the
development board for its code and data. The FEC generator and receiver
buffer use DDR SDRAM, for packet storage. The data width, operating
frequency, and capacity of the SDRAM vary according to the application.
Altera Corporation 5
Preliminary
Video Over IP Reference Design
UDP/IP Function
The UDP/IP function provides the following features:
6 Altera Corporation
Preliminary
Functional Description
The receiver path receives packets from the receiver packet input
interface. The UDP, IP, and (optionally) Ethernet MAC header fields are
parsed to determine how the packet should be processed. For packets
matched for hardware processing, the extracted MPEG TS data is
presented on the receiver payload output interface. Packets matched for
processing by software are made available to the host processor via the
host interface. All remaining packets are discarded.
Altera Corporation 7
Preliminary
Video Over IP Reference Design
If the packet is not matched for hardware processing, the reference design
checks it to see if it should forward it to the host processor. By default, any
unprocessed packets that match the Ethernet MAC address of the design
or the broadcast MAC address go to the host processor. Optionally, you
can also forward all unprocessed multicast packets to the host processor
or filter the unprocessed packets using their IP address.
8 Altera Corporation
Preliminary
Functional Description
Payload
3
Frame Buffer
Host Interface Transmit
Channel
Info
Payload
Pointer Host
4 Transmit
Pointer MII/
Queue
GMII
Transmit
DMA Encapsulate PHY
2 Free
Pointer
List
6
Done Flag
5
The host has its own transmitter queue to prevent its requests being stuck
behind those from the input ports. However the data path from the frame
buffer to the Ethernet output is the same as that used for TS data.
When the host frame has been sent, the related pointer can either be
automatically released to the buffer free list, or the host can be informed
that the transmission is complete and then it can release (or reuse) the
pointer. Figure 5 shows the host transmitter flow diagram.
f For more information on how to write software for the UDP/IP host
transmission, refer to the UDP/IP software instructions in the UDP/IP
package.
Altera Corporation 9
Preliminary
Video Over IP Reference Design
Yes Auto-
Release
No
Another Yes
Frame
No
10 Altera Corporation
Preliminary
Functional Description
Payload
3 Frame Buffer
Receive
Channel
Info
Host Interface
MII/
Interrupt/ Receive GMII
Flag DMA De-encapsulate PHY
1 Host
2 Pointer Receive
Queue
Pointer Free
4
List
Ethernet frames that are received and address matched but not matched
for forwarding to a TS output are routed to the host processor. There is a
dedicated host receiver queue that is loaded with an entry when one of
these frames is received.
The host can poll the host receiver queue to see if there is an entry, or it
can receive an interrupt.
The receiver frame is processed by reading the entry from the host
receiver queue to get the pointer to the frame location in the frame buffer.
The frame length and content are then read from the frame buffer. When
the frame has been processed, the pointer is released to the buffer free list.
Alternatively the pointer can be used for a host transmitter, such as when
a reply to a received message might be required. Figure 7 shows the host
receiver flow diagram.
f For more information on how to write software for the UDP/IP host
reception, refer to the UDP/IP software instructions in the UDP/IP
package.
Altera Corporation 11
Preliminary
Video Over IP Reference Design
Parameters
Figure 8 shows the UDP/IP function IP Toolbench.
12 Altera Corporation
Preliminary
Functional Description
Signals
Unless otherwise indicated, all signals are active high and synchronous to
their related clock.
Note to Table 4:
(1) The payload_clk and payload_rst signals are not available if P_SINGLE_CLOCK_MODE is set to 1.
Altera Corporation 13
Preliminary
Video Over IP Reference Design
Note to Table 5:
(1) Signals are not available if P_INPUT_CHANNELS is 0.
14 Altera Corporation
Preliminary
Functional Description
Note to Table 8:
(1) Signals are not available if P_OUTPUT_CHANNELS is 0.
Altera Corporation 15
Preliminary
Video Over IP Reference Design
Note to Table 8:
(1) Registers are 32-bit and therefore endian neutral. The frame buffer RAM is byte addressable, with the endianness
controlled by P_BIG_ENDIAN (little endian by default—the first packet byte corresponds to data bits [7:0]).
● 0: null
● 1: MAC VLAN
● 2: IP source address
● 3: IP destination address
● 4: UDP source port
● 5: UDP destination port
● 6: IP payload
● 7: Exception (packet not a supported UDP/IP format)
● 10: MAC destination address
denc_out_id_count Output 3 Field identifier byte count.
denc_out_sop Output – Start of packet.
16 Altera Corporation
Preliminary
Functional Description
PHY Interface
The PHY interface is an Atlantic interface to MII or GMII bridge plus
MDIO controller. If MAC layer encapsulation is performed by the
UDP/IP function, you can use the PHY Interface to connect to an external
100/1000 Ethernet PHY.
For fully featured MAC layer functionality, replace the PHY interface
with an Ethernet MAC IP core The UDP/IP function includes a top-level
design for the Altera Triple-Speed Ethernet MAC MegaCore function.
Signals
Unless otherwise indicated, all signals are active high and synchronous to
their related clock.
Altera Corporation 17
Preliminary
Video Over IP Reference Design
18 Altera Corporation
Preliminary
Functional Description
RTP Transmitter
The RTP transmitter provides RTP encapsulation for TS packets. It can
encapsulate from one to seven TS packets per RTP packet. The
encapsulation logic can be bypassed if the input data is already RTP
encapsulated.
The RTP transmitter also generates CoP3 FEC packets for RTP
encapsulated TS. It supports one dimensional (column only) and two-
dimensional (row and column) FEC. You can interleave the generated
FEC packets with the original data stream according to COP#3 Annex A
or B.
Altera Corporation 19
Preliminary
Video Over IP Reference Design
RAM
The design has an Avalon-MM master port for access to the storage RAM.
This can be connected to an internal RAM or external memory controller
with SOPC Builder.
Parameters
Figure 10 shows the RTP transmitter IP Toolbench.
20 Altera Corporation
Preliminary
Functional Description
Signals
Unless otherwise indicated, all signals are active high and synchronous to
their related clock.
Altera Corporation 21
Preliminary
Video Over IP Reference Design
22 Altera Corporation
Preliminary
Functional Description
RTP Receiver
The RTP receiver provides the following features:
Altera Corporation 23
Preliminary
Video Over IP Reference Design
RAM
Channel Status
Status Output
FEC Decoder
RTP payload is accepted by the input DMA data sink interface and then
loaded to the buffer RAM. This RAM can either be on-chip or, more
typically, off-chip, depending on the amount of storage that you require.
FEC packets are stored separately to data packets in this RAM. Data
packets are stored in order of RTP sequence number. Reordered packets
are inserted at the appropriate place, and duplicated packets are
discarded. The buffer attempts to correct for missing packets using the
received FEC data. In UDP mode, packets are just stored in receive order.
Reordering, duplicate packet removal, and lost packet correction are not
supported.
Receiver event information and the level of the receiver buffer (number of
RTP or UDP packets) are presented on a status interface. An external
controller can use this information to decide when to request data from
the buffer, perhaps based on the current level.
When the video output requires data, the external controller requests a
payload packet from the receiver buffer. It is then presented with the
earliest packet received (from the bottom of the buffer). If the packet is not
available, an error indication is asserted. You can use this indication to
allow the external controller to pad the output stream with null data
when packets are missing.
24 Altera Corporation
Preliminary
Functional Description
Parameters
Figure 12 shows the RTP receiver IP Toolbench.
Altera Corporation 25
Preliminary
Video Over IP Reference Design
The RTP receiver stores FEC data separately to the received data payload.
There is a common pool of FEC storage locations that is shared by all
channels. The size of this pool depends on the receiver error profile.
Under normal conditions, only 2 to 3 entries are required per channel.
However, in the presence of burst error conditions on multiple channels,
a much larger number of entries (approximately (L + D) may be required.
Typically you make a trade off between the instantaneous error correction
capability of the design and the number of FEC entries that are allocated.
Each storage location (data and FEC) requires 1,536 bytes of RAM.
Interfaces
Unless otherwise indicated, all signals are active high and synchronous to
their related clock.
Signals
Table 21 shows the system signals.
26 Altera Corporation
Preliminary
Functional Description
Altera Corporation 27
Preliminary
Video Over IP Reference Design
28 Altera Corporation
Preliminary
Functional Description
Altera Corporation 29
Preliminary
Video Over IP Reference Design
TS Input
The TS input block takes TS input on a number of TS ports, and converts
this data into frames suitable for use by the RTP transmitter. These frames
are 32-bit little-endian packed versions of the TS data. Each TS port has its
own clock; the TS input block retimes the TS data onto its local system
clock.
TS
TS
Multichannel Output
Buffer
Input Frames
TS State
TS
Multichannel Machine
Buffer
Input
TS
TS Output
Multichannel
Buffer FIFO Buffer
Input
[
30 Altera Corporation
Preliminary
Functional Description
Parameters
Table 28 shows the TS input parameters.
Default
Name Use
Value
P_NUM_INPUTS 2 The number of TS input ports.
P_NUM_CHANNELS_PER_INPUT 1 The number of channels per TS input port.
Signals
Unless otherwise indicated, all signals are active high and synchronous to
their related clock.
Altera Corporation 31
Preliminary
Video Over IP Reference Design
32 Altera Corporation
Preliminary
Functional Description
f For more information on how to write software for this module, refer to
the software instructions that come with the reference design.
RTP-to-TS
The RTP-to-TS block generates a TS output from received RTP packets. It
connects directly to the RTP receiver.
Altera Corporation 33
Preliminary
Video Over IP Reference Design
Output TS Output 1
Buffer
Channel 1
Output TS Output 0
Payload Buffer
Channel 0
Event Ready
Status Request Output
Status Control
Payload Register Ready
Interfaces
Unless otherwise indicated, all signals are active high and synchronous to
their related clock.
Table 23 on page 27 describes the event, status request, and status signals.
Table 33 shows the payload request signals.
34 Altera Corporation
Preliminary
Functional Description
Width
Name Direction Description
(1)
ts_clk Input 1 TS clock.
ts_rst Input 1 Reset for ts_clk domain.
ts_valid Output N TS valid flag.
ts_data Output N×8 TS data. N represents P_CHANNELS. For ts_data there
are 8 bits per TS. Data for TS 0 is presented on
ts_data[7:0]; data for TS 1 on ts_data[15:8]...
ts_start Output N TS start of packet flag.
ts_end Output N TS end of packet flag.
Altera Corporation 35
Preliminary
Video Over IP Reference Design
Width
Name Direction Description
(1)
avalon_clk Input 1 Clock.
avalon_rst Input 1 Reset.
avalon_address Input 4 Address.
avalon_write Input 1 Write.
avalon_writedata Input 32 Write data.
avalon_read Input 1 Read.
avalon_readdata Output 32 Read data.
avalon_waitrequest Output 1 Wait request.
f For more information on how to write software for this module, refer to
the software instructions that come with the reference design.
Test
Settings
The testbench includes a single set of test vectors, which exercise the
major features of the reference design over two bidirectional channels,
and are sufficient for performing an out-of-the-box check of the reference
design.
36 Altera Corporation
Preliminary
Getting Started
■ Transmit test vectors—TS input and Ethernet output vectors for each
channel, in the tb/vectors/test0 directory
■ Receive test vectors—Ethernet input and TS output vectors for each
channel, in the tb/vectors/test0 directory
■ A testbench configuration file, testbench_settings.v, in the
tb/vectors/test0 directory
■ A software configuration file for use with the basic demonstration
software, test_settings.h, in the software directory.
For more information, see “Simulate the Reference Design” on page 42.
System Requirements
Table 37 shows the demonstration hardware requirements.
Hardware Manufacturer
Nios II Development Kit, Cyclone II Edition Altera Corporation
Audio Video Development Kit, Stratix II GX Edition Altera Corporation
DBGIG1 Gigabit Ethernet PHY Module (1) Richter Industrie
Elektronik,
www.devboards.de
Altera Corporation 37
Preliminary
Video Over IP Reference Design
Hardware Manufacturer
DBASI ASI Module (1) Richter Industrie
Elektronik,
www.devboards.de
TS source and analyzer –
Ethernet switch (optional) –
DHCP server (optional) –
38 Altera Corporation
Preliminary
Getting Started
demo
Contains .sof and .elf for the two demonstrations.
doc
Contains the documentation.
examples
Contains the Quartus II project for the demonstrations.
demo_2c35
Contains the Quartus II project files for the demonstration for the Nios II Development
Board, Cyclone Edition.
demo_2sgx
Contains the Quartus II project files for the demonstration for the Audio Video
Development Kit, Stratix II GX Edition.
software
Contains the software files.
source
Contains the source files.
demo
Contains the top-level source code for the demonstrations.
rtp_ts
Contains the RTP-to-TS function.
ts_input
Contains the TS input function.
tb
Contains the testbench files.
Setup Licensing
The reference design requires licenses for the following features:
If you compile the design without all the licenses it uses the OpenCore
Plus evaluation feature, which generates a time-limited programming
file.
You only need to obtain licenses for the megafunctions when you are
completely satisfied with their functionality and performance, and want
to take your design to production.
Altera Corporation 39
Preliminary
Video Over IP Reference Design
1 This software does not provide the web interface for the
advanced demonstration.
1. Start the Nios II IDE (Start > Programs > Altera > Nios II EDS 6.1 >
Nios II IDE.
40 Altera Corporation
Preliminary
Getting Started
e. Click Finish.
3. Right click on your new project in the projects pane of the Nios II
IDE and click System Library Properties.
4. Right click on your new project in the projects pane of the Nios II
IDE and click Import.
Altera Corporation 41
Preliminary
Video Over IP Reference Design
b. Click Next.
42 Altera Corporation
Preliminary
Use the Demonstration
■ TS-to-Ethernet Demonstration
■ Ethernet-to-TS Demonstration
■ Use VLC Media Player
The DBASI module provides ASI connectivity for the design. For a
parallel connection to the TS test equipment, use the Nios II development
board, Cyclone Edition PROTO1 J11 connector. Figure 18 shows the
signals on the connector.
Altera Corporation 43
Preliminary
Video Over IP Reference Design
N/C 1 2 GND
TS_OUT_DATA[1] 3 4 TS_OUT_DATA[0]
TS_OUT_DATA[3] 5 6 TS_OUT_DATA[2]
TS_OUT_DATA[5] 7 8 TS_OUT_DATA[4]
TS_OUT_DATA[7] 9 10 TS_OUT_DATA[6]
TS_OUT_VALID 11 12 N/C
N/C 13 14 N/C
TS_IN_VALID 15 16 TS_IN_START
TS_IN_DATA[1] 17 18 TS_IN_DATA[0]
GND 19 20 N/C
TS_IN_DATA[2] 21 22 GND
TS_IN_DATA[3} 23 24 GND
TS_IN_DATA[4] 25 26 GND
TS_IN_DATA[5] 27 28 TS_IN_DATA[6]
TS_IN_DATA[7] 29 30 GND
TS_CLK 31 32 N/C
N/C 33 34 N/C
N/C 35 36 TS_OUT_START
N/C 37 38 N/C
N/C 39 40 GND
44 Altera Corporation
Preliminary
Use the Demonstration
The PROTO1 connections are isolated from the FPGA by analog switches.
The output voltage level is 3.3 V. Input voltage levels can be between 3.3
V and 5 V.
Assign an IP Address
The demonstration design requires an IP address, which can either be
assigned by a DHCP server connected to the demonstration network, or
by pressing a switch on the Nios II development board at boot time.
Altera Corporation 45
Preliminary
Video Over IP Reference Design
When the design boots, it looks for a DHCP server on the network. If a
server is found and an IP address is allocated, the design uses this
address. The LCD module displays the allocated IP address.
If no DHCP server is present, the software times out after 10 seconds. The
LCD module displays that no DHCP server has been found and the seven
segment LEDs show --. The design asks you to press a button on the
Nios II development board. The button selects a static IP address. As each
system on the demonstration network must have a unique address, press
a different button on each Nios II development board that you are using.
Table 39 shows the buttons’ fixed IP addresses.
Button IP Address
SW0 192.168.1.10
SW1 192.168.1.11
SW2 192.168.1.12
SW3 192.168.1.13
The computer that controls the design through the web interface must be
able to communicate with the IP address allocated to the board, so assign
it an address that is on the same IP subnet, for example, 192.168.1.1.
46 Altera Corporation
Preliminary
Use the Demonstration
Altera Corporation 47
Preliminary
Video Over IP Reference Design
TS-to-Ethernet Demonstration
The TS-to-Ethernet (transmitter) demonstration shows the design
transmitting TS data on to the IP network. The demonstration supports
two independent channels, but both are driven by the same TS source
data.
The force packet loss setting controls a test fixture that allows the
transmitted Ethernet packets to be corrupted to model a burst loss in the
network. This test is only applied to transmitter channel 0.
The statistics page for the transmitter demonstration just shows the
number of Ethernet frames that are generated for each channel, plus a
summary of the Ethernet and external RAM bandwidth.
Ethernet-to-TS Demonstration
The Ethernet-to-TS (receiver) demonstration shows the design receiving
TS data from the IP network. The demonstration supports two
independent channels. By default, channel 0 is connected to the TS output
connector. You can connect channel 1 instead by pressing and holding
button SW0 on the Nios II development board, Cyclone II edition.
The receiver channel settings section on the parameters page controls the
sockets that are matched for the receiver channels. You can ignore the
global transmitter settings and transmitter channel settings sections. To
change the socket for a receiver channel, click on the channel number to
go to the editing page. Once changes are made, click Submit then return
to the parameters page. To enable a receiver channel, turn on the
appropriate enable then click Submit.
The receiver has optional support for a constant bit rate output mode on
receiver channel 0. To enable this support, turn on CBR mode in the
editing page for the receiver channel. This mode only works for a
48 Altera Corporation
Preliminary
Use the Demonstration
constant bit rate TS running at the programmed rate. If the rate you select
does not match the bit rate of the stream, buffer overflow or underflow
occurs.
The statistics page for the receiver demonstration shows the number of
Ethernet frames that are received for each channel, statistics from the
receiver buffer, and FEC decoder, plus a summary of the Ethernet and
external RAM bandwidth.
For the transmitter demonstration, VLC media player can display the
video being transmitted by the demonstration by setting it to match the
UDP/RTP multicast socket that it uses.
1 Sometimes the VLC decoder may report errors (for example, lost
RTP packets or TS discontinuity errors) even though the traffic
on the network is correct. These errors can be caused by load on
the processor or network interface of your computer. The errors
do not necessarily indicate that there is a problem in the
transmitter traffic. Altera recommends a professional receiver
application, such as an IP based IRD or Altera's Ethernet-to-TS
design.
For the receiver demonstration, you can use the VLC media player to
source the network traffic by streaming a TS file to the RTP multicast
socket that the demonstration uses.
Altera Corporation 49
Preliminary
Video Over IP Reference Design
Copyright © 2007 Altera Corporation. All rights reserved. Altera, The Programmable Solutions Company,
the stylized Altera logo, specific device designations, and all other words and logos that are identified as
trademarks and/or service marks are, unless noted otherwise, the trademarks and service marks of Altera
Corporation in the U.S. and other countries. All other product or service names are the property of their re-
spective holders. Altera products are protected under numerous U.S. and foreign patents and pending
101 Innovation Drive applications, maskwork rights, and copyrights. Altera warrants performance of its semiconductor products
San Jose, CA 95134 to current specifications in accordance with Altera's standard warranty, but reserves the right to make chang-
(408) 544-7000 es to any products and services at any time without notice. Altera assumes no responsibility or liability
arising out of the application or use of any information, product, or service described
www.altera.com herein except as expressly agreed to in writing by Altera Corporation. Altera customers
Applications Hotline: are advised to obtain the latest version of device specifications before relying on any pub-
(800) 800-EPLD lished information and before placing orders for products or services.
Literature Services:
literature@altera.com
50 Altera Corporation
Preliminary