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

Subversion Repositories potato

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

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

powered by: WebSVN 2.1.0

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