pg013 V Rgb2ycrcb
pg013 V Rgb2ycrcb
Color-Space
Converter v7.1
LogiCORE IP Product Guide
Chapter 1: Overview
Feature Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Licensing and Ordering Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Appendix C: Debugging
Finding Help on Xilinx.com . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Debug Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Hardware Debug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Interface Debug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Constraints File
Verilog
XDC
• Support for user-defined conversion Simulation For supported simulators, see the Xilinx Design
Tools: Release Notes Guide.
matrices
Synthesis Tools Vivado Synthesis
• AXI4-Stream data interfaces
Support
• Optional AXI4-Lite control interface Provided by Xilinx, Inc.
• Supports 8, 10, 12 and 16-bit per color 1. For a complete listing of supported devices, see the Vivado IP
Catalog.
component input and output 2. Video protocol as defined in the Video IP: AXI Feature
Adoption section of UG1037 AXI Reference Guide [Ref 1].
• Built-in, optional bypass and test-pattern 3. Standalone driver details can be found in the SDK directory
generator mode (<install_directory>/doc/usenglish/xilinx_drivers.htm). Linux
OS and driver support information is available from
• Built-in, optional throughput monitors the Xilinx Wiki page.
4. For the supported versions of the tools, see the Xilinx Design
• Supports spatial resolutions from 32x32 up Tools: Release Notes Guide.
to 7680x7680
Overview
A color space is a mathematical representation of a set of colors. The most popular color
models are:
These color spaces are directly related to the intuitive notions of hue, saturation and
brightness.
All color spaces can be derived from the RGB information supplied by devices such as
cameras and scanners. Different color spaces have historically evolved for different
applications. In each case, a color space was chosen for application-specific reasons.
The convergence of computers, the Internet and a wide variety of video devices, all using
different color representations, is forcing the digital designer today to convert between
them. The objective is to have all inputs converted to a common color space before
algorithms and processes are executed. Converters are useful for a number of markets,
including image and video processing.
Feature Summary
The RGB to YCrCb Color-Space Converter core transforms RGB video data into YCrCb 4:4:4
or YUV 4:4:4 video data. The core supports four common format conversions as well as a
custom mode that allows for a user-defined transform. The core is capable of a maximum
resolution of 7680 columns by 7680 rows with 8, 10, 12, or 16 bits per pixel and supports the
bandwidth necessary for High-definition (1080p60) resolutions in all Xilinx FPGA device
families. Higher resolutions can be supported in Xilinx high-performance device families.
You can configure and instantiate the core from Vivado design tools. Core functionality may
be controlled dynamically with an optional AXI4-Lite interface.
Applications
• Post-processing core for image data
• Video surveillance
• Video conferencing
• Machine vision
• Other imaging applications
For more information, visit the RGB to YCrCb Color-Space Converter product web page.
Information about other Xilinx LogiCORE IP modules is available at the Xilinx Intellectual
Property page. For information on pricing and availability of other Xilinx LogiCORE IP
modules and tools, contact your local Xilinx sales representative.
Product Specification
Standards
The RGB to YCrCb Color-Space Converter core is compliant with the AXI4-Stream Video
Protocol and AXI4-Lite interconnect standards. Refer to the Video IP: AXI Feature Adoption
section of the (UG1037) AXI Reference Guide [Ref 1] for additional information.
Performance
The following sections detail the performance characteristics of the RGB to YCrCb
Color-Space Converter core.
Maximum Frequencies
This section contains typical clock frequencies for the target devices. The maximum
achievable clock frequency can vary. The maximum achievable clock frequency and all
resource counts can be affected by other tool options, additional logic in the device, using
a different version of Xilinx tools and other factors. See Table 2-1 through Table 2-4 for
device-specific information.
Latency
The processing latency of the core is shown in the following equation:
This code evaluates to 11 clock cycles for typical cases (unless in “custom” mode the
clipping and/or clamping circuits are not used).
Throughput
The Color Space Converter core outputs one YCbCr 4:4:4 sample per clock cycle.
Resource Utilization
Table 2-1 through Table 2-3 were generated using Vivado Design Suite with the AXI4-Lite
interface, INTC_IF, and the Debug Features disabled. UltraScale™ results are expected to
be similar to 7 series results.
Table 2‐1: Kintex‐7 FPGA and Zynq‐7000 Devices with Kintex Based Programmable Logic
Clock
Data Width Slice FFs Slice LUTs LUT6‐FF pairs DSPs Frequency
(MHz)
8 293 290 326 4 226
Table 2‐2: Artix‐7 FPGA and Zynq‐7000 Devices with Artix Based Programmable Logic
Clock
Data Width Slice FFs Slice LUTs LUT6‐FF pairs DSPs Frequency
(MHz)
8 293 290 328 7 188
S?AXIS?VIDEO?TDATA M?AXIS?VIDEO?TDATA
!8) 3TREAM S?AXIS?VIDEO?TVALID M?AXIS?VIDEO?TVALID !8) 3TREAM
3LAVE INPUT S?AXIS?VIDEO?TREADY M?AXIS?VIDEO?TREADY -ASTER OUTPUT
)NTERFACE S?AXIS?VIDEO?TLAST M?AXIS?VIDEO?TLAST )NTERFACE
S?AXIS?VIDEO?TUSER M?AXIS?VIDEO?TUSER
S?AXI?AWADDR;=
S?AXI?AWVALID
S?AXI?ACLK
S?AXI?ACLKEN
S?AXI?ARESETN
S?AXI?AWREADY IRQ
S?AXI?WDATA;=
S?AXI?WSTRB;= ).4#?IF
S?AXI?WVALID
S?AXI?WREADY
/PTIONAL S?AXI?BRESP;=
!8) ,ITE
S?AXI?BVALID
#ONTROL
)NTERFACE S?AXI?BREADY
S?AXI?ARADDR;=
S?AXI?ARVALID
S?AXI?ARREADY
S?AXI?RDATA;=
S?AXI?RRESP;=
S?AXI?RVALID
S?AXI?RREADY
ACLK
ACLKEN
ARESETN
8
The ACLK, ACLKEN and ARESETn signals are shared between the core and the AXI4-Stream
data interfaces. The AXI4-Lite control interface has its own set of clock, clock enable and
reset pins: S_AXI_ACLK, S_AXI_ACLKEN and S_AXI_ARESETn. Refer to The Interrupt
Subsystem for a detailed description of the INTC_IF and IRQ pins.
ACLK
The AXI4-Stream interface must be synchronous to the core clock signal ACLK. All
AXI4-Stream interface input signals are sampled on the rising edge of ACLK. All
AXI4-Stream output signal changes occur after the rising edge of ACLK. The AXI4-Lite
interface is unaffected by the ACLK signal.
ACLKEN
The ACLKEN pin is an active-high, synchronous clock-enable input pertaining to
AXI4-Stream interfaces. Setting ACLKEN low (de-asserted) halts the operation of the core
despite rising edges on the ACLK pin. Internal states are maintained, and output signal
levels are held until ACLKEN is asserted again. When ACLKEN is de-asserted, core inputs are
not sampled, except ARESETn, which supersedes ACLKEN. The AXI4-Lite interface is
unaffected by the ACLKEN signal.
ARESETn
The ARESETn pin is an active-low, synchronous reset input pertaining to only AXI4-Stream
interfaces. ARESETn supersedes ACLKEN, and when set to 0, the core resets at the next
rising edge of ACLK even if ACLKEN is de-asserted. The ARESETn signal must be
synchronous to the ACLK and must be held low for a minimum of 32 clock cycles of the
slowest clock. The AXI4-Lite interface is unaffected by the ARESETn signal.
Data Interface
The RGB2YCrCb core receives and transmits data using AXI4-Stream interfaces that
implement a video protocol as defined in the Video IP: AXI Feature Adoption section of the
(UG1037) AXI Reference Guide [Ref 1].
Video Data
The AXI4-Stream interface specification restricts TDATA widths to integer multiples of
8 bits. Therefore, 10 and 12 bit data must be padded with zeros on the MSB to form Nx8 bit
wide vector before connecting to s_axis_video_tdata. Padding does not affect the size
of the core.
For example, RGB data on the RGB2YCrCb input s_axis_video_tdata is packed and
padded to multiples of 8 bits as necessary, as seen in Figure 2-2. Zero padding the most
significant bits is only necessary for 10 and 12 bit wide data.
X-Ref Target - Figure 2-2
BIT
8
BIT
8
READY/VALID Handshake
A valid transfer occurs whenever READY, VALID, ACLKEN, and ARESETn are high at the
rising edge of ACLK, as seen in Figure 2-4. During valid transfers, DATA only carries active
video data. Blank periods and ancillary data packets are not transferred via the AXI4-Stream
video protocol.
RECOMMENDED: The AXI4-Stream slave should drive READY independently, or pre-assert READY to
minimize latency.
pixel of a frame. The SOF signal may be asserted an arbitrary number of ACLK cycles before
the first pixel value is presented on DATA, as long as a VALID is not asserted.
Control Interface
When configuring the core, you can add an AXI4-Lite register interface to dynamically
control the behavior of the core. The AXI4-Lite slave interface facilitates integrating the core
into a processor system, or along with other video or AXI4-Lite compliant IP, connected via
AXI4-Lite interface to an AXI4-Lite master. In a static configuration with a fixed set of
parameters (constant configuration), the core can be instantiated without the AXI4-Lite
control interface, which reduces the core Slice footprint.
Constant Configuration
The constant configuration caters to designs that use the core in one setup that will not
need to change over time. In constant configuration the image resolution (number of active
pixels per scan line and the number of active scan lines per frame), and the other core
parameters are hard coded into the core. Since there is no AXI4-Lite interface, the core is
not programmable, but can be reset, enabled, or disabled using the ARESETn and ACLKEN
ports.
AXI4‐Lite Interface
The AXI4-Lite interface allows you to dynamically control parameters within the core. Core
configuration can be accomplished using an AXI4-Stream master state machine, or an
embedded ARM or soft system processor such as MicroBlaze.
The RGB2YCrCb core can be controlled via the AXI4-Lite interface using read and write
transactions to the RGB2YCrCb register space.
S_AXI_ACLK
The AXI4-Lite interface must be synchronous to the S_AXI_ACLK clock signal. The
AXI4-Lite interface input signals are sampled on the rising edge of ACLK. The AXI4-Lite
output signal changes occur after the rising edge of ACLK. The AXI4-Stream interfaces
signals are not affected by the S_AXI_ACLK.
S_AXI_ACLKEN
The S_AXI_ACLKEN pin is an active-high, synchronous clock-enable input for the AXI4-Lite
interface. Setting S_AXI_ACLKEN low (de-asserted) halts the operation of the AXI4-Lite
interface despite rising edges on the S_AXI_ACLK pin. AXI4-Lite interface states are
maintained, and AXI4-Lite interface output signal levels are held until S_AXI_ACLKEN is
asserted again. When S_AXI_ACLKEN is de-asserted, AXI4-Lite interface inputs are not
sampled, except S_AXI_ARESETn, which supersedes S_AXI_ACLKEN. The AXI4-Stream
interfaces signals are not affected by the S_AXI_ACLKEN.
S_AXI_ARESETn
The S_AXI_ARESETn pin is an active-low, synchronous reset input for the AXI4-Lite
interface. S_AXI_ARESETn supersedes S_AXI_ACLKEN, and when set to 0, the core resets
at the next rising edge of S_AXI_ACLK even if S_AXI_ACLKEN is de-asserted. The
S_AXI_ARESETn signal must be synchronous to the S_AXI_ACLK and must be held low
for a minimum of 32 clock cycles of the slowest clock. The S_AXI_ARESETn input is
resynchronized to the ACLK clock domain. The AXI4-Stream interfaces and core signals are
also reset by S_AXI_ARESETn.
Register Space
The standardized Xilinx Video IP register space is partitioned to control-, timing-, and
core-specific registers. The RGB2YCrCb core uses only one timing related register,
ACTIVE_SIZE (0x0020), which allows specifying the input frame dimensions. The core has
thirteen core specific registers which allow you to dynamically control core operation.
1. Only available when the debugging features option is enabled in the GUI at the time the core is instantiated.
Bit 1 of the CONTROL register, REG_UPDATE is a write done semaphore for the host
processor, which facilitates committing all user and timing register updates simultaneously.
The RGB2YCrCb core ACTIVE_SIZE and core specific registers are double buffered. One
set of registers (the processor registers) is directly accessed by the processor interface,
while the other set (the active set) is actively used by the core. New values written to the
processor registers will get copied over to the active set at the end of the AXI4-Stream
frame, if and only if REG_UPDATE is set. Setting REG_UPDATE to 0 before updating multiple
register values, then setting REG_UPDATE to 1 when updates are completed ensures all
registers are updated simultaneously at the frame boundary without causing image tearing.
Bit 4 of the CONTROL register, BYPASS, switches the core to bypass mode if debug features
are enabled. In bypass mode the RGB2YCrCb core processing function is bypassed, and the
core repeats AXI4-Stream input samples on its output. Refer to Debug Tools in Appendix C
for more information. If debug features were not included at instantiation, this flag has no
effect on the operation of the core. Switching bypass mode on or off is not synchronized to
frame processing, therefore can lead to image tearing.
Bit 5 of the CONTROL register, TEST_PATTERN, switches the core to test-pattern generator
mode if debug features are enabled. Refer to Debug Tools in Appendix C for more
information. If debug features were not included at instantiation, this flag has no effect on
the operation of the core. Switching test-pattern generator mode on or off is not
synchronized to frame processing, therefore can lead to image tearing.
Bits of the STATUS register can be cleared individually by writing '1' to the bit position.
Bit 0 of the STATUS register, PROC_STARTED, indicates that processing of a frame has
commenced via the AXI4-Stream interface.
Bit 1 of the STATUS register, End-of-frame (EOF), indicates that the processing of a frame
has completed.
Bit 16 of the STATUS register, SLAVE_ERROR, indicates that one of the conditions
monitored by the ERROR register has occurred.
Bits of the ERROR register can be cleared individually by writing '1' to the bit position to be
cleared.
Bit 0 of the ERROR register, EOL_EARLY, indicates an error during processing a video frame
via the AXI4-Stream slave port. The number of pixels received between the latest and the
preceding End-Of-Line (EOL) signal was less than the value programmed into the
ACTIVE_SIZE register.
Bit 1 of the ERROR register, EOL_LATE, indicates an error during processing a video frame
via the AXI4-Stream slave port. The number of pixels received between the last EOL signal
surpassed the value programmed into the ACTIVE_SIZE register.
Bit 2 of the ERROR register, SOF_EARLY, indicates an error during processing a video frame
via the AXI4-Stream slave port. The number of pixels received between the latest and the
preceding Start-Of-Frame (SOF) signal was less than the value programmed into the
ACTIVE_SIZE register.
Bit 3 of the ERROR register, SOF_LATE, indicates an error during processing a video frame
via the AXI4-Stream slave port. The number of pixels received between the last SOF signal
surpassed the value programmed into the ACTIVE_SIZE register.
The CrMin register holds the minimum value allowed on the Cr Chroma channel of the
output. If the output data is less than this value, then this value replaces it on the output.
This register is only valid if Output Clamped is selected in the core parameterization GUI.
When the core is instantiated with an AXI4-Lite Control interface, the optional interrupt
request pin (IRQ) is present. Events associated with bits of the STATUS register can
generate a (level triggered) interrupt, if the corresponding bits of the interrupt enable
register (IRQ_ENABLE) are set. Once set by the corresponding event, bits of the STATUS
register stay set until the user application clears them by writing '1' to the desired bit
positions. Using this mechanism the system processor can identify and clear the interrupt
source.
Without the AXI4-Lite interface the user can still benefit from the core signaling error and
status events. By selecting the Enable INTC Port check-box on the GUI, the core generates
the optional INTC_IF port. This vector of signals gives parallel access to the individual
interrupt sources, as seen in Table 2-9.
Unlike STATUS and ERROR flags, INTC_IF signals are not held, rather stay asserted only
while the corresponding event persists.
In a system integration tool, the interrupt controller INTC IP can be used to register the
selected INTC_IF signals as edge triggered interrupt sources. The INTC IP provides
functionality to mask (enable or disable), as well as identify individual interrupt sources
from software. Alternatively, for an external processor or MCU you can custom build a
priority interrupt controller to aggregate interrupt requests and identify interrupt sources.
Typically, the RGB2YCrCb core is part of larger video system such as an Image Sensor
Pipeline (ISP) System shown in Figure 3-1.
X-Ref Target - Figure 3-1
,EGEND
!8) ,ITE
64# $0# #&! 3TATS ##- 'AMMA #3# .OISE %NHANCE #3# 64#
DRIVER DRIVER DRIVER DRIVER DRIVER DRIVER DRIVER DRIVER DRIVER DRIVER DRIVER
3ENSOR
!' !7"
'AIN
3ENSOR 'LOBAL
%XPOSURE !% #ONTRAST
%MBEDDED 0ROCESSOR 8
Table 3-1 presents the RGB values for 100% saturated color bars, a common video test
signal.
The RGB color space is the most prevalent choice for computer graphics because color
displays use red, green and blue to create the desired color. Also, a system that is designed
using the RGB color space can take advantage of a large number of existing software
algorithms.
However, RGB is not very efficient when dealing with real-world images. All three
components need equal bandwidth to generate arbitrary colors within the RGB color cube.
Also, processing an image in the RGB color space is usually not the most efficient method.
For example, to modify the intensity or color of a given pixel, all three RGB values must be
read, modified and written back to the frame buffer. If the system had access to the image
stored in the intensity and color format, the process would be faster.
DS657_01_032408
Conversion Equations
Derivation of Conversion Equations
To generate the luminance (Y, or gray value) component, biometric experiments were
employed to measure how the human eye perceives the intensities of the red, green and
blue colors. Based on these experiments, optimal values for coefficients CA and CB were
determined, such that:
Conversion from the RGB color space to luminance and chrominance (differential color
components) could be described with Equation 3-2.
Y CA 1 – CA – CB CB R Equation 3‐2
R – Y = 1 – CA CA + CB – 1 – CB G
B–Y – CA CA + CB – 1 1 – CB B
Coefficients CA and CB are chosen between 0 and 1, which guarantees that the range of Y
is constrained between the maximum and minimum RGB values permitted, RGB max and
RGBmin respectively.
min R-Y= RGBmin – (CA*RGB min + (1- CA- CB)*RGBmax + CB*RGBmax ) = (CA-1) * (RGBmax -RGBmin )
max R-Y= RGBmax – (CA*RGBmax + (1- CA- CB)*RGBmin + CB*RGBmin ) = (1-CA) * (RGBmax -RGBmin )
maxB-Y=RGBmax-(CA*RGBmin+(1-CA-CB)RGBmin+CB*RGBmax)=(1-CB)(RGBmax-RGBmin)
Both clipping and dynamic range compression result in loss of information; however, the
introduced artifacts are different. To leverage differences in the input (RGB) range, different
standards choose different trade-offs between clipping and normalization.
The RGB to YCrCb color space conversion core facilitates both range compression and
optional clipping and clamping. Range, offset, clipping and clamping levels are
parameterizable. The core supports conversions that fit the following general form:
Y CA 1 – CA – CB CB R OY
C R = CC 1 – CA CC CA + CB – 1 CC – CB G + O Cr Equation 3‐5
CB CD – CA CD CA + CB – 1 CD 1 – CB B O Cb
CC and CD allow dynamic range compression for R-Y and B-Y, and constants OY, OCr and
O Cb facilitate offset compensation for the resulting Y, C B and C R components.
Based on Equation 3-3 and Equation 3-4, to constrain the resulting chrominance
components (C B and C R) into the [0,1] range, the chrominance offset (O Cr and O Cb) and the
chrominance range compression constants (CC, CD) should be selected as follows (OCr/Cb =
0.5):
1
CC = ------------------------------------------------------------------------------- Equation 3‐6
2 1 – CA RGB max – RGB min
1
CD = ------------------------------------------------------------------------------- Equation 3‐7
2 1 – CB RGB max – RGB min
When RGB values are also in the [0,1] range, using the following equations avoids
arithmetic under- and overflows (O Cr/Cb = 0.5).
1 1
CC = ------------------------- CD = ------------------------- Equation 3‐8
2 1 – CA 2 1 – CB
ITU 601 (SD) and 709 ‐ 1125/60 (NTSC) Standard Conversion Coefficients
Table 3‐2: Parameterization Values for the SD (ITU 601) and NTSC HD (ITU 709) Standards
Coefficient/ Range
Parameter 16‐240 16‐235 0‐255
CA 0.299 0.2568
CB 0.114 0.0979
CC 0.713 0.7295 0.5910
CD 0.564 0.5772
YOFFSET 2 Data_Width-4
Cb/CrOFFSET 2 Data_width-1
YMAX 240*2 Data_Width-8 235*2 Data_Width-8 2 OWIDTH-1
Cb/CrMAX 240*2 Data_Width-8 235*2 Data_Width-8 2 OWIDTH-1
YMIN 16*2 Data_Width-8 0
Cb/CrMIN 16*2 Data_Width-8 0
Table 3‐3: Parameterization Values for the PAL HD (ITU 709) Standard
Coefficient/ Range
Parameter 16‐240 16‐235 0‐255
CA 0.2126 0.1819
CB 0.0722 0.0618
CC 0.6350 0.6495 0.6495
CD 0.5389 0.5512
Data_Width-4
YOFFSET 2
Cb/CrOFFSET 2 Data_Width-1
YMAX 240*2 Data_Width-8 235*2 Data_Width-8 2 Data_Width-1
Cb/CrMAX 240*2 Data_Width-8 235*2 Data_Width-8 2 Data_Width-1
YMIN 16*2 Data_Width-8 0
Data_Width-8
Cb/CrMIN 16*2 0
YUV Standard
Coefficient/ Value
Parameter 16‐240 16‐235 0‐255
CA 0.299
CB 0.114
CC 0.877283
CD 0.492111
Data_Width-4
YOFFSET 2
Cb/CrOFFSET 2 Data_Width-1
YMAX 240*2 Data_Width-8 235*2 Data_Width-8 2 Data_Width-1
Cb/CrMAX 240*2 Data_Width-8 235*2 Data_Width-8 2 Data_Width-1
YMIN 16*2 Data_Width-8 0
Data_Width-8
Cb/CrMIN 16*2 0
Hardware Implementation
The RGB to YCrCb color space transformation equations (Equation 3-5) can be expressed as:
These equations can be directly mapped to the architecture shown in Figure 3-3. The blue
boxes in Figure 3-3 represent logic blocks, which are always implemented using XtremeDSP
slices.
AC
YOFFSET YMAX YMIN
-
R
MWIDTH
Cr
-
B CCOEF CROFFSET CRMAX CRMIN
Cb
BC
DCOEF CBOFFSET CBMAX CBMIN
DS657_02_032408
Error Analysis
The following analysis, based on DSP fundamentals, presents mean-square-error (MSE)
calculations for RGB to YCrCb, assuming IWIDTH bit RGB input data, OWIDTH bit wide
YCrCb output data, and 17 bits for coefficient precision.
where [ ]k denotes rounding to k bits. The architecture contains three possible operators
that might introduce noise. Quantization noise is inserted when data is rounded.
Before analyzing the effects of these noise sources, first look at the input Signal to
Quantization Noise Ratio (SQNR). Assuming uniformly distributed quantization error,
RGBMAX 2
Px RGBMIN X dx
SQNR RGB = 10 log -------- = 10 log ------------------------------------------- Equation 3‐17
PN 1 2 2
---
– 2 e dx
Substituting LSB =2-INBITS, where INBITS is the input (RGB) precision, SQNRRGB becomes a
function of the input dynamic range. In the next three calculations, when calculating
SQNRRGB for the typical dynamic ranges, INBITS = 8 for all three cases.
1 255 2 1 3
---------
255 0 x dx ----------------- 255
3 255
SQNR RGB = 10 log ------------------------------------- = 10 log ------------------------------------ = 54.15dB Equation 3‐18
12 2 1
–1 2 x dx ------
12
1 240 2
---------
224 16 x dx
SQNR RGB = 10 log ------------------------------------- = 53.92dB Equation 3‐19
12 2
–1 2 x dx
1 235 2
---------
219 16 x dx
SQNR RGB = 10 log ------------------------------------- = 53.74dB Equation 3‐20
12 2
–1 2 x dx
The first rounding noise source can be practically eliminated by the careful choice of
MWIDTH. Approximating SQNR by 6.02 MWIDTH [dB], intuitively the rounding noise can be
reduced by increasing MWIDTH. However, MWIDTH affects the resource usage and carry
chain length in the design (thereby affecting maximum speed). Choosing MWIDTH >18
would significantly increase the dedicated multiplier count of the design.
Though a quantitative noise analysis of the signal flow graph based on Figure 3-3 is
possible by replacing quantizers with appropriate AWGN sources, the complexity of the
derivation of a final noise formula which addresses clipping noise as well is beyond the
scope of this document. Instead, Table 3-5 illustrates noise figures for some typical (see
Table 3-2) parameter combinations.
Table 3‐5: Input and Output SNR Measurement Results [dB] for ITU‐REC 601 (SD)
SNR IWIDTH = OWIDTH = 8 Bits IWIDTH = OWIDTH = 10 Bits Input Range
SNRRGB (input) 54.1 66.2 [0..255] (8bit)
SNRY 51.9 64.0 Or
SNRCr 47.0 58.9 [0..1023] (10 bit)
SNRCb 47.0 58.9
SNRRGB (input) 54.0 65.9 [16..240] (8bit)
SNRY 51.8 63.9 Or
SNRCr 46.9 58.8 [64..960] (10 bit)
SNRCb 46.9 58.8
SNRRGB (input) 53.8 65.8 [16..235] (8bit)
SNRY 51.5 63.6 Or
SNRCr 46.9 58.8 [64..920] (10 bit)
SNRCb 46.9 58.8
255
240
0 16
DS657_08_032408
Similarly, clamping logic is included in the design if HAS_CLAMPING=1. Use of clipping and
clamping increases slice count of the design by approximately 6*OWIDTH slices.
If a targeted standard limits output of values to a predefined range other than those of
binary representation, such as ITU-R BT.601-5, use of clipping and clamping logic facilitates
constraining output values. These values are constrained to the predefined range by setting
YMAX and YMIN values (constraining luminance), as well as CMAX and CMIN values
(constraining chrominance) according to the standard specifications.
ACLK
ACLKEN
ARESETN 8
S_AXI_ACLK
The AXI4-Lite interface uses the S_AXI_ACLK pin as its clock source. The ACLK pin is not
shared between the AXI4-Lite and AXI4-Stream interfaces. The Color Filter Array
Interpolation core contains clock-domain crossing logic between the ACLK (AXI4-Stream
and Video Processing) and S_AXI_ACLK (AXI4-Lite) clock domains. The core automatically
ensures that the AXI4-Lite transactions completes even if the video processing is stalled
with ARESETn, ACLKEN or with the video clock not running.
ACLKEN
The Color Filter Array Interpolation core has two enable options: the ACLKEN pin (hardware
clock enable), and the software reset option provided through the AXI4-Lite control
interface (when present).
• Multi-cycle path designs (high speed clock division without clock gating)
• Standby operation of subsystems to save on power
• Hardware controlled bring-up of system components
IMPORTANT: When ACLKEN (clock enable) pins are used (toggled) in conjunction with a common clock
source driving the master and slave sides of an AXI4-Stream interface, to prevent transaction errors the
ACLKEN pins associated with the master and slave component interfaces must also be driven by the
same signal (Figure 2-2).
IMPORTANT: When two cores connected through AXI4-Stream interfaces, where only the master or the
slave interface has an ACLKEN port, which is not permanently tied high, the two interfaces should be
connected through the AXI4-Stream Interconnect or AXI-FIFO cores to avoid data corruption
(Figure 2-3).
S_AXI_ACLKEN
The S_AXI_ACLKEN is the clock enable signal for the AXI4-Lite interface only. Driving this
signal Low only affects the AXI4-Lite interface and does not halt the video processing in the
ACLK clock domain.
ARESETn
The Color Filter Array Interpolation core has two reset source: the ARESETn pin (hardware
reset), and the software reset option provided through the AXI4-Lite control interface
(when present).
The external reset pulse needs to be held for 32 ACLK cycles to reset the core. The ARESETn
signal only resets the AXI4-Stream interfaces. The AXI4-Lite interface is unaffected by the
ARESETn signal to allow the video processing core to be reset without halting the AXI4-Lite
interface.
IMPORTANT: When a system with multiple-clocks and corresponding reset signals are being reset, the
reset generator has to ensure all signals are asserted/de-asserted long enough so that all interfaces
and clock-domains are correctly reinitialized.
S_AXI_ARESETn
The S_AXI_ARESETn signal is synchronous to the S_AXI_ACLK clock domain, but is
internally synchronized to the ACLK clock domain. The S_AXI_ARESETn signal resets the
entire core including the AXI4-Lite and AXI4-Stream interfaces.
System Considerations
When using the RGB2YCrCb, it needs to be configured for the actual video frame size, to
operate properly. To gather the frame size information from the video, it can be connected
to the Video In to AXI4-Stream input and the Video Timing Controller. The timing detector
logic in the Video Timing Controller will gather the video timing signals. The AXI4-Lite
control interface on the Video Timing Controller allows the system processor to read out
the measured frame dimensions, and program all downstream cores, such as the
RGB2YCrCb, with the appropriate image dimensions.
If the target system uses only one configuration of the RGB2YCRCB core (for example, does
not need to be reprogrammed ever), you may choose to create a constant configuration by
removing the AXI4-Lite interface. This reduces the core Slice footprint.
The AXI4-Lite interface will respond with an error if the core registers cannot be read or
written within 128 S_AXI_ACLK clock cycles. The core registers cannot be read or written
if the ARESETn signal is held low, if the ACLKEN signal is held low or if the ACLK signal is
not connected or not running. If core register read does not complete, the AXI4-Lite read
transaction will respond with 10 on the S_AXI_RRESP bus. Similarly, if a core register write
does not complete, the AXI4-Lite write transaction will respond with 10 on the
S_AXI_BRESP bus. The S_AXI_ARESETn input signal resets the entire core.
Programming Sequence
If processing parameters such as the image size needs to be changed on the fly, or the
system needs to be reinitialized, it is recommended that pipelined Xilinx IP video cores are
disabled/reset from system output towards the system input, and programmed/enabled
from system input to system output. STATUS register bits allow system processors to
identify the processing states of individual constituent cores, and successively disable a
pipeline as one core after another is finished processing the last frame of data.
expected (early), or EOL not present when expected (late), signals error conditions
indicative of either upstream communication errors or incorrect core configuration.
When SOF is detected early, the output SOF signal is generated early, terminating the
previous frame immediately. When SOF is detected late, the output SOF signal is generated
according to the programmed values. Extra lines / pixels from the previous frame are
dropped until the input SOF is captured.
Similarly, when EOL is detected early, the output EOL signal is generated early, terminating
the previous line immediately. When EOL is detected late, the output EOL signal is
generated according to the programmed values. Extra pixels from the previous line are
dropped until the input EOL is captured.
• Vivado Design Suite User Guide: Designing IP Subsystems using IP Integrator (UG994)
[Ref 7]
• Vivado Design Suite User Guide: Designing with IP (UG896) [Ref 3]
• Vivado Design Suite User Guide: Getting Started (UG910) [Ref 5]
• Vivado Design Suite User Guide: Logic Simulation (UG900) [Ref 6]
For details, see the sections, “Working with IP” and “Customizing IP for the Design” in the
Vivado Design Suite User Guide: Designing with IP (UG896) [Ref 3] and the “Working with the
Vivado IDE” section in the Vivado Design Suite User Guide: Getting Started (UG910) [Ref 5].
If you are customizing and generating the core in the Vivado IP Integrator, see the Vivado
Design Suite User Guide: Designing IP Subsystems Using IP Integrator (UG994) [Ref 7] for
detailed information. IP Integrator might auto-compute certain configuration values when
validating or generating the design. To check whether the values do change, see the
description of the parameter in this chapter. To view the parameter value you can run the
validate_bd_design command in the Tcl console.
Note: Figures in this chapter are illustrations of the Vivado IDE. This layout might vary from the
current version.
Interface
The main screen of the Graphical User Interface (GUI) of Vivado (shown in Figure 4-1) allows
quick implementation of standard RGB to YCrCb 4:4:4 or RGB to YUV 4:4:4 converter without
having to manually enter values from Table 3-2 though Table 3-4. The Color-Space
Converter core also supports proprietary (non-standard) converter implementations. This is
done by selecting “custom” from the Standard Selection drop-down menu, as long as the
custom conversion matrix can be transformed to the form of Equation 3-5.
The main screen is shown in Figure 4-1. Descriptions of the options provided in the GUI
screens are included in this section.
• Component Name: The component name is used as the base name of output files
generated for the module. Names must begin with a letter and must be composed
° AXI4-Lite Register Interface: When selected, the core will be generated with an
AXI4-Lite interface, which gives access to dynamically program and change
processing parameters. For more information, refer to Control Interface in Chapter
2.
° Include Debug Features: When selected, the core will be generated with
debugging features, which simplify system design, testing and debugging. For more
information, refer to Debugging Features in Appendix C.
IMPORTANT: Debugging features are only available when the AXI4-Lite Register Interface is selected.
° Enable INTC Port: When selected, the core will generate the optional INTC_IF port,
which gives parallel access to signals indicating frame processing status and error
conditions. For more information, refer to The Interrupt Subsystem in Chapter 2.
• Converter Type
Selecting “custom” enables the controls on page 2 of the GUI, so conversion settings
can be customized. Otherwise, page 2 only displays the parameters to be used to
implement the selected standard.
° Output Range Selection: This selection governs the range of outputs Y, Cr and Cb
by affecting the conversion coefficients as well as the clipping and clamping values.
The core supports the following typical output ranges:
- 16 to 235, typical for studio equipment
- 16 to 240, typical for broadcast or television
- 0 to 255, typical for computer graphics
Output clipping and clamping values are the same for luminance and chrominance
channels. To set an asymmetric value, such as 16 to 235 for Cr and Cb and 16 to 240
for Y, select “custom” for the standard, then manually modify the clipping and
clamping values on page 3.
The previously-mentioned ranges are characteristic for 8-bit outputs. If 10- or 12-bit
outputs are used, the ranges are extended proportionally. For example, 16 to 240
mode for 10-bit outputs will result in output values ranging from 64 to 960.
The Conversion Matrix, Offset Compensation, Output Clipped and Output Clamped screen
(Figure 4-2) displays and enables editing of conversion coefficients, similar to Equation 3-9,
Equation 3-10, Equation 3-11, and Equation 3-12. Contents are editable only when
“custom” is selected as the standard on page 1.
Figure 4‐2: Conversion Matrix, Offset Compensation, Clipping and Clamping Screen
Output Generation
For details, see “Generating IP Output Products” in the Vivado Design Suite User Guide:
Designing with IP (UG896) [Ref 3].
Required Constraints
The only constraints required are clock frequency constraints for the video clock, clk, and
the AXI4-Lite clock, s_axi_aclk. Paths between the two clock domains should be
constrained with a max_delay constraint and use the datapathonly flag, causing setup
and hold checks to be ignored for signals that cross clock domains. These constraints are
provided in the XDC constraints file included with the core.
Clock Frequencies
This section is not applicable for this IP core.
Clock Management
This section is not applicable for this IP core.
Clock Placement
This section is not applicable for this IP core.
Banking
This section is not applicable for this IP core.
Transceiver Placement
This section is not applicable for this IP core.
Simulation
For comprehensive information about Vivado simulation components, as well as
information about using supported third party tools, see the Vivado Design Suite User
Guide: Logic Simulation (UG900) [Ref 6].
C‐Model Reference
The RGB to YCrCb Color-Space Converter core has a bit accurate C model designed for
system modeling.
Features
• Bit-accurate with the Image RGB to YCrCb Color Space v7.1 core
• Statically linked library (.lib for Windows)
• Dynamically linked library (.so for Linux)
• Available for 32-bit and 64-bit Windows platforms and 32-bit and 64-bit Linux
platforms
• Supports all features of the Image Enhancement core that affect numerical results
• Designed for rapid integration into a larger system model
• Example C code showing how to use the function is provided
Overview
The RGB to YCrCb Color-Space Converter core has a bit-accurate C model for 32-bit and
64-bit Windows platforms and 32-bit and 64-bit Linux platforms. the model's interface
consists of a set of C functions residing in a statically linked library (shared library).
See Using the C-Model for full details of the interface. A C code example of how to call the
model is provided in C-Model Example Code.
The model is bit accurate, as it produces exactly the same output data as the core on a
frame-by-frame basis. However, the model is not cycle accurate, and it does not model the
core's latency or its interface signals.
Software Requirements
The RGB to YCrCb Color-Space Converter v7.0 C-models were compiled and tested with the
software listed in Table 5-2.
Installation
For Linux, ensure that the file is in the same directory that in your $LD_LIBRARY_PATH
environment variable is in:
• libIP_v_rgb2ycrcb_v7_1_bitacc_cmodel.so
ACOEF double 0.299 0.0 - 1.0 A Coefficient 1 0.0 < ACOEFF + BCOEFF < 1.0
BCOEF double 0.114 0.0 - 1.0 B Coefficient1 0.0 < ACOEFF + BCOEFF < 1.0
CCOEF double 0.713 0.0 - 0.9 C Coefficient 1
DCOEF double 0.564 0.0 - 0.9 D Coefficient1
YOFFSET int 16 0 –2 OWIDTH-1 Offset for the Luminance Channel
CBOFFSET int 128 0 - 2OWIDTH-1 Offset for the Cb Chrominance Channel
CROFFSET int 128 0 - 2OWIDTH-1 Offset for the Cr Chrominance Channel
YMIN int 16 0 - 2OWIDTH-1 Clamping value for the Luminance Channel
CBMIN int 16 0 - 2OWIDTH-1 Clamping value for the Cb Chrominance
Channel
CRMIN int 16 0 - 2OWIDTH-1 Clamping value for the Cr Chrominance Channel
YMAX int 240 0 - 2OWIDTH-1 Clipping value for the Luminance Channel
CBMAX int 240 0 - 2OWIDTH-1 Clipping value for the Cb Chrominance Channel
CRMAX int 240 0 - 2OWIDTH-1 Clipping value for the Cr Chrominance Channel
Calling xilinx_ip_v_rgb2ycrcb_v7_1_get_default_generics(&generics)
initializes the generics structure with the default value.
The inputs structure defines the actual input image. For the description of the input video
structure, see Input and Output Video Structures.
Calling xilinx_ip_v_rgb2ycrcb_v7_1_get_default_inputs(&generics,
&inputs) initializes the input video structure before it can be assigned an image or video
sequence using the memory allocation or file I/O functions provided in the BMP, RGB or
video utility functions.
IMPORTANT: The video_in variable is not initialized because the initialization depends on the actual
test image to be simulated. C-Model Example Code describes the initialization of the video_in
structure.
After the inputs are defined, the model can be simulated by calling this function:
int xilinx_ip_v_rgb2ycrcb_v7_1_bitacc_simulate(
struct xilinx_ip_v_rgb2ycrcb_v7_1_generics* generics,
struct xilinx_ip_v_rgb2ycrcb_v7_1_inputs* inputs,
struct xilinx_ip_v_rgb2ycrcb_v7_1_outputs* outputs).
Results are included in the outputs structure, which contains only one member, type
video_struct. After the outputs are evaluated and saved, dynamically allocated memory
for input and output video structures must be released by calling this function:
void xilinx_ip_v_rgb2ycrcb_v7_1_destroy(
struct xilinx_ip_v_rgb2ycrcb_v7_1_inputs *input,
struct xilinx_ip_v_rgb2ycrcb_v7_1_outputs *output).
Successful execution of all provided functions, except for the destroy function, return value
0. A non-zero error code indicates that problems occurred during function calls.
struct video_struct{
int frames, rows, cols, bits_per_component, mode;
uint16*** data[5]; };
Table 5‐5: Named Video Modes with Corresponding Planes and Representations 1
Mode Planes Video Representation
FORMAT_MONO 1 Monochrome – Luminance only
FORMAT_RGB 3 RGB image/video data
FORMAT_C444 3 444 YUV, or YCrCb image/video data
FORMAT_C422 3 422 format YUV video, (u, v chrominance channels horizontally
sub-sampled)
FORMAT_C420 3 420 format YUV video, ( u, v sub-sampled both horizontally and vertically
)
FORMAT_MONO_M 3 Monochrome (Luminance) video with Motion
FORMAT_RGBA 4 RGB image/video data with alpha (transparency) channel
FORMAT_C420_M 5 420 YUV video with Motion
FORMAT_C422_M 5 422 YUV video with Motion
FORMAT_C444_M 5 444 YUV video with Motion
FORMAT_RGBM 5 RGB video with Motion
1
The Color Space Converter C-model supports FORMAT_RGB mode for the input and FORMAT_C444 for the output.
Note: All image/video manipulation utility functions expect both input and output structures
initialized; for example, pointing to a structure that has been allocated in memory, either as static or
dynamic variables. Moreover, the input structure must have the dynamically allocated container
(data or r, g, b) structures already allocated and initialized with the input frame(s). If the output
container structure is pre-allocated at the time of the function call, the utility functions verify and
issue an error if the output container size does not match the size of the expected output. If the
output container structure is not pre-allocated, the utility functions create the appropriate container
to hold results.
These functions serialize the video_struct structure. The corresponding file contains a
small, plain text header defining, "Mode", "Frames", "Rows", "Columns", and "Bits per Pixel".
The plain text header is followed by binary data, 16-bits per component in scan line
continuous format. Subsequent frames contain as many component planes as defined by
the video mode value selected. Also, the size (rows, columns) of component planes can
differ within each frame, as defined by the actual video mode selected.
During successful execution, two directories are created at the location specified by the
out_path command line parameter. The first directory is the "expected" directory. This
directory contains a BMP file that corresponds to the output of the first frame that was
processed. This directory also contains a txt file called golden_1.txt. This txt file contains
the output of the model in a format that can be directly used with the demonstration test
bench. The second directory that is created is the "stimuli" directory. This directory contains
a txt file called stimuli_1.txt. This txt file contains the input of the model in a format
that can be directly used with the demonstration test bench.
1. Set your $LD_LIBRARY_PATH environment variable to include the root directory where
you unzipped the model zip file using a command such as:
setenv LD_LIBRARY_PATH <unzipped_c_model_dir>:${LD_LIBRARY_PATH}
3. In the root directory, compile using the GNU C Compiler with this command:
gcc -m32 -x c++ ../run_bitacc_cmodel.c ../gen_stim.c -o run_bitacc_cmodel -L.
-lIp_v_rgb2ycrcb_v7_1_bitacc_cmodel -Wl,-rpath,.
3. After the project has been created and populated, it needs to be compiled and linked
(built) to create a win32 executable. To perform the build step, choose Build Solution
from the Build menu. An executable matching the project name has been created either
in the Debug or Release subdirectories under the project location based on whether
Debug or Release has been selected in the Configuration Manager under the Build
menu.
Test Bench
This chapter contains information about the provided test bench in the Vivado® Design
Suite environment.
• axi4lite_mst.v
• axi4s_video_mst.v
• axi4s_video_slv.v
• ce_generator.v
• tb_<IP_instance_name>.v
• DUT
• axi4lite_mst
The AXI4-Lite master module, which initiates AXI4-Lite transactions to program core
registers.
• axi4s_video_mst
The AXI4-Stream master module, which generates ramp data and initiates AXI4-Stream
transactions to provide video stimuli for the core and can also be used to open stimuli
files generated from the reference C models and convert them into corresponding
AXI4-Stream transactions.
a. Add define macro for the stimuli file name and directory path
define STIMULI_FILE_NAME<path><filename>.
b. Comment-out/remove the following line:
MST.is_ramp_gen(`C_ACTIVE_ROWS, `C_ACTIVE_COLS, 2);
and replace with the following line:
MST.use_file(`STIMULI_FILE_NAME);
For information on how to generate stimuli files, see Chapter 4, C Model Reference.
• axi4s_video_slv
The AXI4-Stream slave module, which acts as a passive slave to provide handshake
signals for the AXI4-Stream transactions from the core output, can be used to open the
data files generated from the reference C model and verify the output from the core.
a. Add define macro for the golden file name and directory path
define GOLDEN_FILE_NAME “<path><filename>”.
b. Comment out the following line:
SLV.is_passive;
and replace with the following line:
SLV.use_file(`GOLDEN_FILE_NAME);
For information on how to generate golden files, see Chapter 4, C Model Reference.
• ce_gen
Simulation
A highly parameterizable test bench was used to test the RGB to YCrCb Color-Space
Converter core. Testing included the following:
• Register accesses
• Processing multiple frames of data
• AXI4-Stream bidirectional data-throttling tests
• Testing detection, and recovery from various AXI4-Stream framing error scenarios
• Testing different ACLKEN and ARESETn assertion scenarios
• Testing of various frame sizes
• Varying parameter settings
Hardware Testing
The RGB to YCrCb Color-Space Converter core has been validated in hardware at Xilinx to
represent a variety of parameterizations, including the following:
• A test design was developed for the core that incorporated a MicroBlaze™ processor,
AXI4-Lite interconnect and various other peripherals. The software for the test system
included pre-generated input and output data along with live video stream. The
MicroBlaze processor was responsible for:
° Reporting the Pass/Fail status of the test and any errors that were found
Interoperability
The Core uses AXI4-Stream interfaces that are compliant to the AXI4-Stream Video Protocol
as described in the Video IP: AXI Feature Adoption section of the (UG1037) AXI Reference
Guide [Ref 1]. The core slave (input) AXI4-Stream interface can work directly with any Video
core which produces RGB data compliant with the AXI4-Stream video protocol specification.
The core master (output) interface can work directly with any Video core which consumes
YUV 4:4:4 (YCrCb 4:4:4) data and is compliant with the AXI4-Stream Video Protocol
specification.
Parameter Changes
There are no parameter changes for this core.
Port Changes
There are no port changes for this core.
Other Changes
From version v7.0 to v7.1 of the RGB2YCrCb core the following significant changes took
place:
Debugging
This appendix includes details about resources available on the Xilinx Support website and
debugging tools.
Documentation
This product guide is the main document associated with the RGB to YCrCB Color-Space
Converter core. This guide, along with documentation related to all products that aid in the
design process, can be found on the Xilinx Support web page or by using the Xilinx
Documentation Navigator.
Download the Xilinx Documentation Navigator from the Downloads page. For more
information about this tool and the features available, open the online help after
installation.
Answer Records
Answer Records include information about commonly encountered problems, helpful
information on how to resolve these problems, and any known issues with a Xilinx product.
Answer Records are created and maintained daily ensuring that users have access to the
most accurate information available.
Answer Records for this core are listed below, and can also be located by using the Search
Support box on the main Xilinx support web page. To maximize your search results, use
proper keywords such as
• Product name
• Tool message(s)
• Summary of the issue encountered
A filter search is available after results are returned to further target the results.
AR 54530
Technical Support
Xilinx provides technical support in the Xilinx Support web page for this LogiCORE™ IP
product when used as described in the product documentation. Xilinx cannot guarantee
timing, functionality, or support if you do any of the following:
• Implement the solution in devices that are not defined in the documentation.
• Customize the solution beyond that allowed in the product documentation.
• Change any section of the design labeled DO NOT MODIFY.
Xilinx provides premier technical support for customers encountering issues that require
additional assistance.
To contact Xilinx Technical Support, navigate to the Xilinx Support web page.
1. Open a WebCase by selecting the WebCase link located under Support Quick Links.
• A block diagram of the video system that explains the video source, destination and IP
(custom and Xilinx) used.
Note: Access to WebCase is not available in all cases. Please login to the WebCase tool to see your
specific support options.
Debug Tools
There are many tools available to address RGB to YCrCB Color-Space Converter core design
issues. It is important to know which tools are useful for debugging various situations.
The Vivado lab tools logic analyzer is used to interact with the logic debug LogiCORE IP
cores, including:
See Vivado Design Suite User Guide: Programming and Debugging (UG908).
Reference Boards
Various Xilinx development boards support RGB to YCrCB Color-Space Converter. These
boards can be used to prototype designs and establish that the core can communicate with
the system.
° KC705
° KC724
C Model Reference
See C Model Reference in this guide for tips and instructions for using the provided C model
files to debug your design.
Hardware Debug
Hardware issues can range from link bring-up to problems seen after hours of testing. This
section provides debug steps for common issues. The Vivado lab tools are a valuable
resource to use in hardware debug. The signal names mentioned in the following individual
sections can be probed using the Vivado lab tools for debugging the specific problems.
General Checks
Ensure that all the timing constraints for the core were properly incorporated from the
example design and that all constraints were met during implementation.
• Does it work in post-place and route timing simulation? If problems are seen in
hardware but not in timing simulation, this could indicate a PCB issue. Ensure that all
clock sources are active and clean.
• If using MMCMs in the design, ensure that all MMCMs have obtained lock by
monitoring the LOCKED port.
• If your outputs go to 0, check your licensing.
Flag BYPASS (bit 4 of the CONTROL register) can turn bypass on (1) or off, when the core
instance Debugging Features were enabled at generation. Within the IP this switch controls
multiplexers in the AXI4-Stream path.
In bypass mode the core processing function is bypassed, and the core repeats AXI4-Stream
input samples on its output.
Starting a system with all processing cores set to bypass, then by turning bypass off from the
system input towards the system output allows verification of subsequent cores with known
good stimuli.
Flag TEST_PATTERN (bit 5 of the CONTROL register) can turn test-pattern generation on (1)
or off, when the core instance Debugging Features were enabled at generation. Within the
IP this switch controls multiplexers in the AXI4-Stream path, switching between the regular
core processing output and the test-pattern generator. When enabled, a set of counters
generate 256 scan-lines of color-bars, each color bar 64 pixels wide, repetitively cycling
through Black, Green, Blue, Cyan, Red, Yellow, Magenta, and White colors till the end of each
scan-line. After the Color-Bars segment, the rest of the frame is filled with a monochrome
horizontal and vertical ramp.
Starting a system with all processing cores set to test-pattern mode, then by turning
test-pattern generation off from the system output towards the system input allows
successive bring-up and parameterization of subsequent cores.
Throughput Monitors
Throughput monitors enable monitoring processing performance within the core. This
information can be used to help debug frame-buffer bandwidth limitation issues, and if
possible, allow video application software to balance memory pathways.
Often times video systems, with multiport access to a shared external memory, have
different processing islands. For example, a pre-processing sub-system working in the input
video clock domain may clean up, transform, and write a video stream, or multiple video
streams to memory. The processing sub-system may read the frames out, process, scale,
encode, then write frames back to the frame buffer, in a separate processing clock domain.
Finally, the output sub-system may format the data and read out frames locked to an
external clock.
The SYSDEBUG0 (0x0014) (or Frame Throughput Monitor) indicates the number of frames
processed since power-up or the last time the core was reset. The SYSDEBUG1 (0x0018), or
Line Throughput Monitor, register indicates the number of lines processed since power-up
or the last time the core was reset. The SYSDEBUG2 (0x001C), or Pixel Throughput Monitor,
register indicates the number of pixels processed since power-up or the last time the core
was reset.
Priorities of memory access points can be modified by the application software dynamically
to equalize frame, or partial frame rates.
Interface Debug
AXI4‐Lite Interfaces
Table C-1 describes how to troubleshoot the AXI4-Lite interface.
Assuming the AXI4-Lite interface works, the second step is to bring up the AXI4-Stream
interfaces.
AXI4‐Stream Interfaces
Table C-2 describes how to troubleshoot the AXI4-Stream interface.
If the AXI4-Stream communication is healthy, but the data seems corrupted, the next step is
to find the correct configuration for this core.
Other Interfaces
Table C-3 describes how to troubleshoot third-party interfaces.
Xilinx Resources
For support resources such as Answers, Documentation, Downloads, and Forums, see Xilinx
Support.
http:/
For a comprehensive listing of Video and Imaging application notes, white papers,
reference designs and related IP cores, see the Video and Imaging Resources page at:
http://www.xilinx.com/esp/video/refdes_listing.htm#ref_des.
References
These documents provide supplemental material useful with this user guide:
Revision History
The following table shows the revision history for this document.