Skip to content

Commit

Permalink
veilator information in readme and make help (XUANTIE-RV#12)
Browse files Browse the repository at this point in the history
1. add verilator into the simulator list in README
2. add some verilator examples into the make help.
  • Loading branch information
Taurusxkyle authored Nov 10, 2021
1 parent 95e6079 commit a772ed0
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ setup file about how to specify it:
## Notes

```
The testbench supports iverilog, vcs and irun to run simulation and you can use Gtkwave or verdi
The testbench supports Verilator(version is better newer than 4.215),iverilog, vcs and irun to run simulation and you can use Gtkwave or verdi
to open the waveform under ./smart_run/work/ directory.
You can get the debugger, IDE and SDK from the url:https://occ.t-head.cn/community/download?id=575997419775328256
Expand Down
40 changes: 36 additions & 4 deletions smart_run/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,28 @@ include ./setup/env_check.mk
################################################################################
SIM = iverilog
DUMP = off
THREADS = 4

# Generate C++ in executable form
VERILATOR_FLAGS += -cc --exe
# Generate makefile dependencies (not shown as complicates the Makefile)
#VERILATOR_FLAGS += -MMD
# Optimize
VERILATOR_FLAGS += -Os -x-assign 0
# lint-only
VERILATOR_FLAGS += -lint-only
# Warn abount lint issues; may not want this on less solid designs
VERILATOR_FLAGS += -Wno-fatal
# Make waveforms
#VERILATOR_FLAGS += --trace
## Check SystemVerilog assertions
#VERILATOR_FLAGS += --assert
## Generate coverage analysis
#VERILATOR_FLAGS += --coverage
# Run Verilator in debug mode
#VERILATOR_FLAGS += --debug
# Add this trace to get a backtrace in gdb
#VERILATOR_FLAGS += --gdbbt

# Generate C++ in executable form
VERILATOR_FLAGS += -cc --exe
Expand All @@ -44,7 +66,11 @@ VERILATOR_FLAGS += -Wno-fatal
#VERILATOR_FLAGS += --gdbbt

ifeq ($(DUMP), on)
ifeq (${SIM}, verilator)
SIM_DUMP := --trace
else
SIM_DUMP :=
endif
else
ifeq (${SIM}, iverilog)
SIM_DUMP = -DNO_DUMP
Expand Down Expand Up @@ -79,8 +105,8 @@ else
SIMULATOR_LOG :=
else
ifeq ($(SIM), verilator)
SIMULATOR_OPT := -Os -x-assign 0 --threads 16 -Wno-fatal
SIMULATOR_DEF := -cc --exe --top-module top --trace
SIMULATOR_OPT := -Os -x-assign 0 -Wno-fatal --threads ${THREADS}
SIMULATOR_DEF := -cc --exe --top-module top
SIMULATOR_LOG :=
else
endif
Expand Down Expand Up @@ -112,7 +138,7 @@ else
@cd ./work && iverilog $(TIMESCALE) $(SIMULATOR_OPT) $(SIMULATOR_DEF) $(SIM_FILELIST) $(SIM_DUMP) $(SIMULATOR_LOG)
else
ifeq ($(SIM), verilator)
@cd ./work && verilator $(SIMULATOR_OPT) $(SIMULATOR_DEF) $(SIMULATOR_LOG) $(SIM_FILELIST)
@cd ./work && verilator $(SIMULATOR_OPT) $(SIMULATOR_DEF) $(SIMULATOR_LOG) $(SIM_FILELIST) $(SIM_DUMP)
else
@echo " [THead-smart] Please specify SIM = vcs to use VCS, or SIM = nc ,or SIM = verilator to use irun ..."
endif
Expand Down Expand Up @@ -235,12 +261,18 @@ help:
@echo " cleancase : clean files generated by GNU in ./work ";
@echo " clean : clean ./work ";
@echo " Optional arguments:";
@echo " SIM= : options: vcs / nc";
@echo " SIM= : options: vcs / nc / verilator(use version 4.215 or newer)";
@echo " CASE= : options: the list print by 'make showcase'";
@echo " DUMP= : options: on / off";
@echo " Examples:";
@echo " make runcase CASE=dhry : run case 'dhry' (by iverilog withtout dump) ";
@echo " make runcase CASE=dhry SIM=nc : run case 'dhry' (by nc withtout dump) ";
@echo " make runcase CASE=dhry DUMP=on : run case 'dhry' with dump ";
@echo " make runcase CASE=coremark SIM=verilator THREADS=8 : run case 'coremark' without dump(by verilator) with 8 threads;
@echo " make cleanVerilator : clean the verilator generated file before Verilator operations;
@echo " make compile SIM=verilator DUMP=on THREADS=8 : run compile with dump (by Verilator with dump) with 8 threads;
@echo " make buildVerilator : run build executable file with Verilator;
@echo " make runVerilator : run simulation file with Verilator;



3 changes: 2 additions & 1 deletion smart_run/logical/tb/Makefile_obj
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ include Vtop.mk

# Use OBJCACHE (ccache) if using gmake and its installed
COMPILE.cc = $(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
#CXX = clang

#######################################################################
# Compile flags

# Turn on creating .d make dependency files
CPPFLAGS += -MMD -MP
CPPFLAGS += -MMD -MP #-fPIE

# Compile in Verilator runtime debugging, so +verilator+debug works
CPPFLAGS += -DVL_DEBUG=1
Expand Down

0 comments on commit a772ed0

Please sign in to comment.