summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2023-09-29 03:35:56 -0600
committerAlejandro Soto <alejandro@34project.org>2023-09-29 03:35:56 -0600
commit78c46ca681c9a775cc68c9c58a5d5c70821ca0d7 (patch)
treef58626d2196bac82f616d6bcd38114eae213a8f8
parent205272a130e8def711065c65a0a32815cb45a693 (diff)
tb: enable sim performance flags ("faster is better")
-rw-r--r--Makefile15
-rw-r--r--tb/top/conspiracion.cpp14
2 files changed, 24 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 53e06e5..0423c5e 100644
--- a/Makefile
+++ b/Makefile
@@ -14,9 +14,18 @@ CROSS_OBJCOPY := $(CROSS_COMPILE)objcopy
CROSS_CFLAGS := -O3 -Wall -Wextra -Werror
CROSS_LDFLAGS :=
+ifdef FASTER_IS_BETTER
+ DISABLE_COV := 1
+ DISABLE_RAND := 1
+ DISABLE_TRACE := 1
+endif
+
+X_MODE := $(if $(DISABLE_RAND),fast,unique)
+
VFLAGS ?= \
- --x-assign unique --x-initial unique \
- --threads $(shell nproc) \
+ --x-assign $(X_MODE) --x-initial $(X_MODE) \
+ $(if $(DISABLE_THREADS),,--threads $(shell nproc)) \
+ $(if $(DISABLE_TRACE),,--trace) \
$(if $(DISABLE_COV),,--coverage)
RTL_FILES = $(shell find $(RTL_DIR)/ ! -path '$(RTL_DIR)/top/*' -type f -name '*.sv')
@@ -96,6 +105,6 @@ $(OBJ_DIR)/%.mk: \
mkdir -p $(dir $@)
$(VERILATOR) \
- -O3 --cc --exe --trace -y $(RTL_DIR) --Mdir $(dir $@) \
+ -O3 --cc --exe -y $(RTL_DIR) --Mdir $(dir $@) \
--top $(word 1,$(subst /, ,$*)) $(patsubst tb/%,../tb/%,$^) \
$(VFLAGS)
diff --git a/tb/top/conspiracion.cpp b/tb/top/conspiracion.cpp
index 49c05bf..f12e17a 100644
--- a/tb/top/conspiracion.cpp
+++ b/tb/top/conspiracion.cpp
@@ -298,15 +298,19 @@ int main(int argc, char **argv)
}
Vconspiracion top;
+
+#if VM_TRACE
VerilatedVcdC trace;
bool enable_trace = std::getenv("TRACE");
- if(enable_trace)
- {
+ if (enable_trace) {
Verilated::traceEverOn(true);
top.trace(&trace, 0);
trace.open("trace.vcd");
}
+#else
+ bool enable_trace = false;
+#endif
mem hps_ddr3(0x0000'0000, 512 << 20);
jtag_uart ttyJ0(0x3000'0000);
@@ -424,10 +428,12 @@ int main(int argc, char **argv)
vga.signal_tick(top.clk_clk);
}
+#if VM_TRACE
if(enable_trace)
{
trace.dump(time++);
}
+#endif
};
auto cycle = [&]()
@@ -765,8 +771,10 @@ int main(int argc, char **argv)
if (!no_tty)
ttyJ0.release();
+#if VM_TRACE
if (enable_trace)
trace.close();
+#endif
if (dump_regs)
do_reg_dump();
@@ -779,8 +787,10 @@ int main(int argc, char **argv)
if (ctrl != stdout)
std::fclose(ctrl);
+#if VM_COVERAGE
if (coverage_out)
Verilated::threadContextp()->coveragep()->write(coverage_out->c_str());
+#endif
return failed ? EXIT_FAILURE : EXIT_SUCCESS;
}