olofk / fusesocotb

Quick'n'dirty FuseSoC+cocotb example
18 stars 1 forks source link

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

Open stdefeber opened 2 weeks ago

stdefeber commented 2 weeks ago

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:

Installed packages via poetry:

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 commented 2 weeks ago

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.

olofk commented 2 weeks ago

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 commented 2 weeks ago

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

stdefeber commented 2 weeks ago

The fix works.

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