vunit icon indicating copy to clipboard operation
vunit copied to clipboard

Using last item in stack using pop_stream

Open basedVecna opened this issue 3 years ago • 1 comments

I have a question about finding the last item in a stream when using pop_stream. I am using pop_stream with a uart_slave for debugging an IP, I would like to pop off the entire stream and view it.

I tried something like this:

procedure pop_off_stack(signal net : inout network_t; rx : stream_slave_t;
                  signal stack_response : out std_logic_vector(7 downto 0); constant max_stack_depth : integer; constant loop_delay : time) is
variable data : std_logic_vector(7 downto 0);
variable last : boolean := false;
begin
    stack_loop: for i in 0 to max_stack_depth loop
       if last then 
           exit;
        end if;
        pop_stream(net, rx, data, last);
        stack_response <= data;
        wait for loop_delay;
    end loop stack_loop;
end pop_off_stack;

However my simulation just hangs at the pop_stream call. Am I misunderstanding how this works?
Thanks

basedVecna avatar Jun 22 '22 10:06 basedVecna

There is no concept of "last" for a uart. If you check the uart_slave, it pushes a false to the reply message (line 46, i think - not exactly obvious...). The exit condition thus never triggers.

For uart, you either need to detect the end in the data stream or know how much you want to receive. The same way you would have to do it in SW...

eschmidscs avatar Jun 22 '22 11:06 eschmidscs