Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

axi_stream_slave: check_axi_stream does not compare TDATA bits beyond the last whole byte

オープン 初心者向け
#1,238 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
65/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
領域
testing

調査の方向性

axi_stream_slave.vhd の check_axi_stream 内の比較ループ for idx in tkeep'range から始めてください。このループは、完全な TKEEP バイトに対応する TDATA のビットしか検査していません。data_width を 4 と 12 にして再現用テストベンチを実行し、MSB が異なる場合でも通過することを確認します。MSB と、最後の完全なバイトより上のすべてのビットが比較され、4、8、12、16 ビットの構成が想定どおり失敗すれば完了です。提案されている 2 つの修正案のどちらにするかは、先にメンテナーと相談して決めてください。

索引モデルが issue の本文から書いたものです。

説明

check_axi_stream compares TDATA per TKEEP bit, i.e. byte by byte (axi_stream_slave.vhd, the loop for idx in tkeep'range). tkeep has data_length / 8 bits, so:

  • for a data width below 8 bits the loop range is empty and TDATA is not checked at all;
  • for a width that is not a multiple of 8, the bits above the last whole byte are not checked.

TLAST, TUSER, TID and TDEST are checked as expected. The loop is unchanged on master (5921757e21).

Reproduction (GHDL 6.0.0, VUnit 5.0.0.dev7): a master and a slave of the same width connected directly; the test sends all zeros and expects the most significant bit set.

sent_v                   := (others => '0');
expected_v               := (others => '0');
expected_v(data_width-1) := '1';
push_axi_stream(net, master_c, sent_v, tlast => '1');
check_axi_stream(net, slave_c, expected_v, tlast => '1', msg => "MSB differs");
data_width Result Expected
4 pass fail
8 fail fail
12 pass fail
16 fail fail

We found it through a mutation test of a Reed-Solomon encoder with 4-bit symbols: a wrong encoder passed every 4-bit configuration.

Suggested fix: compare the bits above 8 * tkeep'length unconditionally, since there is no TKEEP bit for them. Alternatively, compare the whole TDATA when data_length is not a multiple of 8.

Complete testbench and run script
library ieee;
use ieee.std_logic_1164.all;

library vunit_lib;
context vunit_lib.vunit_context;
context vunit_lib.vc_context;

entity tb_axis_width is
    generic (
        runner_cfg  : string;
        data_width  : positive := 4
    );
end entity;

architecture tb of tb_axis_width is
    constant master_c : axi_stream_master_t := new_axi_stream_master(data_length => data_width);
    constant slave_c  : axi_stream_slave_t  := new_axi_stream_slave(data_length => data_width);
    signal clk   : std_logic := '0';
    signal valid : std_logic;
    signal ready : std_logic;
    signal last  : std_logic;
    signal data  : std_logic_vector(data_width - 1 downto 0);
begin
    clk <= not clk after 5 ns;

    main : process is
        variable sent_v, expected_v : std_logic_vector(data_width - 1 downto 0);
    begin
        test_runner_setup(runner, runner_cfg);
        sent_v                   := (others => '0');
        expected_v               := (others => '0');
        -- The expected value differs from the sent value in the most significant bit only
        expected_v(data_width-1) := '1';
        push_axi_stream(net, master_c, sent_v, tlast => '1');
        check_axi_stream(net, slave_c, expected_v, tlast => '1', msg => "MSB differs");
        wait_until_idle(net, as_sync(slave_c));
        test_runner_cleanup(runner);
    end process;

    i_master : entity vunit_lib.axi_stream_master
        generic map (master => master_c)
        port map (aclk => clk, tvalid => valid, tready => ready, tdata => data, tlast => last);

    i_slave : entity vunit_lib.axi_stream_slave
        generic map (slave => slave_c)
        port map (aclk => clk, tvalid => valid, tready => ready, tdata => data, tlast => last);
end architecture;
from pathlib import Path
from vunit import VUnit

vu = VUnit.from_argv()
vu.add_vhdl_builtins()
vu.add_verification_components()
lib = vu.add_library("lib")
lib.add_source_files(Path(__file__).parent / "tb_axis_width.vhd")
tb = lib.test_bench("tb_axis_width")
for w in (4, 8, 12, 16):
    tb.add_config(name=f"w{w}", generics={"data_width": w})
vu.main()
主要言語
VHDL
スター
850
フォーク
305
平均マージ
2日 10時間
マージ済み PR(30日)
7

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

VUnit/vunit のほかの issue

VUnit/vunit の issue をすべて見る

似ている issue

Testing & QA の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。