2022-02-25 19:56:36 +08:00
|
|
|
export CODE_BASE_PATH = ${PWD}/../../E906_RTL_FACTORY
|
2022-02-26 22:34:25 +08:00
|
|
|
GDB_PREFIX = /opt/riscv/bin/riscv64-unknown-elf-gdb
|
2022-02-25 19:56:36 +08:00
|
|
|
|
2022-02-26 22:34:25 +08:00
|
|
|
FILELIST = -F ../common/common.fl ../Murax.v
|
2022-02-25 19:56:36 +08:00
|
|
|
|
|
|
|
DEMODIR = ${PWD}
|
|
|
|
|
2022-02-26 22:34:25 +08:00
|
|
|
TEST = Murax
|
|
|
|
|
2022-02-25 19:56:36 +08:00
|
|
|
# CFLAGS for verilator generated Makefiles. Without -std=c++11 it complains for `auto` variables
|
|
|
|
CFLAGS += "-std=c++11"
|
|
|
|
# Optimization for better performance; alternative is nothing for slower runtime (faster compiles)
|
|
|
|
# -O2 for faster runtime (slower compiles), or -O for balance.
|
|
|
|
VERILATOR_MAKE_FLAGS = OPT_FAST="-Os"
|
|
|
|
|
|
|
|
# Targets
|
|
|
|
all: clean verilator
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf obj_dir
|
|
|
|
|
|
|
|
##################### Verilog Builds #####################################
|
|
|
|
|
|
|
|
verilator-build:
|
|
|
|
verilator --cc -CFLAGS ${CFLAGS} \
|
|
|
|
-Wno-UNOPTFLAT \
|
|
|
|
-Wno-STMTDLY \
|
|
|
|
-Wno-MULTIDRIVEN \
|
|
|
|
-Wno-CASEINCOMPLETE \
|
|
|
|
-Wno-COMBDLY \
|
|
|
|
-Wno-LATCH \
|
|
|
|
-Wno-WIDTH \
|
|
|
|
-Wno-IMPLICIT \
|
|
|
|
${FILELIST} \
|
|
|
|
--trace \
|
2022-02-26 22:34:25 +08:00
|
|
|
--top-module Murax -exe main.cpp --autoflush
|
|
|
|
$(MAKE) -j -C obj_dir/ -f VMurax.mk $(VERILATOR_MAKE_FLAGS)
|
2022-02-25 19:56:36 +08:00
|
|
|
|
|
|
|
##################### Simulation Runs #####################################
|
|
|
|
|
|
|
|
verilator: verilator-build
|
2022-02-26 22:34:25 +08:00
|
|
|
./obj_dir/VMurax
|
2022-02-25 19:56:36 +08:00
|
|
|
|
|
|
|
##################### openocd #####################################
|
|
|
|
|
|
|
|
openocd:
|
2022-02-26 22:34:25 +08:00
|
|
|
openocd -f jtag_tcp.cfg -c "set MURAX_CPU0_YAML cpu0.yaml" -f murax.cfg
|
2022-02-25 19:56:36 +08:00
|
|
|
|
|
|
|
gdb:
|
|
|
|
$(GDB_PREFIX) -x gdbinit ./hello_world.elf
|
|
|
|
|
|
|
|
help:
|
|
|
|
@echo Possible targets: verilator help clean all verilator-build program.hex
|
|
|
|
|
|
|
|
.PHONY: help clean verilator
|