📄 test_edh.vhd
字号:
enclk <= '0';
end if;
end process;
--
-- This code generates the vid_in value that is fed into the modules. Normally,
-- vid_in is given the value of the d variable, but in somes cases it is
-- modified to create error conditions.
--
process(clk)
begin
if (clk'event and clk = '0') then
vid_in <= d;
--
-- During the first EDH packet of frame 2, the AP CRC value is
-- modified to create a CRC error.
--
if (frames = 2) then
if (i = (FIRST_EDH + AP_CRC_WORD0)) then
vid_in <= "1011010100"; -- 0x2d4
elsif (i = (FIRST_EDH + FF_FLAG_WORD)) then
vid_in <= "0100000100"; -- 0x104
elsif (i = (FIRST_EDH + CS_WORD)) then
vid_in <= "1001001000"; -- 0x248
end if;
--
-- During the second EDH packet of frame 3, the EDH packet's checksum
-- value is modified to create a checksum error.
--
elsif (frames = 3) then
if (i = (SECOND_EDH + CS_WORD)) then
vid_in <= "1000000000"; --0x200
end if;
--
-- During the first EDH packet of frame 4, the EDH packet is removed
-- from the video stream to create an EDH packet missing error.
--
elsif (frames = 4) then
if (i >= FIRST_EDH and i <= (FIRST_EDH + CS_WORD)) then
if (i - ((i / 2) * 2) = 0) then
vid_in <= "1000000000"; -- 0x200
else
vid_in <= "0001000000"; -- 0x040
end if;
end if;
--
-- During the second field of frame 5, introduce an EDH packet format
-- error by changing the value of the DBN word.
--
elsif (frames = 5) then
if (i = (SECOND_EDH + DBN_WORD)) then
vid_in <= "1000000100"; --0x204;
elsif (i = (SECOND_EDH + CS_WORD)) then
vid_in <= "0101101100"; --0x16c;
end if;
--
-- During the first field of frame 6, one video data word in the
-- inactive portion of the video is modified to create a FF CRC error.
-- The corrupted word is part of an ANC packet. This also causes a
-- ANC EDH error because the checksum for the ANC packet will be
-- wrong.
--
-- During the second EDH packet of frame 6, the AP EDH bit is set in
-- the EDH packet.
--
elsif (frames = 6) then
if (i = 5156) then
vid_in <= d xor "0000000001";
elsif (i = (SECOND_EDH + AP_FLAG_WORD)) then
vid_in <= "0100000100"; --0x104;
elsif (i = (SECOND_EDH + CS_WORD)) then
vid_in <= "1001101100"; --0x26c;
end if;
--
-- During the first EDH packet of frame 7, the ANC EDH bit is set in
-- the EDH packet.
--
-- During the second EDH packet of frame 7, the parity bit of one of
-- the words of the packet is forced to an incorrect value to generate
-- a parity error.
--
elsif (frames = 7) then
if (i = (FIRST_EDH + ANC_FLAG_WORD)) then
vid_in <= "0100000100"; --0x104;
elsif (i = (FIRST_EDH + CS_WORD)) then
vid_in <= "0101000100"; --0x144;
elsif (i = (SECOND_EDH + AP_CRC_WORD2)) then
vid_in <= "0110001000"; --0x188;
elsif (i = (SECOND_EDH + CS_WORD)) then
vid_in <= "1001101000"; --0x268;
end if;
end if;
end if;
end process;
--
-- This code generates the local error flag inputs to the EDH processor.
--
process(packet)
begin
anc_idh_local <= '0';
anc_ues_local <= '0';
ap_idh_local <= '0';
ff_idh_local <= '0';
case packet is
when 2 => anc_idh_local <= '1';
when 3 => anc_ues_local <= '1';
when 5 => ap_idh_local <= '1';
when 6 => ff_idh_local <= '1';
when 9 =>
anc_idh_local <= '1';
anc_ues_local <= '1';
when 10 =>
ap_idh_local <= '1';
ff_idh_local <= '1';
when others =>
end case;
end process;
--
-- This code generates the expected values that will be compared with the
-- actual values generated by the EDH processor.
--
process(edh_packet)
begin
if (edh_packet'event and edh_packet = '0') then
if (packet = 0) then
check_flags <= false;
else
check_flags <= true;
end if;
case packet is
when 1 =>
expected_rx_ap_flags <= "00000";
expected_rx_ff_flags <= "00000";
expected_rx_anc_flags <= "00000";
expected_ap_flags <= "00000";
expected_ff_flags <= "00000";
expected_anc_flags <= "00000";
expected_chksum_err <= '0';
expected_edh_missing <= '0';
expected_parity_err <= '0';
expected_format_err <= '0';
when 2 =>
expected_rx_ap_flags <= "00000";
expected_rx_ff_flags <= "00000";
expected_rx_anc_flags <= "00000";
expected_ap_flags <= "00000";
expected_ff_flags <= "00000";
expected_anc_flags <= "00100"; -- ANC IDH
expected_chksum_err <= '0';
expected_edh_missing <= '0';
expected_parity_err <= '0';
expected_format_err <= '0';
when 3 =>
expected_rx_ap_flags <= "00000";
expected_rx_ff_flags <= "00000";
expected_rx_anc_flags <= "00000";
expected_ap_flags <= "00000";
expected_ff_flags <= "00000";
expected_anc_flags <= "10000"; -- ANC UES
expected_chksum_err <= '0';
expected_edh_missing <= '0';
expected_parity_err <= '0';
expected_format_err <= '0';
when 4 =>
expected_rx_ap_flags <= "00000";
expected_rx_ff_flags <= "00001"; -- FF EDH
expected_rx_anc_flags <= "00000";
expected_ap_flags <= "00001"; -- AP EDH
expected_ff_flags <= "00010"; -- FF EDA
expected_anc_flags <= "00000";
expected_chksum_err <= '0';
expected_edh_missing <= '0';
expected_parity_err <= '0';
expected_format_err <= '0';
when 5 =>
expected_rx_ap_flags <= "00000";
expected_rx_ff_flags <= "00000";
expected_rx_anc_flags <= "00000";
expected_ap_flags <= "00100"; -- AP IDH
expected_ff_flags <= "00000";
expected_anc_flags <= "00000";
expected_chksum_err <= '0';
expected_edh_missing <= '0';
expected_parity_err <= '0';
expected_format_err <= '0';
when 6 =>
expected_rx_ap_flags <= "00000";
expected_rx_ff_flags <= "00000";
expected_rx_anc_flags <= "00000";
expected_ap_flags <= "00000";
expected_ff_flags <= "00100"; -- FF IDH
expected_anc_flags <= "00000";
expected_chksum_err <= '0';
expected_edh_missing <= '0';
expected_parity_err <= '0';
expected_format_err <= '0';
when 7 =>
expected_rx_ap_flags <= "00000";
expected_rx_ff_flags <= "00000";
expected_rx_anc_flags <= "00000";
expected_ap_flags <= "00000";
expected_ff_flags <= "00000";
expected_anc_flags <= "00000";
expected_chksum_err <= '1'; -- EDH checksum error
expected_edh_missing <= '0';
expected_parity_err <= '0';
expected_format_err <= '0';
when 8 =>
expected_rx_ap_flags <= "00000";
expected_rx_ff_flags <= "00000";
expected_rx_anc_flags <= "00000";
expected_ap_flags <= "10000"; -- UES
expected_ff_flags <= "10000"; -- UES
expected_anc_flags <= "10000"; -- UES
expected_chksum_err <= '0';
expected_edh_missing <= '1'; -- missing EDH packet
expected_parity_err <= '0';
expected_format_err <= '0';
when 9 =>
expected_rx_ap_flags <= "00000";
expected_rx_ff_flags <= "00000";
expected_rx_anc_flags <= "00000";
expected_ap_flags <= "00000";
expected_ff_flags <= "00000";
expected_anc_flags <= "10100"; -- IDH, UES
expected_chksum_err <= '0';
expected_edh_missing <= '0';
expected_parity_err <= '0';
expected_format_err <= '0';
when 10 =>
expected_rx_ap_flags <= "00000";
expected_rx_ff_flags <= "00000";
expected_rx_anc_flags <= "00000";
expected_ap_flags <= "00100"; -- AP IDH
expected_ff_flags <= "00100"; -- FF IDH
expected_anc_flags <= "00000";
expected_chksum_err <= '0';
expected_edh_missing <= '0';
expected_parity_err <= '0';
expected_format_err <= '0';
when 11 =>
expected_rx_ap_flags <= "00000";
expected_rx_ff_flags <= "00000";
expected_rx_anc_flags <= "00000";
expected_ap_flags <= "10000"; -- AP UES
expected_ff_flags <= "10000"; -- FF UES
expected_anc_flags <= "10000"; -- ANC UES
expected_chksum_err <= '0';
expected_edh_missing <= '0';
expected_parity_err <= '0';
expected_format_err <= '1'; -- EDH packet format error
when 12 =>
expected_rx_ap_flags <= "00000";
expected_rx_ff_flags <= "00000";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -