esynr3z / corsair

Control and Status Register map generator for HDL projects
https://corsair.readthedocs.io
MIT License
97 stars 35 forks source link

Queue read not working when FIFO is ready in advance #32

Closed arnfol closed 1 year ago

arnfol commented 1 year ago

Queue q hardware interface with ro access misses read when data is already available. Tested on vhdl target.

The waves: image

Here, zeros are read instead of FFFEFF+ or 000164+. That happens because of:

rvalid_drv <=
    csr_prediction_prediction_rvalid_ff when (csr_prediction_ren = '1') else
    rvalid_ff;
arnfol commented 1 year ago

After observing the q interface more closely I think it is a strange abomination of AXI-Stream and FIFO interfaces.

I would expect FIFO interface to never wait for !empty/rvalid when reading, but rather signal an underflow. Like in this picture: image The case of underflow could, and probably should be solved by adding an additional interrupt register to the regmap manually and connecting it to external logic.

On the other hand, AXI-Stream interface would rise and hold ready/ren and wait for data to appear (the current interface only ticks ren).

I think it would be beneficial to support both FIFO and AXI-Stream interfaces.

arnfol commented 1 year ago

Dublicates #7