olofk / fusesocotb

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

fusesoc gives KeyError in combination with ghdl and cocotb #6

Open stdefeber opened 3 weeks ago

stdefeber commented 3 weeks ago

Prerequisites: Environment:

    Ubuntu 23.10
    ghdl 4.1.0
    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"

Objective

I am trying to reproduce:

Please see attached file.

rtl_project.zip

Error

$> poetry run fusesoc run :ip:blinky:0
INFO: Preparing :ip:blinky:0
Traceback (most recent call last):
  File "/home/user/.cache/pypoetry/virtualenvs/es-flow-9GypTbdv-py3.12/bin/fusesoc", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/user/.cache/pypoetry/virtualenvs/es-flow-9GypTbdv-py3.12/lib/python3.12/site-packages/fusesoc/main.py", line 672, in main
    fusesoc(args)
  File "/home/user/.cache/pypoetry/virtualenvs/es-flow-9GypTbdv-py3.12/lib/python3.12/site-packages/fusesoc/main.py", line 662, in fusesoc
    args.func(fs, args)
  File "/home/user/.cache/pypoetry/virtualenvs/es-flow-9GypTbdv-py3.12/lib/python3.12/site-packages/fusesoc/main.py", line 316, in run
    edam_file, backend = fs.get_backend(core, flags, args.backendargs)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.cache/pypoetry/virtualenvs/es-flow-9GypTbdv-py3.12/lib/python3.12/site-packages/fusesoc/fusesoc.py", line 170, in get_backend
    return edam_file, backend_class(
                      ^^^^^^^^^^^^^^
  File "/home/user/.cache/pypoetry/virtualenvs/es-flow-9GypTbdv-py3.12/lib/python3.12/site-packages/edalize/flows/edaflow.py", line 291, in __init__
    self.configure_tools(self.flow)
  File "/home/user/.cache/pypoetry/virtualenvs/es-flow-9GypTbdv-py3.12/lib/python3.12/site-packages/edalize/flows/sim.py", line 41, in configure_tools
    (opt, val) = cocotb_options[tool]
                 ~~~~~~~~~~~~~~^^^^^^
KeyError: 'ghdl'

How to reproduce

poetry run fusesoc library update

Check the cores

poetry run fusesoc core list
poetry run fusesoc run :ip:blinky:0

I have also included a Makefile in the "verification" directory.

The simulation can be started with

poetry run make -f MakefileSim MODULE=tc01
stdefeber commented 2 weeks ago

I managed to get it running, however I needed to combine helper functions from chuckb's alchitry-au-fusesoc repo.

alchitry-au-fusesoc

The downside of this solution is that is seems that ghdl -r is run twice. So when you are expecting a vcd file, cause you configured fusesoc that way, you'll end up with an empty wave file.