📄 edh_processor.vhd
字号:
--------------------------------------------------------------------------------
-- edh_processor.v
--
-- EDH packet processor
--
--
--
-- Author: John F. Snow
-- Staff Applications Engineer
--
-- Video Applications
-- Advanced Products Group
-- Xilinx, Inc.
--
-- Copyright (c) 2002 Xilinx, Inc.
-- All rights reserved
--
-- Date: May 8, 2002
--
-- RESTRICTED RIGHTS LEGEND
--
-- This software has not been published by the author, and
-- has been disclosed to others for the purpose of enhancing
-- and promoting design productivity in Xilinx products.
--
-- Therefore use, duplication or disclosure, now and in the
-- future should give consideration to the productivity
-- enhancements afforded the user of this code by the author's
-- efforts. Thank you for using our products !
--
-- Disclaimer: THESE DESIGNS ARE PROVIDED "AS IS" WITH NO WARRANTY
-- WHATSOEVER AND XILINX SPECIFICALLY DISCLAIMS ANY
-- IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
-- A PARTICULAR PURPOSE, OR AGAINST INFRINGEMENT.
--
-- Revision:
-- May 8, 2002 Release
--
-- Other modules instanced in this design:
-- edh_rx
-- anc_rx
-- edh_loc
-- edh_flags
-- edh_tx
-- edh_crc
--
--------------------------------------------------------------------------------
--
-- This module instances and interconnects the various modules that make up the
-- error detection and handling (EDH) packet processor. This processor includes
-- an ANC packet checksum checker, but does not include any ANC packet mux or
-- demux functions.
--
-- EDH packets for digital component video are defined by the standards
-- ITU-R BT.1304 and SMPTE RP 165-1994. The documents define a standard method
-- of generating and inserting checkwords into the video stream. These
-- checkwords are not used for error correction. They are used to determine if
-- the video data is being corrupted somewhere in the chain of video equipment
-- processing the data. The nature of the EDH packets allows the malfunctioning
-- piece of equipment to be quickly located.
--
-- Two checkwords are defined, one for the field of active picture (AP) video
-- data words and the other for the full field (FF) of video data. Three sets of
-- flags are defined to feed forward information regarding detected errors. One
-- of flags is associated with the AP checkword, one set with the FF checkword.
-- The third set of flags identify errors detected in the ancillary data
-- checksums within the field. Implementation of this third set is optional in
-- the standards.
--
-- The two checkwords and three sets of flags for each field are combined into
-- an ancillary data packet, commonly called the EDH packet. The EDH packet
-- occurs at a fixed location, always immediately before the SAV symbol on the
-- line before the synchronous switching line. The synchronous switching lines
-- for NTSC are lines 10 and 273. For 625-line PAL they are lines 6 and 319.
--
-- Three sets of error flags outputs are provided. One set consists of the 12
-- error flags received in the last EDH packet in the input video stream. The
-- second set consists of the twelve flags sent in the last EDH packet in the
-- output video stream. A third set contains error flags related to the
-- processing of the received EDH packet such as packet_missing errors.
--
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
use ieee.numeric_std.all;
use work.anc_edh_pkg.all;
entity edh_processor is
port (
clk: in std_ulogic; -- clock input
ce: in std_ulogic; -- clock enable
rst: in std_ulogic; -- async reset input
-- video decoder inputs
vid_in: in video_type; -- input video
reacquire: in std_ulogic; -- forces autodetect to reacquire the video standard
en_sync_switch: in std_ulogic; -- enables synchronous switching
en_trs_blank: in std_ulogic; -- enables TRS blanking when asserted
-- EDH flag inputs
anc_idh_local: in std_ulogic; -- ANC IDH flag input
anc_ues_local: in std_ulogic; -- ANC UES flag input
ap_idh_local: in std_ulogic; -- AP IDH flag input
ff_idh_local: in std_ulogic; -- FF IDH flag input
errcnt_flg_en: in edh_allflg_type; -- selects which error flags increment the error counter
clr_errcnt: in std_ulogic; -- clears the error counter
receive_mode: in std_ulogic; -- 1 enables receiver, 0 for generate only
-- video and decoded video timing outputs
vid_out: out video_type; -- output video stream with EDH packets inserted
std: out vidstd_type; -- video standard code
std_locked: out std_ulogic; -- video standard detector is locked
trs: out std_ulogic; -- asserted during flywheel generated TRS symbol
field: out std_ulogic; -- field indicator
v_blank: out std_ulogic; -- vertical blanking indicator
h_blank: out std_ulogic; -- horizontal blanking indicator
horz_count: out hpos_type; -- horizontal position
vert_count: out vpos_type; -- vertical position
sync_switch: out std_ulogic; -- asserted on lines where synchronous switching is allowed
locked: out std_ulogic; -- asserted when flywheel is synchronized to video
eav_next: out std_ulogic; -- next word is first word of EAV
sav_next: out std_ulogic; -- next word is first word of SAV
xyz_word: out std_ulogic; -- current word is the XYZ word of a TRS
anc_next: out std_ulogic; -- next word is first word of a received ANC packet
edh_next: out std_ulogic; -- next word is first word of a received EDH packet
-- EDH flag outputs
rx_ap_flags: out edh_flgset_type; -- AP error flags received from last EDH packet
rx_ff_flags: out edh_flgset_type; -- FF error flags received from last EDH packet
rx_anc_flags: out edh_flgset_type; -- ANC error flags freceived from last EDH packet
ap_flags: out edh_flgset_type; -- transmitted AP error flags from last field
ff_flags: out edh_flgset_type; -- transmitted FF error flags from last field
anc_flags: out edh_flgset_type; -- transmitted ANC error flags from last field
packet_flags: out edh_pktflg_type; -- error flags related to the received packet processing
errcnt: out edh_errcnt_type; -- errored fields counter
edh_packet: out std_ulogic); -- asserted during all words of a generated EDH packet
end;
architecture synth of edh_processor is
-------------------------------------------------------------------------------
-- Signal definitions
--
signal dec_std: vidstd_type; -- video_decode std output
signal dec_std_locked: std_ulogic; -- video_decode std locked output
signal dec_vid: video_type; -- video_decode video output
signal dec_trs: std_ulogic; -- video_decode trs output
signal dec_f: std_ulogic; -- video_decode field output
signal dec_v: std_ulogic; -- video_decode v_blank output
signal dec_h: std_ulogic; -- video_decode h_blank output
signal dec_hcnt: hpos_type; -- video_decode horz_count output
signal dec_vcnt: vpos_type; -- video_decode vert_count output
signal dec_sync_switch: std_ulogic; -- video_decode sync_switch output
signal dec_locked: std_ulogic; -- video_decode locked output
signal dec_eav_next: std_ulogic; -- video_decode eav_next output
signal dec_sav_next: std_ulogic; -- video_decode sav_next output
signal dec_xyz_word: std_ulogic; -- video_decode xyz_word output
signal dec_anc_next: std_ulogic; -- video_decode anc_next output
signal dec_edh_next: std_ulogic; -- video_decode edh_next output
signal ap_crc: crc16_type; -- calculated active pic CRC
signal ap_crc_valid: std_ulogic; -- calculated active pic CRC valid signal
signal ff_crc: crc16_type; -- calculated full field CRC
signal ff_crc_valid: std_ulogic; -- calculated full field CRC valid signal
signal edh_missing: std_ulogic; -- EDH packet missing error flag
signal edh_parity_err: std_ulogic; -- EDH packet parity error flag
signal edh_chksum_err: std_ulogic; -- EDH packet checksum error flag
signal edh_format_err: std_ulogic; -- EDH packet format error flag
signal tx_edh_next: std_ulogic; -- generated EDH packet begins on next word
signal flag_bus: edh_flgset_type; -- flag bus between EDH_FLAGS and EDH_TX
signal ap_flag_word: std_ulogic; -- selects AP flags for flag bus
signal ff_flag_word: std_ulogic; -- selects FF flags for flag bus
signal anc_flag_word: std_ulogic; -- selects ANC flags for flag bus
signal rx_ap_crc_valid: std_ulogic; -- received active pic CRC valid signal
signal rx_ap_crc: crc16_type; -- received active pic CRC
signal rx_ff_crc_valid: std_ulogic; -- received full field CRC valid signal
signal rx_ff_crc: crc16_type; -- received full field CRC
signal in_ap_flags: edh_flgset_type; -- received AP flags to edh_flags
signal in_ff_flags: edh_flgset_type; -- received FF flags to edh_flags
signal in_anc_flags: edh_flgset_type; -- received ACN flags to edh_flags
signal errcnt_en: std_ulogic; -- enables error counter
signal anc_edh_local: std_ulogic; -- ANC EDH signal
signal tx_vid_out: video_type; -- video out of edh_gen
signal tx_edh_packet: std_ulogic; -- asserted when edh packet is to be generated
signal edh_all_flags : edh_allflg_type; -- flag vector for edh_errcnt module
signal anc_flags_int : edh_flgset_type; -- internal version of anc_flags output
signal ap_flags_int : edh_flgset_type; -- internal version of ap_flags output
signal ff_flags_int : edh_flgset_type; -- internal version of ff_flags output
signal GND : std_ulogic := '0';
component video_decode
port(
clk: in std_ulogic; -- clock input
ce: in std_ulogic; -- clock enable
rst: in std_ulogic; -- async reset input
vid_in: in video_type; -- input video
reacquire: in std_ulogic; -- forces autodetect to reacquire the standard
en_sync_switch: in std_ulogic; -- enables sync switching
en_trs_blank: in std_ulogic; -- enables TRS blanking
std: inout vidstd_type; -- video standard code
std_locked: inout std_ulogic; -- autodetect circuit is locked to standard
trs: out std_ulogic; -- asserted during TRS symbol
vid_out: out video_type; -- output video stream
field: out std_ulogic; -- field indicator
v_blank: out std_ulogic; -- vertical blanking indicator
h_blank: out std_ulogic; -- horizontal blanking indicator
horz_count: out hpos_type; -- horizontal counter
vert_count: out vpos_type; -- vertical counter
sync_switch: out std_ulogic; -- asserted on sync switching lines
locked: out std_ulogic; -- asserted when flywheel is synced to input video
eav_next: out std_ulogic; -- next word is first word of EAV
sav_next: out std_ulogic; -- next word is first word of SAV
xyz_word: out std_ulogic; -- current word is the XYZ word
anc_next: out std_ulogic; -- next word is first word of ANC packet
edh_next: out std_ulogic); -- next word is first word of EDH packet
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -