1 |
50 |
ja_rd |
# External memory test -- build simulation and execution VHDL modules
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
# Get common makefile stuff (toolchain & system config)
|
5 |
|
|
include ..\\common\\makefile
|
6 |
|
|
|
7 |
|
|
# We'll run the simulation for long enough to complete the test
|
8 |
109 |
ja_rd |
SIM_LENGTH = 400000
|
9 |
66 |
ja_rd |
|
10 |
|
|
# FPGA Block RAM parameters
|
11 |
|
|
BRAM_START = 0xbfc00000
|
12 |
50 |
ja_rd |
CODE_BRAM_SIZE = 2048
|
13 |
109 |
ja_rd |
FLASH_START = 0xb0000000
|
14 |
66 |
ja_rd |
# External RAM parameters (size in words)
|
15 |
50 |
ja_rd |
XRAM_SIZE = 1024
|
16 |
90 |
ja_rd |
XRAM_START = 0x00000000
|
17 |
50 |
ja_rd |
|
18 |
66 |
ja_rd |
|
19 |
|
|
LFLAGS = -Ttext $(BRAM_START) -Tdata $(XRAM_START) -eentry -I elf32-big
|
20 |
109 |
ja_rd |
LFLAGS_FLASH = -Ttext $(FLASH_START) -eflash_test -I elf32-big
|
21 |
50 |
ja_rd |
|
22 |
66 |
ja_rd |
|
23 |
50 |
ja_rd |
clean:
|
24 |
|
|
-$(RM) *.o *.obj *.map *.lst *.hex *.exe *.axf *.code *.data
|
25 |
|
|
|
26 |
109 |
ja_rd |
# Use this target when you want to test execution from FLASH
|
27 |
|
|
memtest_main_noflash:
|
28 |
|
|
$(AS_MIPS) -defsym TEST_CACHE=1 -defsym XRAM_BASE=$(XRAM_START) -o memtest.o memtest.s
|
29 |
|
|
|
30 |
|
|
# Use this target when you DON'T want to test execution from FLASH
|
31 |
|
|
memtest_main:
|
32 |
|
|
$(AS_MIPS) -defsym TEST_CACHE=1 -defsym EXEC_FLASH=1 -defsym XRAM_BASE=$(XRAM_START) -o memtest.o memtest.s
|
33 |
|
|
|
34 |
|
|
memtest: memtest_main
|
35 |
66 |
ja_rd |
$(LD_MIPS) $(LFLAGS) -Map memtest.map -s -N -o memtest.axf memtest.o
|
36 |
50 |
ja_rd |
-@$(DUMP_MIPS) -I elf32-big --disassemble memtest.axf > memtest.lst
|
37 |
|
|
# Dump code and data to separate binaries (data binary will be empty but TB2 needs it)
|
38 |
|
|
$(COPY_MIPS) -I elf32-big -j .text -j .rodata -O binary memtest.axf memtest.code
|
39 |
|
|
$(COPY_MIPS) -I elf32-big -j .sbss -j .data -j .bss -O binary memtest.axf memtest.data
|
40 |
|
|
|
41 |
109 |
ja_rd |
flashtest: memtest_main
|
42 |
|
|
$(AS_MIPS) -defsym TEST_CACHE=1 -defsym FLASH_BASE=$(FLASH_START) -o flash.o flash.s
|
43 |
|
|
$(LD_MIPS) $(LFLAGS_FLASH) -Map flash.map -s -N -o flash.axf flash.o
|
44 |
|
|
-@$(DUMP_MIPS) -I elf32-big --disassemble flash.axf > flash.lst
|
45 |
|
|
$(COPY_MIPS) -I elf32-big -j .text -j .rodata -O binary flash.axf flash.bin
|
46 |
50 |
ja_rd |
|
47 |
|
|
|
48 |
|
|
# Create VHDL file for simulation test bench using TB2 template
|
49 |
109 |
ja_rd |
memtest_sim: memtest flashtest
|
50 |
|
|
$(TO_VHDL) --code memtest.code --data memtest.data --log_trigger=0xbfc00000 \
|
51 |
149 |
ja_rd |
--flash flash.bin --flash_size 4096 \
|
52 |
50 |
ja_rd |
--code_size $(CODE_BRAM_SIZE) --data_size $(XRAM_SIZE) \
|
53 |
|
|
-s $(SIM_LENGTH) -v $(SRC_DIR)\\mips_tb2_template.vhdl \
|
54 |
|
|
-o $(TB_DIR)\\mips_tb2.vhdl -e mips_tb2
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
# Create VHDL file for hardware demo
|
58 |
109 |
ja_rd |
memtest_demo: memtest flashtest
|
59 |
149 |
ja_rd |
$(TO_VHDL) --code memtest.code --data memtest.data --log_trigger=0xb0000000 \
|
60 |
50 |
ja_rd |
--code_size $(CODE_BRAM_SIZE) --data_size $(XRAM_SIZE) \
|
61 |
|
|
-v $(SRC_DIR)/mips_mpu1_template.vhdl \
|
62 |
109 |
ja_rd |
-o $(DEMO_DIR)/mips_mpu.vhdl -e mips_mpu
|