Lösung des Praktikums Systementwurf
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.

ghdl.mk 1.2KB

1 year ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #
  2. #
  3. #
  4. #
  5. # Make sure that the top level is assigned to main
  6. $(if $(main),,\
  7. $(error Assign top level entity name to variable "main"))
  8. # Make sure that at least on vhdl source is assigned
  9. $(if $(vhdl_srcs),,\
  10. $(error Assign at least on vhdl source to variable "vhdl_srcs"))
  11. # Append prefix -d to all generics
  12. generics = $(addprefix -g,$(generics))
  13. # Add VHDL 2008 as default build standard
  14. vhdl_flags += --std=08
  15. vhdl_objs = $(vhdl_srcs:.vhd=.o)
  16. assert_level := error
  17. .PHONY: sim clean
  18. sim: ${main}
  19. @../../scripts/execute_and_highlight.sh ghdl -r ${vhdl_flags} ${main} -gCHECK_RESULTS=${CHECK_RESULTS} \
  20. --read-wave-opt=${main}.wave \
  21. --assert-level=${assert_level}
  22. gui: ${main}.ghw
  23. @echo "Viewing $<"
  24. @gtkwave $< --script=gtkwave.view
  25. ${main}.ghw: ${main} ${main}.wave
  26. @ghdl -r ${vhdl_flags} ${main} \
  27. --read-wave-opt=${main}.wave \
  28. --wave=$@
  29. ${main}: $(vhdl_objs)
  30. @echo "Elaborating ${main}"
  31. @ghdl -e ${vhdl_flags} ${main}
  32. %.o: %.vhd
  33. @echo "Analysing $<"
  34. @ghdl -a ${vhdl_flags} $<
  35. clean:
  36. @ghdl --clean
  37. @rm -rf ${main}.ghw work-obj08.cf ${vhdl_objs} ${main} ${artifacts}
  38. help:
  39. @echo Use ghdl to simulate and synthesis a vhdl design.
  40. @echo
  41. @echo Build configuration variables:
  42. @echo main main entity
  43. @echo vhdl_flags
  44. @echo generics