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

Subversion Repositories potato

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

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 58 skordal
        lui \
73 2 skordal
        lb \
74
        lbu \
75
        lh \
76
        lhu \
77 58 skordal
        lw \
78
        ma_addr \
79
        sbreak \
80
        scall
81 2 skordal
 
82
# Local tests to run:
83
LOCAL_TESTS ?= \
84 58 skordal
        timer \
85 45 skordal
        sw-jal
86 2 skordal
 
87
all: potato.prj run-tests
88
 
89
potato.prj:
90
        -$(RM) potato.prj
91
        for file in $(SOURCE_FILES) $(TESTBENCHES); do \
92
                echo "vhdl work $$file" >> potato.prj; \
93
        done
94
 
95 9 skordal
copy-riscv-tests:
96 2 skordal
        for test in $(RISCV_TESTS); do \
97 6 skordal
                cp riscv-tests/$$test.S tests; \
98 2 skordal
        done
99
 
100
compile-tests: copy-riscv-tests
101
        test -d tests-build || mkdir tests-build
102
        for test in $(RISCV_TESTS) $(LOCAL_TESTS); do \
103
                echo "Compiling test $$test..."; \
104 45 skordal
                $(TOOLCHAIN_PREFIX)-gcc -c -m32 -march=RV32I -Iriscv-tests -o tests-build/$$test.o tests/$$test.S; \
105 2 skordal
                $(TOOLCHAIN_PREFIX)-ld -m elf32lriscv -T tests.ld tests-build/$$test.o -o tests-build/$$test.elf; \
106
                scripts/extract_hex.sh tests-build/$$test.elf tests-build/$$test-imem.hex tests-build/$$test-dmem.hex; \
107
        done
108
 
109
run-tests: potato.prj compile-tests
110
        for test in $(RISCV_TESTS) $(LOCAL_TESTS); do \
111
                echo -ne "Running test $$test:\t"; \
112
                DMEM_FILENAME="empty_dmem.hex"; \
113
                test -f tests-build/$$test-dmem.hex && DMEM_FILENAME="tests-build/$$test-dmem.hex"; \
114
                xelab tb_processor -generic_top "IMEM_FILENAME=tests-build/$$test-imem.hex" -generic_top "DMEM_FILENAME=$$DMEM_FILENAME" -prj potato.prj > /dev/null; \
115
                xsim tb_processor -R --onfinish quit > tests-build/$$test.results; \
116
                cat tests-build/$$test.results | awk '/Note:/ {print}' | sed 's/Note://' | awk '/Success|Failure/ {print}'; \
117
        done
118
 
119
run-soc-tests: potato.prj compile-tests
120
        for test in $(RISCV_TESTS) $(LOCAL_TESTS); do \
121
                echo -ne "Running SOC test $$test:\t"; \
122
                DMEM_FILENAME="empty_dmem.hex"; \
123
                test -f tests-build/$$test-dmem.hex && DMEM_FILENAME="tests-build/$$test-dmem.hex"; \
124
                xelab tb_soc -generic_top "IMEM_FILENAME=tests-build/$$test-imem.hex" -generic_top "DMEM_FILENAME=$$DMEM_FILENAME" -prj potato.prj > /dev/null; \
125
                xsim tb_soc -R --onfinish quit > tests-build/$$test.results-soc; \
126
                cat tests-build/$$test.results-soc | awk '/Note:/ {print}' | sed 's/Note://' | awk '/Success|Failure/ {print}'; \
127
        done
128
 
129
remove-xilinx-garbage:
130
        -$(RM) -r xsim.dir
131
        -$(RM) xelab.* webtalk* xsim*
132
 
133
clean: remove-xilinx-garbage
134
        for test in $(RISCV_TESTS); do $(RM) tests/$$test.S; done
135
        -$(RM) -r tests-build
136
        -$(RM) potato.prj
137
 
138
distclean: clean
139
 

powered by: WebSVN 2.1.0

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