[rtl] Add plusarg to disable trace log

Option to control the state of the Ibex tracer.
Defaults to enable, but allows a setting to disable the trace log.

In long running simulations this file can get quite big and the contents
might not be needed. Use the argument `+ibex_tracer_enable=0` to prevent
the creation of the file.
This commit is contained in:
Tobias Wölfel 2020-10-08 16:05:33 +02:00 committed by Tobias Wölfel
parent 0106ba80a0
commit bcbf1a7adf
2 changed files with 25 additions and 1 deletions

View file

@ -16,6 +16,15 @@ The file name base, defaulting to ``trace_core`` can be set using the ``ibex_tra
For example, ``+ibex_tracer_file_base=ibex_my_trace`` will produce log files named ``ibex_my_trace_<HARTID>.log``.
The exact syntax of passing plusargs to a simulation depends on the simulator.
Disabling the tracer
--------------------
If the instruction log is not needed for a specific simulation run, the tracer can be disabled.
The plusarg ``ibex_tracer_enable`` controls the tracer.
The tracer is enabled by default.
To disable the tracer use ``ibex_tracer_enable=0`` with the correct plusarg syntax of the simulator.
Trace output format
-------------------

View file

@ -16,6 +16,10 @@
* plusarg passed to the simulation, e.g. "+ibex_tracer_file_base=ibex_my_trace". The exact syntax
* of passing plusargs to a simulation depends on the simulator.
*
* The creation of the instruction trace is enabled by default but can be disabled for a simulation.
* This behaviour is controlled by the plusarg "ibex_tracer_enable". Use "ibex_tracer_enable=0" to
* disable the tracer.
*
* The trace contains six columns, separated by tabs:
* - The simulation time
* - The clock cycle count since reset
@ -92,6 +96,17 @@ module ibex_tracer (
localparam logic [4:0] MEM = (1 << 4);
logic [4:0] data_accessed;
logic trace_log_enable;
initial begin
if ($value$plusargs("ibex_tracer_enable=%b", trace_log_enable)) begin
if (trace_log_enable == 1'b0) begin
$display("%m: Instruction trace disabled.");
end
end else begin
trace_log_enable = 1'b1;
end
end
function automatic void printbuffer_dumpline();
string rvfi_insn_str;
@ -730,7 +745,7 @@ module ibex_tracer (
// log execution
always_ff @(posedge clk_i) begin
if (rvfi_valid) begin
if (rvfi_valid && trace_log_enable) begin
printbuffer_dumpline();
end
end