Skip to content

Commit

Permalink
Fix Verilator 5.010 compilation error
Browse files Browse the repository at this point in the history
Verilator was throwing a compilation error due to
MULTIDRIVEN and BLKSEQ in ibex_tracer.sv

This change ensures successful compilation with Verilator 5.010
  • Loading branch information
leesum1 committed Jun 29, 2023
1 parent 97df7a5 commit 77e87a4
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions rtl/ibex_tracer.sv
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ module ibex_tracer (

import ibex_tracer_pkg::*;

int file_handle;
int xfile_handle;
string file_name;

int unsigned cycle;
Expand Down Expand Up @@ -110,6 +110,8 @@ module ibex_tracer (
function automatic void printbuffer_dumpline();
string rvfi_insn_str;

int file_handle = xfile_handle;

if (file_handle == 32'h0) begin
string file_name_base = "trace_core";
void'($value$plusargs("ibex_tracer_file_base=%s", file_name_base));
Expand All @@ -119,6 +121,8 @@ module ibex_tracer (
file_handle = $fopen(file_name, "w");
$fwrite(file_handle,
"Time\tCycle\tPC\tInsn\tDecoded instruction\tRegister and memory contents\n");

xfile_handle <= file_handle;
end

// Write compressed instructions as four hex digits (16 bit word), and
Expand Down Expand Up @@ -746,8 +750,8 @@ module ibex_tracer (

// close output file for writing
final begin
if (file_handle != 32'h0) begin
$fclose(file_handle);
if (xfile_handle != 32'h0) begin
$fclose(xfile_handle);
end
end

Expand All @@ -759,8 +763,14 @@ module ibex_tracer (
end

always_comb begin
/* verilator lint_off MULTIDRIVEN */
// Actually, the signals "decoded_str" and "data_accessed" are not being MULTIDRIVEN,
// They are only assigned in one always_comb block.
// However, Verilator does not seem to be able to detect this.
// Corresponding issue: https://github.com/verilator/verilator/issues/4045
decoded_str = "";
data_accessed = 5'h0;
/* verilator lint_on MULTIDRIVEN */
insn_is_compressed = 0;

// Check for compressed instructions
Expand Down

0 comments on commit 77e87a4

Please sign in to comment.