1 |
2 |
takar |
TOP_LEVEL_DIR=../..
|
2 |
|
|
|
3 |
|
|
DESIGN_NAME=core
|
4 |
|
|
DESIGN_DIR=$(TOP_LEVEL_DIR)/designs/$(DESIGN_NAME)
|
5 |
|
|
|
6 |
|
|
MBLITE_HW_DIR=$(TOP_LEVEL_DIR)/hw
|
7 |
|
|
MBLITE_STD_DIR=$(MBLITE_HW_DIR)/std
|
8 |
|
|
MBLITE_CORE_DIR=$(MBLITE_HW_DIR)/core
|
9 |
|
|
|
10 |
|
|
MBLITE_LIBRARY_NAME=mblite
|
11 |
|
|
|
12 |
|
|
SIM_DIR=$(DESIGN_DIR)/work
|
13 |
|
|
MODELSIM_SIM_DIR=$(SIM_DIR)/modelsim
|
14 |
|
|
MODELSIM_WORK_DIR=$(MODELSIM_SIM_DIR)/$(DESIGN_NAME)
|
15 |
|
|
|
16 |
|
|
WORK_LIBRARY_NAME=work
|
17 |
|
|
|
18 |
|
|
default:
|
19 |
|
|
@echo "Makefile for the MB-lite microprocessor"
|
20 |
|
|
@echo "---------------------------------------"
|
21 |
|
|
@echo "Make options:"
|
22 |
|
|
@echo " default: Echo these instructions"
|
23 |
|
|
@echo " all: Compile CORE to library mblite"
|
24 |
|
|
@echo " Compile TESTBENCH to library work"
|
25 |
|
|
@echo " clean: Remove all compiled and generated files"
|
26 |
|
|
|
27 |
|
|
all: modelsim-design
|
28 |
|
|
|
29 |
|
|
################
|
30 |
|
|
# WORK library #
|
31 |
|
|
################
|
32 |
|
|
|
33 |
|
|
# Create library WORK
|
34 |
|
|
modelsim-worklib:
|
35 |
|
|
@vlib $(MODELSIM_WORK_DIR)/$(WORK_LIBRARY_NAME)
|
36 |
|
|
@vmap $(WORK_LIBRARY_NAME) $(MODELSIM_WORK_DIR)/$(WORK_LIBRARY_NAME)
|
37 |
|
|
|
38 |
|
|
# Compile MB-LITE configuration to library MB-LITE
|
39 |
|
|
modelsim-mblite-config: modelsim-mblitelib
|
40 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(DESIGN_DIR)/config_Pkg.vhd
|
41 |
|
|
|
42 |
|
|
# Compile a design using MB-LITE to library WORK
|
43 |
|
|
modelsim-design: modelsim-std modelsim-mblite-config modelsim-core modelsim-worklib
|
44 |
|
|
@vcom -work $(WORK_LIBRARY_NAME) $(DESIGN_DIR)/testbench.vhd
|
45 |
|
|
|
46 |
|
|
# Copy memory and do files to work dir
|
47 |
|
|
modelsim-init:
|
48 |
|
|
@cp $(DESIGN_DIR)/*.mem $(MODELSIM_WORK_DIR)
|
49 |
|
|
@cp $(DESIGN_DIR)/*.do $(MODELSIM_WORK_DIR)
|
50 |
|
|
|
51 |
|
|
###################
|
52 |
|
|
# MB-LITE library #
|
53 |
|
|
###################
|
54 |
|
|
|
55 |
|
|
# Create library MB-LITE
|
56 |
|
|
modelsim-mblitelib:
|
57 |
|
|
@mkdir -p $(MODELSIM_WORK_DIR)
|
58 |
|
|
@vlib $(MODELSIM_WORK_DIR)/$(MBLITE_LIBRARY_NAME)
|
59 |
|
|
@vmap $(MBLITE_LIBRARY_NAME) $(MODELSIM_WORK_DIR)/$(MBLITE_LIBRARY_NAME)
|
60 |
|
|
|
61 |
|
|
# Compile MB-LITE standard components
|
62 |
|
|
modelsim-std: modelsim-mblitelib
|
63 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_STD_DIR)/std_Pkg.vhd
|
64 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_STD_DIR)/dsram.vhd
|
65 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_STD_DIR)/sram_4en.vhd
|
66 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_STD_DIR)/sram.vhd
|
67 |
|
|
|
68 |
|
|
# Compile MB-LITE processor
|
69 |
|
|
modelsim-core: modelsim-std modelsim-mblite-config
|
70 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_CORE_DIR)/core_Pkg.vhd
|
71 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_CORE_DIR)/core.vhd
|
72 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_CORE_DIR)/fetch.vhd
|
73 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_CORE_DIR)/gprf.vhd
|
74 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_CORE_DIR)/decode.vhd
|
75 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_CORE_DIR)/execute.vhd
|
76 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_CORE_DIR)/mem.vhd
|
77 |
|
|
|
78 |
|
|
###########################
|
79 |
|
|
# Remove work directories #
|
80 |
|
|
###########################
|
81 |
|
|
|
82 |
|
|
modelsim-clean:
|
83 |
|
|
@rm -r -f $(MODELSIM_WORK_DIR)
|
84 |
|
|
|
85 |
|
|
clean:
|
86 |
|
|
@rm -r -f $(SIM_DIR)
|
87 |
|
|
@rm -f transcript
|
88 |
|
|
@rm -f modelsim.ini
|
89 |
|
|
@rm -f vsim.wlf
|