diff --git a/doc/03_reference/tracer.rst b/doc/03_reference/tracer.rst index 4ba26106..6a1fedab 100644 --- a/doc/03_reference/tracer.rst +++ b/doc/03_reference/tracer.rst @@ -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_.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 ------------------- diff --git a/rtl/ibex_tracer.sv b/rtl/ibex_tracer.sv index 562d621f..78204982 100644 --- a/rtl/ibex_tracer.sv +++ b/rtl/ibex_tracer.sv @@ -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