## ---------------------------------------------------------------------------- ## Script : makefile ## ---------------------------------------------------------------------------- ## Author(s) : Johann Faerber, Friedrich Beckmann ## Company : University of Applied Sciences Augsburg ## ---------------------------------------------------------------------------- ## Description: This makefile allows automating design flow with ModelSim, ## it is based on a design directory structure shown at ## the end of this file. ## ---------------------------------------------------------------------------- GHDL_CMD = ghdl GHDL_OPTIONS = --std=08 --workdir=work LOG_FILE = ghdl.log ECHO_TARGET := echo "$$@" >> $(LOG_FILE) 2>&1 TIME_STAMP := echo "$$@ $$(date --iso=seconds)" >> $(LOG_FILE) 2>&1 ################################################################### # Main Targets # ################################################################### help: @echo '"make" does intentionally nothing. Type:' @echo ' "make gproject" to create a new ghdl project only' @echo ' "make compile" to compile all VHDL sources in batch mode' @echo ' "make sim" to run ghdl with the top testbench of the project' @echo ' "make wave" to display the simulation results in the time domain' @echo ' "make clean" to remove all generated files' gproject : gproject_created gproject_created : $(SOURCE_FILES) makefile.sources @echo "---- $@" >> $(LOG_FILE) 2>&1 @$(TIME_STAMP) @rm -rf ./ghdl_sources.tcl @# Create a directory work if it does not exist. Otherwise do nothing. @[ -d work ] || mkdir -p work @$(GHDL_CMD) -i $(GHDL_OPTIONS) $(SOURCE_FILES) >> $(LOG_FILE) 2>&1 @touch gproject_created compile: ./work/work-obj08.cf ./work/work-obj08.cf: gproject_created @echo "---- $@" >> $(LOG_FILE) 2>&1 @$(TIME_STAMP) @$(GHDL_CMD) -m $(GHDL_OPTIONS) t_$(PROJECT) >> $(LOG_FILE) 2>&1 sim: ./work/work-obj08.cf @echo "---- $@" >> $(LOG_FILE) 2>&1 @$(TIME_STAMP) @$(GHDL_CMD) -r $(GHDL_OPTIONS) t_$(PROJECT) --wave=t_${PROJECT}.ghw >> $(LOG_FILE) 2>&1 t_${PROJECT}.ghw: ./work/work-obj08.cf @echo "---- $@" >> $(LOG_FILE) 2>&1 @$(TIME_STAMP) @$(GHDL_CMD) -r $(GHDL_OPTIONS) t_$(PROJECT) --wave=t_${PROJECT}.ghw >> $(LOG_FILE) 2>&1 wave: t_${PROJECT}.ghw @echo "---- $@" >> $(LOG_FILE) 2>&1 @$(TIME_STAMP) @gtkwave t_${PROJECT}.ghw view_signals.gtkw >> $(LOG_FILE) 2>&1 & check-errors: less ghdl.log clean: @$(GHDL_CMD) --remove; rm -rf work*.cf work *.vcd *.ghw *.log ghdl_sources.tcl gproject_created ## ---------------------------------------------------------------------------- ## Description: ## ------------ ## assumes the following design directory structure as prerequisite ## ## DigitaltechnikPraktikum ## | ## +---src ## | and2gate_equation.vhd ## | invgate_equation.vhd ## | mux2to1_structure.vhd ## | or2gate_equation.vhd ## | t_mux2to1.vhd ## | de1_mux2to1_structure.vhd ## | ## +---sim ## | | makefile ## | | ## | \---mux2to1 ## | makefile ## | makefile.sources ## | ## +---pnr ## | | makefile ## | | ## | \---de1_mux2to1 ## | de1_mux2to1_pins.tcl ## | makefile ## | ## \---scripts ## de1_pin_assignments_minimumio.csv ## de1_pin_assignments_minimumio.tcl ## modelsim.ini ## quartus_project_settings.tcl ## ----------------------------------------------------------------------------