Programmable Logic


Using a CoolRunner-II CPLD as a data stream switch

24 January 2007 Programmable Logic

This article shows how a Xilinx CoolRunnerTM-II CPLD can be used as a simple logical switch that can quickly and reliably select between different MPEG video sources.

The source code for the design, which is available on the Xilinx website, can be expanded by the user to perform additional operations using the remaining CPLD resources.

As consumer electronics become more complex, we are seeing a significant increase in the number of formats used to transfer data. Video and audio both come in a multitude of different formats, and often from different sources. Managing this data and ensuring the right data arrives at the right destination at the right time is a challenge. In our example, we use a CoolRunner-II CPLD to select between three MPEG-2 video sources; these could be satellite, cable and terrestrial television. The selected data source can then be sent to a decoder to be streamed to a display, stored on a hard disk drive (HDD), as would happen in a digital video recorder (DVR), or sent over a serial link to another piece of equipment.

MPEG-2 data sources

The MPEG-2 encoded data from the different sources arrives in transport streams (TS). The transport stream consists of 8 bits of data (TS_DATA) and three control bits (TS_CLK, TS_SYNC and TS_VAL). This design example requires that each data source can be selected with a physical input, so three select inputs are required. If you want to have an electronically-generated select signal, only two select signals will be necessary. Finally, this example also requires that the outputs of the multiplexer can be put into a 3-state condition to isolate them from the system. This is easy to achieve in the CoolRunner-II architecture.

CPLD background

Before implementing even a simple design inside a Xilinx CoolRunner-II CPLD, it is important to understand the architecture. CPLDs are rich in logical resources. The logical array in the CoolRunner-II architecture is a 40 x 56 PLA - 40 input signals to the logical array can be used to create up to 56 product (AND) terms. Product terms can then be used in any of the 16 macrocells, containing registers, which are associated with each logical array. The I/O of the CoolRunner-II CPLD can operate at 1,5, 1,8, 2,5 and 3,3 V by simply changing an attribute when coding the design.

The design requires 37 input pins and 11 output pins. Using Table 1, you can see that the appropriate device/package required is the XC2C64A-VQ100.

Table 1. CoolRunner-II package/I/O matrix
Table 1. CoolRunner-II package/I/O matrix

MPEG-2 multiplexer design

Figure 1 shows the block diagram of the multiplexer system. All the I/O pins in this design are configured to the LVCMOS33 3,3 V I/O standard. Depending on the state of the select lines, one of the three transport streams, TS1, TS2 and TS3, will be directed to the output of the device. When a logic 0 is applied to the enable signal, the outputs of the CPLD will be put into 3-state mode regardless of the condition of the select signals.

Figure 1. Block diagram of the MPEG multiplexer
Figure 1. Block diagram of the MPEG multiplexer

This example is intended to supply data to an MPEG-2 receiver and decoder, and then directly to a display. The MPEG-2 transport stream uses short (188 byte) packet lengths. As broadcast environments can be prone to error and the loss of one or more packets, receiver devices are usually able to correct small errors. Hence losing one or two bits of data while changing between sources will not matter. If the MPEG-2 sources were to be stored, such as when used in a DVR, the user could use the remaining resources in the CPLD to register the data to ensure that no bits are lost.

Performance and utilisation

This is a simple design that only passes through a small amount of logic. Hence, if implemented in the slowest speed grade, the XC2C64A-7, the pin-to-pin combinatorial delay is only 14,8 ns. As the MPEG-2 standard often has clock and data speeds of 27 MHz, this is easily handled. All similar signals travel through the same path in the CPLD, so they will emerge from the other side with negligible skew, because of the deterministic nature of the timing model and architecture.

Table 2 shows the resource utilisation of the implemented design. It is clear that the limiting factor in choice of device is the number of I/O. It is also evident that there are plenty of logic and register resources available if the user wants to expand the functionality of the design. For the sake of simplicity, we ran the simulation with randomly-generated data rather than properly formatted MPEG-2 data.

Table 2. Device resource utilisation of the implemented design
Table 2. Device resource utilisation of the implemented design

VHDL code

To obtain the VHDL code for this application note, please use the following link: XAPP944 - www.xilinx.com/products/xaw/coolvhdlq.htm

Conclusion

Due to their flexibility, Xilinx CoolRunner-II CPLDs are found in a variety of digital consumer products. Multiplexing of MPEG-2 transport streams can easily be performed by a CoolRunner-II CPLD with resources to spare for performing further operations. The VHDL design in this article shows the simplest form of multiplexing between such data sources. If the user requires further functionality, there are many resources available in the CPLD in which to create it.





Share this article:
Share via emailShare via LinkedInPrint this page

Further reading:

Solving industry 4.0 challenges with software-configurable I/O
Altron Arrow Programmable Logic
Software-configurable I/O modules solve problems caused by connecting legacy equipment to modern Ethernet controllers by allowing for the efficient use of all channels in an I/O system.

Read more...
Rapid prototyping with new Xilinx FPGA evaluation kit
EBV Electrolink Programmable Logic
Equipped with the Xilinx Spartan-7 FPGA, the kit is built for rapid prototyping of industrial networking, embedded vision and automotive designs.

Read more...
Embedded vision development tool for RISC-V FPGA
EBV Electrolink Programmable Logic
Microchip Technology announced the second development tool offering in its Smart Embedded Vision initiative for designers using its PolarFire RISC-V system-on-chip (SoC) FPGA. The industry’s lowest-power ...

Read more...
Latest updates to Libero SoC v2021.3 Design Suite
Altron Arrow Programmable Logic
Microchip Technology recently introduced new MPFS025T/095T/160T/250T PolarFire SoC devices with Tgrade2 operating conditions in standard and -1 speed grades and MPFS095TS/250TS/460TS devices with MIL ...

Read more...
HLS tool suite for PolarFire FPGAs
EBV Electrolink Programmable Logic
The need to combine performance with low power consumption in edge compute applications has driven demand for field programmable gate arrays (FPGAs) to be used as power-efficient accelerators while also ...

Read more...
Mid-range FPGAs for edge compute systems
Avnet Silica Programmable Logic
Edge compute systems need compact programmable devices with low power consumption and a small enough thermal footprint to eliminate fans and other heat mitigation while providing robust compute horsepower. ...

Read more...
Microchip achieves JEDEC qualification for rad-tolerant FPGA
Future Electronics Programmable Logic
Developers of small-satellite constellations and other systems used in ‘New Space’ missions must deliver both high reliability and radiation protection while meeting stringent cost and scheduling requirements. ...

Read more...
Intel Agilex FPGAs deliver flexibility and agility for the data-centric world
Altron Arrow Editor's Choice Programmable Logic
The Agilex FPGA fabric and innovative chiplet architecture delivers an extensible FPGA platform that scales across a wide range of device densities and brings key features and benefits to the table.

Read more...
Security tool for mission-critical FPGAs
Future Electronics Programmable Logic
Mission-critical and other high-assurance systems deployed worldwide are under rapidly evolving threats from cybercriminals who attempt to extract Critical Program Information (CPI) via the FPGAs that ...

Read more...
Lattice releases new version of sensAI
Future Electronics Programmable Logic Design Automation
New enhancements have been made to Lattice Semiconductor’s award-winning sensAI solution stack for accelerating AI/ML (artificial intelligence/machine learning) application development on low-power Lattice ...

Read more...