1 |
2 |
takar |
TOP_LEVEL_DIR=../..
|
2 |
|
|
|
3 |
|
|
DESIGN_NAME=core_decoder
|
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)/mblite_stdio.vhd
|
45 |
|
|
@vcom -work $(WORK_LIBRARY_NAME) $(DESIGN_DIR)/testbench.vhd
|
46 |
|
|
|
47 |
|
|
# Copy memory and do files to work dir
|
48 |
|
|
modelsim-init:
|
49 |
|
|
@cp $(DESIGN_DIR)/*.mem $(MODELSIM_WORK_DIR)
|
50 |
|
|
@cp $(DESIGN_DIR)/*.do $(MODELSIM_WORK_DIR)
|
51 |
|
|
|
52 |
|
|
###################
|
53 |
|
|
# MB-LITE library #
|
54 |
|
|
###################
|
55 |
|
|
|
56 |
|
|
# Create library MB-LITE
|
57 |
|
|
modelsim-mblitelib:
|
58 |
|
|
@mkdir -p $(MODELSIM_WORK_DIR)
|
59 |
|
|
@vlib $(MODELSIM_WORK_DIR)/$(MBLITE_LIBRARY_NAME)
|
60 |
|
|
@vmap $(MBLITE_LIBRARY_NAME) $(MODELSIM_WORK_DIR)/$(MBLITE_LIBRARY_NAME)
|
61 |
|
|
|
62 |
|
|
# Compile MB-LITE standard components
|
63 |
|
|
modelsim-std: modelsim-mblitelib
|
64 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_STD_DIR)/std_Pkg.vhd
|
65 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_STD_DIR)/dsram.vhd
|
66 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_STD_DIR)/sram_4en.vhd
|
67 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_STD_DIR)/sram.vhd
|
68 |
|
|
|
69 |
|
|
# Compile MB-LITE processor
|
70 |
|
|
modelsim-core: modelsim-std modelsim-mblite-config
|
71 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_CORE_DIR)/core_Pkg.vhd
|
72 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_CORE_DIR)/core.vhd
|
73 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_CORE_DIR)/fetch.vhd
|
74 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_CORE_DIR)/gprf.vhd
|
75 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_CORE_DIR)/decode.vhd
|
76 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_CORE_DIR)/execute.vhd
|
77 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_CORE_DIR)/mem.vhd
|
78 |
|
|
@vcom -work $(MBLITE_LIBRARY_NAME) $(MBLITE_CORE_DIR)/core_address_decoder.vhd
|
79 |
|
|
|
80 |
|
|
###########################
|
81 |
|
|
# Remove work directories #
|
82 |
|
|
###########################
|
83 |
|
|
|
84 |
|
|
modelsim-clean:
|
85 |
|
|
@rm -r -f $(MODELSIM_WORK_DIR)
|
86 |
|
|
|
87 |
|
|
clean:
|
88 |
|
|
@rm -r -f $(SIM_DIR)
|
89 |
|
|
@rm -f transcript
|
90 |
|
|
@rm -f modelsim.ini
|
91 |
|
|
@rm -f vsim.wlf
|