POST_VHO := $(MPWD)/../quartus/calc/simulation/modelsim/calc.vho
POST_SDO := $(MPWD)/../quartus/calc/simulation/modelsim/calc_vhd.sdo
POST_SDO_INST := inst
+QUARTUS := $(MPWD)/../quartus/calc
+QUOPT := --read_settings_files=on --write_settings_files=off calc -c calc
+QUMACRO := unset LS_COLORS; cd $(QUARTUS);
+
+HN := $(shell hostname)
+TILABHOSTS := $(shell echo ti{1..9}) apps1
WORK := work
BEH_VTARGETS := $(foreach n, $(BEH_IFILES), $(D_BEHSIM)/$(WORK)/$(n)/_primary.dat)
#virtuelle targets fuer postsim
-POST_VTARGETS := $(foreach n, $(shell grep ENTITY $(POST_VHO) | awk '{ print $$2 }'), $(D_POSTSIM)/$(WORK)/$(n)/_primary.dbs)
-POST_VTARGETS += $(foreach n, $(POST_IFILES), $(D_POSTSIM)/$(WORK)/$(n)/_primary.dat)
+POST_VTARGETS := $(foreach n, $(POST_IFILES), $(D_POSTSIM)/$(WORK)/$(n)/_primary.dat)
all: behsim
vsim "work.$@_tb(sim)" -f /dev/null -do $(MPWD)/$@_tb.do
#postsim
-postsim: $(POST_VHO) $(D_POSTSIM)/modelsim.ini $(POST_VTARGETS)
+postsim: $(POST_VHO) $(POST_SDO)
$(D_POSTSIM)/modelsim.ini:
@echo " INIT for post-layout simulation"
vlib work > /dev/null ; \
vmap work work > /dev/null ;
-$(D_POSTSIM)/$(WORK)/%/_primary.dbs: $(POST_VHO) $(D_POSTSIM)/modelsim.ini
- @echo " CC $<"
- @cd $(D_POSTSIM); \
- vcom -work $(WORK) $(POST_VHO)
-
-$(D_POSTSIM)/$(WORK)/%/_primary.dat: %.vhd $(D_POSTSIM)/modelsim.ini
+$(D_POSTSIM)/$(WORK)/%/_primary.dat: %.vhd
@echo " CC $<"
@cd $(D_POSTSIM); \
vcom -work $(WORK) $(MPWD)/$<
-post_%: $(D_POSTSIM)/$(WORK)/post_%_tb/_primary.dat post_%_tb.do postsim $(POST_SDO)
+post_%: postsim $(D_POSTSIM)/$(WORK)/post_%_tb/_primary.dat post_%_tb.do
cd $(D_POSTSIM); \
vsim "work.$@_tb(sim)" -sdftyp /$(POST_SDO_INST)=$(POST_SDO) -f /dev/null -do $(MPWD)/$@_tb.do
-$(POST_VHO) $(POST_SDO):
- @if [ -f $@ ]; \
- then echo "vho/sdo: passt"; true ; \
- else echo "Fehler: $@ muss mit quartus erstellt werden"; false; \
- fi
-
-quartus:
- @echo "Die angebotene (free) Quartus II Version aka Web Edition funktioniert "
- @echo "unter Linux leider nicht. (Build endet mit einem Error, auch mit dem debouncing-bsp der LVA)."
- @echo "Befehl um es trotzdem zu probieren (falls installiert):"
- @echo "$$ unset LS_COLORS #falls gesetzt..."
- @echo -n "$$ quartus # bin verzeichnis von quartus muss sich in "; echo -n "$$"; echo "PATH befinden"
- @echo "in windows (per cygwin?): TODO"
+$(QUARTUS): $(D_POSTSIM)/modelsim.ini
+ @echo -n " Quartus generate project"
+ifeq ($(findstring $(HN), $(TILABHOSTS)),$(HN))
+ @echo "(@tilab)"
+ @cd ../quartus; ./linux_tilab.sh
+else
+ @echo "(not @ tilab)"
+ @cd ../quartus; ./linux_web.sh
+endif
+
+#TODO: more targets plz...
+$(POST_VHO) $(POST_SDO): $(QUARTUS) $(POST_VTARGETS)
+ @echo " Quartus analysis & synthesis"
+ @$(QUMACRO) quartus_map $(QUOPT) | tee $(MPWD)/quartusmap.tmp
+ @echo " Quartus fitter"
+ @$(QUMACRO) quartus_fit $(QUOPT)
+ @echo " Quartus assembler"
+ @$(QUMACRO) quartus_asm $(QUOPT)
+ @echo " Quartus timing analyzer"
+ @$(QUMACRO) quartus_tan $(QUOPT) --timing_analysis_only | tee $(MPWD)/quartustan.tmp
+ @echo " Quartus EDA netlist writer"
+ @$(QUMACRO) quartus_eda $(QUOPT)
+ #not nice atm :/
+ @echo " CC $(POST_VHO)"
+ @cd $(D_POSTSIM); \
+ vcom -work $(WORK) $(POST_VHO)
+ @echo -n " INFO logic cells: "
+ @grep 'logic cells' quartusmap.tmp | awk ' { print $$3 } '
+ @grep 'Fmax ' quartustan.tmp | sed -e 's/ / /g' -e 's/Info/INFO/g' -e 's/:/ /g'
+ @rm quartus*.tmp
.PHONY: clean
clean:
- rm -Rf $(D_BEHSIM) $(D_POSTSIM)
+ rm -Rf $(D_BEHSIM) $(D_POSTSIM) $(QUARTUS)