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

Subversion Repositories potato

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

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
checkout-riscv-tests:
90
        if [ ! -d riscv-tests ]; then \
91
                git clone https://github.com/ucb-bar/riscv-tests.git; \
92
                pushd riscv-tests; \
93
                git submodule update --init --recursive; \
94
                popd; \
95
        else \
96
                pushd riscv-tests; \
97
                git pull; \
98
                popd; \
99
        fi
100
 
101
copy-riscv-tests: checkout-riscv-tests
102
        for test in $(RISCV_TESTS); do \
103
                cp riscv-tests/isa/rv32ui/$$test.S tests; \
104
        done
105
 
106
compile-tests: copy-riscv-tests
107
        test -d tests-build || mkdir tests-build
108
        for test in $(RISCV_TESTS) $(LOCAL_TESTS); do \
109
                echo "Compiling test $$test..."; \
110
                $(TOOLCHAIN_PREFIX)-gcc -I riscv-tests/env/p -c -I riscv-tests/isa/macros/scalar -m32 -o tests-build/$$test.o tests/$$test.S; \
111
                $(TOOLCHAIN_PREFIX)-ld -m elf32lriscv -T tests.ld tests-build/$$test.o -o tests-build/$$test.elf; \
112
                scripts/extract_hex.sh tests-build/$$test.elf tests-build/$$test-imem.hex tests-build/$$test-dmem.hex; \
113
        done
114
 
115
run-tests: potato.prj compile-tests
116
        for test in $(RISCV_TESTS) $(LOCAL_TESTS); do \
117
                echo -ne "Running test $$test:\t"; \
118
                DMEM_FILENAME="empty_dmem.hex"; \
119
                test -f tests-build/$$test-dmem.hex && DMEM_FILENAME="tests-build/$$test-dmem.hex"; \
120
                xelab tb_processor -generic_top "IMEM_FILENAME=tests-build/$$test-imem.hex" -generic_top "DMEM_FILENAME=$$DMEM_FILENAME" -prj potato.prj > /dev/null; \
121
                xsim tb_processor -R --onfinish quit > tests-build/$$test.results; \
122
                cat tests-build/$$test.results | awk '/Note:/ {print}' | sed 's/Note://' | awk '/Success|Failure/ {print}'; \
123
        done
124
 
125
run-soc-tests: potato.prj compile-tests
126
        for test in $(RISCV_TESTS) $(LOCAL_TESTS); do \
127
                echo -ne "Running SOC test $$test:\t"; \
128
                DMEM_FILENAME="empty_dmem.hex"; \
129
                test -f tests-build/$$test-dmem.hex && DMEM_FILENAME="tests-build/$$test-dmem.hex"; \
130
                xelab tb_soc -generic_top "IMEM_FILENAME=tests-build/$$test-imem.hex" -generic_top "DMEM_FILENAME=$$DMEM_FILENAME" -prj potato.prj > /dev/null; \
131
                xsim tb_soc -R --onfinish quit > tests-build/$$test.results-soc; \
132
                cat tests-build/$$test.results-soc | awk '/Note:/ {print}' | sed 's/Note://' | awk '/Success|Failure/ {print}'; \
133
        done
134
 
135
remove-xilinx-garbage:
136
        -$(RM) -r xsim.dir
137
        -$(RM) xelab.* webtalk* xsim*
138
 
139
clean: remove-xilinx-garbage
140
        for test in $(RISCV_TESTS); do $(RM) tests/$$test.S; done
141
        -$(RM) -r tests-build
142
        -$(RM) potato.prj
143
 
144
distclean: clean
145
        -$(RM) -r riscv-tests
146
 

powered by: WebSVN 2.1.0

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