OpenCores
URL https://opencores.org/ocsvn/sd_card_controller/sd_card_controller/trunk

Subversion Repositories sd_card_controller

[/] [sd_card_controller/] [trunk/] [sim/] [rtl_sim/] [bin/] [Makefile] - Diff between revs 3 and 8

Only display areas with differences | Details | Blame | View Log

Rev 3 Rev 8
######################################################################
######################################################################
####                                                              ####
####                                                              ####
#### WISHBONE SD Card Controller IP Core                          ####
#### WISHBONE SD Card Controller IP Core                          ####
####                                                              ####
####                                                              ####
#### Makefile                                                     ####
#### Makefile                                                     ####
####                                                              ####
####                                                              ####
#### This file is part of the WISHBONE SD Card                    ####
#### This file is part of the WISHBONE SD Card                    ####
#### Controller IP Core project                                   ####
#### Controller IP Core project                                   ####
#### http://www.opencores.org/cores/xxx/                          ####
#### http://opencores.org/project,sd_card_controller              ####
####                                                              ####
####                                                              ####
#### Description                                                  ####
#### Description                                                  ####
#### Simulation makefile                                          ####
#### Simulation makefile                                          ####
####                                                              ####
####                                                              ####
#### Author(s):                                                   ####
#### Author(s):                                                   ####
####     - Marek Czerski, ma.czerski@gmail.com                    ####
####     - Marek Czerski, ma.czerski@gmail.com                    ####
####                                                              ####
####                                                              ####
######################################################################
######################################################################
####                                                              ####
####                                                              ####
#### Copyright (C) 2013 Authors                                   ####
#### Copyright (C) 2013 Authors                                   ####
####                                                              ####
####                                                              ####
#### This source file may be used and distributed without         ####
#### This source file may be used and distributed without         ####
#### restriction provided that this copyright statement is not    ####
#### restriction provided that this copyright statement is not    ####
#### removed from the file and that any derivative work contains  ####
#### removed from the file and that any derivative work contains  ####
#### the original copyright notice and the associated disclaimer. ####
#### the original copyright notice and the associated disclaimer. ####
####                                                              ####
####                                                              ####
#### This source file is free software; you can redistribute it   ####
#### This source file is free software; you can redistribute it   ####
#### and/or modify it under the terms of the GNU Lesser General   ####
#### and/or modify it under the terms of the GNU Lesser General   ####
#### Public License as published by the Free Software Foundation; ####
#### Public License as published by the Free Software Foundation; ####
#### either version 2.1 of the License, or (at your option) any   ####
#### either version 2.1 of the License, or (at your option) any   ####
#### later version.                                               ####
#### later version.                                               ####
####                                                              ####
####                                                              ####
#### This source is distributed in the hope that it will be       ####
#### This source is distributed in the hope that it will be       ####
#### useful, but WITHOUT ANY WARRANTY; without even the implied   ####
#### useful, but WITHOUT ANY WARRANTY; without even the implied   ####
#### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ####
#### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ####
#### PURPOSE. See the GNU Lesser General Public License for more  ####
#### PURPOSE. See the GNU Lesser General Public License for more  ####
#### details.                                                     ####
#### details.                                                     ####
####                                                              ####
####                                                              ####
#### You should have received a copy of the GNU Lesser General    ####
#### You should have received a copy of the GNU Lesser General    ####
#### Public License along with this source; if not, download it   ####
#### Public License along with this source; if not, download it   ####
#### from http://www.opencores.org/lgpl.shtml                     ####
#### from http://www.opencores.org/lgpl.shtml                     ####
####                                                              ####
####                                                              ####
######################################################################
######################################################################
V ?= @
V ?= @
VCD ?= 0
VCD ?= 0
MODELSIM_DIR ?= /opt/altera/11.0/modelsim_ase
MODELSIM_DIR ?= /opt/altera/11.0/modelsim_ase
VCOM = $(MODELSIM_DIR)/bin/vcom
VCOM = $(MODELSIM_DIR)/bin/vcom
VLOG = $(MODELSIM_DIR)/bin/vlog
VLOG = $(MODELSIM_DIR)/bin/vlog
VOPT = $(MODELSIM_DIR)/bin/vopt
VOPT = $(MODELSIM_DIR)/bin/vopt
SCCOM = $(MODELSIM_DIR)/bin/sccom
SCCOM = $(MODELSIM_DIR)/bin/sccom
VLIB = $(MODELSIM_DIR)/bin/vlib
VLIB = $(MODELSIM_DIR)/bin/vlib
VMAP = $(MODELSIM_DIR)/bin/vmap
VMAP = $(MODELSIM_DIR)/bin/vmap
VSIM = $(MODELSIM_DIR)/bin/vsim
VSIM = $(MODELSIM_DIR)/bin/vsim
# Define path to each library
# Define path to each library
LIB_SV_STD = $(MODELSIM_DIR)/sv_std
LIB_SV_STD = $(MODELSIM_DIR)/sv_std
LIB_WORK = work
LIB_WORK = work
LIB_TEST = test
LIB_TEST = test
RUN_DIR = $(shell pwd)
RUN_DIR = $(shell pwd)
BIN_DIR = $(shell pwd)/../bin
BIN_DIR = $(shell pwd)/../bin
LOG_DIR = $(shell pwd)/../log
LOG_DIR = $(shell pwd)/../log
OUT_DIR = $(shell pwd)/../out
OUT_DIR = $(shell pwd)/../out
WORK_DIR = ../../../rtl/verilog
WORK_DIR = ../../../rtl/verilog
TEST_DIR = ../../../bench/verilog
TEST_DIR = ../../../bench/verilog
WORK_SOURCES = $(wildcard $(WORK_DIR)/*.v)
WORK_SOURCES = $(wildcard $(WORK_DIR)/*.v)
TEST_SOURCES = $(wildcard $(TEST_DIR)/*.sv) $(wildcard $(TEST_DIR)/*.v)
TEST_SOURCES = $(wildcard $(TEST_DIR)/*.sv) $(wildcard $(TEST_DIR)/*.v)
WORK_OBJECTS = $(shell echo $(WORK_SOURCES) | sed 's:$(WORK_DIR):./$(LIB_WORK):g' | sed 's:\.v:/_primary.dat:g')
WORK_OBJECTS = $(shell echo $(WORK_SOURCES) | sed 's:$(WORK_DIR):./$(LIB_WORK):g' | sed 's:\.v:/_primary.dat:g')
TEST_OBJECTS = $(shell echo $(TEST_SOURCES) | sed 's:$(TEST_DIR):./$(LIB_TEST):g' | sed 's:\.sv:/_primary.dat:g')
TEST_OBJECTS = $(shell echo $(TEST_SOURCES) | sed 's:$(TEST_DIR):./$(LIB_TEST):g' | sed 's:\.sv:/_primary.dat:g')
all: simulate
all: simulate
work_library: $(LIB_WORK) $(WORK_OBJECTS)
work_library: $(LIB_WORK) $(WORK_OBJECTS)
#./$(LIB_WORK)/%/_primary.dat: $(WORK_DIR)/%.v
#./$(LIB_WORK)/%/_primary.dat: $(WORK_DIR)/%.v
#       @echo $@
#       @echo $@
#       $(V)$(VLOG) -work $(LIB_WORK) +incdir+$(WORK_DIR) -nocovercells -O0 $^
#       $(V)$(VLOG) -work $(LIB_WORK) +incdir+$(WORK_DIR) -nocovercells -O0 $^
$(WORK_OBJECTS): $(WORK_SOURCES)
$(WORK_OBJECTS): $(WORK_SOURCES)
        $(V)$(VLOG) -work $(LIB_WORK) +incdir+$(WORK_DIR) -nocovercells -O0 $?
        $(V)$(VLOG) -work $(LIB_WORK) +incdir+$(WORK_DIR) -nocovercells -O0 $?
$(LIB_WORK) :
$(LIB_WORK) :
        $(V)echo "creating library $@ ..."
        $(V)echo "creating library $@ ..."
        $(V)$(VLIB) $(LIB_WORK)
        $(V)$(VLIB) $(LIB_WORK)
        $(V)$(VMAP) $(LIB_WORK) $(LIB_WORK)
        $(V)$(VMAP) $(LIB_WORK) $(LIB_WORK)
test_library: $(LIB_TEST) $(TEST_OBJECTS)
test_library: $(LIB_TEST) $(TEST_OBJECTS)
$(TEST_OBJECTS): $(TEST_SOURCES)
$(TEST_OBJECTS): $(TEST_SOURCES)
        $(V)$(VLOG) -work $(LIB_TEST) +incdir+$(WORK_DIR) +incdir+$(TEST_DIR) -nocovercells -O0 $?
        $(V)$(VLOG) -work $(LIB_TEST) +incdir+$(WORK_DIR) +incdir+$(TEST_DIR) -nocovercells -O0 $?
$(LIB_TEST) :
$(LIB_TEST) :
        $(V)echo "creating library $@ ..."
        $(V)echo "creating library $@ ..."
        $(V)$(VLIB) $(LIB_TEST)
        $(V)$(VLIB) $(LIB_TEST)
        $(V)$(VMAP) $(LIB_TEST) $(LIB_TEST)
        $(V)$(VMAP) $(LIB_TEST) $(LIB_TEST)
compile: work_library test_library
compile: work_library test_library
TESTBENCH_SOURCES = $(shell ls $(TEST_DIR)/*_tb.sv)
TESTBENCH_SOURCES = $(shell ls $(TEST_DIR)/*_tb.sv)
TESTBENCHES = $(shell echo $(TESTBENCH_SOURCES) | sed 's:$(TEST_DIR)/::g' | sed 's:\.sv::g')
TESTBENCHES = $(shell echo $(TESTBENCH_SOURCES) | sed 's:$(TEST_DIR)/::g' | sed 's:\.sv::g')
ifeq ($(VCD), 1)
ifeq ($(VCD), 1)
CLI_STARTUP_FILE = $(BIN_DIR)/vcd_startup.do
CLI_STARTUP_FILE = $(BIN_DIR)/vcd_startup.do
VCD_DIR = $(OUT_DIR)
VCD_DIR = $(OUT_DIR)
else
else
CLI_STARTUP_FILE = $(BIN_DIR)/cli_startup.do
CLI_STARTUP_FILE = $(BIN_DIR)/cli_startup.do
endif
endif
$(OUT_DIR):
$(OUT_DIR):
        $(V)mkdir $@
        $(V)mkdir $@
$(LOG_DIR):
$(LOG_DIR):
        $(V)mkdir $@
        $(V)mkdir $@
%_tb: $(LOG_DIR) $(VCD_DIR) compile
%_tb: $(LOG_DIR) $(VCD_DIR) compile
        $(V)$(VSIM) -c -L $(RUN_DIR)/$(LIB_WORK) -do $(CLI_STARTUP_FILE) $(LIB_TEST).$@
        $(V)$(VSIM) -c -L $(RUN_DIR)/$(LIB_WORK) -do $(CLI_STARTUP_FILE) $(LIB_TEST).$@
        $(V)if [ $(VCD) = 1 ]; then mv tmp.vcd $(OUT_DIR)/$@.vcd; fi
        $(V)if [ $(VCD) = 1 ]; then mv tmp.vcd $(OUT_DIR)/$@.vcd; fi
simulate: $(TESTBENCHES)
simulate: $(TESTBENCHES)
modelsim: compile
modelsim: compile
        $(V)$(VSIM) -lib $(LIB_WORK)
        $(V)$(VSIM) -lib $(LIB_WORK)
%_tb_gui: $(LOG_DIR) compile
%_tb_gui: $(LOG_DIR) compile
        $(V)$(VSIM) -L $(RUN_DIR)/$(LIB_WORK) -do $(BIN_DIR)/gui_startup.do $(LIB_TEST).$(shell echo $@ | sed 's:_gui::')
        $(V)$(VSIM) -L $(RUN_DIR)/$(LIB_WORK) -do $(BIN_DIR)/gui_startup.do $(LIB_TEST).$(shell echo $@ | sed 's:_gui::')
print_work_sources:
print_work_sources:
        $(V)@echo $(WORK_SOURCES)
        $(V)@echo $(WORK_SOURCES)
print_test_sources:
print_test_sources:
        $(V)@echo $(TEST_SOURCES)
        $(V)@echo $(TEST_SOURCES)
print_work_objects:
print_work_objects:
        $(V)@echo $(WORK_OBJECTS)
        $(V)@echo $(WORK_OBJECTS)
print_testbenches:
print_testbenches:
        $(V)@echo $(TESTBENCHES)
        $(V)@echo $(TESTBENCHES)
clean:
clean:
        $(V)rm -rfv $(LIB_WORK)
        $(V)rm -rfv $(LIB_WORK)
        $(V)rm -rfv $(LIB_TEST)
        $(V)rm -rfv $(LIB_TEST)
        $(V)rm -rfv $(LOG_DIR)
        $(V)rm -rfv $(LOG_DIR)
        $(V)rm -rfv $(OUT_DIR)
        $(V)rm -rfv $(OUT_DIR)
        $(V)rm -fv modelsim.ini *.wlf transcript
        $(V)rm -fv modelsim.ini *.wlf transcript
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.