fix: resolve OoO simulation timeout

This commit is contained in:
abnerhexu
2026-06-27 03:38:34 +00:00
parent 502803c37f
commit a2e0126199
68 changed files with 78250 additions and 210 deletions

View File

@@ -1,25 +1,56 @@
VERILATOR = verilator
VERILATOR_FLAGS = --cc --exe --build -Wall --trace -Wno-fatal
JOBS ?= 8
TRACE ?= 0
FAST ?= 1
SPLIT ?= 20000
SPLIT_CFUNCS ?= 20000
VERILATE_JOBS ?= $(JOBS)
BUILD_JOBS ?= $(JOBS)
VERILATOR_FLAGS = --cc --exe --build --verilate-jobs $(VERILATE_JOBS) --build-jobs $(BUILD_JOBS) -Wall -Wno-fatal
VERILATOR_FLAGS += --output-split $(SPLIT) --output-split-cfuncs $(SPLIT_CFUNCS)
ifeq ($(TRACE),1)
VERILATOR_FLAGS += --trace
endif
ifeq ($(FAST),1)
VERILATOR_FLAGS += -CFLAGS "-std=c++14 -O0"
else
VERILATOR_FLAGS += -CFLAGS "-std=c++14 -O2"
endif
SBT = env SBT_OPTS="-Dsbt.boot.directory=/tmp/sbt-boot -Dsbt.ivy.home=/tmp/sbt-ivy" COURSIER_CACHE=/tmp/coursier-cache sbt
CHISEL_DIR = ../..
OOO ?= 0
ifeq ($(OOO),1)
RUN_MAIN = CoreOoO
GENERATED_DIR = $(CHISEL_DIR)/generated-ooo
else
RUN_MAIN = Core
GENERATED_DIR = $(CHISEL_DIR)/generated
endif
SRC_FILES = testbench.cpp memory.cpp
VERILOG_FILES = $(GENERATED_DIR)/Core.sv
VERILOG_STAMP = $(GENERATED_DIR)/.Core.sv.stamp
SCALA_SOURCES = $(shell find $(CHISEL_DIR)/src/main/scala -name '*.scala')
TARGET = obj_dir/VCore
.PHONY: all verilog compile run clean
.PHONY: all verilog compile run clean regenerate
all: compile
verilog:
@echo "Generating Verilog from Chisel..."
cd $(CHISEL_DIR) && $(SBT) "runMain Core"
verilog: $(VERILOG_STAMP)
compile: verilog
$(VERILOG_STAMP): $(SCALA_SOURCES) $(CHISEL_DIR)/build.sbt
@echo "Generating Verilog from Chisel..."
cd $(CHISEL_DIR) && $(SBT) "runMain $(RUN_MAIN)"
@touch $@
$(VERILOG_FILES): $(VERILOG_STAMP)
@test -f $@
compile: $(VERILOG_FILES)
@echo "Compiling with Verilator..."
$(VERILATOR) $(VERILATOR_FLAGS) \
-I$(GENERATED_DIR) \
@@ -38,6 +69,10 @@ test-simple: compile
@echo "Running simple test..."
./$(TARGET) ../../riscv-tests/isa/rv64ui-p-simple
regenerate:
rm -f $(VERILOG_STAMP)
$(MAKE) verilog OOO=$(OOO)
clean:
rm -rf obj_dir
rm -rf $(GENERATED_DIR)