2 VPATH := .:ps2:textmode_vga:textmode_vga/mjl_stratix
5 D_BEHSIM := $(MPWD)/../sim/beh
6 D_POSTSIM := $(MPWD)/../sim/post
7 POST_VHO := $(MPWD)/../quartus/calc/simulation/modelsim/calc.vho
8 POST_SDO := $(MPWD)/../quartus/calc/simulation/modelsim/calc_vhd.sdo
10 QUARTUS := $(MPWD)/../quartus/calc
11 QUOPT := --read_settings_files=on --write_settings_files=off calc -c calc
13 HN := $(shell hostname)
14 TILABHOSTS := $(shell echo ti{1..9}) apps1
16 ifeq ($(findstring $(HN), $(TILABHOSTS)),$(HN))
17 # die option 's' geht nicht... :(
18 COVERVCOM := -cover bcet
19 COVERVSIM := -coverage
25 ifeq ($(findstring $(HN), $(TILABHOSTS)),$(HN))
26 QUMACRO := unset LS_COLORS; cd $(QUARTUS); export LD_LIBRARY_PATH=/opt/quartus/quartus/linux64; export LM_LICENSE_FILE=26888@quartus;
28 QUMACRO := unset LS_COLORS; cd $(QUARTUS);
33 # o source files der module
34 # o reihenfolge ist wichtig
35 # o keine testbechnes hier angeben
36 SRCFILES := alu parser scanner display sp_ram history uart_tx uart_rx pc_communication
38 # o files der packages
39 # o keine testbechnes hier angeben
40 PKGFILES = math_pkg gen_pkg
41 PKGFILES += textmode_vga/textmode_vga_platform_dependent_pkg
42 PKGFILES += textmode_vga/textmode_vga_pkg
43 PKGFILES += textmode_vga/font_pkg
44 PKGFILES += textmode_vga/textmode_vga_component_pkg
46 BEH_IFILES = $(PKGFILES) $(SRCFILES)
47 BEH_IFILES := $(strip $(BEH_IFILES))
49 POST_IFILES = $(PKGFILES)
50 POST_IFILES := $(strip $(POST_IFILES))
52 POST_SRC = $(SRCFILES)
55 #virtuelle targets fuer behsim: weil wir sowas wie ein objectfile von vcom nicht bekommen. bessere ideen sind willkommen
56 BEH_VTARGETS := $(foreach n, $(notdir $(BEH_IFILES)), $(D_BEHSIM)/$(WORK)/$(n)/_primary.dat)
58 #virtuelle targets fuer packagefiles der postsim
59 POST_VTARGETS := $(foreach n, $(notdir $(POST_IFILES)), $(D_POSTSIM)/$(WORK)/$(n)/_primary.dat)
61 #virtuelle targets fuer sourcefiles der postsim
62 POST_SRC_VTARGETS := $(foreach n, $(POST_SRC), $(n).vhd)
68 behsim: $(D_BEHSIM)/modelsim.ini $(BEH_VTARGETS)
70 $(D_BEHSIM)/modelsim.ini:
71 @echo " INIT for behavioural simulation"
73 @#make fuehrt jeden befehl in einer eigenen shell aus, deswegen ein "oneliner"
75 vlib work > /dev/null ; \
76 vmap work work > /dev/null ;
78 $(D_BEHSIM)/$(WORK)/%/_primary.dat: %.vhd $(D_BEHSIM)/modelsim.ini
81 vcom $(COVERVCOM) -work $(WORK) $(MPWD)/$<
83 beh_%: $(D_BEHSIM)/$(WORK)/beh_%_tb/_primary.dat beh_%_tb.do behsim
85 vsim $(COVERVSIM) "work.$@_tb(sim)" -f /dev/null -do $(MPWD)/$@_tb.do
90 $(D_POSTSIM)/modelsim.ini:
91 @echo " INIT for post-layout simulation"
92 @mkdir -p $(D_POSTSIM)
94 vlib work > /dev/null ; \
95 vmap work work > /dev/null ;
97 $(D_POSTSIM)/$(WORK)/%/_primary.dat: %.vhd
100 vcom -work $(WORK) $(MPWD)/$<
102 post_%: quartus_gen_% post_%_tb.do $(D_POSTSIM)/$(WORK)/post_%_tb/_primary.dat
104 vsim "work.$@_tb(sim)" -sdftyp /$(POST_SDO_INST)=$(POST_SDO) -f /dev/null -do $(MPWD)/$@_tb.do
106 quartus_gen_%: ../quartus/project_%.tcl $(D_POSTSIM)/modelsim.ini $(POST_VTARGETS) $(POST_SRC_VTARGETS)
107 @echo -n " Quartus generate project"
108 ifeq ($(findstring $(HN), $(TILABHOSTS)),$(HN))
110 @cd ../quartus; rm -Rf calc; ./linux_tilab.sh $<
112 @echo "(not @ tilab): $<"
113 @cd ../quartus; rm -Rf calc; ./linux_web.sh $<
115 @echo " Quartus analysis & synthesis"
116 @$(QUMACRO) quartus_map $(QUOPT)
117 @echo " Quartus fitter"
118 @$(QUMACRO) quartus_fit $(QUOPT)
119 @echo " Quartus assembler"
120 @$(QUMACRO) quartus_asm $(QUOPT)
121 @echo " Quartus timing analyzer"
122 @$(QUMACRO) quartus_tan $(QUOPT) --timing_analysis_only
123 @echo " Quartus EDA netlist writer"
124 @$(QUMACRO) quartus_eda $(QUOPT)
125 @echo " CC $(POST_VHO)"
127 vcom -work $(WORK) $(POST_VHO)
131 rm -Rf $(D_BEHSIM) $(D_POSTSIM)