Übungen der VHDL-Einführung
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.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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_flags += -frelaxed-rules
  16. #vhdl_flags += --ieee-asserts=disable-at-0
  17. vhdl_objs = $(vhdl_srcs:.vhd=.o)
  18. assert_level := error
  19. .PHONY: sim clean
  20. sim: ${main}
  21. @../scripts/execute_and_highlight.sh \
  22. ghdl \
  23. -r ${vhdl_flags} ${main} \
  24. -gCHECK_RESULTS=${CHECK_RESULTS} \
  25. --read-wave-opt=${main}.wave \
  26. --assert-level=${assert_level}
  27. gui: ${main}.ghw
  28. @echo "Viewing $<"
  29. @gtkwave $< --script=gtkwave.view
  30. ${main}.ghw: ${main} ${main}.wave
  31. @ghdl -r ${vhdl_flags} ${main} \
  32. --read-wave-opt=${main}.wave \
  33. --wave=$@
  34. ${main}: $(vhdl_objs)
  35. @echo "Elaborating ${main}"
  36. @ghdl -e ${vhdl_flags} ${main}
  37. %.o: %.vhd
  38. @echo "Analysing $<"
  39. @ghdl -a ${vhdl_flags} $<
  40. clean:
  41. @ghdl --clean
  42. @rm -rf ${main}.ghw work-obj08.cf ${vhdl_objs} ${main} ${artifacts}
  43. help:
  44. @echo Use ghdl to simulate and synthesis a vhdl design.
  45. @echo
  46. @echo Build configuration variables:
  47. @echo main main entity
  48. @echo vhdl_flags
  49. @echo generics