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.

72 lines
1.4 KiB

10 months ago
10 months ago
10 months ago
10 months ago
  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. # Cocotb related
  19. MODULE := tb_${DUT}
  20. COCOTB_LOG_LEVEL := DEBUG
  21. CUSTOM_COMPILE_DEPS := results
  22. COCOTB_RESULTS_FILE := results/${MODULE}.xml
  23. # Simulator & RTL related
  24. SIM ?= ghdl
  25. TOPLEVEL_LANG := vhdl
  26. VHDL_SOURCES_libvhdl := ${EXT}/libvhdl/common/UtilsP.vhd
  27. VHDL_SOURCES := ${EXT}/libvhdl/syn/* \
  28. ${EXT}/cryptocores/aes/rtl/vhdl/*.vhd
  29. SIM_BUILD := build
  30. ifeq (${SIM}, ghdl)
  31. COMPILE_ARGS := --std=08
  32. SIM_ARGS += \
  33. --wave=results/${MODULE}.ghw \
  34. --psl-report=results/${MODULE}_psl.json \
  35. --vpi-trace=results/${MODULE}_vpi.log
  36. else
  37. EXTRA_ARGS := --std=08
  38. VHDL_LIB_ORDER := libvhdl
  39. endif
  40. ifneq (, $(shell which cocotb-config))
  41. include $(shell cocotb-config --makefiles)/Makefile.sim
  42. else
  43. $(warning WARNING: cocotb not found)
  44. endif
  45. check format:
  46. ifneq (, $(shell which ruff))
  47. ruff $@ *.py $(RUFF_ARGS)
  48. else
  49. @echo "ERROR: ruff not found"; exit 1
  50. endif
  51. FIX:
  52. @#
  53. results:
  54. mkdir -p results
  55. clean::
  56. rm -rf *.o uarttx uartrx wishboneslavee aes results $(SIM_BUILD)
  57. cleanall:
  58. rm -rf .ruff_cache __pycache__
  59. .PHONY: clean cleanall check format FIX