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

Subversion Repositories potato

[/] [potato/] [trunk/] [Makefile] - Blame information for rev 51

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 skordal
# The Potato Processor - A simple RISC-V based processor for FPGAs
2
# (c) Kristian Klomsten Skordal 2014 - 2015 
3 3 skordal
# Report bugs and issues on 
4 2 skordal
 
5
.PHONY: all clean checkout-riscv-tests potato.prj
6
 
7
SOURCE_FILES := \
8
        src/pp_alu.vhd \
9
        src/pp_alu_mux.vhd \
10
        src/pp_alu_control_unit.vhd \
11 45 skordal
        src/pp_icache.vhd \
12 2 skordal
        src/pp_comparator.vhd \
13
        src/pp_constants.vhd \
14
        src/pp_control_unit.vhd \
15
        src/pp_core.vhd \
16
        src/pp_counter.vhd \
17
        src/pp_csr.vhd \
18
        src/pp_csr_unit.vhd \
19
        src/pp_csr_alu.vhd \
20
        src/pp_decode.vhd \
21
        src/pp_execute.vhd \
22
        src/pp_fetch.vhd \
23
        src/pp_imm_decoder.vhd \
24
        src/pp_memory.vhd \
25
        src/pp_potato.vhd \
26
        src/pp_register_file.vhd \
27
        src/pp_types.vhd \
28
        src/pp_utilities.vhd \
29 45 skordal
        src/pp_wb_arbiter.vhd \
30 2 skordal
        src/pp_wb_adapter.vhd \
31
        src/pp_writeback.vhd
32
TESTBENCHES := \
33
        testbenches/tb_processor.vhd \
34
        testbenches/tb_soc.vhd \
35
        soc/pp_soc_memory.vhd
36
 
37
TOOLCHAIN_PREFIX ?= riscv64-unknown-elf
38
 
39
# ISA tests to use from the riscv-tests repository:
40
RISCV_TESTS += \
41
        simple \
42
        add \
43
        addi \
44
        and \
45
        andi \
46
        auipc \
47
        beq \
48
        bge \
49
        bgeu \
50
        blt \
51
        bltu \
52
        bne \
53
        jal \
54
        jalr \
55
        j \
56
        or \
57
        ori \
58
        sll \
59
        slli \
60
        slt \
61
        slti \
62
        sra \
63
        srai \
64
        srl \
65
        srli \
66
        sub \
67
        sb \
68
        sh \
69
        sw \
70
        xor \
71
        xori \
72
        lb \
73
        lbu \
74
        lh \
75
        lhu \
76
        lw
77
 
78
# Local tests to run:
79
LOCAL_TESTS ?= \
80
        scall \
81 45 skordal
        sbreak \
82
        sw-jal
83 2 skordal
 
84
all: potato.prj run-tests
85
 
86
potato.prj:
87
        -$(RM) potato.prj
88
        for file in $(SOURCE_FILES) $(TESTBENCHES); do \
89
                echo "vhdl work $$file" >> potato.prj; \
90
        done
91
 
92 9 skordal
copy-riscv-tests:
93 2 skordal
        for test in $(RISCV_TESTS); do \
94 6 skordal
                cp riscv-tests/$$test.S tests; \
95 2 skordal
        done
96
 
97
compile-tests: copy-riscv-tests
98
        test -d tests-build || mkdir tests-build
99
        for test in $(RISCV_TESTS) $(LOCAL_TESTS); do \
100
                echo "Compiling test $$test..."; \
101 45 skordal
                $(TOOLCHAIN_PREFIX)-gcc -c -m32 -march=RV32I -Iriscv-tests -o tests-build/$$test.o tests/$$test.S; \
102 2 skordal
                $(TOOLCHAIN_PREFIX)-ld -m elf32lriscv -T tests.ld tests-build/$$test.o -o tests-build/$$test.elf; \
103
                scripts/extract_hex.sh tests-build/$$test.elf tests-build/$$test-imem.hex tests-build/$$test-dmem.hex; \
104
        done
105
 
106
run-tests: potato.prj compile-tests
107
        for test in $(RISCV_TESTS) $(LOCAL_TESTS); do \
108
                echo -ne "Running test $$test:\t"; \
109
                DMEM_FILENAME="empty_dmem.hex"; \
110
                test -f tests-build/$$test-dmem.hex && DMEM_FILENAME="tests-build/$$test-dmem.hex"; \
111
                xelab tb_processor -generic_top "IMEM_FILENAME=tests-build/$$test-imem.hex" -generic_top "DMEM_FILENAME=$$DMEM_FILENAME" -prj potato.prj > /dev/null; \
112
                xsim tb_processor -R --onfinish quit > tests-build/$$test.results; \
113
                cat tests-build/$$test.results | awk '/Note:/ {print}' | sed 's/Note://' | awk '/Success|Failure/ {print}'; \
114
        done
115
 
116
run-soc-tests: potato.prj compile-tests
117
        for test in $(RISCV_TESTS) $(LOCAL_TESTS); do \
118
                echo -ne "Running SOC test $$test:\t"; \
119
                DMEM_FILENAME="empty_dmem.hex"; \
120
                test -f tests-build/$$test-dmem.hex && DMEM_FILENAME="tests-build/$$test-dmem.hex"; \
121
                xelab tb_soc -generic_top "IMEM_FILENAME=tests-build/$$test-imem.hex" -generic_top "DMEM_FILENAME=$$DMEM_FILENAME" -prj potato.prj > /dev/null; \
122
                xsim tb_soc -R --onfinish quit > tests-build/$$test.results-soc; \
123
                cat tests-build/$$test.results-soc | awk '/Note:/ {print}' | sed 's/Note://' | awk '/Success|Failure/ {print}'; \
124
        done
125
 
126
remove-xilinx-garbage:
127
        -$(RM) -r xsim.dir
128
        -$(RM) xelab.* webtalk* xsim*
129
 
130
clean: remove-xilinx-garbage
131
        for test in $(RISCV_TESTS); do $(RM) tests/$$test.S; done
132
        -$(RM) -r tests-build
133
        -$(RM) potato.prj
134
 
135
distclean: clean
136
 

powered by: WebSVN 2.1.0

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