⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_edh.vhd

📁 XAPP299 version 1.0 reference design files
💻 VHD
📖 第 1 页 / 共 5 页
字号:
                    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;
        
            if (edh_parity_err = '0' and expected_parity_err = '1') then
                write(l, expected_parity_err_str);
                writeline(output, l);
                error_found <= true;
            end if;

            if (edh_format_err = '1' and expected_format_err = '0') then
                write(l, unexpected_pkt_format_err_str);
                writeline(output, l);
                error_found <= true;
            end if;

            if (edh_format_err = '0' and expected_format_err = '1') then
                write(l, expected_pkt_format_err_str);
                writeline(output, l);
                error_found <= true;
            end if;
        end if; 
    end process;        


    --
    -- Delay registers that delay the video and video timing outputs of the video
    -- decoder so they can be compared with the outputs of the edh_processor.
    --
    process(clk)
    begin
        if (clk'event and clk = '1') then
            dly_std <= ep_dec_std;
            dly_std_locked <= ep_dec_std_locked;
            dly_vid <= ep_dec_vid;
            dly_f <= ep_dec_f;
            dly_v <= ep_dec_v;
            dly_h <= ep_dec_h;
            dly_hcnt <= ep_dec_hcnt;
            dly_vcnt <= ep_dec_vcnt;
            dly_sync_switch <= ep_dec_sync_switch;
            dly_locked <= ep_dec_locked;
            dly_eav_next <= ep_dec_eav_next;
            dly_sav_next <= ep_dec_sav_next;
            dly_xyz_word <= ep_dec_xyz_word;
            dly_anc_next <= ep_dec_anc_next;
            dly_edh_next <= ep_dec_edh_next;    
        end if;
    end process;


    --
    -- This code checks that the output video timing signals match the video
    -- decoders output signals (delayed by the delay registers above.
    --
    process(clk)
       
        variable dly_locked_err_str :   string(1 to 57) 
                                        := "locked output doesn't match video decoder's locked output";
        variable dly_std_err_str :      string(1 to 47) 
                                        := "std output doesn't match video decoder's output";
        variable dly_std_locked_err_str : string(1 to 54) 
                                        := "std_locked output doesn't match video decoder's output";
        variable dly_f_err_str :        string(1 to 54) 
                                        := "std_locked output doesn't match video decoder's output";
    begin
        if (clk'event and clk = '0') then
                
            assert (locked = dly_locked)
                report "locked output doesn't match video decoder's locked output"
                severity error;

            if (locked = '1') then
                assert (std = dly_std)
                    report "std output doesn't match video decoder's output"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -