Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta Adatta ai principianti
#1,238 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Ambito
testing

Direzione di ricerca

Inizia da axi_stream_slave.vhd, nel ciclo di confronto for idx in tkeep'range all'interno di check_axi_stream, che controlla solo i bit di TDATA coperti da byte TKEEP completi. Esegui il testbench di riproduzione con data_width 4 e 12 per confermare che un MSB diverso passa il controllo. Il lavoro è completo quando MSB e tutti i bit sopra l'ultimo byte completo vengono confrontati e le configurazioni a 4, 8, 12 e 16 bit falliscono come previsto. Scegli prima con i maintainer una delle due correzioni proposte.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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()
Lingua principale
VHDL
Stelle
850
Fork
305
Merge medio
2g 10h
PR unite (30g)
7

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di VUnit/vunit

Tutte le issue di VUnit/vunit

Issue simili

Altre issue su Testing & QA

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.