Skip to content

Added a makefile for running directed tests on verilator simple system #1990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions dv/uvm/core_ibex/directed_tests/ibex_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@
// SPDX-License-Identifier: Apache-2.0

// Ibex specific macros
#define SIGNATURE_ADDR 0x8ffffff8

// signatue type - should be stored at sign_addr[7:0]
#define CORE_STATUS 0x0
#define TEST_RESULT 0x1
#define WRITE_GPR 0x2
#define WRITE_CSR 0x3

// writing 0x1 to signature address to end the test for simple system
#ifdef SIMPLE_SYSTEM
#define SIGNATURE_ADDR 0x20008
#define CORE_STATUS 0x1
#define FINISHED_IRQ 0x0
#else
#define SIGNATURE_ADDR 0x8ffffff8
#define CORE_STATUS 0x0
#define FINISHED_IRQ 0x7
#endif

// core status - should be stored at sign_addr[12:8]
#define INITIALIZED 0x0
#define IN_DEBUG_MODE 0x1
Expand All @@ -19,7 +28,6 @@
#define IN_SUPERVISOR_MODE 0x4
#define IN_USER_MODE 0x5
#define HANDLING_IRQ 0x6
#define FINISHED_IRQ 0x7
#define HANDLING_EXCEPTION 0x8
#define INSTR_FAULT_EXCEPTION 0x9
#define ILLEGAL_INSTR_EXCEPTION 0xa
Expand Down
36 changes: 36 additions & 0 deletions examples/sw/simple_system/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

COSIM ?= lowrisc:ibex:ibex_simple_system_cosim
LINKER ?= ./common/link.ld
CFLAGS := -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles
INCLUDE_FILES := -I../../../vendor/riscv-test-env/ \
-I../../../vendor/riscv-test-env/p/ \
-I../../../vendor/riscv-tests/isa/macros/scalar/ \
-I../../../dv/uvm/core_ibex/directed_tests \
-T$(LINKER) \
-DSIMPLE_SYSTEM

DIRECTED_TESTS_PATH ?= ../../../dv/uvm/core_ibex/directed_tests
TEST_PATH ?= $(DIRECTED_TESTS_PATH)/empty/empty.S
TEST := $(shell basename $(TEST_PATH) .S)

RISCV_OBJDUMP := $(patsubst %-gcc,%-,$(RISCV_GCC))objdump

run: build_rtl compile_prog run_prebuilt_rtl

build_rtl:
fusesoc --cores-root=../../../ run --target=sim --setup --build $(COSIM) --RV32E=0 --RV32M=ibex_pkg::RV32MFast --PMPEnable=1

compile_prog:
$(RISCV_GCC) $(CFLAGS) $(INCLUDE_FILES) -o $(TEST).elf $(TEST_PATH)
$(RISCV_OBJDUMP) -DS $(TEST).elf > $(TEST).dis

run_prebuilt_rtl: compile_prog run_precompiled_test

run_precompiled_test:
./build/lowrisc_ibex_ibex_simple_system_cosim_0/sim-verilator/Vibex_simple_system --meminit=ram,$(TEST).elf

clean:
$(RM) -f *.o *.elf *.dis *.log