Skip to content

Commit 77e87a4

Browse files
committed
Fix Verilator 5.010 compilation error
Verilator was throwing a compilation error due to MULTIDRIVEN and BLKSEQ in ibex_tracer.sv This change ensures successful compilation with Verilator 5.010
1 parent 97df7a5 commit 77e87a4

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

rtl/ibex_tracer.sv

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ module ibex_tracer (
8181

8282
import ibex_tracer_pkg::*;
8383

84-
int file_handle;
84+
int xfile_handle;
8585
string file_name;
8686

8787
int unsigned cycle;
@@ -110,6 +110,8 @@ module ibex_tracer (
110110
function automatic void printbuffer_dumpline();
111111
string rvfi_insn_str;
112112

113+
int file_handle = xfile_handle;
114+
113115
if (file_handle == 32'h0) begin
114116
string file_name_base = "trace_core";
115117
void'($value$plusargs("ibex_tracer_file_base=%s", file_name_base));
@@ -119,6 +121,8 @@ module ibex_tracer (
119121
file_handle = $fopen(file_name, "w");
120122
$fwrite(file_handle,
121123
"Time\tCycle\tPC\tInsn\tDecoded instruction\tRegister and memory contents\n");
124+
125+
xfile_handle <= file_handle;
122126
end
123127

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

747751
// close output file for writing
748752
final begin
749-
if (file_handle != 32'h0) begin
750-
$fclose(file_handle);
753+
if (xfile_handle != 32'h0) begin
754+
$fclose(xfile_handle);
751755
end
752756
end
753757

@@ -759,8 +763,14 @@ module ibex_tracer (
759763
end
760764

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

766776
// Check for compressed instructions

0 commit comments

Comments
 (0)