#-- Bring toolchain config parameters from the common makefile -----------------
|
#-- Bring toolchain config parameters from the common makefile -----------------
|
include ..\\common\\makefile
|
include ../common/makefile
|
|
|
# We'll run the simulation for long enough to complete the test
|
# We'll run the simulation for long enough to complete the test
|
SIM_LENGTH = 400000
|
SIM_LENGTH = 400000
|
|
|
# FPGA Block RAM parameters
|
# FPGA Block RAM parameters
|
BRAM_START = 0xbfc00000
|
BRAM_START = 0xbfc00000
|
CODE_BRAM_SIZE = 2048
|
CODE_BRAM_SIZE = 2048
|
FLASH_START = 0xb0000000
|
FLASH_START = 0xb0000000
|
# External RAM parameters (size in words)
|
# External RAM parameters (size in words)
|
XRAM_SIZE = 1024
|
XRAM_SIZE = 1024
|
XRAM_START = 0x00000000
|
XRAM_START = 0x00000000
|
|
|
|
|
LFLAGS = -Ttext $(BRAM_START) -Tdata $(XRAM_START) -eentry -I elf32-big
|
LFLAGS = -Ttext $(BRAM_START) -Tdata $(XRAM_START) -eentry -I elf32-big
|
LFLAGS_FLASH = -Ttext $(FLASH_START) -eflash_test -I elf32-big
|
LFLAGS_FLASH = -Ttext $(FLASH_START) -eflash_test -I elf32-big
|
|
|
OBJS = memtest.o
|
OBJS = memtest.o
|
|
|
#-- Configuration --------------------------------------------------------------
|
#-- Configuration --------------------------------------------------------------
|
|
|
# Set to !=0 to test execution from flash
|
# Set to !=0 to test execution from flash
|
# (Set to 0 if running on real HW on which you have no initialized FLASH)
|
# (Set to 0 if running on real HW on which you have no initialized FLASH)
|
EXEC_FLASH = 1
|
EXEC_FLASH = 1
|
|
|
#-- Targets & rules ------------------------------------------------------------
|
#-- Targets & rules ------------------------------------------------------------
|
|
|
#-- Main target -- build code for BRAM and FLASH
|
#-- Main target -- build code for BRAM and FLASH
|
memtest: memtest.code memtest.data flash.bin
|
memtest: memtest.code memtest.data flash.bin
|
-@# This comment prevents triggering the default rule. Instead, make will
|
-@# This comment prevents triggering the default rule. Instead, make will
|
-@# invoke our rules for the dependencies.
|
-@# invoke our rules for the dependencies.
|
|
|
#-- Targets for main code to be run from BRAM
|
#-- Targets for main code to be run from BRAM
|
|
|
memtest.o: memtest.s
|
memtest.o: memtest.s
|
$(AS) -defsym TEST_CACHE=1 -defsym EXEC_FLASH=$(EXEC_FLASH) \
|
$(AS) -defsym TEST_CACHE=1 -defsym EXEC_FLASH=$(EXEC_FLASH) \
|
-defsym XRAM_BASE=$(XRAM_START) -o memtest.o memtest.s
|
-defsym XRAM_BASE=$(XRAM_START) -o memtest.o memtest.s
|
|
|
memtest.axf: memtest.o
|
memtest.axf: memtest.o
|
$(LD) $(LFLAGS) -Map memtest.map -s -N -o memtest.axf memtest.o
|
$(LD) $(LFLAGS) -Map memtest.map -s -N -o memtest.axf memtest.o
|
-@$(DUMP) -I elf32-big --disassemble memtest.axf > memtest.lst
|
-@$(DUMP) -I elf32-big --disassemble memtest.axf > memtest.lst
|
|
|
# Dump code and data to separate binaries (data binary will be empty but
|
# Dump code and data to separate binaries (data binary will be empty but
|
# TB2 needs it anyway)
|
# TB2 needs it anyway)
|
|
|
memtest.code: memtest.axf
|
memtest.code: memtest.axf
|
$(COPY) -I elf32-big -j .text -j .rodata -O binary memtest.axf memtest.code
|
$(COPY) -I elf32-big -j .text -j .rodata -O binary memtest.axf memtest.code
|
memtest.data: memtest.axf
|
memtest.data: memtest.axf
|
$(COPY) -I elf32-big -j .sbss -j .data -j .bss -O binary memtest.axf memtest.data
|
$(COPY) -I elf32-big -j .sbss -j .data -j .bss -O binary memtest.axf memtest.data
|
|
|
#-- Targets for code to be run from FLASH
|
#-- Targets for code to be run from FLASH
|
|
|
flash.o: flash.s
|
flash.o: flash.s
|
$(AS) -defsym TEST_CACHE=1 -defsym FLASH_BASE=$(FLASH_START) -o flash.o flash.s
|
$(AS) -defsym TEST_CACHE=1 -defsym FLASH_BASE=$(FLASH_START) -o flash.o flash.s
|
|
|
flash.axf: flash.o
|
flash.axf: flash.o
|
$(LD) $(LFLAGS_FLASH) -Map flash.map -s -N -o flash.axf flash.o
|
$(LD) $(LFLAGS_FLASH) -Map flash.map -s -N -o flash.axf flash.o
|
-@$(DUMP) -I elf32-big --disassemble flash.axf > flash.lst
|
-@$(DUMP) -I elf32-big --disassemble flash.axf > flash.lst
|
|
|
flash.bin: flash.axf
|
flash.bin: flash.axf
|
$(COPY) -I elf32-big -j .text -j .rodata -O binary flash.axf flash.bin
|
$(COPY) -I elf32-big -j .text -j .rodata -O binary flash.axf flash.bin
|
|
|
|
|
|
|
#-- Targets that build the synthesizable vhdl; meant for direct invocation -----
|
#-- Targets that build the synthesizable vhdl; meant for direct invocation -----
|
|
|
# Create VHDL file for simulation test bench using TB2 template
|
# Create VHDL file for simulation test bench using TB2 template
|
sim: memtest
|
sim: memtest
|
$(TO_VHDL) --code memtest.code --data memtest.data --log_trigger=0xbfc00000 \
|
$(TO_VHDL) --code memtest.code --data memtest.data --log_trigger=0xbfc00000 \
|
--flash flash.bin --flash_size 4096 \
|
--flash flash.bin --flash_size 4096 \
|
--code_size $(CODE_BRAM_SIZE) --data_size $(XRAM_SIZE) \
|
--code_size $(CODE_BRAM_SIZE) --data_size $(XRAM_SIZE) \
|
-s $(SIM_LENGTH) -v $(SRC_DIR)\\mips_tb2_template.vhdl \
|
-s $(SIM_LENGTH) -v $(SRC_DIR)\\mips_tb2_template.vhdl \
|
-o $(TB_DIR)\\mips_tb2.vhdl -e mips_tb2
|
-o $(TB_DIR)\\mips_tb2.vhdl -e mips_tb2
|
|
|
|
|
# Create VHDL file for hardware demo
|
# Create VHDL file for hardware demo
|
demo: memtest
|
demo: memtest
|
$(TO_VHDL) --code memtest.code --data memtest.data --log_trigger=0xb0000000 \
|
$(TO_VHDL) --code memtest.code --data memtest.data --log_trigger=0xb0000000 \
|
--code_size $(CODE_BRAM_SIZE) --data_size $(XRAM_SIZE) \
|
--code_size $(CODE_BRAM_SIZE) --data_size $(XRAM_SIZE) \
|
-v $(SRC_DIR)/mips_mpu1_template.vhdl \
|
-v $(SRC_DIR)/code_rom_template.vhdl -n "Memory test" \
|
-o $(DEMO_DIR)/mips_mpu.vhdl -e mips_mpu
|
-o $(DEMO_DIR)/code_rom_pkg.vhdl
|
|
|
|
|
#-- And now the usual housekeeping stuff ---------------------------------------
|
#-- And now the usual housekeeping stuff ---------------------------------------
|
|
|
.PHONY: clean
|
.PHONY: clean
|
|
|
clean:
|
clean:
|
-$(RM) *.o *.obj *.map *.lst *.hex *.exe *.axf *.code *.data *.bin
|
-$(RM) *.o *.obj *.map *.lst *.hex *.exe *.axf *.code *.data *.bin
|
|
|