fusesocotb icon indicating copy to clipboard operation
fusesocotb copied to clipboard

"Quick'n'dirty FuseSoC+cocotb example" gives compile errors

Open stdefeber opened this issue 1 year ago • 4 comments

As wannabe fusesoc user I wanted to start of with the given FuseSoc+CoCoTb example. However I got compile errors.

poetry run fusesoc library add fusesocotb https://github.com/olofk/fusesocotb
poetry run fusesoc library add fusesoc_cores https://github.com/fusesoc/fusesoc-cores
poetry run fusesoc run axis_send_packet --vcd
poetry run fusesoc run axis_send_packet --vcd
INFO: Preparing ::vlog_tb_utils:1.1-r1
INFO: Preparing ::axis_send_packet:0
iverilog -saxis_send_packet -svlog_tb_utils -c axis_send_packet_0.scr -o axis_send_packet_0
:0: error: parameter `DW` not found in `vlog_tb_utils`.
:0: error: parameter `MSG_LEN` not found in `vlog_tb_utils`.
:0: error: parameter `MSG_STR` not found in `vlog_tb_utils`.
4 error(s) during elaboration.
make: *** [Makefile:8: axis_send_packet_0] Error 4

Environment:

  • Ubuntu 23.10
  • Icarus Verilog version 12.0 (stable)
  • Poetry (version 1.8.2)

Installed packages via poetry:

  • python = ">=3.9,<4"
  • wheel = "^0.38.4"
  • cocotb = "1.7.2"
  • cocotb-bus = "^0.2.0"
  • cocotb-test = "0.2.2"
  • fusesoc=">=1.10"

I found that the parameters are defined "axis_send_packet.v"

parameter DW = 8,
parameter MSG_LEN = 2,
parameter MSG_STR = "aa"

What am I missing/doing wrong ?

br,

ST

stdefeber avatar Jun 14 '24 07:06 stdefeber

One step futher.

parameters DW, MSG_LEN and MSG_STR are indeed no part of vlog_tb_utils.

Running the example with:

fusesoc run axis_send_packet --vcd

still gives compile errors:

poetry run fusesoc run axis_send_packet --vcd

However:

poetry run fusesoc run axis_send_packet --MSG_LEN=11 --MSG_STR=hello_world

Gives a pass. However I got no VCD file. Which is obvious since this is taken care of in vlog_tb_utils.

stdefeber avatar Jun 14 '24 08:06 stdefeber

This was caused by a change in Icarus Verilog where a previous warning now is an error. I just filed https://github.com/steveicarus/iverilog/issues/1137 in the hope that this can be downgraded to a warning again. We can add a workaround in the meantime, but they will be a bit more clunky compared to the current solution.

Long term there should be syntax in FuseSoC to select which parameters that goes to which toplevel, but there are other things that are of higher priority to fix. A quick workaround is to change the toplevel line from toplevel : [axis_send_packet, vlog_tb_utils] to toplevel : axis_send_packet but that will also not give you a VCD.

I will come up with a better temporary workaround soon.

olofk avatar Jun 14 '24 18:06 olofk

I pushed some fixes now. Please let me know if those solve your issues.

olofk avatar Jun 14 '24 19:06 olofk

The fix works.

Isn't it possible to have the vlog_tb_utils as an include file ?

stdefeber avatar Jun 17 '24 06:06 stdefeber

Yes, it could be an include file, but that's not how it is currently implemented. Either way, closing now.

olofk avatar Aug 22 '24 11:08 olofk