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

AvalonPkts empty handling does not support all symbol sizes #48

Open
Eirikalb opened this issue Apr 21, 2022 · 0 comments
Open

AvalonPkts empty handling does not support all symbol sizes #48

Eirikalb opened this issue Apr 21, 2022 · 0 comments

Comments

@Eirikalb
Copy link

Eirikalb commented Apr 21, 2022

I have an application where I want to use 16 bit symbol size and a 128 bit wide bus. This should in theory result in 8 symbols and thus a 3 bit empty signal. This is also what I assume is configured when configuring if I set ``dataBitsPerSymbol:16`.

from cocotb_bus.drivers.avalon import AvalonSTPkts
self.stream_in = AvalonSTPkts(
       dut, "streamin", dut.clk, config={"dataBitsPerSymbol": 16, "firstSymbolInHighOrderBits": True}
)

So I believe that my empty signal is correctly sized to 3 bits. When trying to send packets of lets say 64 bits, so that would be 4 symbols, giving 4 empty, cocotb tries to set empty to 12.

INFO:cocotb: 20290.00ns INFO     random_big_range_small_size_test failed
INFO:cocotb:                     Traceback (most recent call last):
INFO:cocotb:                       File "/home/eirikalb/GitHub/zivid-sdk/fpga/m017_image_compressor/tb/test_m017_image_compressor.py", line 94, in random_big_range_small_size_test
INFO:cocotb:                         await test_bench.send_packet(test_input)
INFO:cocotb:                       File "/usr/local/lib/python3.9/dist-packages/cocotb/decorators.py", line 255, in __await__
INFO:cocotb:                         return (yield self)
INFO:cocotb:                       File "/home/eirikalb/GitHub/zivid-sdk/fpga/m017_image_compressor/tb/m017_image_compressor_testbench.py", line 45, in send_packet
INFO:cocotb:                         await self.stream_in._driver_send(self._array_to_binstr(pixels, 16))  # pylint: disable=protected-access
INFO:cocotb:                       File "/usr/local/lib/python3.9/dist-packages/cocotb_bus/drivers/avalon.py", line 794, in _driver_send
INFO:cocotb:                         await self._send_string(pkt, sync=sync, channel=channel)
INFO:cocotb:                       File "/usr/local/lib/python3.9/dist-packages/cocotb_bus/drivers/avalon.py", line 708, in _send_string
INFO:cocotb:                         self.bus.empty.value = bus_width - len(string)
INFO:cocotb:                       File "/usr/local/lib/python3.9/dist-packages/cocotb/handle.py", line 196, in __setattr__
INFO:cocotb:                         return object.__setattr__(self, name, value)
INFO:cocotb:                       File "/usr/local/lib/python3.9/dist-packages/cocotb/handle.py", line 458, in value
INFO:cocotb:                         self._set_value(value, cocotb.scheduler._schedule_write)
INFO:cocotb:                       File "/usr/local/lib/python3.9/dist-packages/cocotb/handle.py", line 767, in _set_value
INFO:cocotb:                         raise OverflowError(
INFO:cocotb:                     OverflowError: Int value (12) out of range for assignment of 3-bit signal ('streamin_empty')
INFO:cocotb: 20290.00ns INFO     **********************************************************************************************

The error occurs on line 708, but it seems that the issue is that when sending, the symbol size is not fully taken into consideration giving a bus length of 128 / 8 bits =16 symbols rather than 128 / 16 bits = 8 symbols. Which would then obvisouly give 16-4 instead of 4.

bus_width = int(len(self.bus.data) / 8)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant