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

Subversion Repositories potato

[/] [potato/] [trunk/] [Makefile] - Diff between revs 6 and 9

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 6 Rev 9
# The Potato Processor - A simple RISC-V based processor for FPGAs
# The Potato Processor - A simple RISC-V based processor for FPGAs
# (c) Kristian Klomsten Skordal 2014 - 2015 
# (c) Kristian Klomsten Skordal 2014 - 2015 
# Report bugs and issues on 
# Report bugs and issues on 
.PHONY: all clean checkout-riscv-tests potato.prj
.PHONY: all clean checkout-riscv-tests potato.prj
SOURCE_FILES := \
SOURCE_FILES := \
        src/pp_alu.vhd \
        src/pp_alu.vhd \
        src/pp_alu_mux.vhd \
        src/pp_alu_mux.vhd \
        src/pp_alu_control_unit.vhd \
        src/pp_alu_control_unit.vhd \
        src/pp_comparator.vhd \
        src/pp_comparator.vhd \
        src/pp_constants.vhd \
        src/pp_constants.vhd \
        src/pp_control_unit.vhd \
        src/pp_control_unit.vhd \
        src/pp_core.vhd \
        src/pp_core.vhd \
        src/pp_counter.vhd \
        src/pp_counter.vhd \
        src/pp_csr.vhd \
        src/pp_csr.vhd \
        src/pp_csr_unit.vhd \
        src/pp_csr_unit.vhd \
        src/pp_csr_alu.vhd \
        src/pp_csr_alu.vhd \
        src/pp_decode.vhd \
        src/pp_decode.vhd \
        src/pp_execute.vhd \
        src/pp_execute.vhd \
        src/pp_fetch.vhd \
        src/pp_fetch.vhd \
        src/pp_imm_decoder.vhd \
        src/pp_imm_decoder.vhd \
        src/pp_memory.vhd \
        src/pp_memory.vhd \
        src/pp_potato.vhd \
        src/pp_potato.vhd \
        src/pp_register_file.vhd \
        src/pp_register_file.vhd \
        src/pp_types.vhd \
        src/pp_types.vhd \
        src/pp_utilities.vhd \
        src/pp_utilities.vhd \
        src/pp_wb_adapter.vhd \
        src/pp_wb_adapter.vhd \
        src/pp_writeback.vhd
        src/pp_writeback.vhd
TESTBENCHES := \
TESTBENCHES := \
        testbenches/tb_processor.vhd \
        testbenches/tb_processor.vhd \
        testbenches/tb_soc.vhd \
        testbenches/tb_soc.vhd \
        soc/pp_soc_memory.vhd
        soc/pp_soc_memory.vhd
TOOLCHAIN_PREFIX ?= riscv64-unknown-elf
TOOLCHAIN_PREFIX ?= riscv64-unknown-elf
# ISA tests to use from the riscv-tests repository:
# ISA tests to use from the riscv-tests repository:
RISCV_TESTS += \
RISCV_TESTS += \
        simple \
        simple \
        add \
        add \
        addi \
        addi \
        and \
        and \
        andi \
        andi \
        auipc \
        auipc \
        beq \
        beq \
        bge \
        bge \
        bgeu \
        bgeu \
        blt \
        blt \
        bltu \
        bltu \
        bne \
        bne \
        jal \
        jal \
        jalr \
        jalr \
        j \
        j \
        or \
        or \
        ori \
        ori \
        sll \
        sll \
        slli \
        slli \
        slt \
        slt \
        slti \
        slti \
        sra \
        sra \
        srai \
        srai \
        srl \
        srl \
        srli \
        srli \
        sub \
        sub \
        sb \
        sb \
        sh \
        sh \
        sw \
        sw \
        xor \
        xor \
        xori \
        xori \
        lb \
        lb \
        lbu \
        lbu \
        lh \
        lh \
        lhu \
        lhu \
        lw
        lw
# Local tests to run:
# Local tests to run:
LOCAL_TESTS ?= \
LOCAL_TESTS ?= \
        scall \
        scall \
        sbreak
        sbreak
all: potato.prj run-tests
all: potato.prj run-tests
potato.prj:
potato.prj:
        -$(RM) potato.prj
        -$(RM) potato.prj
        for file in $(SOURCE_FILES) $(TESTBENCHES); do \
        for file in $(SOURCE_FILES) $(TESTBENCHES); do \
                echo "vhdl work $$file" >> potato.prj; \
                echo "vhdl work $$file" >> potato.prj; \
        done
        done
 
 
copy-riscv-tests: checkout-riscv-tests
copy-riscv-tests:
        for test in $(RISCV_TESTS); do \
        for test in $(RISCV_TESTS); do \
                cp riscv-tests/$$test.S tests; \
                cp riscv-tests/$$test.S tests; \
        done
        done
compile-tests: copy-riscv-tests
compile-tests: copy-riscv-tests
        test -d tests-build || mkdir tests-build
        test -d tests-build || mkdir tests-build
        for test in $(RISCV_TESTS) $(LOCAL_TESTS); do \
        for test in $(RISCV_TESTS) $(LOCAL_TESTS); do \
                echo "Compiling test $$test..."; \
                echo "Compiling test $$test..."; \
                $(TOOLCHAIN_PREFIX)-gcc -c -m32 -Iriscv-tests -o tests-build/$$test.o tests/$$test.S; \
                $(TOOLCHAIN_PREFIX)-gcc -c -m32 -Iriscv-tests -o tests-build/$$test.o tests/$$test.S; \
                $(TOOLCHAIN_PREFIX)-ld -m elf32lriscv -T tests.ld tests-build/$$test.o -o tests-build/$$test.elf; \
                $(TOOLCHAIN_PREFIX)-ld -m elf32lriscv -T tests.ld tests-build/$$test.o -o tests-build/$$test.elf; \
                scripts/extract_hex.sh tests-build/$$test.elf tests-build/$$test-imem.hex tests-build/$$test-dmem.hex; \
                scripts/extract_hex.sh tests-build/$$test.elf tests-build/$$test-imem.hex tests-build/$$test-dmem.hex; \
        done
        done
run-tests: potato.prj compile-tests
run-tests: potato.prj compile-tests
        for test in $(RISCV_TESTS) $(LOCAL_TESTS); do \
        for test in $(RISCV_TESTS) $(LOCAL_TESTS); do \
                echo -ne "Running test $$test:\t"; \
                echo -ne "Running test $$test:\t"; \
                DMEM_FILENAME="empty_dmem.hex"; \
                DMEM_FILENAME="empty_dmem.hex"; \
                test -f tests-build/$$test-dmem.hex && DMEM_FILENAME="tests-build/$$test-dmem.hex"; \
                test -f tests-build/$$test-dmem.hex && DMEM_FILENAME="tests-build/$$test-dmem.hex"; \
                xelab tb_processor -generic_top "IMEM_FILENAME=tests-build/$$test-imem.hex" -generic_top "DMEM_FILENAME=$$DMEM_FILENAME" -prj potato.prj > /dev/null; \
                xelab tb_processor -generic_top "IMEM_FILENAME=tests-build/$$test-imem.hex" -generic_top "DMEM_FILENAME=$$DMEM_FILENAME" -prj potato.prj > /dev/null; \
                xsim tb_processor -R --onfinish quit > tests-build/$$test.results; \
                xsim tb_processor -R --onfinish quit > tests-build/$$test.results; \
                cat tests-build/$$test.results | awk '/Note:/ {print}' | sed 's/Note://' | awk '/Success|Failure/ {print}'; \
                cat tests-build/$$test.results | awk '/Note:/ {print}' | sed 's/Note://' | awk '/Success|Failure/ {print}'; \
        done
        done
run-soc-tests: potato.prj compile-tests
run-soc-tests: potato.prj compile-tests
        for test in $(RISCV_TESTS) $(LOCAL_TESTS); do \
        for test in $(RISCV_TESTS) $(LOCAL_TESTS); do \
                echo -ne "Running SOC test $$test:\t"; \
                echo -ne "Running SOC test $$test:\t"; \
                DMEM_FILENAME="empty_dmem.hex"; \
                DMEM_FILENAME="empty_dmem.hex"; \
                test -f tests-build/$$test-dmem.hex && DMEM_FILENAME="tests-build/$$test-dmem.hex"; \
                test -f tests-build/$$test-dmem.hex && DMEM_FILENAME="tests-build/$$test-dmem.hex"; \
                xelab tb_soc -generic_top "IMEM_FILENAME=tests-build/$$test-imem.hex" -generic_top "DMEM_FILENAME=$$DMEM_FILENAME" -prj potato.prj > /dev/null; \
                xelab tb_soc -generic_top "IMEM_FILENAME=tests-build/$$test-imem.hex" -generic_top "DMEM_FILENAME=$$DMEM_FILENAME" -prj potato.prj > /dev/null; \
                xsim tb_soc -R --onfinish quit > tests-build/$$test.results-soc; \
                xsim tb_soc -R --onfinish quit > tests-build/$$test.results-soc; \
                cat tests-build/$$test.results-soc | awk '/Note:/ {print}' | sed 's/Note://' | awk '/Success|Failure/ {print}'; \
                cat tests-build/$$test.results-soc | awk '/Note:/ {print}' | sed 's/Note://' | awk '/Success|Failure/ {print}'; \
        done
        done
remove-xilinx-garbage:
remove-xilinx-garbage:
        -$(RM) -r xsim.dir
        -$(RM) -r xsim.dir
        -$(RM) xelab.* webtalk* xsim*
        -$(RM) xelab.* webtalk* xsim*
clean: remove-xilinx-garbage
clean: remove-xilinx-garbage
        for test in $(RISCV_TESTS); do $(RM) tests/$$test.S; done
        for test in $(RISCV_TESTS); do $(RM) tests/$$test.S; done
        -$(RM) -r tests-build
        -$(RM) -r tests-build
        -$(RM) potato.prj
        -$(RM) potato.prj
distclean: clean
distclean: clean
 
 

powered by: WebSVN 2.1.0

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