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.

29 lines
876 B

  1. DESIGN_NAME := blink
  2. LIB_SRC := ../../lib/rtl_components.vhd ../../lib/sim_components.vhd
  3. RTL_SRC := ../../lib/user_components.vhd ../rtl/${DESIGN_NAME}.vhd
  4. SIM_SRC := tb_${DESIGN_NAME}.vhd
  5. SIM_FLAGS := --std=08 -fpsl --workdir=work
  6. .PHONY: all compile sim clean
  7. all: sim
  8. compile: tb_${DESIGN_NAME}
  9. tb_${DESIGN_NAME}: ${LIB_SRC} ${RTL_SRC} ${SIM_SRC} | work
  10. @echo "Analyze gatemate library ..."
  11. ghdl -a ${SIM_FLAGS} --work=gatemate ${LIB_SRC}
  12. @echo "Analyze testbench & design ..."
  13. ghdl -a ${SIM_FLAGS} -Pwork ${RTL_SRC} ${SIM_SRC}
  14. @echo "Elaborate testbench & design ..."
  15. ghdl -e ${SIM_FLAGS} -Pwork $@
  16. sim: tb_${DESIGN_NAME}
  17. @echo "Run testbench ..."
  18. ghdl -r ${SIM_FLAGS} -Pwork tb_${DESIGN_NAME} --assert-level=error --wave=tb_${DESIGN_NAME}.ghw
  19. work:
  20. mkdir $@
  21. clean:
  22. @echo "Cleaning simulation files ..."
  23. rm -rf tb_${DESIGN_NAME} *.o work/