makefile 2.85 KB
Newer Older
Friedrich Beckmann's avatar
first  
Friedrich Beckmann committed
1
2
3
## ----------------------------------------------------------------------------
## Script     : makefile
## ----------------------------------------------------------------------------
4
## Author(s)  : Johann Faerber, Friedrich Beckmann
Friedrich Beckmann's avatar
first  
Friedrich Beckmann committed
5
6
## Company    : University of Applied Sciences Augsburg
## ----------------------------------------------------------------------------
7
8
9
## Description: This makefile allows automating design flow with ModelSim,
##              it is based on a design directory structure shown at 
##              the end of this file.
Friedrich Beckmann's avatar
first  
Friedrich Beckmann committed
10
## ----------------------------------------------------------------------------
Johann Faerber's avatar
Johann Faerber committed
11

Friedrich Beckmann's avatar
first  
Friedrich Beckmann committed
12
13
14
15
16
17
18
19
20
21
22
23
###################################################################
# Main Targets
#
###################################################################

help:
	@echo '"make" does intentionally nothing. Type:'
	@echo '  "make mproject" to create a new modelsim project'
	@echo '  "make compile" to compile all VHDL sources in batch mode'
	@echo '  "make modelsim" to start modelsim with graphical user interface'
	@echo '  "make sim" to start modelsim gui with the top testbench of the project'
	@echo '  "make clean" to remove all generated files'
Johann Faerber's avatar
Johann Faerber committed
24
25
26
27

mproject : $(PROJECT).mpf

$(PROJECT).mpf : $(SOURCE_FILES)
Friedrich Beckmann's avatar
first  
Friedrich Beckmann committed
28
	# create modelsim project
Johann Faerber's avatar
Johann Faerber committed
29
30
31
32
	rm -rf ./modelsim_sources.tcl
	for source_file in $(SOURCE_FILES); do \
	  echo project addfile $$source_file >> modelsim_sources.tcl; \
	done
Johann Faerber's avatar
Johann Faerber committed
33
	vsim -modelsimini ../../scripts/modelsim.ini -c -do "project new [pwd] $(PROJECT); source ./modelsim_sources.tcl; quit -f"
Johann Faerber's avatar
Johann Faerber committed
34
35
36
37

compile: ./work/_vmake

./work/_vmake: $(PROJECT).mpf
Friedrich Beckmann's avatar
first  
Friedrich Beckmann committed
38
39
	vsim -c -do "project open $(PROJECT); project calculateorder; quit -f"

Johann Faerber's avatar
Johann Faerber committed
40
41
modelsim: ./work/_vmake
	vsim -i $(PROJECT) &
Friedrich Beckmann's avatar
first  
Friedrich Beckmann committed
42

Johann Faerber's avatar
Johann Faerber committed
43
44
sim: ./work/_vmake
	vsim -i -do "project open $(PROJECT); vsim work.t_$(PROJECT)(tbench); add wave *; run -a;" 
Friedrich Beckmann's avatar
first  
Friedrich Beckmann committed
45
46

clean:
Johann Faerber's avatar
Johann Faerber committed
47
	rm -rf *.mpf *.mti *.ini *.wlf wlf* transcript work modelsim_sources.tcl
Friedrich Beckmann's avatar
first  
Friedrich Beckmann committed
48
49
50
51
52
53
54
55
56
57
58
59
60
61

## ----------------------------------------------------------------------------
## 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
62
63
64
65
66
67
68
69
70
## |       de1_mux2to1_structure.vhd
## |
## +---sim
## |   |   makefile
## |   |
## |   \---mux2to1
## |           makefile
## |           makefile.sources
## |
Friedrich Beckmann's avatar
first  
Friedrich Beckmann committed
71
## +---pnr
72
73
74
75
## |   |   makefile
## |   |
## |   \---de1_mux2to1
## |           de1_mux2to1_pins.tcl
Friedrich Beckmann's avatar
first  
Friedrich Beckmann committed
76
77
## |           makefile
## |
78
79
80
81
82
## \---scripts
##         de1_pin_assignments_minimumio.csv
##         de1_pin_assignments_minimumio.tcl
##         modelsim.ini
##         quartus_project_settings.tcl
Friedrich Beckmann's avatar
first  
Friedrich Beckmann committed
83
## ----------------------------------------------------------------------------
84