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

📄 test_edh.vhd

📁 XAPP299 version 1.0 reference design files
💻 VHD
📖 第 1 页 / 共 5 页
字号:
                    severity error;
                     
                assert (std_locked = dly_std_locked)
                    report "std_locked output doesn't match video decoder's output"
                    severity error;

                assert (f = dly_f)
                    report "f output doesn't match video decoder's output"
                    severity error;
                    
                assert (v = dly_v)
                    report "v output doesn't match video decoder's output"
                    severity error;
                    
                assert (h = dly_h)
                    report "h output doesn't match video decoder's output"
                    severity error;
                    
                assert (hcnt = dly_hcnt)
                    report "hcnt output doesn't match video decoder's output"
                    severity error;
                    
                assert (vcnt = dly_vcnt)
                    report "vcnt output doesn't match video decoder's output"
                    severity error;
                    
                assert (sync_switch = dly_sync_switch)
                    report "sync_switch output doesn't match video decoder's output"
                    severity error;
                    
                assert (eav_next = dly_eav_next)
                    report "eav_next output doesn't match video decoder's output"
                    severity error;
                    
                assert (sav_next = dly_sav_next)
                    report "sav_next output doesn't match video decoder's output"
                    severity error;
                    
                assert (xyz_word = dly_xyz_word)
                    report "xyz_word output doesn't match video decoder's output"
                    severity error;
                    
                assert (anc_next = dly_anc_next)
                    report "anc_next output doesn't match video decoder's output"
                    severity error;

                assert (edh_next = dly_edh_next)
                    report "edh_next output doesn't match video decoder's output"
                    severity error;
            end if;
        end if;
    end process;    

    --
    -- This clode checks that the vid_out signal matches the video out of the video
    -- decoder during the active portions of the video display. The edh_processor
    -- should never modify the active portion of the video.
    --  
    process(clk)
    begin
        if (clk'event and clk = '0') then
            if (locked = '1' and h = '0' and v = '0') then
                assert (vid_out = dly_vid)
                    report "vid_out output doesn't match video decoder's output"
                    severity error;
            end if; 
        end if;
    end process;

    --
    -- The code below verifies the formatting of the EDH packets generated by the
    -- edh_processor. Other code in this testbench verifies that the CRC values and
    -- flags are as expected. This code verifies that the CRC values and flags were
    -- formatted into an EDH packet properly and that the checksum for the EDH
    -- packet is valid.
    --
    process(clk)
    variable edh_word :     integer;
    variable edh_data :     std_ulogic_vector(7 downto 0);
    variable edh_parity :   std_ulogic;
    variable edh_expected : std_ulogic_vector(9 downto 0);
    variable edh_checksum : std_ulogic_vector(8 downto 0);

    begin
        if (clk'event and clk = '0') then
            
            if (locked = '1' and edh_next = '1') then
                edh_word := 0;
            end if;

            if (locked = '1' and edh_packet = '1') then
                case edh_word is
                    when 0 =>
                        assert (vid_out = "0000000000")
                            report "vid_out isn't equal to first word of ADF (000)"
                            severity error;
                                
                    when 1 =>
                        assert (vid_out = "1111111111")
                            report "vid_out isn't equal to second word of ADF (3FF)"
                            severity error;
                                                        
                    when 2 =>   
                        assert (vid_out = "1111111111")
                            report "vid_out isn't equal to third word of ADF (3FF)"
                            severity error;
                                                        
                    when 3 =>
                        assert (vid_out = "0111110100")
                            report "vid_out isn't equal to DID word of EDH (1F4)"
                            severity error;

                        edh_checksum := vid_out(8 downto 0);

                    when 4 =>
                        assert (vid_out = "1000000000")
                            report "vid_out isn't equal to DBN word of EDH (200)"
                            severity error;

                        edh_checksum := std_ulogic_vector(std_logic_vector(edh_checksum) 
                                        + std_logic_vector(vid_out(8 downto 0)));

                    when 5 =>
                        assert (vid_out = "0100010000")
                            report "vid_out isn't equal to DC word of EDH (110)"
                            severity error;

                        edh_checksum := std_ulogic_vector(std_logic_vector(edh_checksum)
                                         + std_logic_vector(vid_out(8 downto 0)));

                    when 6 =>
                        edh_data := (ep_ap_crc(5 downto 0) & "00");
                        edh_parity := calc_parity(edh_data);
                        edh_expected := (not edh_parity & edh_parity & edh_data);
                        edh_checksum := std_ulogic_vector(std_logic_vector(edh_checksum) 
                                        + std_logic_vector(edh_expected(8 downto 0)));

                        assert (vid_out = edh_expected)
                            report "vid_out doesn't match first AP CRC word of EDH packet"
                            severity error;

                    when 7 =>
                        edh_data := (ep_ap_crc(11 downto 6) & "00");
                        edh_parity := calc_parity(edh_data);
                        edh_expected := (not edh_parity & edh_parity & edh_data);
                        edh_checksum := std_ulogic_vector(std_logic_vector(edh_checksum) 
                                        + std_logic_vector(edh_expected(8 downto 0)));

                        assert (vid_out = edh_expected)
                            report "vid_out doesn't match second AP CRC word of EDH packet"
                            severity error;

                    when 8 =>
                        edh_data := (ep_ap_crc_valid & '0' & ep_ap_crc(15 downto 12) & "00");
                        edh_parity := calc_parity(edh_data);
                        edh_expected := (not edh_parity & edh_parity & edh_data);
                        edh_checksum := std_ulogic_vector(std_logic_vector(edh_checksum) 
                                        + std_logic_vector(edh_expected(8 downto 0)));

                        assert (vid_out = edh_expected)
                            report "vid_out doesn't match third AP CRC word of EDH packet"
                            severity error;

                    when 9 =>
                        edh_data := (ep_ff_crc(5 downto 0) & "00");
                        edh_parity := calc_parity(edh_data);
                        edh_expected := (not edh_parity & edh_parity & edh_data);
                        edh_checksum := std_ulogic_vector(std_logic_vector(edh_checksum) 
                                        + std_logic_vector(edh_expected(8 downto 0)));

                        assert (vid_out = edh_expected)
                            report "vid_out doesn't match first FF CRC word of EDH packet"
                            severity error;

                    when 10 =>
                        edh_data := (ep_ff_crc(11 downto 6) & "00");
                        edh_parity := calc_parity(edh_data);
                        edh_expected := (not edh_parity & edh_parity & edh_data);
                        edh_checksum := std_ulogic_vector(std_logic_vector(edh_checksum) 
                                        + std_logic_vector(edh_expected(8 downto 0)));
                        
                        assert (vid_out = edh_expected)
                            report "vid_out doesn't match second FF CRC word of EDH packet"
                            severity error;

                    when 11 =>
                        edh_data := (ep_ff_crc_valid & '0' & ep_ff_crc(15 downto 12) & "00");
                        edh_parity := calc_parity(edh_data);
                        edh_expected := (not edh_parity & edh_parity & edh_data);
                        edh_checksum := std_ulogic_vector(std_logic_vector(edh_checksum) 
                                        + std_logic_vector(edh_expected(8 downto 0)));
                        
                        assert (vid_out = edh_expected)
                            report "vid_out doesn't match third FF CRC word of EDH packet"
                            severity error;

                    when 12 =>
                        edh_data := ('0' & ep_anc_flags & "00");
                        edh_parity := calc_parity(edh_data);
                        edh_expected := (not edh_parity & edh_parity & edh_data);
                        edh_checksum := std_ulogic_vector(std_logic_vector(edh_checksum) 
                                        + std_logic_vector(edh_expected(8 downto 0)));
                        
                        assert (vid_out = edh_expected)
                            report "vid_out doesn't match ANC flags word of EDH packet"
                            severity error;
                                    
                    when 13 =>
                        edh_data := ('0' & ep_ap_flags & "00");
                        edh_parity := calc_parity(edh_data);
                        edh_expected := (not edh_parity & edh_parity & edh_data);
                        edh_checksum := std_ulogic_vector(std_logic_vector(edh_checksum) 
                                        + std_logic_vector(edh_expected(8 downto 0)));
                        
                        assert (vid_out = edh_expected)
                            report "vid_out doesn't match AP flags word of EDH packet"
                            severity error;
                        
                    when 14 =>
                        edh_data := ('0' & ep_ff_flags & "00");
                        edh_parity := calc_parity(edh_data);
                        edh_expected := (not edh_parity & edh_parity & edh_data);
                        edh_checksum := std_ulogic_vector(std_logic_vector(edh_checksum) 
                                        + std_logic_vector(edh_expected(8 downto 0)));
                        
                        assert (vid_out = edh_expected)
                            report "vid_out doesn't match FF flags word of EDH packet"
                            severity error;
                                     
                    when 15 =>
                        assert (vid_out = "1000000000")
                            report "vid_out doesn't match reserved word value of EDH packet"
                            severity error;

                    when 16 =>
                        assert (vid_out = "1000000000")
                            report "vid_out doesn't match reserved word value of EDH packet"
                            severity error;
                    when 17 =>
                        assert (vid_out = "1000000000")
                            report "vid_out doesn't match reserved word value of EDH packet"
                            severity error;
                    when 18 =>
                        assert (vid_out = "1000000000")
                            report "vid_out doesn't match reserved word value of EDH packet"
                            severity error;
                    when 19 =>
                        assert (vid_out = "1000000000")
                            report "vid_out doesn't match reserved word value of EDH packet"
                            severity error;
                    when 20 =>
                        assert (vid_out = "1000000000")
                            report "vid_out doesn't match reserved word value of EDH packet"
                            severity error;
                    when 21 =>
                        assert (vid_out = "1000000000")
                            report "vid_out doesn't match reserved word value of EDH packet"
                            severity error;

                    when 22 =>
                        edh_expected := (not edh_checksum(8) & edh_checksum);
                        
                        assert (vid_out = edh_expected)
                            report "vid_out doesn't match CS word of EDH packet"
                            severity error;

                    when others =>
                end case;
                edh_word := edh_word + 1;
            end if;
        end if;
    end process;

end sim;

⌨️ 快捷键说明

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