Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Verilator 5.010 compilation error #2042

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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