Align to Verilatable PULPissimo

This commit is contained in:
Francesco Conti 2025-01-21 18:24:43 +01:00
parent 326f85ce9a
commit 26f3f15a15
3 changed files with 53 additions and 10 deletions

View file

@ -21,7 +21,7 @@ if args.output_file is None:
raise Exception('Specify the output file with --output=<path> (ex. --output=./build/pulpissimo/slm_files/hyper_flash_stim.slm')
delimiter=" "
with open(args.input_file, "rU") as fi:
with open(args.input_file, "r") as fi:
data = list(map(lambda x:x.split(delimiter), fi.read().strip().split("\n")))
fo=open(args.output_file, "w")
A=np.array(data)

View file

@ -66,6 +66,9 @@ endif
ifeq '$(platform)' 'fpga'
PULP_CFLAGS += -D__PLATFORM__=ARCHI_PLATFORM_FPGA
endif
ifeq '$(platform)' 'verilator'
PULP_CFLAGS += -D__PLATFORM__=ARCHI_PLATFORM_RTL
endif
ifdef CONFIG_NB_PE
PULP_CFLAGS += -DARCHI_CLUSTER_NB_PE=$(CONFIG_NB_PE)
@ -146,6 +149,13 @@ else
LOAD_MODE := JTAG
endif
#
# VERILATOR Flags
#
verilator_flags ?= --trace
verilator_flags += +bootmode=jtag
verilator_flags += +log_file=trace_core.log +itb_file=$(TARGETS).itb
#
# VSIM Flags
#
@ -353,3 +363,28 @@ help:
@echo "Makefile options:"
@echo " CONFIG_TRACE_LEVEL=<level> Activate traces for the specified level (0=none, 1=fatal, 2=error, 3=warning, 4=info, 5=debug, 6=trace)."
@echo " CONFIG_TRACE_ALL=1 Activate all traces. Other traces can be individually activated with CONFIG_TRACE_<NAME>."
ifeq '$(platform)' 'verilator'
$(TARGET_BUILD_DIR)/Vtb_pulp:
ifndef VERILATOR_PATH
$(error "VERILATOR_PATH is undefined. Either call \
'source $$YOUR_HW_DIR/setup/verilator.sh' or set it manually.")
endif
ln -sfn $(VERILATOR_PATH)/obj_dir/Vtb_pulp $@
# ITB file needed by CV32E40X tracer
$(TARGETS).itb:
$(PULP_OBJDUMP) -d -l -s $(disopt) $(TARGETS) > $(TARGETS).dis
$(PULPRT_HOME)/bin/objdump2itb.py $(TARGETS).dis > $(TARGETS).itb
run: $(TARGET_BUILD_DIR)/Vtb_pulp $(TARGETS).itb
$(PULPRT_HOME)/bin/stim_utils.py --binary=$(TARGETS) --vectors=$(TARGET_BUILD_DIR)/vectors/stim.txt
$(PULPRT_HOME)/bin/plp_mkflash --flash-boot-binary=$(TARGETS) --stimuli=$(TARGET_BUILD_DIR)/vectors/qspi_stim.slm --flash-type=spi --qpi
$(PULPRT_HOME)/bin/slm_hyper.py --input=$(TARGET_BUILD_DIR)/vectors/qspi_stim.slm --output=$(TARGET_BUILD_DIR)/vectors/hyper_stim.slm
ifndef VERILATOR_PATH
$(error "VERILATOR_PATH is undefined. Either call \
'source $$YOUR_HW_DIR/setup/verilator.sh' or set it manually.")
endif
cd $(TARGET_BUILD_DIR) && ./Vtb_pulp $(verilator_flags) +stimuli=$(TARGET_BUILD_DIR)/vectors/stim.txt
endif

View file

@ -1,11 +1,11 @@
ifdef USE_IBEX
PULP_LDFLAGS +=
PULP_LDFLAGS += -nostartfiles -nostdlib -Wl,--gc-sections -L$(PULPRT_HOME)/kernel -Tchips/pulpissimo/link.ld -lgcc
PULP_CFLAGS += -D__ibex__ -U__riscv__ -UARCHI_CORE_HAS_PULPV2 -DRV_ISA_RV32
PULP_ARCH_CFLAGS ?= -march=rv32imc
PULP_ARCH_LDFLAGS ?= -march=rv32imc
PULP_ARCH_OBJDFLAGS ?= -Mmarch=rv32imc
else ifdef USE_CV32E40P
PULP_LDFLAGS +=
PULP_LDFLAGS += -nostartfiles -nostdlib -Wl,--gc-sections -L$(PULPRT_HOME)/kernel -Tchips/pulpissimo/link.ld -lgcc
PULP_CFLAGS += -D__cv32e40p__ -U__riscv__ -UARCHI_CORE_HAS_PULPV2
ifdef CONFIG_USE_ZFINX
PULP_ARCH_CFLAGS ?= -march=rv32imc_zfinx_xcorev -mno-pulp-hwloop
@ -16,13 +16,18 @@ PULP_ARCH_LDFLAGS ?= -march=rv32imfc_xcorev -mno-pulp-hwloop
endif
PULP_ARCH_OBJDFLAGS ?=
else ifdef USE_CV32E40X
PULP_LDFLAGS +=
PULP_LDFLAGS += -nostartfiles -nostdlib -Wl,--gc-sections -L$(PULPRT_HOME)/kernel -Tchips/pulpissimo/link.ld
PULP_CFLAGS += -D__riscv__ -UARCHI_CORE_HAS_PULPV2 -DRV_ISA_RV32 -DPULP_LLVM
PULP_ARCH_CFLAGS ?= -march=rv32imcxfir --target=riscv32
PULP_ARCH_LDFLAGS ?= -march=rv32imcxfir --target=riscv32
PULP_ARCH_OBJDFLAGS ?= -D
# use LLVM for CV32E40X
PULP_CC = clang
PULP_AR = llvm-ar
PULP_LD = clang
PULP_OBJDUMP = llvm-objdump
else
PULP_LDFLAGS +=
PULP_LDFLAGS += -nostartfiles -nostdlib -Wl,--gc-sections -L$(PULPRT_HOME)/kernel -Tchips/pulpissimo/link.ld -lgcc
PULP_CFLAGS += -D__riscv__
PULP_ARCH_CFLAGS ?= -march=rv32imcxgap9
PULP_ARCH_LDFLAGS ?= -march=rv32imcxgap9
@ -31,12 +36,11 @@ endif
PULP_CFLAGS += -fdata-sections -ffunction-sections -include chips/pulpissimo/config.h -I$(PULPRT_HOME)/include/chips/pulpissimo
PULP_OMP_CFLAGS += -fopenmp -mnativeomp
PULP_LDFLAGS += -nostartfiles -nostdlib -Wl,--gc-sections -L$(PULPRT_HOME)/kernel -Tchips/pulpissimo/link.ld
PULP_CC = clang
PULP_AR ?= llvm-ar
PULP_LD ?= clang
PULP_OBJDUMP ?= llvm-objdump
PULP_CC ?= riscv32-unknown-elf-gcc
PULP_AR ?= riscv32-unknown-elf-ar
PULP_LD ?= riscv32-unknown-elf-gcc
PULP_OBJDUMP ?= riscv32-unknown-elf-objdump
fc/archi=riscv
pe/archi=riscv
@ -73,6 +77,10 @@ ifeq '$(platform)' 'rtl'
PULP_SRCS += drivers/pulpissimo/rtl_sim/io_mux/src/io_mux.c
PULP_CFLAGS += -I$(PULPRT_HOME)/drivers/pulpissimo/rtl_sim/io_mux/include
endif
ifeq '$(platform)' 'verilator'
PULP_SRCS += drivers/pulpissimo/rtl_sim/io_mux/src/io_mux.c
PULP_CFLAGS += -I$(PULPRT_HOME)/drivers/pulpissimo/rtl_sim/io_mux/include
endif
include $(PULPRT_HOME)/rules/pulpos/configs/default.mk