Examples of using cocotb for functional verification of VHDL designs with GHDL.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.4 KiB

  1. # Default test
  2. DUT ?= aes
  3. # Path to ext deps
  4. EXT := ../ext
  5. ifeq (${DUT}, wishbone)
  6. TOPLEVEL := wishboneslavee
  7. SIM_ARGS := -gSimulation=true \
  8. -gAddressWidth=8 \
  9. -gDataWidth=16
  10. else
  11. TOPLEVEL := ${DUT}
  12. endif
  13. ifeq (check, $(firstword $(MAKECMDGOALS)))
  14. ifeq (FIX, $(lastword $(MAKECMDGOALS)))
  15. RUFF_ARGS := --fix
  16. endif
  17. endif
  18. .PHONY:
  19. FIX:
  20. @#
  21. # Cocotb related
  22. MODULE := tb_${DUT}
  23. COCOTB_LOG_LEVEL := DEBUG
  24. CUSTOM_COMPILE_DEPS := results
  25. COCOTB_RESULTS_FILE := results/${MODULE}.xml
  26. # Simulator & RTL related
  27. SIM ?= ghdl
  28. TOPLEVEL_LANG := vhdl
  29. VHDL_SOURCES_libvhdl := ${EXT}/libvhdl/common/UtilsP.vhd
  30. VHDL_SOURCES := ${EXT}/libvhdl/syn/* \
  31. ${EXT}/cryptocores/aes/rtl/vhdl/*.vhd
  32. SIM_BUILD := build
  33. ifeq (${SIM}, ghdl)
  34. COMPILE_ARGS := --std=08
  35. SIM_ARGS += \
  36. --wave=results/${MODULE}.ghw \
  37. --psl-report=results/${MODULE}_psl.json \
  38. --vpi-trace=results/${MODULE}_vpi.log
  39. else
  40. EXTRA_ARGS := --std=08
  41. VHDL_LIB_ORDER := libvhdl
  42. endif
  43. check format:
  44. ifneq (, $(shell which ruff))
  45. ruff $@ *.py $(RUFF_ARGS)
  46. else
  47. @echo "ERROR: ruff not found"; exit 1
  48. endif
  49. ifneq (, $(shell which cocotb-config))
  50. include $(shell cocotb-config --makefiles)/Makefile.sim
  51. else
  52. $(warning WARNING: cocotb not found)
  53. endif
  54. results:
  55. mkdir -p results
  56. clean::
  57. rm -rf *.o __pycache__ uarttx uartrx wishboneslavee aes results $(SIM_BUILD)
  58. .PHONY: clean check format FIX