Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array data not written to the FST file #852

Closed
m-kru opened this issue Feb 27, 2024 · 3 comments
Closed

Array data not written to the FST file #852

m-kru opened this issue Feb 27, 2024 · 3 comments
Assignees
Labels

Comments

@m-kru
Copy link

m-kru commented Feb 27, 2024

I have some testbench with following declarative part:

architecture test of tb_writeb is

  signal clk : std_logic := '1';

  signal ck : checker_t := init;
  signal iface : interface_t := init;

  constant ADDR : unsigned(31 downto 0) := x"00000000";
  constant DATA : data_array_t := (
    x"01234567", x"89ABCDEF", x"DAEDBEEF", x"F0F0F0F0"
  );

  signal written_data : data_array_t(0 to 3);

  signal write_done : boolean := false;

begin

The data_arary_t is defined in a separate package as type data_array_t is array (natural range <>) of std_logic_vector(31 downto 0);. In the output .fst file I cannot find ADDR, DATA, and written_data. ADDR and DATA are constants so their absence is not a big deal. However, the written_data is a signal and it would be really nice to have a possibility to display it on a waveform.

@nickg
Copy link
Owner

nickg commented Feb 27, 2024

The --dump-arrays option should do that:

     --dump-arrays
             Include memories and nested arrays in the waveform data.  This is
             disabled by default as it can have significant performance, mem‐
             ory, and disk space overhead.

@m-kru
Copy link
Author

m-kru commented Feb 27, 2024

It indeed works. However, I observe some weird behavior.

  type data_array_t is array (natural range <>) of std_logic_vector(31 downto 0);

  type mock_completer_t is record
    -- Configuration elements
    prefix : string; -- Optional prefix used in report messages.
    -- Internal elements
    memory : data_array_t;
    -- Statistics elements
    read_count  : natural; -- Number of read transfers.
    write_count : natural; -- Number of write transfers.
  end record;

  function init (memory_size: natural; prefix: string := "apb: mock completer: ") return mock_completer_t is
    variable mc : mock_completer_t(prefix(0 to prefix'length-1), memory(0 to memory_size - 1));
  begin
    mc.prefix := prefix;
    return mc;
  end function;

  signal mc : mock_completer_t := init(memory_size => 8);

I would expect the mc.memory array to have 8 elements. However, the gtkwave shows 256 elements.

image

@nickg
Copy link
Owner

nickg commented Feb 27, 2024

I would expect the mc.memory array to have 8 elements. However, the gtkwave shows 256 elements.

Yes this is a bug.

@nickg nickg self-assigned this Feb 27, 2024
@nickg nickg added the wave label Feb 27, 2024
@nickg nickg closed this as completed in c258c7c Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants