📄 test_ae_edh.vhd
字号:
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";
expected_rx_anc_flags <= "00000";
expected_ap_flags <= "00000";
expected_ff_flags <= "00001"; -- FF EDH
expected_anc_flags <= "00001"; -- ANC EDH
expected_chksum_err <= '0';
expected_edh_missing <= '0';
expected_parity_err <= '0';
expected_format_err <= '0';
when 13 =>
expected_rx_ap_flags <= "00001"; -- AP EDH
expected_rx_ff_flags <= "00000";
expected_rx_anc_flags <= "00000";
expected_ap_flags <= "00010"; -- AP EDA
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 14 =>
expected_rx_ap_flags <= "00000";
expected_rx_ff_flags <= "00000";
expected_rx_anc_flags <= "00001"; -- ANC EDH
expected_ap_flags <= "00000";
expected_ff_flags <= "00000";
expected_anc_flags <= "00010"; -- ANC EDA
expected_chksum_err <= '0';
expected_edh_missing <= '0';
expected_parity_err <= '0';
expected_format_err <= '0';
when 15 =>
expected_rx_ap_flags <= "00000";
expected_rx_ff_flags <= "00000";
expected_rx_anc_flags <= "00000";
expected_ap_flags <= "10000";
expected_ff_flags <= "10000";
expected_anc_flags <= "10000";
expected_chksum_err <= '0';
expected_edh_missing <= '0';
expected_parity_err <= '1'; -- EDH packet parity error
expected_format_err <= '0';
when others =>
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';
end case;
end if;
end process;
--
-- This code compares the expected and received values of the flags from the
-- EDH processor. They are compared on falling edge of the H blanking signal
-- after the EDH packet is received.
--
process
variable l : line;
variable pkt_rx_str : string(1 to 12)
:= "EDH packet #";
variable pkt_rx_str2 : string(1 to 10)
:= " received.";
variable actual_str : string(1 to 9)
:= "actual = ";
variable expected_str : string(1 to 13)
:= " expected = ";
variable rxap_flg_mismatch_str: string(1 to 26)
:= " RX AP flags mismatched, ";
variable rxff_flg_mismatch_str: string(1 to 26)
:= " RX FF flags mismatched, ";
variable rxanc_flg_mismatch_str: string(1 to 27)
:= " RX ANC flags mismatched, ";
variable ap_flg_mismatch_str : string(1 to 23)
:= " AP flags mismatched, ";
variable ff_flg_mismatch_str : string(1 to 23)
:= " FF flags mismatched, ";
variable anc_flg_mismatch_str : string(1 to 24)
:= " ANC flags mismatched, ";
variable unexpected_cksum_err_str : string(1 to 48)
:= " Unexpected EDH packet checksum error detected.";
variable expected_cksum_err_str : string(1 to 54)
:= " Expected EDH packet checksum error was not detected.";
variable unexpected_pkt_missing_err_str : string(1 to 36)
:= " EDH packet missing error detected.";
variable expected_pkt_missing_err_str : string(1 to 58)
:= " Expected an EDH packet missing error, but didn't get it.";
variable unexpected_parity_err_str : string(1 to 46)
:= " Unexpected EDH packet parity error detected.";
variable expected_parity_err_str : string(1 to 54)
:= " Expected EDH packet parity error, but didn't get it.";
variable unexpected_pkt_format_err_str : string(1 to 46)
:= " Unexpected EDH packet format error detected.";
variable expected_pkt_format_err_str : string(1 to 54)
:= " Expected EDH packet format error, but didn't get it.";
begin
wait until (edh_packet'event and edh_packet = '0');
wait until (h'event and h = '0');
if (packet /= 0) then
write(l, pkt_rx_str);
write(l, packet);
write(l, pkt_rx_str2);
writeline(output, l);
end if;
if (check_flags) then
if (rx_ap_flags /= expected_rx_ap_flags) then
write(l, rxap_flg_mismatch_str);
write(l, actual_str);
hwrite(l, rx_ap_flags, left, rx_ap_flags'length);
write(l, expected_str);
hwrite(l, expected_rx_ap_flags, left, expected_rx_ap_flags'length);
writeline(output, l);
error_found <= true;
end if;
if (rx_ff_flags /= expected_rx_ff_flags) then
write(l, rxff_flg_mismatch_str);
write(l, actual_str);
hwrite(l, rx_ff_flags, left, rx_ff_flags'length);
write(l, expected_str);
hwrite(l, expected_rx_ff_flags, left, expected_rx_ff_flags'length);
writeline(output, l);
error_found <= true;
end if;
if (rx_anc_flags /= expected_rx_anc_flags) then
write(l, rxanc_flg_mismatch_str);
write(l, actual_str);
hwrite(l, rx_anc_flags, left, rx_anc_flags'length);
write(l, expected_str);
hwrite(l, expected_rx_anc_flags, left, expected_rx_anc_flags'length);
writeline(output, l);
error_found <= true;
end if;
if (ap_flags /= expected_ap_flags) then
write(l, ap_flg_mismatch_str);
write(l, actual_str);
hwrite(l, ap_flags, left, ap_flags'length);
write(l, expected_str);
hwrite(l, expected_ap_flags, left, expected_ap_flags'length);
writeline(output, l);
error_found <= true;
end if;
if (ff_flags /= expected_ff_flags) then
write(l, ff_flg_mismatch_str);
write(l, actual_str);
hwrite(l, ff_flags, left, ff_flags'length);
write(l, expected_str);
hwrite(l, expected_ff_flags, left, expected_ff_flags'length);
writeline(output, l);
error_found <= true;
end if;
if (anc_flags /= expected_anc_flags) then
write(l, anc_flg_mismatch_str);
write(l, actual_str);
hwrite(l, anc_flags, left, anc_flags'length);
write(l, expected_str);
hwrite(l, expected_anc_flags, left, expected_anc_flags'length);
writeline(output, l);
error_found <= true;
end if;
if (edh_chksum_err = '1' and expected_chksum_err = '0') then
write(l, unexpected_cksum_err_str);
writeline(output, l);
error_found <= true;
end if;
if (edh_chksum_err = '0' and expected_chksum_err = '1') then
write(l, expected_cksum_err_str);
writeline(output, l);
error_found <= true;
end if;
if (edh_missing = '1' and expected_edh_missing = '0') then
write(l, unexpected_pkt_missing_err_str);
writeline(output, l);
error_found <= true;
end if;
if (edh_missing = '0' and expected_edh_missing = '1') then
write(l, expected_pkt_missing_err_str);
writeline(output, l);
error_found <= true;
end if;
if (edh_parity_err = '1' and expected_parity_err = '0') then
write(l, unexpected_parity_err_str);
writeline(output, l);
error_found <= true;
end if;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -