📄 anc_edh_processor.vhd
字号:
--------------------------------------------------------------------------------
-- anc_edh_processor.vhd
--
-- ANC & EDH 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:
-- video_decode
-- edh_crc
-- edh_loc
-- edh_flags
-- anc_rx
-- edh_errcnt
-- edh_loc
-- edh_gen
-- anc_demux
-- anc_mux
--
--------------------------------------------------------------------------------
--
-- This module instances and interconnects the various modules that make up the
-- ANC and EDH processors. The video_decode module from XAPP625 is also
-- instanced.
--
-- This module calculates CRC checkwords for each field of the input video
-- stream. It finds the EDH packets in the input video stream, if they are
-- present, and compares the calculated checkwords with the ones in the EDH
-- packets. If differences are detected, these will be noted in the error flags
-- of the EDH packet in the outgoing video stream.
--
-- For each ANC packet in the video stream, the module calculates a checksum and
-- compares it to the packet's CS word. Any differences will be noted in the
-- error flags of the EDH packet in the outgoing video stream.
--
-- The module includes one instance of an anc_demux. This module will search the
-- input video stream for up to four different types of ANC packets and
-- demultiplex them to the anc_out port. Optionally, demultiplexed ANC packets
-- can be marked for deletion.
--
-- The module includes on instance of an anc_mux. This module will multiplex new
-- ANC packets into the video stream.
--
-- After the ANC packet processing, the module recalculates the CRC words for
-- each field and inserts them, along with the updated error flags, into the
-- EDH packet in the output video stream. If the input video stream did not
-- have an EDH packet, and new EDH packet is created and inserted at the
-- appropriate spot in the video stream.
--
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 anc_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
-- ANC demux inputs
en_a: in std_ulogic; -- enable for DID A decoder
did_a: in ubyte_type; -- first DID code to match
sdid_a: in ubyte_type; -- first SDID code to match
del_pkt_a: in std_ulogic; -- packet will be deleted if asserted
en_b: in std_ulogic; -- enable for DID B decoder
did_b: in ubyte_type; -- second DID code to match
sdid_b: in ubyte_type; -- second SDID code to match
del_pkt_b: in std_ulogic; -- packet will be deleted if asserted
en_c: in std_ulogic; -- enable for DID C decoder
did_c: in ubyte_type; -- third DID code to match
sdid_c: in ubyte_type; -- third SDID code to match
del_pkt_c: in std_ulogic; -- packet will be deleted if asserted
en_d: in std_ulogic; -- enable for DID D decoder
did_d: in ubyte_type; -- fourth DID code to match
sdid_d: in ubyte_type; -- fourth SDID code to match
del_pkt_d: in std_ulogic; -- packet will be deleted if asserted
-- ANC mux inputs
hanc_pkt: in std_ulogic; -- ANC packet to be sent can be inserted into HANC space
vanc_pkt: in std_ulogic; -- ANC packet to be sent can be inserted into VANC space
pkt_rdy_in: in std_ulogic; -- indicates packet has been loaded into input regs
calc_udw_parity:in std_ulogic; -- indicates that module should calculate parity on UDW
anc_in: in video_type; -- input data bus
ld_did: in std_ulogic; -- load DID register
ld_dbn: in std_ulogic; -- load SDID/DBN register
ld_dc: in std_ulogic; -- load DC register
ld_udw: in std_ulogic; -- loads the UDW RAM
udw_wr_adr: in udwadr_type; -- UDW RAM write address
-- 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 received 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
-- ANC demux outputs
anc_out: out video_type; -- output packet data
anc_out_valid: out std_ulogic; -- asserted while all words of a matching packet are on anc_out
anc_match: out -- indicates DID/SDID combination matched the current packet
std_ulogic_vector(1 downto 0);
did: out std_ulogic; -- asserted when a DID word from a matching packet is on anc_out
dbn: out std_ulogic; -- asserted when a DBN word from a matching packet is on anc_out
sdid: out std_ulogic; -- asserted when an SDID word from a matching packet is on anc_out
dc: out std_ulogic; -- asserted when a DC word from a matching packet is on anc_out
udw: out std_ulogic; -- asserted when a UDW word from a matching packet is on anc_out
cs: out std_ulogic; -- asserted when a CS word from a matching packet is on anc_out
-- ANC mux outputs
pkt_in_empty: out std_ulogic); -- module is ready for input packet to be loaded
end;
architecture synth of anc_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_edh_packet: std_ulogic; -- asserted when edh packet is to be generated
signal dmux_vid: video_type; -- video out of anc_demux
signal dmux_trs: std_ulogic; -- trs output of anc_demux
signal dmux_f: std_ulogic; -- f output of anc_demux
signal dmux_v: std_ulogic; -- v output of anc_demux
signal dmux_h: std_ulogic; -- h output of anc_demux
signal dmux_hcnt: hpos_type; -- hcnt output of anc_demux
signal dmux_vcnt: vpos_type; -- vcnt output of anc_demux
signal dmux_sync_switch:std_ulogic; -- sync_switch output of anc_demux
signal dmux_eav_next: std_ulogic; -- eav_next output of anc_demux
signal dmux_sav_next: std_ulogic; -- sav_next output of anc_demux
signal dmux_xyz_word: std_ulogic; -- xyz_word output of anc_demux
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -